Changeset c4c2a3c in network-game


Ignore:
Timestamp:
Jul 27, 2013, 1:43:27 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
bc70282
Parents:
934ab53
Message:

The player must select a class when registering

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r934ab53 rc4c2a3c  
    564564
    565565         memcpy(&playerClass, clientMsg.buffer+username.length()+password.length()+2, 4);
     566         serverMsg.type = MSG_TYPE_REGISTER;
     567
    566568
    567569         cout << "username: " << username << endl;
     
    572574         else if (playerClass == Player::CLASS_RANGER)
    573575            cout << "class: RANGER" << endl;
     576         else {
     577            cout << "Unknown player class detected" << endl;
     578            strcpy(serverMsg.buffer, "You didn't select a class");
     579            break;
     580         }
     581
     582         int error = da.insertPlayer(username, password, playerClass);
     583
     584         if (error)
     585            strcpy(serverMsg.buffer, "Registration failed. Please try again.");
    574586         else
    575             cout << "Unknown player class detected" << endl;
    576 
    577          int error = da.insertPlayer(username, password, playerClass);
    578 
    579          if (!error)
    580587            strcpy(serverMsg.buffer, "Registration successful.");
    581          else
    582             strcpy(serverMsg.buffer, "Registration failed. Please try again.");
    583 
    584          serverMsg.type = MSG_TYPE_REGISTER;
    585588
    586589         break;
Note: See TracChangeset for help on using the changeset viewer.