Changeset 6038 for sandbox/src
- Timestamp:
- Nov 5, 2009, 9:22:22 PM (15 years ago)
- Location:
- sandbox
- Files:
-
- 7 deleted
- 30 edited
- 6 copied
Legend:
- Unmodified
- Added
- Removed
-
sandbox
- Property svn:mergeinfo changed
-
sandbox/src/Orxonox.cc
r5752 r6038 63 63 for (int i = 1; i < argc; ++i) 64 64 strCmdLine += argv[i] + std::string(" "); 65 #endif 65 66 66 67 return orxonox::main(strCmdLine); 67 #endif68 68 } 69 69 catch (...) -
sandbox/src/OrxonoxConfig.cmake
r5695 r6038 38 38 OPTION(PCH_ENABLE "Global PCH switch" TRUE) 39 39 ENDIF() 40 41 # Global switch to disable multiple file compilations 42 OPTION(DISABLE_COMPILATIONS "Global multi-file compilation switch" FALSE) 40 43 41 44 # Use WinMain() or main()? -
sandbox/src/external/tolua/CMakeLists.txt
r5738 r6038 20 20 ################### Tolua++ library ################### 21 21 22 SET (TOLUA++_FILES22 SET_SOURCE_FILES(TOLUA++_FILES 23 23 tolua_event.h 24 24 tolua++.h 25 25 COMPILATION_BEGIN ToluaCompilation.c 26 26 tolua_event.c 27 27 tolua_is.c … … 29 29 tolua_push.c 30 30 tolua_to.c 31 COMPILATION_END 31 32 ) 32 GENERATE_SOURCE_GROUPS(${TOLUA++_FILES})33 34 # No warnings needed from third party libraries35 REMOVE_COMPILER_FLAGS("-W3 -W4" MSVC)36 ADD_COMPILER_FLAGS("-w")37 33 38 34 ORXONOX_ADD_LIBRARY(tolua++_orxonox -
sandbox/src/libraries/CMakeLists.txt
r5782 r6038 25 25 ################ Sub Directories ################ 26 26 27 ADD_SUBDIRECTORY(util) 27 28 ADD_SUBDIRECTORY(core) 28 ADD_SUBDIRECTORY(util) -
sandbox/src/libraries/core/CMakeLists.txt
r5782 r6038 19 19 20 20 SET_SOURCE_FILES(CORE_SRC_FILES 21 Clock.cc22 ConfigFileManager.cc23 21 ConfigValueContainer.cc 24 22 Core.cc … … 33 31 34 32 # command 35 CommandLine .cc33 CommandLineParser.cc 36 34 Executor.cc 37 35 38 36 # hierarchy 39 Factory.cc40 37 Identifier.cc 41 38 MetaObjectList.cc … … 43 40 # level 44 41 BaseObject.cc 42 43 COMPILATION_BEGIN FilesystemCompilation.cc 44 ConfigFileManager.cc 45 PathConfig.cc 46 COMPILATION_END 45 47 46 48 # multithreading -
sandbox/src/libraries/core/ClassFactory.h
r5782 r6038 42 42 43 43 #include "util/Debug.h" 44 #include "Factory.h"45 44 #include "Identifier.h" 46 45 47 46 namespace orxonox 48 47 { 48 // ########################### 49 // ### Factory ### 50 // ########################### 51 //! Base-class of ClassFactory. 52 class _CoreExport Factory 53 { 54 public: 55 virtual ~Factory() {}; 56 virtual BaseObject* fabricate(BaseObject* creator) = 0; 57 }; 58 49 59 // ############################### 50 60 // ### ClassFactory ### … … 52 62 //! The ClassFactory is able to create new objects of a specific class. 53 63 template <class T> 54 class ClassFactory : public BaseFactory64 class ClassFactory : public Factory 55 65 { 56 66 public: 57 static bool create(const std::string& name); 58 BaseObject* fabricate(BaseObject* creator); 67 /** 68 @brief Constructor: Adds the ClassFactory to the Identifier of the same type. 69 @param name The name of the class 70 @param bLoadable True if the class can be loaded through XML 71 */ 72 ClassFactory(const std::string& name, bool bLoadable = true) 73 { 74 COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl; 75 ClassIdentifier<T>::getIdentifier(name)->addFactory(this); 76 } 59 77 60 private: 61 ClassFactory() {} // Don't create 62 ClassFactory(const ClassFactory& factory) {} // Don't copy 63 virtual ~ClassFactory() {} // Don't delete 64 65 static T* createNewObject(BaseObject* creator); 78 /** 79 @brief Creates and returns a new object of class T. 80 @return The new object 81 */ 82 inline BaseObject* fabricate(BaseObject* creator) 83 { 84 return static_cast<BaseObject*>(new T(creator)); 85 } 66 86 }; 67 68 /**69 @brief Adds the ClassFactory to the Identifier of the same type and the Identifier to the Factory.70 @param name The name of the class71 @param bLoadable True if the class can be loaded through XML72 @return Always true (this is needed because the compiler only allows assignments before main())73 */74 template <class T>75 bool ClassFactory<T>::create(const std::string& name)76 {77 COUT(4) << "*** ClassFactory: Create entry for " << name << " in Factory." << std::endl;78 ClassIdentifier<T>::getIdentifier(name)->addFactory(new ClassFactory<T>);79 Factory::add(name, ClassIdentifier<T>::getIdentifier());80 81 return true;82 }83 84 /**85 @brief Creates and returns a new object of class T.86 @return The new object87 */88 template <class T>89 inline BaseObject* ClassFactory<T>::fabricate(BaseObject* creator)90 {91 return ClassFactory<T>::createNewObject(creator);92 }93 94 /**95 @brief Creates and returns a new object of class T; this is a wrapper for the new operator.96 @return The new object97 */98 template <class T>99 inline T* ClassFactory<T>::createNewObject(BaseObject* creator)100 {101 return new T(creator);102 }103 87 } 104 88 -
sandbox/src/libraries/core/ConfigFileManager.cc
r5782 r6038 35 35 #include "util/StringUtils.h" 36 36 #include "ConfigValueContainer.h" 37 #include " Core.h"37 #include "PathConfig.h" 38 38 39 39 namespace orxonox … … 41 41 bool config(const std::string& classname, const std::string& varname, const std::string& value) 42 42 { 43 std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercase IdentifierMap().find(getLowercase(classname));44 if (identifier != Identifier::getLowercase IdentifierMapEnd())43 std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseStringIdentifierMap().find(getLowercase(classname)); 44 if (identifier != Identifier::getLowercaseStringIdentifierMapEnd()) 45 45 { 46 46 std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname)); … … 53 53 bool tconfig(const std::string& classname, const std::string& varname, const std::string& value) 54 54 { 55 std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercase IdentifierMap().find(getLowercase(classname));56 if (identifier != Identifier::getLowercase IdentifierMapEnd())55 std::map<std::string, Identifier*>::const_iterator identifier = Identifier::getLowercaseStringIdentifierMap().find(getLowercase(classname)); 56 if (identifier != Identifier::getLowercaseStringIdentifierMapEnd()) 57 57 { 58 58 std::map<std::string, ConfigValueContainer*>::const_iterator variable = (*identifier).second->getLowercaseConfigValueMap().find(getLowercase(varname)); … … 215 215 216 216 // Get default file if necessary and available 217 boost::filesystem::path filepath( Core::getConfigPath() / this->filename_);217 boost::filesystem::path filepath(PathConfig::getConfigPath() / this->filename_); 218 218 if (!boost::filesystem::exists(filepath)) 219 219 { 220 220 // Try to get default one from the data folder 221 boost::filesystem::path defaultFilepath( Core::getDataPath() / "defaultConfig" / this->filename_);221 boost::filesystem::path defaultFilepath(PathConfig::getDataPath() / "defaultConfig" / this->filename_); 222 222 if (boost::filesystem::exists(defaultFilepath)) 223 223 { … … 329 329 { 330 330 std::ofstream file; 331 file.open(( Core::getConfigPathString() + filename_).c_str(), std::fstream::out);331 file.open((PathConfig::getConfigPathString() + filename_).c_str(), std::fstream::out); 332 332 file.setf(std::ios::fixed, std::ios::floatfield); 333 333 file.precision(6); … … 369 369 for (std::list<ConfigFileSection*>::iterator it1 = this->sections_.begin(); it1 != this->sections_.end(); ) 370 370 { 371 std::map<std::string, Identifier*>::const_iterator it2 = Identifier::get IdentifierMap().find((*it1)->getName());372 if (it2 != Identifier::get IdentifierMapEnd() && (*it2).second->hasConfigValues())371 std::map<std::string, Identifier*>::const_iterator it2 = Identifier::getStringIdentifierMap().find((*it1)->getName()); 372 if (it2 != Identifier::getStringIdentifierMapEnd() && (*it2).second->hasConfigValues()) 373 373 { 374 374 // The section exists, delete comment … … 448 448 if (this->type_ == ConfigFileType::Settings) 449 449 { 450 for (std::map<std::string, Identifier*>::const_iterator it = Identifier::get IdentifierMapBegin(); it != Identifier::getIdentifierMapEnd(); ++it)450 for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapBegin(); it != Identifier::getStringIdentifierMapEnd(); ++it) 451 451 { 452 452 if (it->second->hasConfigValues()) -
sandbox/src/libraries/core/Core.cc
r5782 r6038 37 37 38 38 #include <cassert> 39 #include <fstream> 40 #include <cstdlib> 41 #include <cstdio> 42 #include <boost/version.hpp> 43 #include <boost/filesystem.hpp> 39 #include <vector> 44 40 45 41 #ifdef ORXONOX_PLATFORM_WINDOWS … … 50 46 # undef min 51 47 # undef max 52 #elif defined(ORXONOX_PLATFORM_APPLE) 53 # include <sys/param.h> 54 # include <mach-o/dyld.h> 55 #else /* Linux */ 56 # include <sys/types.h> 57 # include <unistd.h> 58 #endif 59 60 #include "SpecialConfig.h" 48 #endif 49 50 #include "util/Clock.h" 61 51 #include "util/Debug.h" 62 52 #include "util/Exception.h" 63 53 #include "util/SignalHandler.h" 64 #include " Clock.h"65 #include "CommandLine .h"54 #include "PathConfig.h" 55 #include "CommandLineParser.h" 66 56 #include "ConfigFileManager.h" 67 57 #include "ConfigValueIncludes.h" 68 58 #include "CoreIncludes.h" 69 59 #include "DynLibManager.h" 70 #include "Factory.h"71 60 #include "Identifier.h" 72 61 #include "Language.h" 73 62 #include "LuaState.h" 74 75 // Boost 1.36 has some issues with deprecated functions that have been omitted76 #if (BOOST_VERSION == 103600)77 # define BOOST_LEAF_FUNCTION filename78 #else79 # define BOOST_LEAF_FUNCTION leaf80 #endif81 63 82 64 namespace orxonox … … 85 67 Core* Core::singletonPtr_s = 0; 86 68 87 SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");88 SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files");89 69 SetCommandLineArgument(settingsFile, "orxonox.ini").information("THE configuration file"); 90 70 #ifdef ORXONOX_PLATFORM_WINDOWS … … 195 175 std::string language_; //!< The language 196 176 bool bInitializeRandomNumberGenerator_; //!< If true, srand(time(0)) is called 197 198 //! Path to the parent directory of the ones above if program was installed with relativ pahts199 boost::filesystem::path rootPath_;200 boost::filesystem::path executablePath_; //!< Path to the executable201 boost::filesystem::path modulePath_; //!< Path to the modules202 boost::filesystem::path dataPath_; //!< Path to the data file folder203 boost::filesystem::path configPath_; //!< Path to the config file folder204 boost::filesystem::path logPath_; //!< Path to the log file folder205 177 }; 206 178 … … 210 182 : identifierDestroyer_(Identifier::destroyAllIdentifiers) 211 183 , configuration_(new CoreConfiguration()) // Don't yet create config values! 212 , bDevRun_(false)213 184 { 214 185 // Set the hard coded fixed paths 215 this-> setFixedPaths();186 this->pathConfig_.reset(new PathConfig()); 216 187 217 188 // Create a new dynamic library manager … … 219 190 220 191 // Load modules 221 try 222 { 223 // We search for helper files with the following extension 224 std::string moduleextension = specialConfig::moduleExtension; 225 size_t moduleextensionlength = moduleextension.size(); 226 227 // Search in the directory of our executable 228 boost::filesystem::path searchpath = this->configuration_->modulePath_; 229 230 // Add that path to the PATH variable in case a module depends on another one 231 std::string pathVariable = getenv("PATH"); 232 putenv(const_cast<char*>(("PATH=" + pathVariable + ";" + configuration_->modulePath_.string()).c_str())); 233 234 boost::filesystem::directory_iterator file(searchpath); 235 boost::filesystem::directory_iterator end; 236 237 // Iterate through all files 238 while (file != end) 192 const std::vector<std::string>& modulePaths = this->pathConfig_->getModulePaths(); 193 for (std::vector<std::string>::const_iterator it = modulePaths.begin(); it != modulePaths.end(); ++it) 194 { 195 try 239 196 { 240 std::string filename = file->BOOST_LEAF_FUNCTION(); 241 242 // Check if the file ends with the exension in question 243 if (filename.size() > moduleextensionlength) 244 { 245 if (filename.substr(filename.size() - moduleextensionlength) == moduleextension) 246 { 247 // We've found a helper file - now load the library with the same name 248 std::string library = filename.substr(0, filename.size() - moduleextensionlength); 249 boost::filesystem::path librarypath = searchpath / library; 250 251 try 252 { 253 DynLibManager::getInstance().load(librarypath.string()); 254 } 255 catch (...) 256 { 257 COUT(1) << "Couldn't load module \"" << librarypath.string() << "\": " << Exception::handleMessage() << std::endl; 258 } 259 } 260 } 261 262 ++file; 197 this->dynLibManager_->load(*it); 263 198 } 264 }265 catch (...)266 {267 COUT(1) << "An error occurred while loading modules: " << Exception::handleMessage() << std::endl;199 catch (...) 200 { 201 COUT(1) << "Couldn't load module \"" << *it << "\": " << Exception::handleMessage() << std::endl; 202 } 268 203 } 269 204 270 205 // Parse command line arguments AFTER the modules have been loaded (static code!) 271 CommandLine ::parseCommandLine(cmdLine);206 CommandLineParser::parseCommandLine(cmdLine); 272 207 273 208 // Set configurable paths like log, config and media 274 this-> setConfigurablePaths();209 this->pathConfig_->setConfigurablePaths(); 275 210 276 211 // create a signal handler (only active for linux) 277 212 // This call is placed as soon as possible, but after the directories are set 278 213 this->signalHandler_.reset(new SignalHandler()); 279 this->signalHandler_->doCatch( configuration_->executablePath_.string(), Core::getLogPathString() + "orxonox_crash.log");214 this->signalHandler_->doCatch(PathConfig::getExecutablePathString(), PathConfig::getLogPathString() + "orxonox_crash.log"); 280 215 281 216 // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used 282 OutputHandler::getOutStream().setLogPath( Core::getLogPathString());217 OutputHandler::getOutStream().setLogPath(PathConfig::getLogPathString()); 283 218 284 219 // Parse additional options file now that we know its path 285 CommandLine ::parseFile();220 CommandLineParser::parseFile(); 286 221 287 222 #ifdef ORXONOX_PLATFORM_WINDOWS … … 289 224 // do this after ogre has initialised. Somehow Ogre changes the settings again (not through 290 225 // the timer though). 291 int limitToCPU = CommandLine ::getValue("limitToCPU");226 int limitToCPU = CommandLineParser::getValue("limitToCPU"); 292 227 if (limitToCPU > 0) 293 228 setThreadAffinity(static_cast<unsigned int>(limitToCPU)); … … 297 232 this->configFileManager_.reset(new ConfigFileManager()); 298 233 this->configFileManager_->setFilename(ConfigFileType::Settings, 299 CommandLine ::getValue("settingsFile").getString());234 CommandLineParser::getValue("settingsFile").getString()); 300 235 301 236 // Required as well for the config values … … 303 238 304 239 // creates the class hierarchy for all classes with factories 305 Factory::createClassHierarchy();240 Identifier::createClassHierarchy(); 306 241 307 242 // Do this soon after the ConfigFileManager has been created to open up the … … 376 311 } 377 312 378 /*static*/ const boost::filesystem::path& Core::getDataPath()379 {380 return getInstance().configuration_->dataPath_;381 }382 /*static*/ std::string Core::getDataPathString()383 {384 return getInstance().configuration_->dataPath_.string() + '/';385 }386 387 /*static*/ const boost::filesystem::path& Core::getConfigPath()388 {389 return getInstance().configuration_->configPath_;390 }391 /*static*/ std::string Core::getConfigPathString()392 {393 return getInstance().configuration_->configPath_.string() + '/';394 }395 396 /*static*/ const boost::filesystem::path& Core::getLogPath()397 {398 return getInstance().configuration_->logPath_;399 }400 /*static*/ std::string Core::getLogPathString()401 {402 return getInstance().configuration_->logPath_.string() + '/';403 }404 405 /*static*/ const boost::filesystem::path& Core::getRootPath()406 {407 return getInstance().configuration_->rootPath_;408 }409 /*static*/ std::string Core::getRootPathString()410 {411 return getInstance().configuration_->rootPath_.string() + '/';412 }413 414 313 /** 415 314 @note … … 458 357 } 459 358 460 /**461 @brief462 Retrievs the executable path and sets all hard coded fixed path (currently only the module path)463 Also checks for "orxonox_dev_build.keep_me" in the executable diretory.464 If found it means that this is not an installed run, hence we465 don't write the logs and config files to ~/.orxonox466 @throw467 GeneralException468 */469 void Core::setFixedPaths()470 {471 //////////////////////////472 // FIND EXECUTABLE PATH //473 //////////////////////////474 475 #ifdef ORXONOX_PLATFORM_WINDOWS476 // get executable module477 TCHAR buffer[1024];478 if (GetModuleFileName(NULL, buffer, 1024) == 0)479 ThrowException(General, "Could not retrieve executable path.");480 481 #elif defined(ORXONOX_PLATFORM_APPLE)482 char buffer[1024];483 unsigned long path_len = 1023;484 if (_NSGetExecutablePath(buffer, &path_len))485 ThrowException(General, "Could not retrieve executable path.");486 487 #else /* Linux */488 /* written by Nicolai Haehnle <prefect_@gmx.net> */489 490 /* Get our PID and build the name of the link in /proc */491 char linkname[64]; /* /proc/<pid>/exe */492 if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0)493 {494 /* This should only happen on large word systems. I'm not sure495 what the proper response is here.496 Since it really is an assert-like condition, aborting the497 program seems to be in order. */498 assert(false);499 }500 501 /* Now read the symbolic link */502 char buffer[1024];503 int ret;504 ret = readlink(linkname, buffer, 1024);505 /* In case of an error, leave the handling up to the caller */506 if (ret == -1)507 ThrowException(General, "Could not retrieve executable path.");508 509 /* Ensure proper NUL termination */510 buffer[ret] = 0;511 #endif512 513 configuration_->executablePath_ = boost::filesystem::path(buffer);514 #ifndef ORXONOX_PLATFORM_APPLE515 configuration_->executablePath_ = configuration_->executablePath_.branch_path(); // remove executable name516 #endif517 518 /////////////////////519 // SET MODULE PATH //520 /////////////////////521 522 if (boost::filesystem::exists(configuration_->executablePath_ / "orxonox_dev_build.keep_me"))523 {524 COUT(1) << "Running from the build tree." << std::endl;525 Core::bDevRun_ = true;526 configuration_->modulePath_ = specialConfig::moduleDevDirectory;527 }528 else529 {530 531 #ifdef INSTALL_COPYABLE // --> relative paths532 533 // Also set the root path534 boost::filesystem::path relativeExecutablePath(specialConfig::defaultRuntimePath);535 configuration_->rootPath_ = configuration_->executablePath_;536 while (!boost::filesystem::equivalent(configuration_->rootPath_ / relativeExecutablePath, configuration_->executablePath_)537 && !configuration_->rootPath_.empty())538 configuration_->rootPath_ = configuration_->rootPath_.branch_path();539 if (configuration_->rootPath_.empty())540 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?");541 542 // Module path is fixed as well543 configuration_->modulePath_ = configuration_->rootPath_ / specialConfig::defaultModulePath;544 545 #else546 547 // There is no root path, so don't set it at all548 // Module path is fixed as well549 configuration_->modulePath_ = specialConfig::moduleInstallDirectory;550 551 #endif552 }553 }554 555 /**556 @brief557 Sets config, log and media path and creates folders if necessary.558 @throws559 GeneralException560 */561 void Core::setConfigurablePaths()562 {563 if (Core::isDevelopmentRun())564 {565 configuration_->dataPath_ = specialConfig::dataDevDirectory;566 configuration_->configPath_ = specialConfig::configDevDirectory;567 configuration_->logPath_ = specialConfig::logDevDirectory;568 }569 else570 {571 572 #ifdef INSTALL_COPYABLE // --> relative paths573 574 // Using paths relative to the install prefix, complete them575 configuration_->dataPath_ = configuration_->rootPath_ / specialConfig::defaultDataPath;576 configuration_->configPath_ = configuration_->rootPath_ / specialConfig::defaultConfigPath;577 configuration_->logPath_ = configuration_->rootPath_ / specialConfig::defaultLogPath;578 579 #else580 581 configuration_->dataPath_ = specialConfig::dataInstallDirectory;582 583 // Get user directory584 # ifdef ORXONOX_PLATFORM_UNIX /* Apple? */585 char* userDataPathPtr(getenv("HOME"));586 # else587 char* userDataPathPtr(getenv("APPDATA"));588 # endif589 if (userDataPathPtr == NULL)590 ThrowException(General, "Could not retrieve user data path.");591 boost::filesystem::path userDataPath(userDataPathPtr);592 userDataPath /= ".orxonox";593 594 configuration_->configPath_ = userDataPath / specialConfig::defaultConfigPath;595 configuration_->logPath_ = userDataPath / specialConfig::defaultLogPath;596 597 #endif598 599 }600 601 // Option to put all the config and log files in a separate folder602 if (!CommandLine::getArgument("writingPathSuffix")->hasDefaultValue())603 {604 std::string directory(CommandLine::getValue("writingPathSuffix").getString());605 configuration_->configPath_ = configuration_->configPath_ / directory;606 configuration_->logPath_ = configuration_->logPath_ / directory;607 }608 609 // Create directories to avoid problems when opening files in non existent folders.610 std::vector<std::pair<boost::filesystem::path, std::string> > directories;611 directories.push_back(std::make_pair(boost::filesystem::path(configuration_->configPath_), "config"));612 directories.push_back(std::make_pair(boost::filesystem::path(configuration_->logPath_), "log"));613 614 for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin();615 it != directories.end(); ++it)616 {617 if (boost::filesystem::exists(it->first) && !boost::filesystem::is_directory(it->first))618 {619 ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \620 Please remove " + it->first.string());621 }622 if (boost::filesystem::create_directories(it->first)) // function may not return true at all (bug?)623 {624 COUT(4) << "Created " << it->second << " directory" << std::endl;625 }626 }627 }628 629 359 void Core::preUpdate(const Clock& time) 630 360 { -
sandbox/src/libraries/core/Core.h
r5782 r6038 28 28 */ 29 29 30 /**31 @file32 @brief33 Declaration of the Core class.34 @details35 The Core class is a singleton, only used to configure some variables36 in the core through the config-file.37 */38 39 30 #ifndef _Core_H__ 40 31 #define _Core_H__ … … 55 46 @brief 56 47 The Core class is a singleton used to configure the program basics. 57 @details58 The class provides information about the data, config and log path.59 It determines those by the use of platform specific functions.60 48 @remark 61 49 You should only create this singleton once because it destroys the identifiers! … … 85 73 static void resetLanguage(); 86 74 87 //! Returns the path to the data files as boost::filesystem::path88 static const boost::filesystem::path& getDataPath();89 //! Returns the path to the config files as boost::filesystem::path90 static const boost::filesystem::path& getConfigPath();91 //! Returns the path to the log files as boost::filesystem::path92 static const boost::filesystem::path& getLogPath();93 //! Returns the path to the root folder as boost::filesystem::path94 static const boost::filesystem::path& getRootPath();95 //! Returns the path to the data files as std::string96 static std::string getDataPathString();97 //! Returns the path to the config files as std::string98 static std::string getConfigPathString();99 //! Returns the path to the log files as std::string100 static std::string getLogPathString();101 //! Returns the path to the root folder as std::string102 static std::string getRootPathString();103 104 static bool isDevelopmentRun() { return getInstance().bDevRun_; }105 106 75 private: 107 76 Core(const Core&); //!< Don't use (undefined symbol) … … 110 79 void postUpdate(const Clock& time); 111 80 112 void setFixedPaths();113 void setConfigurablePaths();114 81 void setThreadAffinity(int limitToCPU); 115 82 116 83 // Mind the order for the destruction! 84 scoped_ptr<PathConfig> pathConfig_; 117 85 scoped_ptr<DynLibManager> dynLibManager_; 118 86 scoped_ptr<SignalHandler> signalHandler_; … … 122 90 scoped_ptr<CoreConfiguration> configuration_; 123 91 124 bool bDevRun_; //!< True for runs in the build directory (not installed)125 126 92 static Core* singletonPtr_s; 127 93 }; -
sandbox/src/libraries/core/CoreIncludes.h
r5782 r6038 29 29 /** 30 30 @file 31 @brief Definition of macros for Identifier and Factory.31 @brief Definition of macros for Identifiers 32 32 33 33 Every class needs the RegisterObject(class) macro in its constructor. If the class is an interface … … 45 45 #include "util/Debug.h" 46 46 #include "Identifier.h" 47 #include "Factory.h"48 47 #include "ClassFactory.h" 49 48 #include "ObjectList.h" … … 76 75 77 76 /** 78 @brief Creates the entry in theFactory.77 @brief Creates the Factory. 79 78 @param ClassName The name of the class 80 79 */ 81 80 #define CreateFactory(ClassName) \ 82 bool bCreated##ClassName##Factory = orxonox::ClassFactory<ClassName>::create(#ClassName)81 Factory* _##ClassName##Factory = new orxonox::ClassFactory<ClassName>(#ClassName) 83 82 84 83 /** … … 93 92 { 94 93 /** 95 @brief Returns the Identifier with a given name through the factory.94 @brief Returns the Identifier with a given name. 96 95 @param String The name of the class 97 96 */ 98 97 inline Identifier* ClassByString(const std::string& name) 99 98 { 100 return Factory::getIdentifier(name);99 return Identifier::getIdentifierByString(name); 101 100 } 102 101 103 102 /** 104 @brief Returns the Identifier with a given network ID through the factory.105 @param networkID The network IDof the class103 @brief Returns the Identifier with a given lowercase name. 104 @param String The lowercase name of the class 106 105 */ 107 inline Identifier* ClassBy ID(uint32_t id)106 inline Identifier* ClassByLowercaseString(const std::string& name) 108 107 { 109 return Factory::getIdentifier(id);108 return Identifier::getIdentifierByLowercaseString(name); 110 109 } 111 110 } -
sandbox/src/libraries/core/CorePrereqs.h
r5738 r6038 28 28 29 29 /** 30 @file 31 @brief Contains all the necessary forward declarations for all classes and structs. 30 @file 31 @brief 32 Shared library macros, enums, constants and forward declarations for the core library 32 33 */ 33 34 … … 40 41 // Shared library settings 41 42 //----------------------------------------------------------------------- 43 42 44 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( CORE_STATIC_BUILD ) 43 45 # ifdef CORE_SHARED_BUILD … … 56 58 #endif 57 59 58 59 //----------------------------------------------------------------------- 60 // Forward declarations 61 //----------------------------------------------------------------------- 60 //----------------------------------------------------------------------- 61 // Constants 62 //----------------------------------------------------------------------- 63 64 namespace orxonox 65 { 66 static const uint32_t OBJECTID_UNKNOWN = static_cast<uint32_t>(-1); 67 } 68 69 //----------------------------------------------------------------------- 70 // Enums 71 //----------------------------------------------------------------------- 72 62 73 namespace orxonox 63 74 { … … 66 77 enum Mode 67 78 { 79 NOP, 68 80 LoadObject, 69 81 SaveObject, 70 82 ExpandObject 71 83 }; 72 84 } 73 85 74 86 namespace KeybindMode … … 82 94 }; 83 95 }; 84 96 } 97 98 //----------------------------------------------------------------------- 99 // Forward declarations 100 //----------------------------------------------------------------------- 101 102 namespace orxonox 103 { 85 104 typedef std::string LanguageEntryLabel; 86 105 87 106 class ArgumentCompleter; 88 107 class ArgumentCompletionListElement; 89 class BaseFactory;90 class BaseMetaObjectListElement;91 108 class BaseObject; 92 109 template <class T> … … 98 115 class ClassTreeMaskNode; 99 116 class ClassTreeMaskObjectIterator; 100 class Clock;101 117 class CommandEvaluation; 102 class CommandExecutor; 103 class CommandLine; 118 class CommandLineParser; 104 119 class CommandLineArgument; 105 120 class ConfigFile; … … 109 124 class ConfigFileManager; 110 125 class ConfigFileSection; 126 struct ConfigFileType; 111 127 class ConfigValueContainer; 112 128 class ConsoleCommand; … … 115 131 class DynLibManager; 116 132 struct Event; 117 class Event Container;133 class EventState; 118 134 class Executor; 119 135 template <class T> … … 125 141 class FunctorMember; 126 142 class FunctorStatic; 143 class Game; 144 class GameState; 145 struct GameStateInfo; 146 struct GameStateTreeNode; 127 147 class GraphicsManager; 128 148 class GUIManager; … … 131 151 template <class T> 132 152 class Iterator; 133 class IteratorBase;134 153 class Language; 135 class LanguageEntry;136 class Loader;137 154 class LuaState; 138 155 class MemoryArchive; … … 152 169 class OgreWindowEventListener; 153 170 class OrxonoxClass; 171 class PathConfig; 154 172 struct ResourceInfo; 155 173 class Shell; 156 174 class ShellListener; 157 175 template <class T> 176 class SmartPtr; 177 template <class T> 158 178 class SubclassIdentifier; 159 179 class TclBind; … … 163 183 class TclThreadManager; 164 184 class Template; 185 class Thread; 186 class ThreadPool; 187 template <class T> 188 class WeakPtr; 165 189 class WindowEventListener; 166 190 class XMLFile; … … 173 197 class XMLPortParamContainer; 174 198 175 // game states 176 class Game; 177 class GameState; 178 struct GameStateInfo; 179 struct GameStateTreeNode; 180 181 // input 199 // Input 182 200 class BaseCommand; 183 201 class BufferedParamCommand; 184 202 class Button; 185 class CalibratorCallback;186 203 class HalfAxis; 187 204 class InputBuffer; … … 192 209 class InputManager; 193 210 class InputState; 211 struct InputStatePriority; 212 class JoyStickQuantityListener; 194 213 class JoyStick; 214 class KeyBinder; 215 class KeyBinderManager; 216 class Keyboard; 217 class KeyDetector; 218 class KeyEvent; 195 219 class Mouse; 196 class Keyboard;197 class KeyBinder;198 class KeyDetector;199 220 class ParamCommand; 200 221 class SimpleCommand; 201 202 203 // multithreading204 class Thread;205 class ThreadPool;206 222 } 207 223 … … 282 298 namespace orxonox 283 299 { 284 using ticpp::Document;285 300 using ticpp::Element; 286 using ticpp::Declaration; 287 using ticpp::StylesheetReference; 288 using ticpp::Text; 289 using ticpp::Comment; 290 using ticpp::Attribute; 291 } 292 301 } 293 302 294 303 #endif /* _CorePrereqs_H__ */ -
sandbox/src/libraries/core/Functor.h
r5738 r6038 191 191 192 192 193 #define FUNCTOR_TEMPLATE(ismember, returnvalue, numparams) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams 194 #define FUNCTOR_TEMPLATE000 195 #define FUNCTOR_TEMPLATE001 template <class P1> 196 #define FUNCTOR_TEMPLATE002 template <class P1, class P2> 197 #define FUNCTOR_TEMPLATE003 template <class P1, class P2, class P3> 198 #define FUNCTOR_TEMPLATE004 template <class P1, class P2, class P3, class P4> 199 #define FUNCTOR_TEMPLATE005 template <class P1, class P2, class P3, class P4, class P5> 200 #define FUNCTOR_TEMPLATE010 template <class R> 201 #define FUNCTOR_TEMPLATE011 template <class R, class P1> 202 #define FUNCTOR_TEMPLATE012 template <class R, class P1, class P2> 203 #define FUNCTOR_TEMPLATE013 template <class R, class P1, class P2, class P3> 204 #define FUNCTOR_TEMPLATE014 template <class R, class P1, class P2, class P3, class P4> 205 #define FUNCTOR_TEMPLATE015 template <class R, class P1, class P2, class P3, class P4, class P5> 206 #define FUNCTOR_TEMPLATE100 template <class T> 207 #define FUNCTOR_TEMPLATE101 template <class T, class P1> 208 #define FUNCTOR_TEMPLATE102 template <class T, class P1, class P2> 209 #define FUNCTOR_TEMPLATE103 template <class T, class P1, class P2, class P3> 210 #define FUNCTOR_TEMPLATE104 template <class T, class P1, class P2, class P3, class P4> 211 #define FUNCTOR_TEMPLATE105 template <class T, class P1, class P2, class P3, class P4, class P5> 212 #define FUNCTOR_TEMPLATE110 template <class T, class R> 213 #define FUNCTOR_TEMPLATE111 template <class T, class R, class P1> 214 #define FUNCTOR_TEMPLATE112 template <class T, class R, class P1, class P2> 215 #define FUNCTOR_TEMPLATE113 template <class T, class R, class P1, class P2, class P3> 216 #define FUNCTOR_TEMPLATE114 template <class T, class R, class P1, class P2, class P3, class P4> 217 #define FUNCTOR_TEMPLATE115 template <class T, class R, class P1, class P2, class P3, class P4, class P5> 193 #define FUNCTOR_TEMPLATE(ismember, returnvalue, numparams, additionalobject) FUNCTOR_TEMPLATE##ismember##returnvalue##numparams(additionalobject) 194 #define FUNCTOR_TEMPLATE000(additionalobject) 195 #define FUNCTOR_TEMPLATE001(additionalobject) template <class P1> 196 #define FUNCTOR_TEMPLATE002(additionalobject) template <class P1, class P2> 197 #define FUNCTOR_TEMPLATE003(additionalobject) template <class P1, class P2, class P3> 198 #define FUNCTOR_TEMPLATE004(additionalobject) template <class P1, class P2, class P3, class P4> 199 #define FUNCTOR_TEMPLATE005(additionalobject) template <class P1, class P2, class P3, class P4, class P5> 200 #define FUNCTOR_TEMPLATE010(additionalobject) template <class R> 201 #define FUNCTOR_TEMPLATE011(additionalobject) template <class R, class P1> 202 #define FUNCTOR_TEMPLATE012(additionalobject) template <class R, class P1, class P2> 203 #define FUNCTOR_TEMPLATE013(additionalobject) template <class R, class P1, class P2, class P3> 204 #define FUNCTOR_TEMPLATE014(additionalobject) template <class R, class P1, class P2, class P3, class P4> 205 #define FUNCTOR_TEMPLATE015(additionalobject) template <class R, class P1, class P2, class P3, class P4, class P5> 206 #define FUNCTOR_TEMPLATE100(additionalobject) template <class T FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 207 #define FUNCTOR_TEMPLATE101(additionalobject) template <class T, class P1 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 208 #define FUNCTOR_TEMPLATE102(additionalobject) template <class T, class P1, class P2 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 209 #define FUNCTOR_TEMPLATE103(additionalobject) template <class T, class P1, class P2, class P3 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 210 #define FUNCTOR_TEMPLATE104(additionalobject) template <class T, class P1, class P2, class P3, class P4 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 211 #define FUNCTOR_TEMPLATE105(additionalobject) template <class T, class P1, class P2, class P3, class P4, class P5 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 212 #define FUNCTOR_TEMPLATE110(additionalobject) template <class T, class R FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 213 #define FUNCTOR_TEMPLATE111(additionalobject) template <class T, class R, class P1 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 214 #define FUNCTOR_TEMPLATE112(additionalobject) template <class T, class R, class P1, class P2 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 215 #define FUNCTOR_TEMPLATE113(additionalobject) template <class T, class R, class P1, class P2, class P3 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 216 #define FUNCTOR_TEMPLATE114(additionalobject) template <class T, class R, class P1, class P2, class P3, class P4 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 217 #define FUNCTOR_TEMPLATE115(additionalobject) template <class T, class R, class P1, class P2, class P3, class P4, class P5 FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) > 218 219 220 221 #define FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT(additionalobject) FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT##additionalobject 222 #define FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT0 223 #define FUNCTOR_TEMPLATE_ADDITIONAL_OBJECT1 , class O 218 224 219 225 … … 317 323 318 324 #define CREATE_STATIC_FUNCTOR(returnvalue, numparams) \ 319 FUNCTOR_TEMPLATE(0, returnvalue, numparams ) \325 FUNCTOR_TEMPLATE(0, returnvalue, numparams, 0) \ 320 326 class FunctorStatic##returnvalue##numparams : public FunctorStatic \ 321 327 { \ … … 347 353 \ 348 354 \ 349 FUNCTOR_TEMPLATE(0, returnvalue, numparams ) \355 FUNCTOR_TEMPLATE(0, returnvalue, numparams, 0) \ 350 356 inline FunctorStatic##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(0, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \ 351 357 { \ … … 358 364 359 365 #define CREATE_MEMBER_FUNCTOR(returnvalue, numparams) \ 360 FUNCTOR_TEMPLATE(1, returnvalue, numparams ) \366 FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \ 361 367 class FunctorMember##returnvalue##numparams : public FunctorMember<T> \ 362 368 { \ … … 391 397 \ 392 398 \ 393 FUNCTOR_TEMPLATE(1, returnvalue, numparams ) \399 FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \ 394 400 class FunctorConstMember##returnvalue##numparams : public FunctorMember<T> \ 395 401 { \ … … 423 429 \ 424 430 \ 425 FUNCTOR_TEMPLATE(1, returnvalue, numparams ) \431 FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \ 426 432 inline FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams))) \ 427 433 { \ … … 430 436 \ 431 437 \ 432 FUNCTOR_TEMPLATE(1, returnvalue, numparams ) \438 FUNCTOR_TEMPLATE(1, returnvalue, numparams, 0) \ 433 439 inline FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const) \ 434 440 { \ 435 441 return new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \ 442 } \ 443 \ 444 FUNCTOR_TEMPLATE(1, returnvalue, numparams, 1) \ 445 inline FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)), O* object) \ 446 { \ 447 FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* functor = new FunctorMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \ 448 functor->setObject(object); \ 449 return functor; \ 450 } \ 451 \ 452 \ 453 FUNCTOR_TEMPLATE(1, returnvalue, numparams, 1) \ 454 inline FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* createFunctor(FUNCTOR_FUNCTION_RETURNVALUE(returnvalue) (T::*functionPointer)(FUNCTOR_FUNCTION_PARAMS(numparams)) const, O* object) \ 455 { \ 456 FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams)* functor = new FunctorConstMember##returnvalue##numparams FUNCTOR_TEMPLATE_CLASSES(1, returnvalue, numparams) (functionPointer); \ 457 functor->setObject(object); \ 458 return functor; \ 436 459 } 437 460 -
sandbox/src/libraries/core/Game.cc
r5782 r6038 38 38 #include <boost/weak_ptr.hpp> 39 39 40 #include "util/Clock.h" 40 41 #include "util/Debug.h" 41 42 #include "util/Exception.h" … … 43 44 #include "util/Sleep.h" 44 45 #include "util/SubString.h" 45 #include "Clock.h" 46 #include "CommandLine.h" 46 #include "CommandLineParser.h" 47 47 #include "Core.h" 48 48 #include "CoreIncludes.h" … … 105 105 Game::Game(const std::string& cmdLine) 106 106 // Destroy factories before the Core! 107 : gsFactoryDestroyer_(Game::GameStateFactory:: factories_s, &std::map<std::string, shared_ptr<GameStateFactory> >::clear)107 : gsFactoryDestroyer_(Game::GameStateFactory::getFactories(), &std::map<std::string, shared_ptr<GameStateFactory> >::clear) 108 108 { 109 109 this->bAbort_ = false; … … 404 404 requestedNodes.push_back(currentNode); 405 405 } 406 if (currentNode == NULL) 407 requestedNodes.clear(); 406 408 } 407 409 … … 451 453 { 452 454 // Split string into pieces of the form whitespacesText 453 std::vector<std::pair<std::string, unsigned> > stateStrings;455 std::vector<std::pair<std::string, int> > stateStrings; 454 456 size_t pos = 0; 455 457 size_t startPos = 0; 456 458 while (pos < str.size()) 457 459 { 458 unsignedindentation = 0;460 int indentation = 0; 459 461 while(pos < str.size() && str[pos] == ' ') 460 462 ++indentation, ++pos; … … 464 466 stateStrings.push_back(std::make_pair(str.substr(startPos, pos - startPos), indentation)); 465 467 } 466 unsigned int currentLevel = 0; 467 shared_ptr<GameStateTreeNode> currentNode = this->rootStateNode_; 468 for (std::vector<std::pair<std::string, unsigned> >::const_iterator it = stateStrings.begin(); it != stateStrings.end(); ++it) 469 { 470 std::string newStateName = it->first; 471 unsigned newLevel = it->second + 1; // empty root is 0 472 if (!this->checkState(newStateName)) 473 ThrowException(GameState, "GameState with name '" << newStateName << "' not found!"); 474 if (newStateName == this->rootStateNode_->name_) 468 if (stateStrings.empty()) 469 ThrowException(GameState, "Emtpy GameState hierarchy provided, terminating."); 470 // Add element with large identation to detect the last with just an iterator 471 stateStrings.push_back(std::make_pair("", -1)); 472 473 // Parse elements recursively 474 std::vector<std::pair<std::string, int> >::const_iterator begin = stateStrings.begin(); 475 parseStates(begin, this->rootStateNode_); 476 } 477 478 /*** Internal ***/ 479 480 void Game::parseStates(std::vector<std::pair<std::string, int> >::const_iterator& it, shared_ptr<GameStateTreeNode> currentNode) 481 { 482 SubString tokens(it->first, ","); 483 std::vector<std::pair<std::string, int> >::const_iterator startIt = it; 484 485 for (unsigned int i = 0; i < tokens.size(); ++i) 486 { 487 it = startIt; // Reset iterator to the beginning of the sub tree 488 if (!this->checkState(tokens[i])) 489 ThrowException(GameState, "GameState with name '" << tokens[i] << "' not found!"); 490 if (tokens[i] == this->rootStateNode_->name_) 475 491 ThrowException(GameState, "You shouldn't use 'emptyRootGameState' in the hierarchy..."); 476 shared_ptr<GameStateTreeNode> newNode(new GameStateTreeNode); 477 newNode->name_ = newStateName; 478 479 if (newLevel <= currentLevel) 480 { 481 do 482 currentNode = currentNode->parent_.lock(); 483 while (newLevel <= --currentLevel); 484 } 485 if (newLevel == currentLevel + 1) 486 { 487 // Add the child 488 newNode->parent_ = currentNode; 489 currentNode->children_.push_back(newNode); 490 } 492 shared_ptr<GameStateTreeNode> node(new GameStateTreeNode()); 493 node->name_ = tokens[i]; 494 node->parent_ = currentNode; 495 currentNode->children_.push_back(node); 496 497 int currentLevel = it->second; 498 ++it; 499 while (it->second != -1) 500 { 501 if (it->second <= currentLevel) 502 break; 503 else if (it->second == currentLevel + 1) 504 parseStates(it, node); 491 505 else 492 506 ThrowException(GameState, "Indentation error while parsing the hierarchy."); 493 currentNode = newNode; 494 currentLevel = newLevel; 495 } 496 } 497 498 /*** Internal ***/ 507 } 508 } 509 } 499 510 500 511 void Game::loadGraphics() … … 566 577 } 567 578 568 std::map<std::string, shared_ptr<Game::GameStateFactory> > Game::GameStateFactory::factories_s; 579 /*static*/ std::map<std::string, shared_ptr<Game::GameStateFactory> >& Game::GameStateFactory::getFactories() 580 { 581 static std::map<std::string, shared_ptr<GameStateFactory> > factories; 582 return factories; 583 } 569 584 570 585 /*static*/ shared_ptr<GameState> Game::GameStateFactory::fabricate(const GameStateInfo& info) 571 586 { 572 std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = factories_s.find(info.className);573 assert(it != factories_s.end());587 std::map<std::string, shared_ptr<Game::GameStateFactory> >::const_iterator it = getFactories().find(info.className); 588 assert(it != getFactories().end()); 574 589 return it->second->fabricateInternal(info); 575 590 } -
sandbox/src/libraries/core/Game.h
r5747 r6038 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> … … 143 143 void unloadGraphics(); 144 144 145 void parseStates(std::vector<std::pair<std::string, int> >::const_iterator& it, shared_ptr<GameStateTreeNode> currentNode); 145 146 bool checkState(const std::string& name) const; 146 147 void loadState(const std::string& name); -
sandbox/src/libraries/core/GameState.h
r5738 r6038 40 40 #include <map> 41 41 #include <string> 42 #include "util/UtilPrereqs.h" 42 43 43 44 namespace orxonox -
sandbox/src/libraries/core/Identifier.cc
r5782 r6038 37 37 38 38 #include "util/StringUtils.h" 39 #include "BaseObject.h" 39 40 #include "ConfigValueContainer.h" 40 #include " Factory.h"41 #include "ClassFactory.h" 41 42 42 43 namespace orxonox … … 62 63 this->bHasConfigValues_ = false; 63 64 64 this->children_ = new std::set<const Identifier*>();65 this->directChildren_ = new std::set<const Identifier*>();66 65 } 67 66 … … 71 70 Identifier::~Identifier() 72 71 { 73 delete this->children_;74 delete this->directChildren_;75 72 delete this->objects_; 76 73 … … 105 102 // There is already an entry: return it and delete the proposal 106 103 delete proposal; 107 return (*it).second;104 return it->second; 108 105 } 109 106 else … … 152 149 { 153 150 // Tell the parent we're one of it's children 154 (*it)-> getChildrenIntern().insert((*it)->getChildrenIntern().end(), this);151 (*it)->children_.insert((*it)->children_.end(), this); 155 152 156 153 // Erase all parents of our parent from our direct-parent-list … … 174 171 { 175 172 // Tell the parent we're one of it's direct children 176 (*it)-> getDirectChildrenIntern().insert((*it)->getDirectChildrenIntern().end(), this);173 (*it)->directChildren_.insert((*it)->directChildren_.end(), this); 177 174 } 178 175 } 176 } 177 178 /** 179 @brief Creates the class-hierarchy by creating and destroying one object of each type. 180 */ 181 void Identifier::createClassHierarchy() 182 { 183 COUT(3) << "*** Identifier: Create class-hierarchy" << std::endl; 184 Identifier::startCreatingHierarchy(); 185 for (std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMap().begin(); it != Identifier::getStringIdentifierMap().end(); ++it) 186 { 187 // To create the new branch of the class-hierarchy, we create a new object and delete it afterwards. 188 if (it->second->hasFactory()) 189 { 190 BaseObject* temp = it->second->fabricate(0); 191 delete temp; 192 } 193 } 194 Identifier::stopCreatingHierarchy(); 195 COUT(3) << "*** Identifier: Finished class-hierarchy creation" << std::endl; 179 196 } 180 197 … … 198 215 this->name_ = name; 199 216 this->bSetName_ = true; 200 Identifier::get IdentifierMapIntern()[name] = this;201 Identifier::getLowercase IdentifierMapIntern()[getLowercase(name)] = this;217 Identifier::getStringIdentifierMapIntern()[name] = this; 218 Identifier::getLowercaseStringIdentifierMapIntern()[getLowercase(name)] = this; 202 219 } 203 220 } … … 219 236 COUT(1) << "Aborting..." << std::endl; 220 237 abort(); 221 return NULL;238 return 0; 222 239 } 223 240 } … … 265 282 bool Identifier::isParentOf(const Identifier* identifier) const 266 283 { 267 return (this->children_ ->find(identifier) != this->children_->end());284 return (this->children_.find(identifier) != this->children_.end()); 268 285 } 269 286 … … 274 291 bool Identifier::isDirectParentOf(const Identifier* identifier) const 275 292 { 276 return (this->directChildren_ ->find(identifier) != this->directChildren_->end());277 } 278 279 /** 280 @brief Returns the map that stores all Identifiers .293 return (this->directChildren_.find(identifier) != this->directChildren_.end()); 294 } 295 296 /** 297 @brief Returns the map that stores all Identifiers with their names. 281 298 @return The map 282 299 */ 283 std::map<std::string, Identifier*>& Identifier::get IdentifierMapIntern()300 std::map<std::string, Identifier*>& Identifier::getStringIdentifierMapIntern() 284 301 { 285 302 static std::map<std::string, Identifier*> identifierMap; … … 288 305 289 306 /** 290 @brief Returns the map that stores all Identifiers .307 @brief Returns the map that stores all Identifiers with their names in lowercase. 291 308 @return The map 292 309 */ 293 std::map<std::string, Identifier*>& Identifier::getLowercase IdentifierMapIntern()310 std::map<std::string, Identifier*>& Identifier::getLowercaseStringIdentifierMapIntern() 294 311 { 295 312 static std::map<std::string, Identifier*> lowercaseIdentifierMap; 296 313 return lowercaseIdentifierMap; 314 } 315 316 /** 317 @brief Returns the map that stores all Identifiers with their network IDs. 318 @return The map 319 */ 320 std::map<uint32_t, Identifier*>& Identifier::getIDIdentifierMapIntern() 321 { 322 static std::map<uint32_t, Identifier*> identifierMap; 323 return identifierMap; 324 } 325 326 /** 327 @brief Returns the Identifier with a given name. 328 @param name The name of the wanted Identifier 329 @return The Identifier 330 */ 331 Identifier* Identifier::getIdentifierByString(const std::string& name) 332 { 333 std::map<std::string, Identifier*>::const_iterator it = Identifier::getStringIdentifierMapIntern().find(name); 334 if (it != Identifier::getStringIdentifierMapIntern().end()) 335 return it->second; 336 else 337 return 0; 338 } 339 340 /** 341 @brief Returns the Identifier with a given name in lowercase. 342 @param name The name of the wanted Identifier 343 @return The Identifier 344 */ 345 Identifier* Identifier::getIdentifierByLowercaseString(const std::string& name) 346 { 347 std::map<std::string, Identifier*>::const_iterator it = Identifier::getLowercaseStringIdentifierMapIntern().find(name); 348 if (it != Identifier::getLowercaseStringIdentifierMapIntern().end()) 349 return it->second; 350 else 351 return 0; 297 352 } 298 353 … … 325 380 std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_.find(varname); 326 381 if (it != configValues_.end()) 327 return ((*it).second);382 return it->second; 328 383 else 329 384 return 0; … … 339 394 std::map<std::string, ConfigValueContainer*>::const_iterator it = configValues_LC_.find(varname); 340 395 if (it != configValues_LC_.end()) 341 return ((*it).second);396 return it->second; 342 397 else 343 398 return 0; … … 353 408 { 354 409 for (std::set<const Identifier*>::const_iterator it = list.begin(); it != list.end(); ++it) 355 out << (*it)->getName() << " "; 410 { 411 if (it != list.begin()) 412 out << " "; 413 out << (*it)->getName(); 414 } 356 415 357 416 return out; -
sandbox/src/libraries/core/Identifier.h
r5782 r6038 29 29 /** 30 30 @file 31 @brief Definition of the Identifier , ClassIdentifier and SubclassIdentifier classes, implementation of the ClassIdentifier and SubclassIdentifier classes.31 @brief Definition of the Identifier class, definition and implementation of the ClassIdentifier class. 32 32 33 33 The Identifier contains all needed information about the class it belongs to: … … 45 45 46 46 Every Identifier is in fact a ClassIdentifier, but they are derived from Identifier. 47 48 SubclassIdentifier is a separated class, acting like an Identifier, but has a given class.49 You can only assign Identifiers of exactly the given class or of a derivative to a SubclassIdentifier.50 47 */ 51 48 … … 89 86 class _CoreExport Identifier 90 87 { 91 template <class T>92 friend class SubclassIdentifier;93 94 friend class Factory;95 96 88 public: 89 /** @brief Returns the name of the class the Identifier belongs to. @return The name */ 90 inline const std::string& getName() const { return this->name_; } 91 void setName(const std::string& name); 92 93 /** @brief Returns the unique ID of the class */ 94 FORCEINLINE unsigned int getClassID() const { return this->classID_; } 95 96 /** @brief Returns the list of all existing objects of this class. @return The list */ 97 inline ObjectListBase* getObjects() const { return this->objects_; } 98 97 99 /** @brief Sets the Factory. @param factory The factory to assign */ 98 inline void addFactory(BaseFactory* factory) { this->factory_ = factory; } 100 inline void addFactory(Factory* factory) { this->factory_ = factory; } 101 /** @brief Returns true if the Identifier has a Factory. */ 102 inline bool hasFactory() const { return (this->factory_ != 0); } 99 103 100 104 BaseObject* fabricate(BaseObject* creator); 105 101 106 bool isA(const Identifier* identifier) const; 102 107 bool isExactlyA(const Identifier* identifier) const; … … 106 111 bool isDirectParentOf(const Identifier* identifier) const; 107 112 108 /** @brief Returns the list of all existing objects of this class. @return The list */ 109 inline ObjectListBase* getObjects() const 110 { return this->objects_; } 111 112 /** @brief Returns the name of the class the Identifier belongs to. @return The name */ 113 inline const std::string& getName() const { return this->name_; } 114 void setName(const std::string& name); 115 116 virtual void updateConfigValues(bool updateChildren = true) const = 0; 113 114 ///////////////////////////// 115 ////// Class Hierarchy ////// 116 ///////////////////////////// 117 static void createClassHierarchy(); 118 119 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */ 120 inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); } 117 121 118 122 /** @brief Returns the parents of the class the Identifier belongs to. @return The list of all parents */ … … 124 128 125 129 /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */ 126 inline const std::set<const Identifier*>& getChildren() const { return (*this->children_); }130 inline const std::set<const Identifier*>& getChildren() const { return this->children_; } 127 131 /** @brief Returns the begin-iterator of the children-list. @return The begin-iterator */ 128 inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_ ->begin(); }132 inline std::set<const Identifier*>::const_iterator getChildrenBegin() const { return this->children_.begin(); } 129 133 /** @brief Returns the end-iterator of the children-list. @return The end-iterator */ 130 inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_ ->end(); }134 inline std::set<const Identifier*>::const_iterator getChildrenEnd() const { return this->children_.end(); } 131 135 132 136 /** @brief Returns the direct parents of the class the Identifier belongs to. @return The list of all direct parents */ … … 138 142 139 143 /** @brief Returns the direct children the class the Identifier belongs to. @return The list of all direct children */ 140 inline const std::set<const Identifier*>& getDirectChildren() const { return (*this->directChildren_); }144 inline const std::set<const Identifier*>& getDirectChildren() const { return this->directChildren_; } 141 145 /** @brief Returns the begin-iterator of the direct-children-list. @return The begin-iterator */ 142 inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_ ->begin(); }146 inline std::set<const Identifier*>::const_iterator getDirectChildrenBegin() const { return this->directChildren_.begin(); } 143 147 /** @brief Returns the end-iterator of the direct-children-list. @return The end-iterator */ 144 inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_->end(); } 145 146 147 /** @brief Returns the map that stores all Identifiers. @return The map */ 148 static inline const std::map<std::string, Identifier*>& getIdentifierMap() { return Identifier::getIdentifierMapIntern(); } 149 /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers. @return The const_iterator */ 150 static inline std::map<std::string, Identifier*>::const_iterator getIdentifierMapBegin() { return Identifier::getIdentifierMap().begin(); } 151 /** @brief Returns a const_iterator to the end of the map that stores all Identifiers. @return The const_iterator */ 152 static inline std::map<std::string, Identifier*>::const_iterator getIdentifierMapEnd() { return Identifier::getIdentifierMap().end(); } 148 inline std::set<const Identifier*>::const_iterator getDirectChildrenEnd() const { return this->directChildren_.end(); } 149 150 151 ////////////////////////// 152 ///// Identifier Map ///// 153 ////////////////////////// 154 static void destroyAllIdentifiers(); 155 156 static Identifier* getIdentifierByString(const std::string& name); 157 static Identifier* getIdentifierByLowercaseString(const std::string& name); 158 static Identifier* getIdentifierByID(uint32_t id); 159 160 static void clearNetworkIDs(); 161 162 /** @brief Returns the map that stores all Identifiers with their names. @return The map */ 163 static inline const std::map<std::string, Identifier*>& getStringIdentifierMap() { return Identifier::getStringIdentifierMapIntern(); } 164 /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers with their names. @return The const_iterator */ 165 static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapBegin() { return Identifier::getStringIdentifierMap().begin(); } 166 /** @brief Returns a const_iterator to the end of the map that stores all Identifiers with their names. @return The const_iterator */ 167 static inline std::map<std::string, Identifier*>::const_iterator getStringIdentifierMapEnd() { return Identifier::getStringIdentifierMap().end(); } 153 168 154 169 /** @brief Returns the map that stores all Identifiers with their names in lowercase. @return The map */ 155 static inline const std::map<std::string, Identifier*>& getLowercase IdentifierMap() { return Identifier::getLowercaseIdentifierMapIntern(); }170 static inline const std::map<std::string, Identifier*>& getLowercaseStringIdentifierMap() { return Identifier::getLowercaseStringIdentifierMapIntern(); } 156 171 /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers with their names in lowercase. @return The const_iterator */ 157 static inline std::map<std::string, Identifier*>::const_iterator getLowercase IdentifierMapBegin() { return Identifier::getLowercaseIdentifierMap().begin(); }172 static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapBegin() { return Identifier::getLowercaseStringIdentifierMap().begin(); } 158 173 /** @brief Returns a const_iterator to the end of the map that stores all Identifiers with their names in lowercase. @return The const_iterator */ 159 static inline std::map<std::string, Identifier*>::const_iterator getLowercaseIdentifierMapEnd() { return Identifier::getLowercaseIdentifierMap().end(); } 160 174 static inline std::map<std::string, Identifier*>::const_iterator getLowercaseStringIdentifierMapEnd() { return Identifier::getLowercaseStringIdentifierMap().end(); } 175 176 /** @brief Returns the map that stores all Identifiers with their IDs. @return The map */ 177 static inline const std::map<uint32_t, Identifier*>& getIDIdentifierMap() { return Identifier::getIDIdentifierMapIntern(); } 178 /** @brief Returns a const_iterator to the beginning of the map that stores all Identifiers with their IDs. @return The const_iterator */ 179 static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapBegin() { return Identifier::getIDIdentifierMap().begin(); } 180 /** @brief Returns a const_iterator to the end of the map that stores all Identifiers with their IDs. @return The const_iterator */ 181 static inline std::map<uint32_t, Identifier*>::const_iterator getIDIdentifierMapEnd() { return Identifier::getIDIdentifierMap().end(); } 182 183 184 ///////////////////////// 185 ///// Config Values ///// 186 ///////////////////////// 187 virtual void updateConfigValues(bool updateChildren = true) const = 0; 188 189 /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */ 190 inline bool hasConfigValues() const { return this->bHasConfigValues_; } 161 191 162 192 /** @brief Returns the map that stores all config values. @return The const_iterator */ … … 174 204 inline std::map<std::string, ConfigValueContainer*>::const_iterator getLowercaseConfigValueMapEnd() const { return this->configValues_LC_.end(); } 175 205 176 177 /** @brief Returns true if this class has at least one config value. @return True if this class has at least one config value */178 inline bool hasConfigValues() const { return this->bHasConfigValues_; }179 180 /** @brief Returns true, if a branch of the class-hierarchy is being created, causing all new objects to store their parents. @return The status of the class-hierarchy creation */181 inline static bool isCreatingHierarchy() { return (hierarchyCreatingCounter_s > 0); }182 183 /** @brief Returns the unique ID of the class */184 FORCEINLINE unsigned int getClassID() const { return this->classID_; }185 186 206 void addConfigValueContainer(const std::string& varname, ConfigValueContainer* container); 187 207 ConfigValueContainer* getConfigValueContainer(const std::string& varname); 188 208 ConfigValueContainer* getLowercaseConfigValueContainer(const std::string& varname); 189 209 190 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass);191 192 static void destroyAllIdentifiers();193 210 194 211 protected: … … 199 216 static Identifier* getIdentifierSingleton(const std::string& name, Identifier* proposal); 200 217 201 /** @brief Returns the map that stores all Identifiers. @return The map */ 202 static std::map<std::string, Identifier*>& getIdentifierMapIntern(); 218 void initializeClassHierarchy(std::set<const Identifier*>* parents, bool bRootClass); 219 220 /** @brief Returns the map that stores all Identifiers with their names. @return The map */ 221 static std::map<std::string, Identifier*>& getStringIdentifierMapIntern(); 203 222 /** @brief Returns the map that stores all Identifiers with their names in lowercase. @return The map */ 204 static std::map<std::string, Identifier*>& getLowercaseIdentifierMapIntern(); 223 static std::map<std::string, Identifier*>& getLowercaseStringIdentifierMapIntern(); 224 /** @brief Returns the map that stores all Identifiers with their network IDs. @return The map */ 225 static std::map<uint32_t, Identifier*>& getIDIdentifierMapIntern(); 205 226 206 227 /** @brief Returns the children of the class the Identifier belongs to. @return The list of all children */ 207 inline std::set<const Identifier*>& getChildrenIntern() const { return (*this->children_); }228 inline std::set<const Identifier*>& getChildrenIntern() const { return this->children_; } 208 229 /** @brief Returns the direct children of the class the Identifier belongs to. @return The list of all direct children */ 209 inline std::set<const Identifier*>& getDirectChildrenIntern() const { return (*this->directChildren_); }230 inline std::set<const Identifier*>& getDirectChildrenIntern() const { return this->directChildren_; } 210 231 211 232 ObjectListBase* objects_; //!< The list of all objects of this class 212 233 213 234 private: 214 /** 215 @brief Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents. 216 */ 217 inline static void startCreatingHierarchy() 218 { 219 hierarchyCreatingCounter_s++; 220 COUT(4) << "*** Identifier: Increased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl; 221 } 222 223 /** 224 @brief Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents. 225 */ 226 inline static void stopCreatingHierarchy() 227 { 228 hierarchyCreatingCounter_s--; 229 COUT(4) << "*** Identifier: Decreased Hierarchy-Creating-Counter to " << hierarchyCreatingCounter_s << std::endl; 230 } 235 /** @brief Increases the hierarchyCreatingCounter_s variable, causing all new objects to store their parents. */ 236 inline static void startCreatingHierarchy() { hierarchyCreatingCounter_s++; } 237 /** @brief Decreases the hierarchyCreatingCounter_s variable, causing the objects to stop storing their parents. */ 238 inline static void stopCreatingHierarchy() { hierarchyCreatingCounter_s--; } 231 239 232 240 static std::map<std::string, Identifier*>& getTypeIDIdentifierMap(); … … 235 243 236 244 std::set<const Identifier*> parents_; //!< The parents of the class the Identifier belongs to 237 std::set<const Identifier*>* children_;//!< The children of the class the Identifier belongs to245 mutable std::set<const Identifier*> children_; //!< The children of the class the Identifier belongs to 238 246 239 247 std::set<const Identifier*> directParents_; //!< The direct parents of the class the Identifier belongs to 240 std::set<const Identifier*>* directChildren_;//!< The direct children of the class the Identifier belongs to248 mutable std::set<const Identifier*> directChildren_; //!< The direct children of the class the Identifier belongs to 241 249 242 250 bool bCreatedOneObject_; //!< True if at least one object of the given type was created (used to determine the need of storing the parents) 243 251 bool bSetName_; //!< True if the name is set 244 252 std::string name_; //!< The name of the class the Identifier belongs to 245 BaseFactory* factory_;//!< The Factory, able to create new objects of the given class (if available)253 Factory* factory_; //!< The Factory, able to create new objects of the given class (if available) 246 254 static int hierarchyCreatingCounter_s; //!< Bigger than zero if at least one Identifier stores its parents (its an int instead of a bool to avoid conflicts with multithreading) 247 255 const unsigned int classID_; //!< Uniquely identifies a class (might not be the same as the networkID_) … … 302 310 inline ClassIdentifier<T>* ClassIdentifier<T>::getIdentifier() 303 311 { 304 // check if the static field has already been filled305 if ( ClassIdentifier<T>::classIdentifier_s == 0)312 // check if the Identifier already exists 313 if (!ClassIdentifier<T>::classIdentifier_s) 306 314 ClassIdentifier<T>::initialiseIdentifier(); 307 315 … … 430 438 #endif 431 439 } 432 433 434 // ###############################435 // ### SubclassIdentifier ###436 // ###############################437 //! The SubclassIdentifier acts almost like an Identifier, but has some prerequisites.438 /**439 You can only assign an Identifier that belongs to a class T (or derived) to a SubclassIdentifier<T>.440 If you assign something else, the program aborts.441 Because we know the minimum type, a dynamic_cast is done, which makes it easier to create a new object.442 */443 template <class T>444 class SubclassIdentifier445 {446 public:447 /**448 @brief Constructor: Automaticaly assigns the Identifier of the given class.449 */450 SubclassIdentifier()451 {452 this->identifier_ = ClassIdentifier<T>::getIdentifier();453 }454 455 /**456 @brief Copyconstructor: Assigns the given Identifier.457 @param identifier The Identifier458 */459 SubclassIdentifier(Identifier* identifier)460 {461 this->operator=(identifier);462 }463 464 /**465 @brief Overloading of the = operator: assigns the identifier and checks its type.466 @param identifier The Identifier to assign467 @return The SubclassIdentifier itself468 */469 SubclassIdentifier<T>& operator=(Identifier* identifier)470 {471 if (!identifier || !identifier->isA(ClassIdentifier<T>::getIdentifier()))472 {473 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;474 if (identifier)475 {476 COUT(1) << "Error: Class " << identifier->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;477 COUT(1) << "Error: SubclassIdentifier<" << ClassIdentifier<T>::getIdentifier()->getName() << "> = Class(" << identifier->getName() << ") is forbidden." << std::endl;478 }479 else480 {481 COUT(1) << "Error: Can't assign NULL identifier" << std::endl;482 }483 }484 else485 {486 this->identifier_ = identifier;487 }488 return *this;489 }490 491 /**492 @brief Overloading of the * operator: returns the assigned identifier.493 */494 inline Identifier* operator*() const495 {496 return this->identifier_;497 }498 499 /**500 @brief Overloading of the -> operator: returns the assigned identifier.501 */502 inline Identifier* operator->() const503 {504 return this->identifier_;505 }506 507 /**508 @brief Returns the assigned identifier. This allows you to assign a SubclassIdentifier to a normal Identifier*.509 */510 inline operator Identifier*() const511 {512 return this->identifier_;513 }514 515 /**516 @brief Creates a new object of the type of the assigned Identifier and dynamic_casts it to the minimal type given by T.517 @return The new object518 */519 T* fabricate(BaseObject* creator) const520 {521 BaseObject* newObject = this->identifier_->fabricate(creator);522 523 // Check if the creation was successful524 if (newObject)525 {526 return orxonox_cast<T*>(newObject);527 }528 else529 {530 // Something went terribly wrong531 if (this->identifier_)532 {533 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;534 COUT(1) << "Error: Class " << this->identifier_->getName() << " is not a " << ClassIdentifier<T>::getIdentifier()->getName() << "!" << std::endl;535 COUT(1) << "Error: Couldn't fabricate a new Object." << std::endl;536 COUT(1) << "Aborting..." << std::endl;537 }538 else539 {540 COUT(1) << "An error occurred in SubclassIdentifier (Identifier.h):" << std::endl;541 COUT(1) << "Error: Couldn't fabricate a new Object - Identifier is undefined." << std::endl;542 COUT(1) << "Aborting..." << std::endl;543 }544 545 assert(false);546 return 0;547 }548 }549 550 /** @brief Returns the assigned identifier. @return The identifier */551 inline Identifier* getIdentifier() const552 { return this->identifier_; }553 554 private:555 Identifier* identifier_; //!< The assigned identifier556 };557 440 } 558 441 -
sandbox/src/libraries/core/Iterator.h
r5738 r6038 167 167 168 168 return (*this); 169 return *this;170 169 } 171 170 … … 193 192 inline const Iterator<T>& operator++() 194 193 { 195 if (this->element_) 196 this->element_ = this->element_->next_; 194 this->element_ = this->element_->next_; 197 195 return *this; 198 196 } … … 205 203 { 206 204 Iterator<T> copy = *this; 207 if (this->element_) 208 this->element_ = this->element_->next_; 205 this->element_ = this->element_->next_; 209 206 return copy; 210 207 } … … 216 213 inline const Iterator<T>& operator--() 217 214 { 218 if (this->element_) 219 this->element_ = this->element_->prev_; 215 this->element_ = this->element_->prev_; 220 216 return *this; 221 217 } … … 228 224 { 229 225 Iterator<T> copy = *this; 230 if (this->element_) 231 this->element_ = this->element_->prev_; 226 this->element_ = this->element_->prev_; 232 227 return copy; 233 228 } … … 239 234 inline T* operator*() const 240 235 { 241 if (this->element_) 242 return orxonox_cast<T*>(this->element_->objectBase_); 243 else 244 return 0; 236 return orxonox_cast<T*>(this->element_->objectBase_); 245 237 } 246 238 … … 251 243 inline T* operator->() const 252 244 { 253 if (this->element_) 254 return orxonox_cast<T*>(this->element_->objectBase_); 255 else 256 return 0; 245 return orxonox_cast<T*>(this->element_->objectBase_); 257 246 } 258 247 -
sandbox/src/libraries/core/Language.cc
r5738 r6038 35 35 36 36 #include <fstream> 37 #include <boost/filesystem.hpp>38 39 37 #include "util/Debug.h" 40 38 #include "Core.h" 39 #include "PathConfig.h" 41 40 42 41 namespace orxonox … … 200 199 COUT(4) << "Read default language file." << std::endl; 201 200 202 boost::filesystem::path filepath(Core::getConfigPath() / getFilename(this->defaultLanguage_));201 std::string filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_); 203 202 204 203 // This creates the file if it's not existing 205 204 std::ofstream createFile; 206 createFile.open(filepath. string().c_str(), std::fstream::app);205 createFile.open(filepath.c_str(), std::fstream::app); 207 206 createFile.close(); 208 207 209 208 // Open the file 210 209 std::ifstream file; 211 file.open(filepath. string().c_str(), std::fstream::in);210 file.open(filepath.c_str(), std::fstream::in); 212 211 213 212 if (!file.is_open()) … … 249 248 COUT(4) << "Read translated language file (" << Core::getLanguage() << ")." << std::endl; 250 249 251 boost::filesystem::path filepath(Core::getConfigPath() / getFilename(Core::getLanguage()));250 std::string filepath = PathConfig::getConfigPathString() + getFilename(Core::getLanguage()); 252 251 253 252 // Open the file 254 253 std::ifstream file; 255 file.open(filepath. string().c_str(), std::fstream::in);254 file.open(filepath.c_str(), std::fstream::in); 256 255 257 256 if (!file.is_open()) … … 303 302 COUT(4) << "Language: Write default language file." << std::endl; 304 303 305 boost::filesystem::path filepath(Core::getConfigPath() / getFilename(this->defaultLanguage_));304 std::string filepath = PathConfig::getConfigPathString() + getFilename(this->defaultLanguage_); 306 305 307 306 // Open the file 308 307 std::ofstream file; 309 file.open(filepath. string().c_str(), std::fstream::out);308 file.open(filepath.c_str(), std::fstream::out); 310 309 311 310 if (!file.is_open()) -
sandbox/src/libraries/core/LuaState.cc
r5782 r6038 38 38 39 39 #include "util/Debug.h" 40 #include " Core.h"40 #include "PathConfig.h" 41 41 #include "ToluaBindCore.h" 42 42 … … 106 106 shared_ptr<ResourceInfo> LuaState::getFileInfo(const std::string& filename) 107 107 { 108 boost::filesystem::path filepath = Core::getDataPath() / "lua" / filename;108 boost::filesystem::path filepath = PathConfig::getDataPath() / "lua" / filename; 109 109 if (boost::filesystem::exists(filepath)) 110 110 { -
sandbox/src/libraries/core/ObjectListIterator.h
r5738 r6038 123 123 inline const ObjectListIterator<T>& operator++() 124 124 { 125 if (this->element_) 126 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 125 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 127 126 return *this; 128 127 } … … 135 134 { 136 135 ObjectListIterator<T> copy = *this; 137 if (this->element_) 138 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 136 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 139 137 return copy; 140 138 } … … 146 144 inline const ObjectListIterator<T>& operator--() 147 145 { 148 if (this->element_) 149 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 146 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 150 147 return *this; 151 148 } … … 158 155 { 159 156 ObjectListIterator<T> copy = *this; 160 if (this->element_) 161 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 157 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 162 158 return copy; 163 159 } … … 169 165 inline T* operator*() const 170 166 { 171 if (this->element_) 172 return this->element_->object_; 173 else 174 return 0; 167 return this->element_->object_; 175 168 } 176 169 … … 181 174 inline T* operator->() const 182 175 { 183 if (this->element_) 184 return this->element_->object_; 185 else 186 return 0; 176 return this->element_->object_; 187 177 } 188 178 -
sandbox/src/libraries/core/OrxonoxClass.cc
r5738 r6038 78 78 79 79 /** @brief Returns true if the objects class is of the given type or a derivative. */ 80 template <class B> bool OrxonoxClass::isA(const SubclassIdentifier<B>* identifier)81 { return this->getIdentifier()->isA(identifier->getIdentifier()); }82 /** @brief Returns true if the objects class is exactly of the given type. */83 template <class B> bool OrxonoxClass::isExactlyA(const SubclassIdentifier<B>* identifier)84 { return this->getIdentifier()->isExactlyA(identifier->getIdentifier()); }85 /** @brief Returns true if the objects class is a child of the given type. */86 template <class B> bool OrxonoxClass::isChildOf(const SubclassIdentifier<B>* identifier)87 { return this->getIdentifier()->isChildOf(identifier->getIdentifier()); }88 /** @brief Returns true if the objects class is a direct child of the given type. */89 template <class B> bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<B>* identifier)90 { return this->getIdentifier()->isDirectChildOf(identifier->getIdentifier()); }91 /** @brief Returns true if the objects class is a parent of the given type. */92 template <class B> bool OrxonoxClass::isParentOf(const SubclassIdentifier<B>* identifier)93 { return this->getIdentifier()->isParentOf(identifier->getIdentifier()); }94 /** @brief Returns true if the objects class is a direct parent of the given type. */95 template <class B> bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<B>* identifier)96 { return this->getIdentifier()->isDirectParentOf(identifier->getIdentifier()); }97 98 99 /** @brief Returns true if the objects class is of the given type or a derivative. */100 template <class B> bool OrxonoxClass::isA(const SubclassIdentifier<B> identifier)101 { return this->getIdentifier()->isA(identifier.getIdentifier()); }102 /** @brief Returns true if the objects class is exactly of the given type. */103 template <class B> bool OrxonoxClass::isExactlyA(const SubclassIdentifier<B> identifier)104 { return this->getIdentifier()->isExactlyA(identifier.getIdentifier()); }105 /** @brief Returns true if the objects class is a child of the given type. */106 template <class B> bool OrxonoxClass::isChildOf(const SubclassIdentifier<B> identifier)107 { return this->getIdentifier()->isChildOf(identifier.getIdentifier()); }108 /** @brief Returns true if the objects class is a direct child of the given type. */109 template <class B> bool OrxonoxClass::isDirectChildOf(const SubclassIdentifier<B> identifier)110 { return this->getIdentifier()->isDirectChildOf(identifier.getIdentifier()); }111 /** @brief Returns true if the objects class is a parent of the given type. */112 template <class B> bool OrxonoxClass::isParentOf(const SubclassIdentifier<B> identifier)113 { return this->getIdentifier()->isParentOf(identifier.getIdentifier()); }114 /** @brief Returns true if the objects class is a direct parent of the given type. */115 template <class B> bool OrxonoxClass::isDirectParentOf(const SubclassIdentifier<B> identifier)116 { return this->getIdentifier()->isDirectParentOf(identifier.getIdentifier()); }117 118 119 /** @brief Returns true if the objects class is of the given type or a derivative. */120 80 bool OrxonoxClass::isA(const OrxonoxClass* object) 121 81 { return this->getIdentifier()->isA(object->getIdentifier()); } -
sandbox/src/libraries/core/OrxonoxClass.h
r5738 r6038 72 72 bool isDirectParentOf(const Identifier* identifier); 73 73 74 template <class B> bool isA(const SubclassIdentifier<B>* identifier); 75 template <class B> bool isExactlyA(const SubclassIdentifier<B>* identifier); 76 template <class B> bool isChildOf(const SubclassIdentifier<B>* identifier); 77 template <class B> bool isDirectChildOf(const SubclassIdentifier<B>* identifier); 78 template <class B> bool isParentOf(const SubclassIdentifier<B>* identifier); 79 template <class B> bool isDirectParentOf(const SubclassIdentifier<B>* identifier); 80 81 template <class B> bool isA(const SubclassIdentifier<B> identifier); 82 template <class B> bool isExactlyA(const SubclassIdentifier<B> identifier); 83 template <class B> bool isChildOf(const SubclassIdentifier<B> identifier); 84 template <class B> bool isDirectChildOf(const SubclassIdentifier<B> identifier); 85 template <class B> bool isParentOf(const SubclassIdentifier<B> identifier); 86 template <class B> bool isDirectParentOf(const SubclassIdentifier<B> identifier); 74 template <class B> inline bool isA(const SubclassIdentifier<B>* identifier) 75 { return this->isA(*identifier); } 76 template <class B> inline bool isExactlyA(const SubclassIdentifier<B>* identifier) 77 { return this->isExactlyA(*identifier); } 78 template <class B> inline bool isChildOf(const SubclassIdentifier<B>* identifier) 79 { return this->isChildOf(*identifier); } 80 template <class B> inline bool isDirectChildOf(const SubclassIdentifier<B>* identifier) 81 { return this->isDirectChildOf(*identifier); } 82 template <class B> inline bool isParentOf(const SubclassIdentifier<B>* identifier) 83 { return this->isParentOf(*identifier); } 84 template <class B> inline bool isDirectParentOf(const SubclassIdentifier<B>* identifier) 85 { return this->isDirectParentOf(*identifier); } 87 86 88 87 bool isA(const OrxonoxClass* object); … … 100 99 Returns NULL if the no pointer was found. 101 100 */ 102 template <class T> 103 FORCEINLINE T* getDerivedPointer(unsigned int classID) 101 FORCEINLINE void* getDerivedPointer(unsigned int classID) 104 102 { 105 103 for (int i = this->objectPointers_.size() - 1; i >= 0; --i) 106 104 { 107 105 if (this->objectPointers_[i].first == classID) 108 return static_cast<T*>(this->objectPointers_[i].second);106 return this->objectPointers_[i].second; 109 107 } 110 108 return NULL; 111 109 } 112 //! Const version of getDerivedPointer 113 template <class T> 114 FORCEINLINE const T* getDerivedPointer(unsigned int classID) const 115 { 116 return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); 117 } 110 111 //! Version of getDerivedPointer with template 112 template <class T> FORCEINLINE T* getDerivedPointer(unsigned int classID) 113 { return static_cast<T*>(this->getDerivedPointer(classID)); } 114 //! Const version of getDerivedPointer with template 115 template <class T> FORCEINLINE const T* getDerivedPointer(unsigned int classID) const 116 { return const_cast<OrxonoxClass*>(this)->getDerivedPointer<T>(classID); } 118 117 119 118 private: -
sandbox/src/libraries/core/PathConfig.cc
r6035 r6038 70 70 PathConfig* PathConfig::singletonPtr_s = 0; 71 71 72 SetCommandLineArgument(externalDataPath, "").information("Path to the external data files");73 72 SetCommandLineOnlyArgument(writingPathSuffix, "").information("Additional subfolder for config and log files"); 74 73 … … 78 77 , modulePath_(*(new bf::path())) 79 78 , dataPath_(*(new bf::path())) 80 , externalDataPath_(*(new bf::path()))81 79 , configPath_(*(new bf::path())) 82 80 , logPath_(*(new bf::path())) … … 172 170 delete &modulePath_; 173 171 delete &dataPath_; 174 delete &externalDataPath_;175 172 delete &configPath_; 176 173 delete &logPath_; … … 184 181 configPath_ = specialConfig::configDevDirectory; 185 182 logPath_ = specialConfig::logDevDirectory; 186 187 // Check for data path override by the command line188 if (!CommandLineParser::getArgument("externalDataPath")->hasDefaultValue())189 externalDataPath_ = CommandLineParser::getValue("externalDataPath").getString();190 else191 externalDataPath_ = specialConfig::externalDataDevDirectory;192 183 } 193 184 else … … 302 293 } 303 294 304 /*static*/ std::string PathConfig::getExternalDataPathString()305 {306 return getInstance().externalDataPath_.string() + '/';307 }308 309 295 /*static*/ std::string PathConfig::getConfigPathString() 310 296 { -
sandbox/src/libraries/core/PathConfig.h
r6035 r6038 77 77 static const boost::filesystem::path& getDataPath() 78 78 { return getInstance().dataPath_; } 79 //! Returns the path to the external data files as boost::filesystem::path80 static const boost::filesystem::path& getExternalDataPath()81 { return getInstance().externalDataPath_; }82 79 //! Returns the path to the config files as boost::filesystem::path 83 80 static const boost::filesystem::path& getConfigPath() … … 96 93 //! Returns the path to the data files as std::string 97 94 static std::string getDataPathString(); 98 //! Returns the path to the external data files as std::string99 static std::string getExternalDataPathString();100 95 //! Returns the path to the config files as std::string 101 96 static std::string getConfigPathString(); … … 126 121 boost::filesystem::path& modulePath_; //!< Path to the modules 127 122 boost::filesystem::path& dataPath_; //!< Path to the data files folder 128 boost::filesystem::path& externalDataPath_; //!< Path to the external data files folder129 123 boost::filesystem::path& configPath_; //!< Path to the config files folder 130 124 boost::filesystem::path& logPath_; //!< Path to the log files folder -
sandbox/src/libraries/util/CMakeLists.txt
r5782 r6038 19 19 20 20 SET_SOURCE_FILES(UTIL_SRC_FILES 21 CRC32.cc22 21 Exception.cc 23 ExprParser.cc24 22 Math.cc 25 23 MultiType.cc 24 Scope.cc 25 StringUtils.cc 26 COMPILATION_BEGIN StableCompilation.cc 27 Clock.cc 28 CRC32.cc 29 ExprParser.cc 26 30 OutputBuffer.cc 27 31 OutputHandler.cc 28 Scope.cc29 32 SignalHandler.cc 30 33 Sleep.cc 31 StringUtils.cc32 34 SubString.cc 35 COMPILATION_END 33 36 ) 34 37 -
sandbox/src/libraries/util/Clock.h
r6035 r6038 31 31 32 32 #include "UtilPrereqs.h" 33 #include "OgreForwardRefs.h" 33 34 namespace Ogre { class Timer; } 34 35 35 36 namespace orxonox -
sandbox/src/libraries/util/Scope.h
r5738 r6038 31 31 32 32 #include "UtilPrereqs.h" 33 33 34 #include <cassert> 35 #include <map> 34 36 #include <set> 35 #include <map> 37 36 38 #include "Debug.h" 39 #include "ScopeGuard.h" 37 40 38 41 namespace orxonox 39 42 { 40 namespace ScopeID41 {42 /**43 @brief A list of available scopes for the Scope template.44 */45 enum Value46 {47 GSRoot,48 GSGraphics,49 GSLevel50 };51 }52 53 class ScopeListener; // Forward declaration54 55 43 /** 56 44 @brief The ScopeManager stores the variables of the scope templates in a statically linked context. … … 77 65 protected: 78 66 //! Constructor: Registers the instance. 79 ScopeListener(ScopeID::Value scope) : scope_(scope) 67 ScopeListener(ScopeID::Value scope) : scope_(scope), bActivated_(false) 80 68 { ScopeManager::listeners_s[this->scope_].insert(this); } 81 69 //! Destructor: Unregisters the instance. … … 90 78 private: 91 79 ScopeID::Value scope_; //!< Store the scope to unregister on destruction 80 bool bActivated_; 92 81 }; 93 82 … … 105 94 Scope() 106 95 { 107 ScopeManager::instanceCounts_s[scope]++; 108 assert(ScopeManager::instanceCounts_s[scope] > 0); 109 if (ScopeManager::instanceCounts_s[scope] == 1) 96 try 110 97 { 111 for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); ) 112 (*(it++))->activated(); 98 ScopeManager::instanceCounts_s[scope]++; 99 assert(ScopeManager::instanceCounts_s[scope] > 0); 100 if (ScopeManager::instanceCounts_s[scope] == 1) 101 { 102 Loki::ScopeGuard deactivator = Loki::MakeObjGuard(*this, &Scope::deactivateListeners); 103 for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); ) 104 { 105 (*it)->activated(); 106 (*(it++))->bActivated_ = true; 107 } 108 deactivator.Dismiss(); 109 } 110 } 111 catch (...) 112 { 113 ScopeManager::instanceCounts_s[scope]--; 114 throw; 113 115 } 114 116 } … … 125 127 126 128 if (ScopeManager::instanceCounts_s[scope] == 0) 129 this->deactivateListeners(); 130 } 131 132 void deactivateListeners() 133 { 134 for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); ) 127 135 { 128 for (typename std::set<ScopeListener*>::iterator it = ScopeManager::listeners_s[scope].begin(); it != ScopeManager::listeners_s[scope].end(); ) 129 (*(it++))->deactivated(); 136 if ((*it)->bActivated_) 137 { 138 try 139 { (*it)->deactivated(); } 140 catch (...) 141 { COUT(0) << "ScopeListener::deactivated() failed! This MUST NOT happen, fix it!" << std::endl; } 142 (*(it++))->bActivated_ = false; 143 } 144 else 145 ++it; 130 146 } 131 147 } -
sandbox/src/libraries/util/UtilPrereqs.h
r5738 r6038 28 28 29 29 /** 30 @file 31 @brief Contains all the necessary forward declarations for all classes and structs. 30 @file 31 @brief 32 Shared library macros, enums, constants and forward declarations for the util library 32 33 */ 33 34 … … 40 41 // Shared library settings 41 42 //----------------------------------------------------------------------- 43 42 44 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD ) 43 45 # ifdef UTIL_SHARED_BUILD … … 56 58 #endif 57 59 60 //----------------------------------------------------------------------- 61 // Enums 62 //----------------------------------------------------------------------- 63 64 namespace orxonox 65 { 66 namespace ScopeID 67 { 68 //!A list of available scopes for the Scope template. 69 enum Value 70 { 71 Root, 72 Graphics 73 }; 74 } 75 } 58 76 59 77 //----------------------------------------------------------------------- … … 63 81 namespace orxonox 64 82 { 83 class Clock; 65 84 class Exception; 66 85 class ExprParser; … … 71 90 class OutputBufferListener; 72 91 class OutputHandler; 92 template <ScopeID::Value> 93 class Scope; 94 template <class, ScopeID::Value> 95 class ScopedSingleton; 96 class ScopeListener; 73 97 class SignalHandler; 98 template <class T> 99 class Singleton; 74 100 class SubString; 75 101 } -
sandbox/src/orxonox/GSRoot.cc
r5782 r6038 29 29 #include "GSRoot.h" 30 30 31 #include " core/Clock.h"31 #include "util/Clock.h" 32 32 #include "core/Game.h" 33 33 -
sandbox/src/orxonox/Main.cc
r5782 r6038 31 31 @file 32 32 @brief 33 The main function of Orxonox .33 The main function of Orxonox (but not the entry point of the program!) 34 34 */ 35 35 36 36 #include "OrxonoxPrereqs.h" 37 #include "SpecialConfig.h"38 37 39 #include "util/Exception.h" 40 #include "core/CommandLine.h" 38 #include "core/CommandLineParser.h" 41 39 #include "core/Game.h" 42 40 #include "core/LuaState.h" … … 47 45 /** 48 46 @brief 49 Main method. Game starts here (except for static initialisations).47 Starting point of orxonox (however not the entry point of the program!) 50 48 */ 51 49 int main(const std::string& strCmdLine) -
sandbox/src/orxonox/OrxonoxPrereqs.h
r5782 r6038 28 28 29 29 /** 30 @file 31 @brief Contains all the necessary forward declarations for all classes and structs. 30 @file 31 @brief 32 Shared library macros, enums, constants and forward declarations for the orxonox library 32 33 */ 33 34 … … 36 37 37 38 #include "OrxonoxConfig.h" 38 39 39 //----------------------------------------------------------------------- 40 40 // Shared library settings 41 41 //----------------------------------------------------------------------- 42 42 43 #if defined(ORXONOX_PLATFORM_WINDOWS) && !defined(ORXONOX_STATIC_BUILD) 43 44 # ifdef ORXONOX_SHARED_BUILD … … 63 64 { 64 65 class CameraManager; 66 class Level; 65 67 class LevelManager; 66 68 class PawnManager; 67 69 class PlayerManager; 68 69 class Level; 70 class Radar; 70 71 class Scene; 71 class Tickable; 72 73 // collisionshapes 74 class CollisionShape; 75 class CompoundCollisionShape; 76 class WorldEntityCollisionShape; 77 78 // controllers 79 class AIController; 80 class ArtificialController; 81 class Controller; 82 class HumanController; 83 class ScriptController; 84 class WaypointController; 85 class WaypointPatrolController; 86 87 // gametypes 88 class Asteroids; 89 class Deathmatch; 90 class Gametype; 91 class TeamBaseMatch; 92 class TeamDeathmatch; 93 class UnderAttack; 94 95 // graphics 96 class Backlight; 97 class Billboard; 98 class BlinkingBillboard; 99 class Camera; 100 class FadingBillboard; 101 class GlobalShader; 102 class Light; 103 class Model; 104 class ParticleEmitter; 105 class ParticleSpawner; 106 107 // infos 108 class Bot; 109 class GametypeInfo; 110 class HumanPlayer; 111 class Info; 112 class PlayerInfo; 72 113 73 114 // interfaces 74 115 class GametypeMessageListener; 75 116 class NotificationListener; 76 class PawnListener;77 117 class PlayerTrigger; 78 118 class RadarListener; 79 119 class RadarViewable; 80 120 class Rewardable; 81 class Teamcolourable; 82 83 // worldentities 84 class WorldEntity; 85 class StaticEntity; 86 class MobileEntity; 87 class ControllableEntity; 88 class MovableEntity; 89 90 // graphics 91 class Model; 92 class Billboard; 93 class BlinkingBillboard; 94 class BigExplosion; 95 class ExplosionChunk; 96 class FadingBillboard; 97 class GlobalShader; 98 class Light; 99 class Backlight; 100 class ParticleEmitter; 101 class ParticleSpawner; 102 class Camera; 103 104 // mixed 105 class SpawnPoint; 106 class TeamSpawnPoint; 107 108 class CameraPosition; 109 class Sublevel; 110 class Radar; 111 112 class Test; 113 114 // pawns 115 class Spectator; 116 class Pawn; 117 class SpaceShip; 118 class TeamBaseMatchBase; 119 class Destroyer; 120 121 // gametypes 122 class Gametype; 123 class Deathmatch; 124 class TeamDeathmatch; 125 class Asteroids; 126 class TeamBaseMatch; 127 class UnderAttack; 128 129 // pickups 121 class TeamColourable; 122 123 // items 124 class Engine; 125 class Item; 126 class MultiStateEngine; 127 128 // overlays 129 class InGameConsole; 130 class Map; 131 class OrxonoxOverlay; 132 class OverlayGroup; 133 134 // pickup 130 135 class BaseItem; 131 136 class DroppedItem; … … 137 142 class PickupSpawner; 138 143 class UsableItem; 139 144 // pickup, items 145 class HealthImmediate; 146 class HealthUsable; 140 147 class Jump; 141 class HealthUsable; 142 class PassiveItem; 143 144 // items 145 class Item; 146 class Engine; 147 class MultiStateEngine; 148 class RotatingEngine; 148 149 //sound 150 class AmbientSound; 151 class BaseSound; 152 class SoundManager; 153 class WorldSound; 149 154 150 155 // weaponsystem 151 class WeaponSystem; 156 class DefaultWeaponmodeLink; 157 class Munition; 158 class Weapon; 159 class WeaponMode; 160 class WeaponPack; 152 161 class WeaponSet; 153 162 class WeaponSlot; 154 class WeaponPack; 155 class Weapon; 156 class WeaponMode; 157 class DefaultWeaponmodeLink; 158 class Munition; 159 160 // controller 161 class Controller; 162 class HumanController; 163 class ArtificialController; 164 class AIController; 165 class ScriptController; 166 class WaypointController; 167 class WaypointPatrolController; 168 169 // infos 170 class Info; 171 class PlayerInfo; 172 class HumanPlayer; 173 class Bot; 174 class GametypeInfo; 175 176 // collision 177 class CollisionShape; 178 class CompoundCollisionShape; 179 class WorldEntityCollisionShape; 180 181 // overlays 182 class OverlayGroup; 183 class OrxonoxOverlay; 184 class Notification; 185 class NotificationManager; 186 class InGameConsole; 187 class Map; 188 189 //sound 190 class SoundBase; 191 class SoundManager; 192 class SoundMainMenu; 163 class WeaponSystem; 164 165 // worldentities 166 class BigExplosion; 167 class CameraPosition; 168 class ControllableEntity; 169 class ExplosionChunk; 170 class MobileEntity; 171 class MovableEntity; 172 class SpawnPoint; 173 class StaticEntity; 174 class TeamSpawnPoint; 175 class WorldEntity; 176 // worldentities, pawns 177 class Destroyer; 178 class Pawn; 179 class SpaceShip; 180 class Spectator; 181 class TeamBaseMatchBase; 193 182 } 194 183
Note: See TracChangeset
for help on using the changeset viewer.