- Timestamp:
- May 26, 2013, 12:11:09 AM (12 years ago)
- Branches:
- master
- Children:
- 446dc65
- Parents:
- b8601ee
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
rb8601ee r15efb4e 47 47 void initWinSock(); 48 48 void shutdownWinSock(); 49 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, 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, int &scoreBlue, int &scoreRed); 50 50 void drawMap(WorldMap* gameMap); 51 51 void drawPlayers(map<unsigned int, Player>& mapPlayers, unsigned int curPlayerId); … … 100 100 map<unsigned int, Player> mapPlayers; 101 101 unsigned int curPlayerId = -1; 102 int scoreBlue, scoreRed; 103 104 scoreBlue = 0; 105 scoreRed = 0; 102 106 103 107 state = STATE_START; … … 296 300 297 301 if (receiveMessage(&msgFrom, sock, &from) >= 0) 298 processMessage(msgFrom, state, chatConsole, gameMap, mapPlayers, curPlayerId );302 processMessage(msgFrom, state, chatConsole, gameMap, mapPlayers, curPlayerId, scoreBlue, scoreRed); 299 303 300 304 if (redraw) … … 312 316 else if(wndCurrent == wndMain) { 313 317 al_draw_text(font, al_map_rgb(0, 255, 0), 4, 43, ALLEGRO_ALIGN_LEFT, "Message:"); 318 319 ostringstream ossScoreBlue, ossScoreRed; 320 321 ossScoreBlue << "Blue: " << scoreBlue << endl; 322 ossScoreRed << "Red: " << scoreRed << endl; 323 324 al_draw_text(font, al_map_rgb(0, 255, 0), 330, 80, ALLEGRO_ALIGN_LEFT, ossScoreBlue.str().c_str()); 325 al_draw_text(font, al_map_rgb(0, 255, 0), 515, 80, ALLEGRO_ALIGN_LEFT, ossScoreRed.str().c_str()); 314 326 315 327 // update player positions … … 412 424 } 413 425 414 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId )426 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, WorldMap *gameMap, map<unsigned int, Player>& mapPlayers, unsigned int& curPlayerId, int &scoreBlue, int &scoreRed) 415 427 { 416 428 string response = string(msg.buffer); … … 575 587 break; 576 588 } 589 case MSG_TYPE_SCORE: 590 { 591 memcpy(&scoreBlue, msg.buffer, 4); 592 memcpy(&scoreRed, msg.buffer+4, 4); 593 594 break; 595 } 577 596 default: 578 597 {
Note:
See TracChangeset
for help on using the changeset viewer.