Changeset 90eaad2 in network-game for server


Ignore:
Timestamp:
Oct 4, 2013, 5:23:24 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
53ba300
Parents:
95ffe57
Message:

When the server receives a logout message, it broadcasts it now instead of just responding to the sender

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r95ffe57 r90eaad2  
    727727         Player *p = findPlayerByName(mapPlayers, name);
    728728
     729         memcpy(serverMsg.buffer, &p->id, 4);
     730
    729731         if (p == NULL)
    730732         {
    731             strcpy(serverMsg.buffer, "That player is not logged in. This is either a bug, or you're trying to hack the server.");
     733            strcpy(serverMsg.buffer+4, "That player is not logged in. This is either a bug, or you're trying to hack the server.");
    732734            cout << "Player not logged in" << endl;
    733735         }
     
    735737                   p->addr.sin_port != from.sin_port )
    736738         {
    737             strcpy(serverMsg.buffer, "That player is logged in using a differemt connection. This is either a bug, or you're trying to hack the server.");
     739            strcpy(serverMsg.buffer+4, "That player is logged in using a differemt connection. This is either a bug, or you're trying to hack the server.");
    738740            cout << "Player logged in using a different connection" << endl;
    739741         }
     
    756758            mapPlayers.erase(p->id);
    757759            delete p;
    758             strcpy(serverMsg.buffer, "You have successfully logged out.");
     760            strcpy(serverMsg.buffer+4, "You have successfully logged out.");
     761            broadcastResponse = true;
    759762         }
    760763
Note: See TracChangeset for help on using the changeset viewer.