Changeset d69eb32 in network-game for server/server.cpp


Ignore:
Timestamp:
May 18, 2013, 8:30:53 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
e76055f
Parents:
430c80e
Message:

Re-enabled sending PLAYER_MOVE messages when a player encounters an obstacle

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r430c80e rd69eb32  
    117117      clock_gettime(CLOCK_REALTIME, &ts);
    118118      // make the number smaller so millis can fit in an int
    119       ts.tv_sec = ts.tv_sec & 0x3fffff;
     119      ts.tv_sec -= 1368000000;
    120120      curTime = ts.tv_sec*1000 + ts.tv_nsec/1000000;
    121121
    122122      if (timeLastUpdated == 0 || (curTime-timeLastUpdated) >= 50) {
    123123         timeLastUpdated = curTime;
     124         //cout << "Server-side player movement: " << timeLastUpdated << endl;
    124125
    125126         // maybe put this in a separate method
     
    128129            if (!it->second.move(gameMap)) {
    129130               cout << "Cenceling move" << endl;
    130                //serverMsg.type = MSG_TYPE_PLAYER;
    131                //it->second.serialize(serverMsg.buffer);
     131               serverMsg.type = MSG_TYPE_PLAYER;
     132               it->second.serialize(serverMsg.buffer);
    132133
    133134               cout << "about to send move cencellation" << endl;
    134135               for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++)
    135136               {
    136                   //if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
    137                     // error("sendMessage");
     137                  if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )
     138                    error("sendMessage");
    138139               }
    139140            }
Note: See TracChangeset for help on using the changeset viewer.