Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Aug 12, 2009, 5:06:34 PM (15 years ago)
Author:
landauf
Message:

Applied retos patch for Game.cc and Game.h (thanks)

+2 small changes in Core.cc and GSClient.cc

Location:
code/branches/libraries/src/core
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/branches/libraries/src/core/Core.cc

    r5628 r5637  
    299299                        boost::filesystem::path librarypath = searchpath / library;
    300300
    301                         this->dynLibManager_->load(librarypath.string());
     301                        DynLibManager::getInstance().load(librarypath.string());
    302302                    }
    303303                }
  • code/branches/libraries/src/core/Game.cc

    r3370 r5637  
    113113    */
    114114    Game::Game(const std::string& cmdLine)
     115        // Destroy factories before the Core!
     116        : gsFactoryDestroyer_(Game::GameStateFactory::factories_s, &std::map<std::string, shared_ptr<GameStateFactory> >::clear)
    115117    {
    116118        this->bAbort_ = false;
  • code/branches/libraries/src/core/Game.h

    r3370 r5637  
    4848
    4949#include "util/Debug.h"
     50#include "util/ScopeGuard.h"
    5051#include "util/Singleton.h"
    5152
     
    8586        typedef std::map<std::string, shared_ptr<GameState> > GameStateMap;
    8687        typedef boost::shared_ptr<GameStateTreeNode> GameStateTreeNodePtr;
     88
    8789    public:
    8890        Game(const std::string& cmdLine);
     
    118120            static void createFactory(const std::string& className)
    119121                { factories_s[className].reset(new TemplateGameStateFactory<T>()); }
    120         private:
     122
    121123            virtual shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;
    122124            static std::map<std::string, shared_ptr<GameStateFactory> > factories_s;
     
    129131                { return shared_ptr<GameState>(new T(info)); }
    130132        };
     133        // For the factory destruction
     134        typedef Loki::ObjScopeGuardImpl0<std::map<std::string, shared_ptr<GameStateFactory> >, void (std::map<std::string, shared_ptr<GameStateFactory> >::*)()> ObjScopeGuard;
    131135
    132136        struct StatisticsTickInfo
     
    156160        scoped_ptr<Clock>                  gameClock_;
    157161        scoped_ptr<Core>                   core_;
     162        ObjScopeGuard                      gsFactoryDestroyer_;
    158163        scoped_ptr<GameConfiguration>      configuration_;
    159164
Note: See TracChangeset for help on using the changeset viewer.