Changeset 8a4ed74 in network-game


Ignore:
Timestamp:
May 26, 2013, 10:34:28 PM (12 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
8dad966
Parents:
4b4b153
Message:

Made some minor server changes to help handle player attacks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r4b4b153 r8a4ed74  
    325325         broadcastResponse = processMessage(clientMsg, from, mapPlayers, gameMap, unusedId, serverMsg, sock, scoreBlue, scoreRed);
    326326
    327          // probably replace this with a function that prints based on the
    328          // message type
    329          cout << "msg: " << serverMsg.buffer << endl;
    330327         if (broadcastResponse)
    331328         {
     
    684681         cout << "Received a START_ATTACK message" << endl;
    685682
     683         int id, targetId;
     684
     685         memcpy(&id, clientMsg.buffer, 4);
     686         memcpy(&targetId, clientMsg.buffer+4, 4);
     687
    686688         serverMsg.type = MSG_TYPE_START_ATTACK;
    687689         broadcastResponse = true;
     690
     691         break;
    688692      }
    689693      case MSG_TYPE_ATTACK:
    690694      {
    691695         cout << "Received am ATTACK message" << endl;
     696
     697         int id, targetId;
     698
     699         memcpy(&id, clientMsg.buffer, 4);
     700         memcpy(&targetId, clientMsg.buffer+4, 4);
    692701
    693702         serverMsg.type = MSG_TYPE_ATTACK;
    694703         broadcastResponse = true;
     704
     705         break;
    695706      }
    696707      default:
Note: See TracChangeset for help on using the changeset viewer.