[Orxonox-commit 1147] r5868 - in code/branches/core5: cmake src/libraries/core
rgrieder at orxonox.net
rgrieder at orxonox.net
Sun Oct 4 00:03:14 CEST 2009
Author: rgrieder
Date: 2009-10-04 00:03:14 +0200 (Sun, 04 Oct 2009)
New Revision: 5868
Modified:
code/branches/core5/cmake/PrecompiledHeaderFiles.cmake
code/branches/core5/src/libraries/core/Game.cc
code/branches/core5/src/libraries/core/Game.h
Log:
Fixed a possible issue in Game and a build system bug with PCH.
Modified: code/branches/core5/cmake/PrecompiledHeaderFiles.cmake
===================================================================
--- code/branches/core5/cmake/PrecompiledHeaderFiles.cmake 2009-10-03 22:02:28 UTC (rev 5867)
+++ code/branches/core5/cmake/PrecompiledHeaderFiles.cmake 2009-10-03 22:03:14 UTC (rev 5868)
@@ -109,7 +109,7 @@
# This is just the best possible opportunity to address this dependency issue
GET_GCC_COMPILER_FLAGS(${_target_name} _pch_gcc_flags)
# Make sure we recompile the pch file even if only the flags change
- IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}")
+ IF(NOT "${_pch_gcc_flags}" STREQUAL "${_INTERNAL_${_target_name}_PCH_GCC_FLAGS}" OR NOT EXISTS "${_pch_dep_helper_file}")
SET(_INTERNAL_${_target_name}_PCH_GCC_FLAGS "${_pch_gcc_flags}" CACHE INTERNAL "")
FILE(WRITE ${_pch_dep_helper_file} "/* ${_pch_gcc_flags} */")
ENDIF()
Modified: code/branches/core5/src/libraries/core/Game.cc
===================================================================
--- code/branches/core5/src/libraries/core/Game.cc 2009-10-03 22:02:28 UTC (rev 5867)
+++ code/branches/core5/src/libraries/core/Game.cc 2009-10-03 22:03:14 UTC (rev 5868)
@@ -116,7 +116,7 @@
*/
Game::Game(const std::string& cmdLine)
// Destroy factories before the Core!
- : gsFactoryDestroyer_(Game::GameStateFactory::factories_s, &std::map<std::string, shared_ptr<GameStateFactory> >::clear)
+ : gsFactoryDestroyer_(Game::GameStateFactory::getFactories(), &std::map<std::string, shared_ptr<GameStateFactory> >::clear)
{
this->bAbort_ = false;
bChangingState_ = false;
@@ -623,12 +623,16 @@
this->bChangingState_ = false;
}
- std::map<std::string, shared_ptr<Game::GameStateFactory> > Game::GameStateFactory::factories_s;
+ /*static*/ std::map<std::string, shared_ptr<Game::GameStateFactory> >& Game::GameStateFactory::getFactories()
+ {
+ static std::map<std::string, shared_ptr<GameStateFactory> > factories;
+ return factories;
+ }
/*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info)
{
- std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = factories_s.find(info.className);
- assert(it != factories_s.end());
+ std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = getFactories().find(info.className);
+ assert(it != getFactories().end());
return it->second->fabricateInternal(info);
}
}
Modified: code/branches/core5/src/libraries/core/Game.h
===================================================================
--- code/branches/core5/src/libraries/core/Game.h 2009-10-03 22:02:28 UTC (rev 5867)
+++ code/branches/core5/src/libraries/core/Game.h 2009-10-03 22:03:14 UTC (rev 5868)
@@ -116,10 +116,10 @@
static shared_ptr<GameState> fabricate(const GameStateInfo& info);
template <class T>
static void createFactory(const std::string& className)
- { factories_s[className].reset(new TemplateGameStateFactory<T>()); }
+ { getFactories()[className].reset(new TemplateGameStateFactory<T>()); }
virtual shared_ptr<GameState> fabricateInternal(const GameStateInfo& info) = 0;
- static std::map<std::string, shared_ptr<GameStateFactory> > factories_s;
+ static std::map<std::string, shared_ptr<GameStateFactory> >& getFactories();
};
template <class T>
class TemplateGameStateFactory : public GameStateFactory
More information about the Orxonox-commit
mailing list