Example #1
0
bool CMissionMgr::HandleExitLevel( ILTMessage_Read& msg  )
{
	msg.ReadString( m_sNewWorldName.GetBuffer( MAX_PATH ), MAX_PATH );
	m_sNewWorldName.ReleaseBuffer( );
	m_bExitingMission = msg.Readbool( );
	m_bRestoringLevel = msg.Readbool( );
	m_bServerWaiting  = msg.Readbool( );

	int nMissionId, nLevel;

	// Check if this is a valid mission level.
	if (g_pMissionButeMgr->IsMissionLevel( m_sNewWorldName, nMissionId, nLevel))
	{
		m_nNewMission = nMissionId;
		m_nNewLevel = nLevel;
	}
	else
	{
		m_nNewMission = -1;
		m_nNewLevel = -1;
	}

	//m_bServerWaiting should only be false in the case where we are loading a game,
	if (!m_bServerWaiting)
	{
		//  if we are the host, we are already on the preload screen
		if (g_pClientMultiplayerMgr->IsConnectedToRemoteServer( ) )
			g_pInterfaceMgr->ChangeState(GS_LOADINGLEVEL);
		return true;

	}


	m_bNewMission = m_bExitingMission;

	// Check if we didn't get a new world.
	if( m_sNewWorldName.IsEmpty( ))
	{
		// Just go back to the main menu.
		g_pInterfaceMgr->ChangeState( GS_SCREEN );
		return true;
	}

	// Consider ourselves to be exiting.
	m_bExitingLevel = true;

	// Change to the exiting level state.
	g_pInterfaceMgr->ChangeState(GS_EXITINGLEVEL);

	return true;
}
Example #2
0
bool CServerMissionMgr::Load( ILTMessage_Read& msg, uint32 dwSaveFlags )
{
	msg.ReadString( m_sCampaignFile.GetBuffer( MAX_PATH ), MAX_PATH );
	m_sCampaignFile.ReleaseBuffer( );

	m_Campaign.clear( );
	int nNumCampaignEntries = msg.Readuint8( );
	for( int nCampaignIndex = 0; nCampaignIndex < nNumCampaignEntries; ++nCampaignIndex )
	{
		m_Campaign.push_back( msg.Readuint8( ));
	}
	m_nCurCampaignIndex = msg.Readuint8( );

	ServerMissionSettings ss = m_ServerSettings;
	ss.m_bUseSkills = msg.Readbool();
	ss.m_bFriendlyFire = msg.Readbool();
	ss.m_nMPDifficulty = msg.Readuint8();
	ss.m_fPlayerDiffFactor = msg.Readfloat();
	SetServerSettings(ss);

	

	return true;
}