- Timestamp:
- Dec 18, 2013, 12:57:06 AM (11 years ago)
- Branches:
- master
- Children:
- 70fc3e8
- Parents:
- 2d78e03
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r2d78e03 r4509648 611 611 Player::PlayerClass playerClass; 612 612 613 serverMsg.type = MSG_TYPE_REGISTER; 613 614 memcpy(&playerClass, clientMsg.buffer+username.length()+password.length()+2, 4); 614 serverMsg.type = MSG_TYPE_REGISTER;615 615 616 616 cout << "username: " << username << endl; … … 727 727 Player *p = findPlayerByName(mapPlayers, name); 728 728 729 memcpy(serverMsg.buffer, &p->id, 4);730 731 729 if (p == NULL) 732 730 { … … 755 753 756 754 // broadcast to all players before deleting p from the map 755 serverMsg.type = MSG_TYPE_LOGOUT; 756 memcpy(serverMsg.buffer, &p->id, 4); 757 757 758 map<unsigned int, Player*>::iterator it; 758 759 for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) … … 1065 1066 g->removePlayer(p->id); 1066 1067 1067 // broadcast a messsage to other players so they know someone left the game1068 // also, check if the game has any players left. If not, remove it and send everyone a message so the game is gone from their lobby list1069 1070 1068 int numPlayers = g->getNumPlayers(); 1071 cout << "" << endl;1072 1069 1073 1070 serverMsg.type = MSG_TYPE_GAME_INFO;
Note:
See TracChangeset
for help on using the changeset viewer.