Changeset 45c9d0f in network-game


Ignore:
Timestamp:
Feb 17, 2015, 1:35:51 AM (10 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
e2a0a27
Parents:
35d702d
Message:

Remove the response variable in the client-side processMessage

File:
1 edited

Legend:

Unmodified
Added
Removed
  • client/Client/main.cpp

    r35d702d r45c9d0f  
    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 
    836833   switch(state)
    837834   {
     
    844841            case MSG_TYPE_REGISTER:
    845842            {
    846                lblRegisterStatus->setText(response);
     843               lblRegisterStatus->setText(msg.buffer);
    847844               break;
    848845            }
     
    863860            case MSG_TYPE_LOGIN:
    864861            {
    865                if (response.compare("Player has already logged in.") == 0)
     862               if (string(msg.buffer).compare("Player has already logged in.") == 0)
    866863               {
    867864                  goToLoginScreen();
    868865                  state = STATE_START;
    869866
    870                   lblLoginStatus->setText(response);
     867                  lblLoginStatus->setText(msg.buffer);
    871868               }
    872                else if (response.compare("Incorrect username or password") == 0)
     869               else if (string(msg.buffer).compare("Incorrect username or password") == 0)
    873870               {
    874871                  goToLoginScreen();
    875872                  state = STATE_START;
    876873
    877                   lblLoginStatus->setText(response);
     874                  lblLoginStatus->setText(msg.buffer);
    878875               }
    879876               else
     
    908905               // Check if it's about you or another player
    909906               memcpy(&playerId, msg.buffer, 4);
    910                response = string(msg.buffer+4);
     907               string response = string(msg.buffer+4);
    911908
    912909               if (playerId == curPlayerId)
     
    933930            case MSG_TYPE_CHAT:
    934931            {
    935                chatConsole.addLine(response);
     932               chatConsole.addLine(msg.buffer);
    936933
    937934               break;
     
    11121109               // Check if it's about you or another player
    11131110               memcpy(&playerId, msg.buffer, 4);
    1114                response = string(msg.buffer+4);
    11151111
    11161112               if (playerId == curPlayerId)
Note: See TracChangeset for help on using the changeset viewer.