Changeset 45b2750 in network-game
- Timestamp:
- May 22, 2013, 10:55:36 PM (11 years ago)
- Branches:
- master
- Children:
- 23559e7
- Parents:
- 5f868c0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r5f868c0 r45b2750 47 47 void initWinSock(); 48 48 void shutdownWinSock(); 49 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId);49 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId); 50 50 void drawMap(WorldMap* gameMap); 51 51 void drawPlayers(map<unsigned int, Player>& mapPlayers, unsigned int curPlayerId); … … 265 265 266 266 if (receiveMessage(&msgFrom, sock, &from) >= 0) 267 processMessage(msgFrom, state, chatConsole, mapPlayers, curPlayerId);267 processMessage(msgFrom, state, chatConsole, gameMap, mapPlayers, curPlayerId); 268 268 269 269 if (redraw) … … 381 381 } 382 382 383 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId)383 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId) 384 384 { 385 385 string response = string(msg.buffer); … … 443 443 break; 444 444 } 445 case MSG_TYPE_OBJECT: 446 { 447 cout << "Received object message. Baller Biller!" << endl; 448 449 WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0); 450 o.deserialize(msg.buffer); 451 gameMap->updateObject(o.id, o.type, o.pos.x, o.pos.y); 452 453 break; 454 } 445 455 } 446 456 … … 509 519 510 520 break; 521 } 522 case MSG_TYPE_OBJECT: 523 { 524 cout << "Received object message. Baller Biller!" << endl; 525 526 WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0); 527 o.deserialize(msg.buffer); 528 gameMap->updateObject(o.id, o.type, o.pos.x, o.pos.y); 529 530 break; 531 } 532 default: 533 { 534 cout << "Received an unexpected message type: " << msg.type << endl; 511 535 } 512 536 }
Note:
See TracChangeset
for help on using the changeset viewer.