- Timestamp:
- Dec 17, 2013, 11:35:52 PM (11 years ago)
- Branches:
- master
- Children:
- 6012178
- Parents:
- 31b347a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified server/server.cpp ¶
r31b347a r453087e 1103 1103 p->currentGame = g; // should have been done in JOIN_GAME, so not necessary 1104 1104 1105 map<unsigned int, Player*>& otherPlayers = g->getPlayers();1106 1107 // tell the new player about all the existing players1108 cout << "Sending other players to new player" << endl;1109 serverMsg.type = MSG_TYPE_PLAYER;1110 1111 map<unsigned int, Player*>::iterator it;1112 for (it = otherPlayers.begin(); it != otherPlayers.end(); it++)1113 {1114 it->second->serialize(serverMsg.buffer);1115 1116 cout << "sending info about " << it->second->name << endl;1117 cout << "sending id " << it->second->id << endl;1118 if ( msgProcessor.sendMessage(&serverMsg, sock, &from, &outputLog) < 0 )1119 error("sendMessage");1120 }1121 1122 1105 // tell the new player about all map objects 1123 1106 // (currently just the flags) … … 1146 1129 error("sendMessage"); 1147 1130 1148 serverMsg.type = MSG_TYPE_PLAYER ;1131 serverMsg.type = MSG_TYPE_PLAYER_JOIN_GAME; 1149 1132 p->serialize(serverMsg.buffer); 1150 1133 cout << "Should be broadcasting the message" << endl; 1151 1134 1135 map<unsigned int, Player*>& otherPlayers = g->getPlayers(); 1152 1136 for (it = otherPlayers.begin(); it != otherPlayers.end(); it++) 1153 1137 { … … 1158 1142 1159 1143 g->addPlayer(p); 1144 1145 map<unsigned int, Player*>& allPlayers = g->getPlayers(); 1146 1147 // tell the new player about all the players in the game (including himself) 1148 cout << "Sending other players to new player" << endl; 1149 serverMsg.type = MSG_TYPE_PLAYER_JOIN_GAME; 1150 1151 map<unsigned int, Player*>::iterator it; 1152 for (it = allPlayers.begin(); it != allPlayers.end(); it++) 1153 { 1154 it->second->serialize(serverMsg.buffer); 1155 1156 cout << "sending info about " << it->second->name << endl; 1157 cout << "sending id " << it->second->id << endl; 1158 if ( msgProcessor.sendMessage(&serverMsg, sock, &from, &outputLog) < 0 ) 1159 error("sendMessage"); 1160 } 1161 1160 1162 int numPlayers = g->getNumPlayers(); 1161 1163
Note:
See TracChangeset
for help on using the changeset viewer.