Changeset 8423 for code/trunk/src/libraries/core/Game.cc
- Timestamp:
- May 9, 2011, 5:06:49 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/libraries/core/Game.cc
r8351 r8423 78 78 79 79 Game::Game(const std::string& cmdLine) 80 // Destroy factories before the Core!81 : gsFactoryDestroyer_(Game::GameStateFactory::getFactories(), &std::map<std::string, shared_ptr<GameStateFactory> >::clear)82 {83 this->bAbort_ = false;84 bChangingState_ = false;85 80 : gameClock_(NULL) 81 , core_(NULL) 82 , bChangingState_(false) 83 , bAbort_(false) 84 , destructionHelper_(this) 85 { 86 86 #ifdef ORXONOX_PLATFORM_WINDOWS 87 87 minimumSleepTime_ = 1000/*us*/; … … 103 103 104 104 // Set up a basic clock to keep time 105 this->gameClock_ .reset(new Clock());105 this->gameClock_ = new Clock(); 106 106 107 107 // Create the Core 108 this->core_ .reset(new Core(cmdLine));108 this->core_ = new Core(cmdLine); 109 109 110 110 // Do this after the Core creation! … … 127 127 } 128 128 129 /** 130 @brief 131 All destruction code is handled by scoped_ptrs and SimpleScopeGuards. 132 */ 133 Game::~Game() 129 void Game::destroy() 134 130 { 135 131 // Remove us from the object lists again to avoid problems when destroying them 136 132 this->unregisterObject(); 133 134 assert(loadedStates_.size() <= 1); // Just empty root GameState 135 // Destroy all GameStates (shared_ptrs take care of actual destruction) 136 constructedStates_.clear(); 137 138 GameStateFactory::getFactories().clear(); 139 safeObjectDelete(&core_); 140 safeObjectDelete(&gameClock_); 137 141 } 138 142
Note: See TracChangeset
for help on using the changeset viewer.