Changeset 9ee50ce in network-game for server


Ignore:
Timestamp:
Jan 25, 2014, 6:50:46 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
1e250bf, 5c7f28d
Parents:
1ee0ffa
Message:

Server logs unknown messages

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r1ee0ffa r9ee50ce  
    4444// from used to be const. Removed that so I could take a reference
    4545// and use it to send messages
    46 void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, unsigned int& unusedPlayerId);
     46void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, unsigned int& unusedPlayerId, ofstream& outputLog);
    4747
    4848void updateUnusedPlayerId(unsigned int& id, map<unsigned int, Player*>& mapPlayers);
     
    231231      if (msgProcessor.receiveMessage(&clientMsg, &from) >= 0)
    232232      {
    233          processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, unusedPlayerId);
     233         processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, unusedPlayerId, outputLog);
    234234
    235235         cout << "Finished processing the message" << endl;
     
    256256}
    257257
    258 void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, unsigned int& unusedPlayerId)
     258void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, unsigned int& unusedPlayerId, ofstream& outputLog)
    259259{
    260260   NETWORK_MSG serverMsg;
     
    759759      default:
    760760      {
    761          // probably want to log the error rather than sending a chat message,
    762          // especially since chat isn't currently visible on all screens
    763 
    764          serverMsg.type = MSG_TYPE_CHAT;
    765          strcpy(serverMsg.buffer, "Server error occured. Report this please.");
     761         outputLog << "Received unknown message of type " << clientMsg.type << endl;
    766762
    767763         break;
Note: See TracChangeset for help on using the changeset viewer.