Changes in / [e2a0a27:13a8212] in network-game


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    re2a0a27 r13a8212  
    831831   cout << "Total players in map: " << mapPlayers.size() << endl;
    832832
     833   // this is outdated since most messages now don't contain just a text string
     834   string response = string(msg.buffer);
     835
    833836   switch(state)
    834837   {
     
    841844            case MSG_TYPE_REGISTER:
    842845            {
    843                lblRegisterStatus->setText(msg.buffer);
     846               lblRegisterStatus->setText(response);
    844847               break;
    845848            }
     
    860863            case MSG_TYPE_LOGIN:
    861864            {
    862                if (string(msg.buffer).compare("Player has already logged in.") == 0)
     865               if (response.compare("Player has already logged in.") == 0)
    863866               {
    864867                  goToLoginScreen();
    865868                  state = STATE_START;
    866869
    867                   lblLoginStatus->setText(msg.buffer);
     870                  lblLoginStatus->setText(response);
    868871               }
    869                else if (string(msg.buffer).compare("Incorrect username or password") == 0)
     872               else if (response.compare("Incorrect username or password") == 0)
    870873               {
    871874                  goToLoginScreen();
    872875                  state = STATE_START;
    873876
    874                   lblLoginStatus->setText(msg.buffer);
     877                  lblLoginStatus->setText(response);
    875878               }
    876879               else
     
    905908               // Check if it's about you or another player
    906909               memcpy(&playerId, msg.buffer, 4);
    907                string response = string(msg.buffer+4);
     910               response = string(msg.buffer+4);
    908911
    909912               if (playerId == curPlayerId)
     
    930933            case MSG_TYPE_CHAT:
    931934            {
    932                chatConsole.addLine(msg.buffer);
     935               chatConsole.addLine(response);
    933936
    934937               break;
     
    11091112               // Check if it's about you or another player
    11101113               memcpy(&playerId, msg.buffer, 4);
     1114               response = string(msg.buffer+4);
    11111115
    11121116               if (playerId == curPlayerId)
Note: See TracChangeset for help on using the changeset viewer.