Exemplo n.º 1
0
//
// TeapotWarsBaseGame::VRemoveActor			- TODO
//
void CometConquestBaseGame::VRemoveActor(ActorId aid) 
{ 
	shared_ptr<IActor> actor = VGetActor( aid );
	assert(actor && "No such actor!");
	if (!actor)
	{
		return;
	}

	//Stuff about calling function when actor is destroyed

	BaseGameLogic::VRemoveActor(aid); 

	//Now remove the actor from the system.
	safeQueEvent( IEventDataPtr( GCC_NEW EvtData_Destroy_Actor( aid ) ) );
}
Exemplo n.º 2
0
void BaseGameLogic::VChangeState(BaseGameState newState)
{
	if (newState==BGS_WaitingForPlayers)
	{
		// Get rid of the Main Menu...
		m_gameViews.pop_front();
		//todo
		// Note: Split screen support would require this to change!
		m_ExpectedPlayers = 1;
		m_ExpectedRemotePlayers = g_pApp->m_pOptions->m_expectedPlayers;

		if (!g_pApp->m_pOptions->m_gameHost.empty())
		{
			VSetProxy();
			m_ExpectedRemotePlayers = 0;	// the server will create these
			ClientSocketManager *pClient = GCC_NEW ClientSocketManager(g_pApp->m_pOptions->m_gameHost, g_pApp->m_pOptions->m_listenPort);
			if (!pClient->Connect())
			{
				// Throw up a main menu
				VChangeState(BGS_MainMenu);
				return;
			}
			g_pApp->m_pBaseSocketManager = pClient;
		}
		else if (m_ExpectedRemotePlayers > 0)
		{
			BaseSocketManager *pServer = GCC_NEW BaseSocketManager();
			if (!pServer->Init())
			{
				// Throw up a main menu
				VChangeState(BGS_MainMenu);	
				return;
			}

			pServer->AddSocket(new GameServerListenSocket(g_pApp->m_pOptions->m_listenPort));
			g_pApp->m_pBaseSocketManager = pServer;
		}
	}

	m_State = newState;
	if (!m_bProxy)
	{
		safeQueEvent( IEventDataPtr(GCC_NEW EvtData_Game_State(m_State)) );
	}
}
	virtual IEventDataPtr VCopy() const
	{
		return IEventDataPtr ( QSE_NEW EvtData_PhysTrigger_Leave(m_triggerID, m_other) );
	}
	IEventDataPtr VCopy() const 
	{
		return IEventDataPtr(QSE_NEW EvtData_PhysTrigger_Enter(m_triggerID, m_other));
	}
	virtual IEventDataPtr VCopy() const
	{
		return IEventDataPtr ( QSE_NEW EvtData_PhysSeparation(m_ActorA, m_ActorB) );
	}
	virtual IEventDataPtr VCopy() const
	{
		return IEventDataPtr ( QSE_NEW EvtData_PhysCollision(m_ActorA, m_ActorB, m_SumNormalForce, m_SumFrictionForce, m_CollisionPoints));
	}