Changeset d69eb32 in network-game for server/server.cpp
- Timestamp:
- May 18, 2013, 8:30:53 PM (11 years ago)
- Branches:
- master
- Children:
- e76055f
- Parents:
- 430c80e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r430c80e rd69eb32 117 117 clock_gettime(CLOCK_REALTIME, &ts); 118 118 // make the number smaller so millis can fit in an int 119 ts.tv_sec = ts.tv_sec & 0x3fffff;119 ts.tv_sec -= 1368000000; 120 120 curTime = ts.tv_sec*1000 + ts.tv_nsec/1000000; 121 121 122 122 if (timeLastUpdated == 0 || (curTime-timeLastUpdated) >= 50) { 123 123 timeLastUpdated = curTime; 124 //cout << "Server-side player movement: " << timeLastUpdated << endl; 124 125 125 126 // maybe put this in a separate method … … 128 129 if (!it->second.move(gameMap)) { 129 130 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); 132 133 133 134 cout << "about to send move cencellation" << endl; 134 135 for (it2 = mapPlayers.begin(); it2 != mapPlayers.end(); it2++) 135 136 { 136 //if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 )137 //error("sendMessage");137 if ( sendMessage(&serverMsg, sock, &(it2->second.addr)) < 0 ) 138 error("sendMessage"); 138 139 } 139 140 }
Note:
See TracChangeset
for help on using the changeset viewer.