Changeset 6ba31d2 in network-game
- Timestamp:
- Feb 2, 2015, 12:53:42 AM (10 years ago)
- Branches:
- master
- Children:
- d58e3c3
- Parents:
- 85da778
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r85da778 r6ba31d2 221 221 memcpy(serverMsg.buffer, &numPlayers, 4); 222 222 strcpy(serverMsg.buffer+4, game->getName().c_str()); 223 msgProcessor.broadcastMessage(serverMsg, mapPlayers); 223 224 // only send this to players in the game 225 msgProcessor.broadcastMessage(serverMsg, game->getPlayers()); 224 226 225 227 delete itGames->second; … … 840 842 msgProcessor.broadcastMessage(serverMsg, players); 841 843 844 // send a GAME_INFO message to all players not in the game so they delete it from their lobby 845 map<unsigned int, Player*> playersNotInGame; 846 map<unsigned int, Player*>::iterator it; 847 848 for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) { 849 if (players.count(it->first) == 0) 850 playersNotInGame[it->first] = it->second; 851 } 852 853 cout << "Sending game info to " << playersNotInGame.size() << " players not in the currently started game" << endl; 854 855 int numPlayers = 0; 856 serverMsg.type = MSG_TYPE_GAME_INFO; 857 memcpy(serverMsg.buffer, &numPlayers, 4); 858 strcpy(serverMsg.buffer+4, p->currentGame->getName().c_str()); 859 860 msgProcessor.broadcastMessage(serverMsg, playersNotInGame); 861 842 862 break; 843 863 }
Note:
See TracChangeset
for help on using the changeset viewer.