Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 27, 2009, 11:13:25 AM (15 years ago)
Author:
rgrieder
Message:

GameStates requiring graphics (Level is not one of them because it uses showsGraphics() to distinguish) are now only constructed when basic graphic support is given (GraphicsManager, InputManager and GUIManager loaded).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/resource/src/core/GameState.cc

    r3355 r3356  
    4848    GameState::GameState(const GameStateInfo& info)
    4949        : info_(info)
    50         , parent_(0)
    5150    {
    5251        this->activity_.activating   = false;
     
    7069    {
    7170        return info_.stateName;
    72     }
    73 
    74     /**
    75     @brief
    76         Adds a child to the current tree. The Child can contain children of its own.
    77         But you cannot a state tree that already has an active state.
    78     @param state
    79         The state to be added.
    80     */
    81     void GameState::addChild(GameState* state)
    82     {
    83         assert(state != NULL);
    84 
    85         std::map<std::string, GameState*>::const_iterator it = this->children_.find(state->getName());
    86         if (it == this->children_.end())
    87         {
    88             this->children_[state->getName()] = state;
    89             // mark us as parent
    90             state->setParent(this);
    91         }
    92         else
    93         {
    94             ThrowException(GameState, "Cannot add two children with the same name");
    95         }
    96     }
    97 
    98     /**
    99     @brief
    100         Removes a child by instance. This splits the tree in two parts,
    101         each of them functional on its own.
    102     @param state
    103         GameState by instance pointer
    104     */
    105     void GameState::removeChild(GameState* state)
    106     {
    107         assert(state != NULL);
    108 
    109         std::map<std::string, GameState*>::iterator it = this->children_.find(state->getName());
    110         if (it != this->children_.end())
    111             this->children_.erase(it);
    112         else
    113         {
    114             ThrowException(GameState, "Game state '" + this->getName() + "' doesn't have a child named '"
    115                 + state->getName() + "'.");
    116         }
    11771    }
    11872
Note: See TracChangeset for help on using the changeset viewer.