Changeset 360c0f1 in network-game for server


Ignore:
Timestamp:
Dec 28, 2013, 2:18:05 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
8aed9c0
Parents:
3ff2bd7
Message:

Server no longer sends OBJECT messages on player login or runs the drop flag logic on player logout

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r3ff2bd7 r360c0f1  
    392392            }
    393393
    394             // tell the new player about all map objects
    395             // (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 
    406394            // send info about existing games to new player
    407395            map<string, Game*>::iterator itGames;
     
    451439         else
    452440         {
    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 
    465441            // broadcast to all players before deleting p from the map
    466442            serverMsg.type = MSG_TYPE_LOGOUT;
     
    714690            p->currentGame = NULL;
    715691
     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
    716710            serverMsg.type = MSG_TYPE_LEAVE_GAME;
    717711            memcpy(serverMsg.buffer, &p->id, 4);
Note: See TracChangeset for help on using the changeset viewer.