Esempio n. 1
0
static void handleQueryResponse(Game *game, const Address &remoteAddress, BitStream *stream)
{
   TNLAssert(!game->isServer(), "Expected this to be a client!");

   Nonce nonce;
   StringTableEntry name;
   StringTableEntry descr;
   U32 playerCount, maxPlayers, botCount;
   bool dedicated, test, passwordRequired;

   nonce.read(stream);
   stream->readStringTableEntry(&name);
   stream->readStringTableEntry(&descr);

   stream->read(&playerCount);
   stream->read(&maxPlayers);
   stream->read(&botCount);
   dedicated = stream->readFlag();
   test = stream->readFlag();
   passwordRequired = stream->readFlag();

   if(!stream->isValid())
      return;

   S32 serverId;
   if(!stream->read(&serverId))  // If we can't read (goes past the end of data size from older 019)
      serverId = 0;              // then set this to zero

   // Alert the user
   game->gotQueryResponse(remoteAddress, serverId, nonce, name.getString(), descr.getString(), 
                          playerCount, maxPlayers, botCount, dedicated, test, passwordRequired);
}
Esempio n. 2
0
void AbstractChat::playerJoinedLobbyChat(const StringTableEntry &playerNick)
{
   mPlayersInLobbyChat.push_back(playerNick);

   // Make the following be from us, so it will be colored white
   string msg = "----- Player " + string(playerNick.getString()) + " joined the conversation -----";
   newMessage(mGame->getClientInfo()->getName().getString(), msg, false, true, true);
   SoundSystem::playSoundEffect(SFXPlayerEnteredLobbyChat, mGame->getSettings()->getSetting<F32>(IniKey::EffectsVolume));   // Make sound?
}
Esempio n. 3
0
void AbstractChat::playerLeftLobbyChat(const StringTableEntry &playerNick)
{
   ChatUserInterface *ui = mGame->getUIManager()->getUI<ChatUserInterface>();

   for(S32 i = 0; i < ui->mPlayersInLobbyChat.size(); i++)
      if(ui->mPlayersInLobbyChat[i] == playerNick)
      {
         ui->mPlayersInLobbyChat.erase_fast(i);

         string msg = "----- Player " + string(playerNick.getString()) + " left the conversation -----";
         newMessage(mGame->getClientInfo()->getName().getString(), msg, false, true, true);
         
         SoundSystem::playSoundEffect(SFXPlayerLeftLobbyChat, mGame->getSettings()->getSetting<F32>(IniKey::EffectsVolume));   // Me make sound!
         break;
      }
}