Changeset 7ca5d21 in network-game


Ignore:
Timestamp:
Jun 23, 2013, 2:12:33 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
9b1e12c
Parents:
521c88b
Message:

The server can handle loading a NULL class from the db

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/DataAccess.cpp

    r521c88b r7ca5d21  
    8484      cout << "Creating a new player" << endl;
    8585      p = new Player(string(row[1]), string(row[2]));
    86       p->setClass((Player::PlayerClass)atoi(row[3]));
    87       cout << "Class from db: " << atoi(row[3]) << endl;
     86      if (row[3] == NULL) {
     87         p->setClass(Player::CLASS_NONE);
     88         cout << "Class from db was NULL" << endl;
     89      }else {
     90         p->setClass((Player::PlayerClass)atoi(row[3]));
     91         cout << "Class from db: " << atoi(row[3]) << endl;
     92      }
    8893      cout << "Player class: " << p->playerClass << endl;
    8994      cout << "Created new player" << endl;
Note: See TracChangeset for help on using the changeset viewer.