Changeset 50e6c7a in network-game
- Timestamp:
- Sep 26, 2013, 1:51:26 AM (11 years ago)
- Branches:
- master
- Children:
- 99afbb8
- Parents:
- b8f789d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
client/Client/main.cpp
rb8f789d r50e6c7a 118 118 chat chatConsole, debugConsole; 119 119 bool debugging; 120 vector<string> games; 120 121 121 122 MessageProcessor msgProcessor; … … 421 422 // right now, this code will target all players other than the current one 422 423 target = &it->second; 423 if (target->id != curPlayerId && target->team != curPlayer->team) { 424 if (target->id != curPlayerId && target->team != curPlayer->team) 425 { 424 426 msgTo.type = MSG_TYPE_START_ATTACK; 425 427 memcpy(msgTo.buffer, &curPlayerId, 4); … … 448 450 wndCurrent->draw(display); 449 451 450 if(wndCurrent == wndGame) { 452 if (wndCurrent == wndLobby) { 453 for (int i=0; i<games.size(); i++) { 454 al_draw_text(font, al_map_rgb(0, 255, 0), SCREEN_W*1/4-100, 120+i*15, ALLEGRO_ALIGN_LEFT, games[i].c_str()); 455 } 456 } 457 else if (wndCurrent == wndGame) 458 { 451 459 if (!debugging) 452 460 chatConsole.draw(font, al_map_rgb(255,255,255)); … … 779 787 cout << "Received a PROJECTILE message" << endl; 780 788 781 int id, x, y, targetId;789 unsigned int id, x, y, targetId; 782 790 783 791 memcpy(&id, msg.buffer, 4); … … 803 811 804 812 int id; 805 806 813 memcpy(&id, msg.buffer, 4); 807 814 … … 810 817 break; 811 818 } 819 case MSG_TYPE_GAME_INFO: 820 { 821 cout << "Received a GAME_INFO message" << endl; 822 823 string name(msg.buffer+4); 824 int numPlayers; 825 826 memcpy(&numPlayers, msg.buffer, 4); 827 828 cout << "Received game info for " << name << " (num players: " << numPlayers << ")" << endl; 829 games.push_back(name); 830 831 break; 832 } 812 833 default: 813 834 { 814 835 cout << "(STATE_LOBBY) Received invlaid message of type " << msg.type << endl; 836 815 837 break; 816 838 }
Note:
See TracChangeset
for help on using the changeset viewer.