Example #1
0
void Player::SetAgent( sf::Uint16 id ) {
	m_tentative_agent_id = id;
	ObjectPtr object = Game::GetGame()->GetObjectManager()->GetObjectById( id );

	if( !object ) {
		return;
	}

	if( object->GetType() != ObjectType::SHIP ) {
		return;
	}

	ShipPtr agent = std::static_pointer_cast<Ship>( Game::GetGame()->GetObjectManager()->GetObjectById( id ) );
	agent->SetPlayer( true );
	LogConsole( "Set player ship to object: " + string_cast( id ) );
	m_tentative_agent_id = 0xffff;

	m_agent = agent;
}