- Timestamp:
- Dec 28, 2013, 2:18:05 PM (11 years ago)
- Branches:
- master
- Children:
- 8aed9c0
- Parents:
- 3ff2bd7
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
server/server.cpp
r3ff2bd7 r360c0f1 392 392 } 393 393 394 // tell the new player about all map objects395 // (currently just the flags)396 serverMsg.type = MSG_TYPE_OBJECT;397 vector<WorldMap::Object>* vctObjects = gameMap->getObjects();398 vector<WorldMap::Object>::iterator itObjects;399 cout << "sending items" << endl;400 for (itObjects = vctObjects->begin(); itObjects != vctObjects->end(); itObjects++) {401 itObjects->serialize(serverMsg.buffer);402 cout << "sending item id " << itObjects->id << endl;403 msgProcessor.sendMessage(&serverMsg, &from);404 }405 406 394 // send info about existing games to new player 407 395 map<string, Game*>::iterator itGames; … … 451 439 else 452 440 { 453 if (!p->isDead) {454 WorldMap::ObjectType flagType = WorldMap::OBJECT_NONE;455 if (p->hasBlueFlag)456 flagType = WorldMap::OBJECT_BLUE_FLAG;457 else if (p->hasRedFlag)458 flagType = WorldMap::OBJECT_RED_FLAG;459 460 if (flagType != WorldMap::OBJECT_NONE) {461 addObjectToMap(flagType, p->pos.x, p->pos.y, gameMap, mapPlayers, msgProcessor);462 }463 }464 465 441 // broadcast to all players before deleting p from the map 466 442 serverMsg.type = MSG_TYPE_LOGOUT; … … 714 690 p->currentGame = NULL; 715 691 692 // check if the player that's leaving needs to receive the 693 // LEAVE_GAME message and run thie logic below to make the player 694 // drop any flag he's carrying 695 696 /* 697 if (!p->isDead) { 698 WorldMap::ObjectType flagType = WorldMap::OBJECT_NONE; 699 if (p->hasBlueFlag) 700 flagType = WorldMap::OBJECT_BLUE_FLAG; 701 else if (p->hasRedFlag) 702 flagType = WorldMap::OBJECT_RED_FLAG; 703 704 if (flagType != WorldMap::OBJECT_NONE) { 705 addObjectToMap(flagType, p->pos.x, p->pos.y, gameMap, mapPlayers, msgProcessor); 706 } 707 } 708 */ 709 716 710 serverMsg.type = MSG_TYPE_LEAVE_GAME; 717 711 memcpy(serverMsg.buffer, &p->id, 4);
Note:
See TracChangeset
for help on using the changeset viewer.