Multiple player info requests can be placed in one packet.

This commit is contained in:
lotodore
2012-09-24 12:22:13 +02:00
parent f0ee0af6ec
commit 02016381ef
9 changed files with 1078 additions and 991 deletions
+5 -2
View File
@@ -677,15 +677,18 @@ AbstractClientStateReceiving::HandlePacket(boost::shared_ptr<ClientThread> clien
unsigned numPlayers = netListNew.playerids_size();
// Request player info for players if needed.
GameInfo tmpInfo;
list<unsigned> requestList;
for (unsigned i = 0; i < numPlayers; i++) {
PlayerInfo info;
unsigned playerId = netListNew.playerids(i);
if (!client->GetCachedPlayerInfo(playerId, info)) {
// Request player info.
client->RequestPlayerInfo(playerId);
requestList.push_back(playerId);
}
tmpInfo.players.push_back(playerId);
}
// Send request for multiple players (will only act if list is non-empty).
client->RequestPlayerInfo(requestList);
tmpInfo.adminPlayerId = netListNew.adminplayerid();
tmpInfo.isPasswordProtected = netListNew.isprivate();
tmpInfo.mode = static_cast<GameMode>(netListNew.gamemode());