Changeset d519032 in network-game
- Timestamp:
- Sep 27, 2013, 6:20:43 PM (11 years ago)
- Branches:
- master
- Children:
- 233e736
- Parents:
- 88258c9
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
r88258c9 rd519032 549 549 550 550 delete gameMap; 551 delete game; 551 552 if (game != NULL) 553 delete game; 552 554 553 555 al_destroy_event_queue(event_queue); … … 654 656 } 655 657 case STATE_LOBBY: 658 cout << "In STATE_LOBBY" << endl; 656 659 case STATE_GAME: 657 660 { … … 743 746 case MSG_TYPE_OBJECT: 744 747 { 745 cout << "Received object message in STATE_LOBBY." << endl;748 cout << "Received OBJECT message" << endl; 746 749 747 750 WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0); … … 845 848 break; 846 849 } 850 case MSG_TYPE_JOIN_GAME_SUCCESS: 851 { 852 cout << "Received a JOIN_GAME_SUCCESS message" << endl; 853 854 string gameName(msg.buffer); 855 856 cout << "Game name: " << gameName << endl; 857 858 game = new Game(gameName); 859 860 state = STATE_NEW_GAME; 861 862 msgTo.type = MSG_TYPE_JOIN_GAME_ACK; 863 strcpy(msgTo.buffer, gameName.c_str()); 864 865 msgProcessor.sendMessage(&msgTo, sock, &server, &outputLog); 866 867 break; 868 } 869 case MSG_TYPE_JOIN_GAME_FAILURE: 870 { 871 cout << "Received a JOIN_GAME_FAILURE message" << endl; 872 873 break; 874 } 847 875 default: 848 876 { … … 857 885 case STATE_NEW_GAME: 858 886 { 887 cout << "(STATE_NEW_GAME) "; 859 888 switch(msg.type) 860 889 { 861 890 case MSG_TYPE_GAME_INFO: 862 891 { 863 cout << " (STATE_NEW_GAME)Received a GAME_INFO message" << endl;892 cout << "Received a GAME_INFO message" << endl; 864 893 865 894 string gameName(msg.buffer+4); 866 895 int numPlayers; 867 868 //game = new Game(gameName);869 896 870 897 memcpy(&numPlayers, msg.buffer, 4); … … 878 905 case MSG_TYPE_OBJECT: 879 906 { 880 cout << " (STATE_NEW_GAME) Received object message in STATE_LOBBY." << endl;907 cout << "Received object message in STATE_NEW_GAME" << endl; 881 908 882 909 WorldMap::Object o(0, WorldMap::OBJECT_NONE, 0, 0); … … 889 916 case MSG_TYPE_REMOVE_OBJECT: 890 917 { 891 cout << " (STATE_NEW_GAME)Received REMOVE_OBJECT message!" << endl;918 cout << "Received REMOVE_OBJECT message!" << endl; 892 919 893 920 int id; … … 921 948 default: 922 949 { 923 cout << " (STATE_NEW_GAME)Received invalid message of type " << msg.type << endl;950 cout << "Received invalid message of type " << msg.type << endl; 924 951 925 952 break; … … 1260 1287 cout << "Creating game" << endl; 1261 1288 1262 // hack to help transitions to multiple games1263 state = STATE_NEW_GAME;1264 game = new Game( txtCreateGame->getStr());1265 1266 1289 string msg = txtCreateGame->getStr(); 1267 1290 txtCreateGame->clear(); 1268 1291 1292 cout << "Sending message: " << msg.c_str() << endl; 1293 1269 1294 msgTo.type = MSG_TYPE_CREATE_GAME; 1270 1295 strcpy(msgTo.buffer, msg.c_str());
Note:
See TracChangeset
for help on using the changeset viewer.