Changeset 3ff2bd7 in network-game


Ignore:
Timestamp:
Dec 27, 2013, 8:58:51 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
360c0f1
Parents:
9bfc1cb
Message:

Client updates related to the attack message change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r9bfc1cb r3ff2bd7  
    9595Window* wndLobby;
    9696Window* wndLobbyDebug;
    97 Window* wndNewGame;
     97Window* wndGame;
    9898Window* wndGameSummary;
    9999Window* wndCurrent;
     
    287287   cout << "Created debug lobby screen" << endl;
    288288
    289    wndNewGame = new Window(0, 0, SCREEN_W, SCREEN_H);
    290    vctComponents.push_back(wndNewGame->addComponent(new Button(880, 10, 120, 20, font, "Leave Game", leaveGame)));
     289   wndGame = new Window(0, 0, SCREEN_W, SCREEN_H);
     290   vctComponents.push_back(wndGame->addComponent(new Button(880, 10, 120, 20, font, "Leave Game", leaveGame)));
    291291
    292292   cout << "Created new game screen" << endl;
     
    398398      }
    399399      else if(ev.type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) {
    400          if(wndCurrent == wndNewGame) {
     400         if(wndCurrent == wndGame) {
    401401            if (ev.mouse.button == 1) {   // left click
    402402               msgTo.type = MSG_TYPE_PLAYER_MOVE;
     
    439439                     cout << "Found valid target" << endl;
    440440
    441                      msgTo.type = MSG_TYPE_START_ATTACK;
     441                     msgTo.type = MSG_TYPE_ATTACK;
    442442                     memcpy(msgTo.buffer, &curPlayerId, 4);
    443443                     memcpy(msgTo.buffer+4, &target->id, 4);
     
    479479            }
    480480         }
    481          else if (wndCurrent == wndNewGame)
     481         else if (wndCurrent == wndGame)
    482482         {
    483483            al_draw_text(font, al_map_rgb(0, 255, 0), 4, 4, ALLEGRO_ALIGN_LEFT, "Players");
     
    486486            map<unsigned int, Player*>::iterator it;
    487487
    488             int playerCount = 0;
    489             for (it = gamePlayers.begin(); it != gamePlayers.end(); it++)
    490             {
    491                al_draw_text(font, al_map_rgb(0, 255, 0), 4, 19+(playerCount+1)*15, ALLEGRO_ALIGN_LEFT, it->second->name.c_str());
    492                playerCount++;
     488            if (!debugging) {
     489               int playerCount = 0;
     490               for (it = gamePlayers.begin(); it != gamePlayers.end(); it++)
     491               {
     492                  al_draw_text(font, al_map_rgb(0, 255, 0), 4, 19+(playerCount+1)*15, ALLEGRO_ALIGN_LEFT, it->second->name.c_str());
     493                  playerCount++;
     494               }
    493495            }
    494496
     
    589591   delete wndLobby;
    590592   delete wndLobbyDebug;
    591    delete wndNewGame;
     593   delete wndGame;
    592594   delete wndGameSummary;
    593595
     
    807809            case MSG_TYPE_ATTACK:
    808810            {
    809                cout << "Received ATTACK message" << endl;
    810 
    811                break;
    812             }
    813             case MSG_TYPE_START_ATTACK:
    814             {
    815811               cout << "Received START_ATTACK message" << endl;
    816812
     
    889885
    890886               state = STATE_GAME;
    891                wndCurrent = wndNewGame;
     887               wndCurrent = wndGame;
    892888
    893889               msgTo.type = MSG_TYPE_JOIN_GAME_ACK;
     
    10861082            case MSG_TYPE_ATTACK:
    10871083            {
    1088                cout << "Received ATTACK message" << endl;
    1089 
    1090                break;
    1091             }
    1092             case MSG_TYPE_START_ATTACK:
    1093             {
    10941084               cout << "Received START_ATTACK message" << endl;
    10951085
     
    11851175   al_draw_text(font, al_map_rgb(0, 255, 255), 240+clientMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "Acked?");
    11861176
    1187    al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
     1177   //al_draw_text(font, al_map_rgb(0, 255, 255), serverMsgOffset, 43, ALLEGRO_ALIGN_LEFT, "ID");
    11881178
    11891179   map<unsigned int, map<unsigned long, MessageContainer> >& sentMessages = msgProcessor.getSentMessages();
Note: See TracChangeset for help on using the changeset viewer.