Changeset 521c88b in network-game for server/server.cpp
- Timestamp:
- Jun 22, 2013, 1:26:58 PM (12 years ago)
- Branches:
- master
- Children:
- 7ca5d21
- Parents:
- 109e8a3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r109e8a3 r521c88b 529 529 string username(clientMsg.buffer); 530 530 string password(strchr(clientMsg.buffer, '\0')+1); 531 Player::PlayerClass playerClass; 532 533 memcpy(&playerClass, clientMsg.buffer+username.length()+password.length()+2, 4); 531 534 532 535 cout << "username: " << username << endl; 533 536 cout << "password: " << password << endl; 534 537 535 int error = da.insertPlayer(username, password); 538 if (playerClass == Player::CLASS_WARRIOR) 539 cout << "class: WARRIOR" << endl; 540 else if (playerClass == Player::CLASS_RANGER) 541 cout << "class: RANGER" << endl; 542 else 543 cout << "Unknown player class detected" << endl; 544 545 int error = da.insertPlayer(username, password, playerClass); 536 546 537 547 if (!error) … … 574 584 // choose a random team (either 0 or 1) 575 585 p->team = rand() % 2; 576 577 // choose a random class578 int intClass = rand() % 2;579 switch (intClass) {580 case 0:581 p->setClass(Player::CLASS_WARRIOR);582 break;583 case 1:584 p->setClass(Player::CLASS_RANGER);585 break;586 }587 586 588 587 // tell the new player about all the existing players
Note:
See TracChangeset
for help on using the changeset viewer.