Changeset 1a47469 in network-game
- Timestamp:
- Dec 16, 2013, 2:49:26 AM (11 years ago)
- Branches:
- master
- Children:
- b4c5b6a
- Parents:
- 53d41ea
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
design/message_spec.txt
r53d41ea r1a47469 12 12 MSG_TYPE_LOGOUT 13 13 Client sends this message to logout. Contains no extra data. The server uses the sender address to determine which player sent it. 14 Server broadcasts a reply with the player id if logout was successfull or sends the sender's id and a string with an error message back to the original sender. 14 15 15 16 MSG_TYPE_CHAT -
server/server.cpp
r53d41ea r1a47469 754 754 } 755 755 756 // broadcast to all players before deleting p from the map 757 map<unsigned int, Player*>::iterator it; 758 for (it = mapPlayers.begin(); it != mapPlayers.end(); it++) 759 { 760 cout << "Sent message back to " << it->second->name << endl; 761 if ( msgProcessor.sendMessage(&serverMsg, sock, &(it->second->addr), &outputLog) < 0 ) 762 error("sendMessage"); 763 } 764 756 765 if (p->id < unusedPlayerId) 757 766 unusedPlayerId = p->id; … … 759 768 delete p; 760 769 strcpy(serverMsg.buffer+4, "You have successfully logged out."); 761 broadcastResponse = true;762 770 } 763 771
Note:
See TracChangeset
for help on using the changeset viewer.