Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Sep 28, 2009, 2:55:47 AM (15 years ago)
Author:
landauf
Message:

Changes in ClientConnectionListener:

  • Added static functions for connect/disconnect which notify all instances
  • getConnectedClients() also returned client "0" which is the ID of the server. This is important for the PlayerManager, but other classes (like for example TrafficControl) don't use getConnectedClients(), so I assumed I can safely remove this line. The 0-client gets now connected and disconnected in GSLevel (which also creates and destroys the PlayerManager). If the 0-client is also needed by other classes, I suggest moving it into the network.

The instance of HumanPlayer is now deleted if GSLevel gets deactivated. This also destroys the default HUD.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/core5/src/modules/gamestates/GSLevel.cc

    r5818 r5820  
    129129            // level is loaded: we can start capturing the input
    130130            InputManager::getInstance().enterState("game");
     131           
     132            // connect the HumanPlayer to the game
     133            this->playerManager_->clientConnected(0);
    131134        }
    132135    }
     
    177180
    178181        if (GameMode::showsGraphics())
     182        {
     183            // disconnect the HumanPlayer
     184            this->playerManager_->clientDisconnected(0);
     185           
    179186            InputManager::getInstance().leaveState("game");
     187        }
    180188
    181189        if (GameMode::isMaster())
     
    234242    void GSLevel::unloadLevel()
    235243    {
    236         for (ObjectList<HumanPlayer>::iterator it = ObjectList<HumanPlayer>::begin(); it; ++it)
    237             it->setGametype(0);
    238        
    239244        Loader::unload(startFile_s);
    240245
Note: See TracChangeset for help on using the changeset viewer.