Changeset eb2ad4f in network-game for client/Client/main.cpp
- Timestamp:
- Dec 28, 2013, 4:29:07 PM (11 years ago)
- Branches:
- master
- Children:
- 6054f1e
- Parents:
- 2e63b64
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r2e63b64 reb2ad4f 57 57 void initWinSock(); 58 58 void shutdownWinSock(); 59 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap,map<unsigned int, Player*>& mapPlayers,59 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, 60 60 map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId); 61 61 int getRefreshRate(int width, int height); … … 205 205 return -1; 206 206 } 207 208 WorldMap* gameMap = WorldMap::loadMapFromFile("../../data/map.txt");209 210 cout << "Loaded map" << endl;211 207 212 208 debugConsole.addLine("Debug console:"); … … 452 448 453 449 if (msgProcessor.receiveMessage(&msgFrom, &from) >= 0) 454 processMessage(msgFrom, state, chatConsole, gameMap,mapPlayers, mapProjectiles, curPlayerId);450 processMessage(msgFrom, state, chatConsole, mapPlayers, mapProjectiles, curPlayerId); 455 451 456 452 if (redraw) … … 595 591 delete wndGameSummary; 596 592 597 delete gameMap; 598 593 // game should be deleted when the player leaves a gamw 599 594 if (game != NULL) 600 595 delete game; … … 644 639 } 645 640 646 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap,map<unsigned int, Player*>& mapPlayers,641 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, 647 642 map<unsigned int, Projectile>& mapProjectiles, unsigned int& curPlayerId) 648 643 { … … 780 775 { 781 776 chatConsole.addLine(response); 782 783 break;784 }785 case MSG_TYPE_OBJECT:786 {787 cout << "Received OBJECT message" << endl;788 789 WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0);790 o.deserialize(msg.buffer);791 cout << "object id: " << o.id << endl;792 gameMap->updateObject(o.id, o.type, o.pos.x, o.pos.y);793 794 break;795 }796 case MSG_TYPE_REMOVE_OBJECT:797 {798 cout << "Received REMOVE_OBJECT message!" << endl;799 800 int id;801 memcpy(&id, msg.buffer, 4);802 803 cout << "Removing object with id " << id << endl;804 805 if (!gameMap->removeObject(id))806 cout << "Did not remove the object" << endl;807 777 808 778 break;
Note:
See TracChangeset
for help on using the changeset viewer.