Example #1
0
// Currently only used on client, for various effects
// Will return NULL if ship is out-of-scope... we have ClientInfos for all players, but not aways their ships
Ship *Game::findShip(const StringTableEntry &clientName)
{
   ClientInfo *clientInfo = findClientInfo(clientName);
   
   if(clientInfo)
      return clientInfo->getShip();
   else
      return NULL;
}
Example #2
0
void GamePair::addBotClientAndSetTeam(const string &name, S32 teamIndex)
{
   ServerGame *server = GameManager::getServerGame();

   server->addBot(Vector<string>(), ClientInfo::ClassRobotAddedByAutoleveler);
   // Get most recently added clientInfo
   ClientInfo *clientInfo = server->getClientInfo(server->getClientInfos()->size() - 1);
   ASSERT_TRUE(clientInfo->isRobot()) << "This is supposed to be a robot!";

   // Normally, in a game, a ship or bot would be destroyed and would respawn when their team changes, and upon
   // respawning the BfObject representing that ship would be on the correct team.  Not so here (where we are
   // taking lots of shortcuts); here we need to manually assign a new team to the robot object in addition to
   // it's more "official" setting on the ClientInfo.
   clientInfo->setTeamIndex(teamIndex);
   clientInfo->getShip()->setTeam(teamIndex);
}