Changeset ea17281 in network-game
- Timestamp:
- Jul 4, 2014, 8:09:47 PM (10 years ago)
- Branches:
- master
- Children:
- e98426d
- Parents:
- a0ce8a3
- Location:
- common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Game.cpp
ra0ce8a3 rea17281 43 43 } 44 44 45 bool Game::addPlayer(Player* p ) {45 bool Game::addPlayer(Player* p, bool serverSide) { 46 46 if (players.find(p->getId()) == players.end()) { 47 47 players[p->getId()] = p; … … 58 58 p->hasRedFlag = false; 59 59 60 // choose a random team (either 0 or 1) 61 p->team = rand() % 2; 60 if (serverSide) { 61 // choose a random team (either 0 or 1) 62 p->team = rand() % 2; 63 } 62 64 63 65 p->currentGame = this; -
common/Game.h
ra0ce8a3 rea17281 49 49 50 50 map<unsigned int, Player*>& getPlayers(); 51 bool addPlayer(Player* p );51 bool addPlayer(Player* p, bool serverSide); 52 52 bool removePlayer(unsigned int id); 53 53 -
common/MessageProcessor.cpp
ra0ce8a3 rea17281 50 50 51 51 // assume we don't care about the value of socklen 52 cout << "Waiting for message from server" << endl;52 //cout << "Waiting for message from server" << endl; 53 53 int ret = recvfrom(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)source, &socklen); 54 cout << "Returned from wait" << endl;54 //cout << "Returned from wait" << endl; 55 55 56 56 if (ret == -1)
Note:
See TracChangeset
for help on using the changeset viewer.