Changeset bcfd99a in network-game for server


Ignore:
Timestamp:
Dec 28, 2013, 4:08:34 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
2e63b64
Parents:
8aed9c0
Message:

When a player leaves a game, any flag they were carrying is dropped

File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/server.cpp

    r8aed9c0 rbcfd99a  
    688688         }else {
    689689            cout << "Game name: " << g->getName() << endl;
    690             p->currentGame = NULL;
    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             /*
     690
    697691            if (!p->isDead) {
    698692               WorldMap::ObjectType flagType = WorldMap::OBJECT_NONE;
     
    703697
    704698               if (flagType != WorldMap::OBJECT_NONE) {
    705                   addObjectToMap(flagType, p->pos.x, p->pos.y, gameMap, mapPlayers, msgProcessor);
     699                  addObjectToMap(flagType, p->pos.x, p->pos.y, g->getMap(), g->getPlayers(), msgProcessor);
    706700               }
    707701            }
    708             */
     702
     703            p->currentGame = NULL;
     704            g->removePlayer(p->id);
    709705
    710706            serverMsg.type = MSG_TYPE_LEAVE_GAME;
     
    712708            strcpy(serverMsg.buffer+4, g->getName().c_str());
    713709            broadcastMessage(msgProcessor, serverMsg, g->getPlayers());
    714 
    715             g->removePlayer(p->id);
    716710
    717711            int numPlayers = g->getNumPlayers();
Note: See TracChangeset for help on using the changeset viewer.