Changeset 5868
- Timestamp:
- Oct 4, 2009, 12:03:14 AM (15 years ago)
- Location:
- code/branches/core5
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/cmake/PrecompiledHeaderFiles.cmake
r3251 r5868 110 110 GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags) 111 111 # Make sure we recompile the pch file even if only the flags change 112 IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" )112 IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}") 113 113 SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "") 114 114 FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */") -
code/branches/core5/src/libraries/core/Game.cc
r5855 r5868 117 117 Game::Game(const std::string& cmdLine) 118 118 // Destroy factories before the Core! 119 : gsFactoryDestroyer_(Game::GameStateFactory:: factories_s, &std::map<std::string, shared_ptr<GameStateFactory> >::clear)119 : gsFactoryDestroyer_(Game::GameStateFactory::getFactories(), &std::map<std::string, shared_ptr<GameStateFactory> >::clear) 120 120 { 121 121 this->bAbort_ = false; … … 624 624 } 625 625 626 std::map<std::string, shared_ptr<Game::GameStateFactory> > Game::GameStateFactory::factories_s; 626 /*static*/ std::map<std::string, shared_ptr<Game::GameStateFactory> >& Game::GameStateFactory::getFactories() 627 { 628 static std::map<std::string, shared_ptr<GameStateFactory> > factories; 629 return factories; 630 } 627 631 628 632 /*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info) 629 633 { 630 std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = factories_s.find(info.className);631 assert(it != factories_s.end());634 std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = getFactories().find(info.className); 635 assert(it != getFactories().end()); 632 636 return it->second->fabricateInternal(info); 633 637 } -
code/branches/core5/src/libraries/core/Game.h
r5843 r5868 117 117 template <class T> 118 118 static void createFactory(const std::string& className) 119 { factories_s[className].reset(new TemplateGameStateFactory<T>()); }119 { getFactories()[className].reset(new TemplateGameStateFactory<T>()); } 120 120 121 121 virtual shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0; 122 static std::map<std::string, shared_ptr<GameStateFactory> > factories_s;122 static std::map<std::string, shared_ptr<GameStateFactory> >& getFactories(); 123 123 }; 124 124 template <class T>
Note: See TracChangeset
for help on using the changeset viewer.