Changeset 35d702d in network-game for client/Client/main.cpp
- Timestamp:
- Feb 2, 2015, 1:48:53 AM (10 years ago)
- Branches:
- master
- Children:
- 13a8212, 45c9d0f
- Parents:
- d58e3c3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
rd58e3c3 r35d702d 61 61 void createGui(ALLEGRO_FONT* font); 62 62 63 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames, unsigned int& curPlayerId );63 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames, unsigned int& curPlayerId, string& alertMessage); 64 64 void handleMsgPlayer(NETWORK_MSG &msg, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames); 65 65 void handleMsgGameInfo(NETWORK_MSG &msg, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames); … … 147 147 MessageProcessor msgProcessor; 148 148 149 string alertMessage; 150 149 151 int main(int argc, char **argv) 150 152 { … … 169 171 numGames = 0; 170 172 gameHistory = NULL; 173 174 alertMessage = ""; 171 175 172 176 state = STATE_START; … … 401 405 402 406 if (msgProcessor.receiveMessage(&msgFrom, &from) >= 0) 403 processMessage(msgFrom, state, chatConsole, mapPlayers, mapGames, curPlayerId );407 processMessage(msgFrom, state, chatConsole, mapPlayers, mapGames, curPlayerId, alertMessage); 404 408 405 409 if (redraw) … … 442 446 i++; 443 447 } 448 449 al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W/2, 15, ALLEGRO_ALIGN_CENTER, alertMessage.c_str()); 444 450 } 445 451 else if (wndCurrent == wndProfile) … … 821 827 } 822 828 823 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames, unsigned int& curPlayerId )829 void processMessage(NETWORK_MSG &msg, int &state, chat &chatConsole, map<unsigned int, Player*>& mapPlayers, map<string, int>& mapGames, unsigned int& curPlayerId, string& alertMessage) 824 830 { 825 831 cout << "Total players in map: " << mapPlayers.size() << endl; … … 1003 1009 break; 1004 1010 } 1011 case MSG_TYPE_CREATE_GAME_FAILURE: 1012 { 1013 cout << "Received a CREATE_GAME_FAILURE message" << endl; 1014 alertMessage = "Game could not be created because one exists with that name"; 1015 1016 break; 1017 } 1005 1018 case MSG_TYPE_PLAYER: 1006 1019 { … … 1087 1100 state = STATE_LOBBY; 1088 1101 wndCurrent = wndGameSummary; 1102 alertMessage = ""; 1089 1103 1090 1104 break; … … 1459 1473 1460 1474 state = STATE_LOBBY; 1475 alertMessage = ""; 1461 1476 } 1462 1477 … … 1589 1604 state = STATE_LOBBY; 1590 1605 wndCurrent = wndLobby; 1606 alertMessage = ""; 1591 1607 1592 1608 msgTo.type = MSG_TYPE_LEAVE_GAME;
Note:
See TracChangeset
for help on using the changeset viewer.