Esempio n. 1
0
bool CDeathMatchMissionMgr::FinishExitLevel( )
{
	TRACE( "CDeathMatchMissionMgr::FinishExitLevel:\n" );

	// No longer waiting for exitlevel messages back from client.
	m_bExitingLevel = false;

	// Clear out the playertracker.
	m_PlayerTracker.Term( );

	// Tell the players to handle an exit level.
	CPlayerObj::PlayerObjList::const_iterator iter = CPlayerObj::GetPlayerObjList( ).begin( );
	while( iter != CPlayerObj::GetPlayerObjList( ).end( ))
	{
		CPlayerObj* pPlayerObj = *iter;
		pPlayerObj->HandleExit( true );
		iter++;
	}

	// Load new level with no restoring of keepalives or save games.
	if( !g_pServerSaveLoadMgr->LoadNewLevel( m_sCurrentWorldName ))
		return false;

	// Unpause the server now that we're done switching levels.
	g_pGameServerShell->PauseGame( LTFALSE );	


	return true;
}
Esempio n. 2
0
bool CServerMissionMgr::FinishExitLevel( )
{
	TRACE( "CServerMissionMgr::FinishExitLevel:\n" );

	// No longer waiting for exitlevel messages back from client.
	m_bExitingLevel = false;

	// Clear out the playertracker.
	m_PlayerTracker.Term( );

	// Tell the players to handle an exit level.
	CPlayerObj::PlayerObjList::const_iterator iter = CPlayerObj::GetPlayerObjList( ).begin( );
	while( iter != CPlayerObj::GetPlayerObjList( ).end( ))
	{
		CPlayerObj* pPlayerObj = *iter;
		pPlayerObj->HandleExit( m_bNewMission );
		iter++;
	}

	// Save the keepalives between levels.
	bool bSaveKeepAlives = true;
	
	if( m_bNewMission )
	{
		// Clear out our objectives...
		g_pGameServerShell->ResetObjectives();

		// Clear working save dir since we're starting fresh.
		g_pServerSaveLoadMgr->ClearWorkingDir( );

		// If this is mp, then consider this to be a new game.  Saves between
		// missions is only available in sp which allows skills to be saved.
		if( IsMultiplayerGame( ))
		{
			// Tell the gameservershell it's a new game.
			g_pGameServerShell->SetLGFlags( LOAD_NEW_GAME );
			bSaveKeepAlives = false;
		}
	}

	// Default to failure.
	bool bRet = false;

	// Do transition.
	if( m_bTransitionLevels )
	{
		m_bTransitionLevels = false;
		bRet = g_pServerSaveLoadMgr->TransitionLevels( m_sCurrentWorldName );
	}
	// Do switch.
	else
	{
		bRet = g_pServerSaveLoadMgr->SwitchLevels( m_sCurrentWorldName, bSaveKeepAlives );
	}

	// Unpause the server now that we're done switching levels.
	g_pGameServerShell->PauseGame( LTFALSE );	

	return bRet;
}