Changeset 2848 for code/branches
- Timestamp:
- Mar 25, 2009, 7:37:00 PM (16 years ago)
- Location:
- code/branches/gui/src
- Files:
-
- 43 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/CMakeLists.txt
r2844 r2848 25 25 Event.cc 26 26 Game.cc 27 GameMode.cc 27 28 GameState.cc 28 29 Language.cc -
code/branches/gui/src/core/Core.cc
r2846 r2848 81 81 static boost::filesystem::path logPath_g; //!< Path to the log file folder 82 82 83 bool Core::bShowsGraphics_s = false;84 bool Core::bHasServer_s = false;85 bool Core::bIsClient_s = false;86 bool Core::bIsStandalone_s = false;87 bool Core::bIsMaster_s = false;88 89 83 Core* Core::singletonRef_s = 0; 90 84 -
code/branches/gui/src/core/Core.h
r2846 r2848 83 83 static std::string getLogPathString(); 84 84 85 // fast access global variables.86 static bool showsGraphics() { return bShowsGraphics_s; }87 static bool hasServer() { return bHasServer_s; }88 static bool isClient() { return bIsClient_s; }89 static bool isStandalone() { return bIsStandalone_s; }90 static bool isMaster() { return bIsMaster_s; }91 static void setShowsGraphics(bool val) { bShowsGraphics_s = val; updateIsMaster(); }92 static void setHasServer (bool val) { bHasServer_s = val; updateIsMaster(); }93 static void setIsClient (bool val) { bIsClient_s = val; updateIsMaster(); }94 static void setIsStandalone (bool val) { bIsStandalone_s = val; updateIsMaster(); }95 static void updateIsMaster () { bIsMaster_s = (bHasServer_s || bIsStandalone_s); }96 97 85 private: 98 86 Core(const Core&); … … 129 117 bool loaded_; //!< Only true if constructor was interrupted 130 118 131 static bool bShowsGraphics_s; //!< global variable that tells whether to show graphics132 static bool bHasServer_s; //!< global variable that tells whether this is a server133 static bool bIsClient_s;134 static bool bIsStandalone_s;135 static bool bIsMaster_s;136 137 119 static Core* singletonRef_s; 138 120 }; -
code/branches/gui/src/core/GameMode.cc
r2843 r2848 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau24 23 * Reto Grieder 25 24 * Co-authors: … … 30 29 /** 31 30 @file 32 @brief Implementation of the Core class.31 @brief Implementation of the GameMode class. 33 32 */ 34 33 35 #include "Core.h" 36 37 #include <cassert> 38 #include <fstream> 39 #include <cstdlib> 40 #include <cstdio> 41 #include <boost/filesystem.hpp> 42 43 #ifdef ORXONOX_PLATFORM_WINDOWS 44 # ifndef WIN32_LEAN_AND_MEAN 45 # define WIN32_LEAN_AND_MEAN 46 # endif 47 # include <windows.h> 48 #elif defined(ORXONOX_PLATFORM_APPLE) 49 # include <sys/param.h> 50 # include <mach-o/dyld.h> 51 #else /* Linux */ 52 # include <sys/types.h> 53 # include <unistd.h> 54 #endif 55 56 #include "SpecialConfig.h" 57 #include "util/Debug.h" 58 #include "util/Exception.h" 59 #include "util/SignalHandler.h" 60 #include "Clock.h" 61 #include "CommandExecutor.h" 62 #include "CommandLine.h" 63 #include "ConfigFileManager.h" 64 #include "ConfigValueIncludes.h" 65 #include "CoreIncludes.h" 66 #include "Factory.h" 67 #include "Identifier.h" 68 #include "Language.h" 69 #include "LuaBind.h" 70 #include "Shell.h" 71 #include "TclBind.h" 72 #include "TclThreadManager.h" 34 #include "GameMode.h" 73 35 74 36 namespace orxonox 75 37 { 76 //! Path to the parent directory of the ones above if program was installed with relativ pahts 77 static boost::filesystem::path rootPath_g; 78 static boost::filesystem::path executablePath_g; //!< Path to the executable 79 static boost::filesystem::path mediaPath_g; //!< Path to the media file folder 80 static boost::filesystem::path configPath_g; //!< Path to the config file folder 81 static boost::filesystem::path logPath_g; //!< Path to the log file folder 82 83 bool Core::bShowsGraphics_s = false; 84 bool Core::bHasServer_s = false; 85 bool Core::bIsClient_s = false; 86 bool Core::bIsStandalone_s = false; 87 bool Core::bIsMaster_s = false; 88 89 Core* Core::singletonRef_s = 0; 90 91 SetCommandLineArgument(mediaPath, "").information("PATH"); 92 SetCommandLineArgument(writingPathSuffix, "").information("DIR"); 93 SetCommandLineArgument(settingsFile, "orxonox.ini"); 94 SetCommandLineArgument(limitToCPU, 0).information("0: off | #cpu"); 95 96 Core::Core() 97 { 98 RegisterRootObject(Core); 99 100 assert(Core::singletonRef_s == 0); 101 Core::singletonRef_s = this; 102 } 103 104 Clock* Core::initialise(int argc, char** argv) 105 { 106 // Set up a basic clock to keep time 107 this->gameClock_ = new Clock(); 108 109 // Parse command line arguments fist 110 try 111 { 112 CommandLine::parseAll(argc, argv); 113 } 114 catch (ArgumentException& ex) 115 { 116 COUT(1) << ex.what() << std::endl; 117 COUT(0) << "Usage:" << std::endl << "orxonox " << CommandLine::getUsageInformation() << std::endl; 118 } 119 120 // limit the main thread to the first core so that QueryPerformanceCounter doesn't jump 121 // do this after ogre has initialised. Somehow Ogre changes the settings again (not through 122 // the timer though). 123 int limitToCPU = CommandLine::getValue("limitToCPU"); 124 if (limitToCPU > 0) 125 setThreadAffinity((unsigned int)limitToCPU); 126 127 // Determine and set the location of the executable 128 setExecutablePath(); 129 130 // Determine whether we have an installed or a binary dir run 131 // The latter occurs when simply running from the build directory 132 checkDevBuild(); 133 134 // Make sure the directories we write in exist or else make them 135 createDirectories(); 136 137 // create a signal handler (only active for linux) 138 // This call is placed as soon as possible, but after the directories are set 139 this->signalHandler_ = new SignalHandler(); 140 this->signalHandler_->doCatch(executablePath_g.string(), Core::getLogPathString() + "orxonox_crash.log"); 141 142 // Set the correct log path. Before this call, /tmp (Unix) or %TEMP% was used 143 OutputHandler::getOutStream().setLogPath(Core::getLogPathString()); 144 145 // Manage ini files and set the default settings file (usually orxonox.ini) 146 this->configFileManager_ = new ConfigFileManager(); 147 this->configFileManager_->setFilename(ConfigFileType::Settings, 148 CommandLine::getValue("settingsFile").getString()); 149 150 this->languageInstance_ = new Language(); 151 152 // Do this soon after the ConfigFileManager has been created to open up the 153 // possibility to configure everything below here 154 this->setConfigValues(); 155 156 // Possible media path override by the command line 157 if (!CommandLine::getArgument("mediaPath")->hasDefaultValue()) 158 { 159 //std::string mediaPath = CommandLine::getValue("mediaPath"); 160 Core::tsetMediaPath(CommandLine::getValue("mediaPath")); 161 } 162 163 // Create the lua interface 164 this->luaBind_ = new LuaBind(); 165 166 // initialise Tcl 167 this->tclBind_ = new TclBind(Core::getMediaPathString()); 168 this->tclThreadManager_ = new TclThreadManager(tclBind_->getTclInterpreter()); 169 170 // create a shell 171 this->shell_ = new Shell(); 172 173 // creates the class hierarchy for all classes with factories 174 Factory::createClassHierarchy(); 175 176 this->loaded_ = true; 177 178 // Return non const pointer to the game's clock for the main loop 179 return this->gameClock_; 180 } 181 182 /** 183 @brief Sets the bool to true to avoid static functions accessing a deleted object. 184 */ 185 Core::~Core() 186 { 187 this->loaded_ = false; 188 189 delete this->shell_; 190 delete this->tclThreadManager_; 191 delete this->tclBind_; 192 delete this->luaBind_; 193 delete this->languageInstance_; 194 delete this->configFileManager_; 195 delete this->signalHandler_; 196 197 // Destroy command line arguments 198 CommandLine::destroyAllArguments(); 199 // Also delete external console command that don't belong to an Identifier 200 CommandExecutor::destroyExternalCommands(); 201 202 delete this->gameClock_; 203 204 assert(Core::singletonRef_s); 205 Core::singletonRef_s = 0; 206 } 207 208 /** 209 @brief Function to collect the SetConfigValue-macro calls. 210 */ 211 void Core::setConfigValues() 212 { 213 #ifdef NDEBUG 214 const unsigned int defaultLevelConsole = 1; 215 const unsigned int defaultLevelLogfile = 3; 216 const unsigned int defaultLevelShell = 1; 217 #else 218 const unsigned int defaultLevelConsole = 3; 219 const unsigned int defaultLevelLogfile = 4; 220 const unsigned int defaultLevelShell = 3; 221 #endif 222 SetConfigValue(softDebugLevelConsole_, defaultLevelConsole) 223 .description("The maximal level of debug output shown in the console").callback(this, &Core::debugLevelChanged); 224 SetConfigValue(softDebugLevelLogfile_, defaultLevelLogfile) 225 .description("The maximal level of debug output shown in the logfile").callback(this, &Core::debugLevelChanged); 226 SetConfigValue(softDebugLevelShell_, defaultLevelShell) 227 .description("The maximal level of debug output shown in the ingame shell").callback(this, &Core::debugLevelChanged); 228 229 SetConfigValue(language_, Language::getLanguage().defaultLanguage_).description("The language of the ingame text").callback(this, &Core::languageChanged); 230 SetConfigValue(bInitializeRandomNumberGenerator_, true).description("If true, all random actions are different each time you start the game").callback(this, &Core::initializeRandomNumberGenerator); 231 232 SetConfigValue(mediaPathString_, mediaPath_g.string()) 233 .description("Relative path to the game data.").callback(this, &Core::mediaPathChanged); 234 } 235 236 /** 237 @brief Callback function if the debug level has changed. 238 */ 239 void Core::debugLevelChanged() 240 { 241 // softDebugLevel_ is the maximum of the 3 variables 242 this->softDebugLevel_ = this->softDebugLevelConsole_; 243 if (this->softDebugLevelLogfile_ > this->softDebugLevel_) 244 this->softDebugLevel_ = this->softDebugLevelLogfile_; 245 if (this->softDebugLevelShell_ > this->softDebugLevel_) 246 this->softDebugLevel_ = this->softDebugLevelShell_; 247 248 OutputHandler::setSoftDebugLevel(OutputHandler::LD_All, this->softDebugLevel_); 249 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Console, this->softDebugLevelConsole_); 250 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Logfile, this->softDebugLevelLogfile_); 251 OutputHandler::setSoftDebugLevel(OutputHandler::LD_Shell, this->softDebugLevelShell_); 252 } 253 254 /** 255 @brief Callback function if the language has changed. 256 */ 257 void Core::languageChanged() 258 { 259 // Read the translation file after the language was configured 260 Language::getLanguage().readTranslatedLanguageFile(); 261 } 262 263 /** 264 @brief 265 Callback function if the media path has changed. 266 */ 267 void Core::mediaPathChanged() 268 { 269 mediaPath_g = boost::filesystem::path(this->mediaPathString_); 270 } 271 272 /** 273 @brief Returns the softDebugLevel for the given device (returns a default-value if the class ist right about to be created). 274 @param device The device 275 @return The softDebugLevel 276 */ 277 int Core::getSoftDebugLevel(OutputHandler::OutputDevice device) 278 { 279 switch (device) 280 { 281 case OutputHandler::LD_All: 282 return Core::getInstance().softDebugLevel_; 283 case OutputHandler::LD_Console: 284 return Core::getInstance().softDebugLevelConsole_; 285 case OutputHandler::LD_Logfile: 286 return Core::getInstance().softDebugLevelLogfile_; 287 case OutputHandler::LD_Shell: 288 return Core::getInstance().softDebugLevelShell_; 289 default: 290 assert(0); 291 return 2; 292 } 293 } 294 295 /** 296 @brief Sets the softDebugLevel for the given device. Please use this only temporary and restore the value afterwards, as it overrides the configured value. 297 @param device The device 298 @param level The level 299 */ 300 void Core::setSoftDebugLevel(OutputHandler::OutputDevice device, int level) 301 { 302 if (device == OutputHandler::LD_All) 303 Core::getInstance().softDebugLevel_ = level; 304 else if (device == OutputHandler::LD_Console) 305 Core::getInstance().softDebugLevelConsole_ = level; 306 else if (device == OutputHandler::LD_Logfile) 307 Core::getInstance().softDebugLevelLogfile_ = level; 308 else if (device == OutputHandler::LD_Shell) 309 Core::getInstance().softDebugLevelShell_ = level; 310 311 OutputHandler::setSoftDebugLevel(device, level); 312 } 313 314 /** 315 @brief Returns the configured language. 316 */ 317 const std::string& Core::getLanguage() 318 { 319 return Core::getInstance().language_; 320 } 321 322 /** 323 @brief Sets the language in the config-file back to the default. 324 */ 325 void Core::resetLanguage() 326 { 327 Core::getInstance().resetLanguageIntern(); 328 } 329 330 /** 331 @brief Sets the language in the config-file back to the default. 332 */ 333 void Core::resetLanguageIntern() 334 { 335 ResetConfigValue(language_); 336 } 337 338 /** 339 @brief 340 Temporary sets the media path 341 @param path 342 The new media path 343 */ 344 void Core::_tsetMediaPath(const std::string& path) 345 { 346 ModifyConfigValue(mediaPathString_, tset, path); 347 } 348 349 /*static*/ const boost::filesystem::path& Core::getMediaPath() 350 { 351 return mediaPath_g; 352 } 353 /*static*/ std::string Core::getMediaPathString() 354 { 355 return mediaPath_g.string() + '/'; 356 } 357 358 /*static*/ const boost::filesystem::path& Core::getConfigPath() 359 { 360 return configPath_g; 361 } 362 /*static*/ std::string Core::getConfigPathString() 363 { 364 return configPath_g.string() + '/'; 365 } 366 367 /*static*/ const boost::filesystem::path& Core::getLogPath() 368 { 369 return logPath_g; 370 } 371 /*static*/ std::string Core::getLogPathString() 372 { 373 return logPath_g.string() + '/'; 374 } 375 376 void Core::initializeRandomNumberGenerator() 377 { 378 static bool bInitialized = false; 379 if (!bInitialized && this->bInitializeRandomNumberGenerator_) 380 { 381 srand(time(0)); 382 rand(); 383 bInitialized = true; 384 } 385 } 386 387 388 /** 389 @note 390 The code of this function has been copied and adjusted from OGRE, an open source graphics engine. 391 (Object-oriented Graphics Rendering Engine) 392 For the latest info, see http://www.ogre3d.org/ 393 394 Copyright (c) 2000-2008 Torus Knot Software Ltd 395 396 OGRE is licensed under the LGPL. For more info, see OGRE license. 397 */ 398 void Core::setThreadAffinity(int limitToCPU) 399 { 400 if (limitToCPU <= 0) 401 return; 402 403 #ifdef ORXONOX_PLATFORM_WINDOWS 404 unsigned int coreNr = limitToCPU - 1; 405 // Get the current process core mask 406 DWORD procMask; 407 DWORD sysMask; 408 # if _MSC_VER >= 1400 && defined (_M_X64) 409 GetProcessAffinityMask(GetCurrentProcess(), (PDWORD_PTR)&procMask, (PDWORD_PTR)&sysMask); 410 # else 411 GetProcessAffinityMask(GetCurrentProcess(), &procMask, &sysMask); 412 # endif 413 414 // If procMask is 0, consider there is only one core available 415 // (using 0 as procMask will cause an infinite loop below) 416 if (procMask == 0) 417 procMask = 1; 418 419 // if the core specified with coreNr is not available, take the lowest one 420 if (!(procMask & (1 << coreNr))) 421 coreNr = 0; 422 423 // Find the lowest core that this process uses and coreNr suggests 424 DWORD threadMask = 1; 425 while ((threadMask & procMask) == 0 || (threadMask < (1u << coreNr))) 426 threadMask <<= 1; 427 428 // Set affinity to the first core 429 SetThreadAffinityMask(GetCurrentThread(), threadMask); 430 #endif 431 } 432 433 /** 434 @brief 435 Compares the executable path with the working directory 436 */ 437 void Core::setExecutablePath() 438 { 439 #ifdef ORXONOX_PLATFORM_WINDOWS 440 // get executable module 441 TCHAR buffer[1024]; 442 if (GetModuleFileName(NULL, buffer, 1024) == 0) 443 ThrowException(General, "Could not retrieve executable path."); 444 445 #elif defined(ORXONOX_PLATFORM_APPLE) 446 char buffer[1024]; 447 unsigned long path_len = 1023; 448 if (_NSGetExecutablePath(buffer, &path_len)) 449 ThrowException(General, "Could not retrieve executable path."); 450 451 #else /* Linux */ 452 /* written by Nicolai Haehnle <prefect_@gmx.net> */ 453 454 /* Get our PID and build the name of the link in /proc */ 455 char linkname[64]; /* /proc/<pid>/exe */ 456 if (snprintf(linkname, sizeof(linkname), "/proc/%i/exe", getpid()) < 0) 457 { 458 /* This should only happen on large word systems. I'm not sure 459 what the proper response is here. 460 Since it really is an assert-like condition, aborting the 461 program seems to be in order. */ 462 assert(false); 463 } 464 465 /* Now read the symbolic link */ 466 char buffer[1024]; 467 int ret; 468 ret = readlink(linkname, buffer, 1024); 469 /* In case of an error, leave the handling up to the caller */ 470 if (ret == -1) 471 ThrowException(General, "Could not retrieve executable path."); 472 473 /* Ensure proper NUL termination */ 474 buffer[ret] = 0; 475 #endif 476 477 executablePath_g = boost::filesystem::path(buffer); 478 #ifndef ORXONOX_PLATFORM_APPLE 479 executablePath_g = executablePath_g.branch_path(); // remove executable name 480 #endif 481 } 482 483 /** 484 @brief 485 Checks for "orxonox_dev_build.keep_me" in the executable diretory. 486 If found it means that this is not an installed run, hence we 487 don't write the logs and config files to ~/.orxonox 488 */ 489 void Core::checkDevBuild() 490 { 491 if (boost::filesystem::exists(executablePath_g / "orxonox_dev_build.keep_me")) 492 { 493 COUT(1) << "Running from the build tree." << std::endl; 494 Core::isDevBuild_ = true; 495 mediaPath_g = ORXONOX_MEDIA_DEV_PATH; 496 configPath_g = ORXONOX_CONFIG_DEV_PATH; 497 logPath_g = ORXONOX_LOG_DEV_PATH; 498 } 499 else 500 { 501 #ifdef INSTALL_COPYABLE // --> relative paths 502 // Also set the root path 503 boost::filesystem::path relativeExecutablePath(ORXONOX_RUNTIME_INSTALL_PATH); 504 rootPath_g = executablePath_g; 505 while (!boost::filesystem::equivalent(rootPath_g / relativeExecutablePath, executablePath_g) || rootPath_g.empty()) 506 rootPath_g = rootPath_g.branch_path(); 507 if (rootPath_g.empty()) 508 ThrowException(General, "Could not derive a root directory. Might the binary installation directory contain '..' when taken relative to the installation prefix path?"); 509 510 // Using paths relative to the install prefix, complete them 511 mediaPath_g = rootPath_g / ORXONOX_MEDIA_INSTALL_PATH; 512 configPath_g = rootPath_g / ORXONOX_CONFIG_INSTALL_PATH; 513 logPath_g = rootPath_g / ORXONOX_LOG_INSTALL_PATH; 514 #else 515 // There is no root path, so don't set it at all 516 517 mediaPath_g = ORXONOX_MEDIA_INSTALL_PATH; 518 519 // Get user directory 520 # ifdef ORXONOX_PLATFORM_UNIX /* Apple? */ 521 char* userDataPathPtr(getenv("HOME")); 522 # else 523 char* userDataPathPtr(getenv("APPDATA")); 524 # endif 525 if (userDataPathPtr == NULL) 526 ThrowException(General, "Could not retrieve user data path."); 527 boost::filesystem::path userDataPath(userDataPathPtr); 528 userDataPath /= ".orxonox"; 529 530 configPath_g = userDataPath / ORXONOX_CONFIG_INSTALL_PATH; 531 logPath_g = userDataPath / ORXONOX_LOG_INSTALL_PATH; 532 #endif 533 } 534 535 // Option to put all the config and log files in a separate folder 536 if (!CommandLine::getArgument("writingPathSuffix")->hasDefaultValue()) 537 { 538 std::string directory(CommandLine::getValue("writingPathSuffix").getString()); 539 configPath_g = configPath_g / directory; 540 logPath_g = logPath_g / directory; 541 } 542 } 543 544 /* 545 @brief 546 Checks for the log and the config directory and creates them 547 if necessary. Otherwise me might have problems opening those files. 548 */ 549 void Core::createDirectories() 550 { 551 std::vector<std::pair<boost::filesystem::path, std::string> > directories; 552 directories.push_back(std::pair<boost::filesystem::path, std::string> 553 (boost::filesystem::path(configPath_g), "config")); 554 directories.push_back(std::pair<boost::filesystem::path, std::string> 555 (boost::filesystem::path(logPath_g), "log")); 556 557 for (std::vector<std::pair<boost::filesystem::path, std::string> >::iterator it = directories.begin(); 558 it != directories.end(); ++it) 559 { 560 if (boost::filesystem::exists(it->first) && !boost::filesystem::is_directory(it->first)) 561 { 562 ThrowException(General, std::string("The ") + it->second + " directory has been preoccupied by a file! \ 563 Please remove " + it->first.string()); 564 } 565 if (boost::filesystem::create_directories(it->first)) // function may not return true at all (bug?) 566 { 567 COUT(4) << "Created " << it->second << " directory" << std::endl; 568 } 569 } 570 } 571 572 void Core::update(const Clock& time) 573 { 574 this->tclThreadManager_->update(time); 575 } 38 bool GameMode::bShowsGraphics_s = false; 39 bool GameMode::bHasServer_s = false; 40 bool GameMode::bIsClient_s = false; 41 bool GameMode::bIsStandalone_s = false; 42 bool GameMode::bIsMaster_s = false; 576 43 } -
code/branches/gui/src/core/GameMode.h
r2843 r2848 21 21 * 22 22 * Author: 23 * Fabian 'x3n' Landau24 23 * Reto Grieder 25 24 * Co-authors: … … 30 29 /** 31 30 @file 32 @brief Declaration of the Core class. 33 34 The Core class is a singleton, only used to configure some variables 35 in the core through the config-file. 31 @brief Declaration of the GameMode class. 36 32 */ 37 33 38 #ifndef _ Core_H__39 #define _ Core_H__34 #ifndef _GameMode_H__ 35 #define _GameMode_H__ 40 36 41 37 #include "CorePrereqs.h" 42 38 43 #include <cassert>44 #include "OrxonoxClass.h"45 #include "util/OutputHandler.h"46 47 // Only allow main to access postMainInitialisation, so we need a forward declaration48 int main(int, char**);49 // boost::filesystem header has quite a large tail, use forward declaration50 namespace boost { namespace filesystem51 {52 struct path_traits;53 template<class String, class Traits> class basic_path;54 typedef basic_path< std::string, path_traits> path;55 } }56 57 39 namespace orxonox 58 40 { 59 //! The Core class is a singleton, only used to configure some config-values. 60 class _CoreExport Core : public OrxonoxClass 41 class _CoreExport GameMode 61 42 { 62 43 public: 63 Core();64 ~Core();65 66 Clock* initialise(int argc, char** argv);67 void setConfigValues();68 69 void update(const Clock& time);70 71 static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; }72 73 static int getSoftDebugLevel(OutputHandler::OutputDevice device = OutputHandler::LD_All);74 static void setSoftDebugLevel(OutputHandler::OutputDevice device, int level);75 static const std::string& getLanguage();76 static void resetLanguage();77 78 static const Clock& getGameClock() { return *getInstance().gameClock_; }79 80 static void tsetMediaPath(const std::string& path)81 { assert(singletonRef_s); singletonRef_s->_tsetMediaPath(path); }82 static const boost::filesystem::path& getMediaPath();83 static const boost::filesystem::path& getConfigPath();84 static const boost::filesystem::path& getLogPath();85 static std::string getMediaPathString();86 static std::string getConfigPathString();87 static std::string getLogPathString();88 89 // fast access global variables.90 44 static bool showsGraphics() { return bShowsGraphics_s; } 91 45 static bool hasServer() { return bHasServer_s; } … … 100 54 101 55 private: 102 Core(const Core&); 103 104 void checkDevBuild(); 105 void setExecutablePath(); 106 void createDirectories(); 107 void setThreadAffinity(int limitToCPU); 108 109 void resetLanguageIntern(); 110 void initializeRandomNumberGenerator(); 111 void debugLevelChanged(); 112 void languageChanged(); 113 void mediaPathChanged(); 114 void _tsetMediaPath(const std::string& path); 115 116 // Singletons 117 ConfigFileManager* configFileManager_; 118 Language* languageInstance_; 119 LuaBind* luaBind_; 120 Shell* shell_; 121 SignalHandler* signalHandler_; 122 TclBind* tclBind_; 123 TclThreadManager* tclThreadManager_; 124 125 Clock* gameClock_; 126 127 int softDebugLevel_; //!< The debug level 128 int softDebugLevelConsole_; //!< The debug level for the console 129 int softDebugLevelLogfile_; //!< The debug level for the logfile 130 int softDebugLevelShell_; //!< The debug level for the ingame shell 131 std::string language_; //!< The language 132 bool bInitializeRandomNumberGenerator_; //!< If true, srand(time(0)) is called 133 std::string mediaPathString_; //!< Path to the data/media file folder as string 134 bool isDevBuild_; //!< True for builds in the build directory (not installed) 135 bool loaded_; //!< Only true if constructor was interrupted 56 GameMode(); 57 GameMode(const GameMode& inst); 58 ~GameMode(); 136 59 137 60 static bool bShowsGraphics_s; //!< global variable that tells whether to show graphics … … 140 63 static bool bIsStandalone_s; 141 64 static bool bIsMaster_s; 142 143 static Core* singletonRef_s;144 65 }; 145 66 } 146 67 147 #endif /* _ Core_H__ */68 #endif /* _GameMode_H__ */ -
code/branches/gui/src/network/ClientConnectionListener.cc
r2846 r2848 29 29 #include "ClientConnectionListener.h" 30 30 #include "core/CoreIncludes.h" 31 #include "core/ Core.h"31 #include "core/GameMode.h" 32 32 33 33 namespace orxonox{ … … 39 39 40 40 void ClientConnectionListener::getConnectedClients(){ 41 if( Core::showsGraphics())41 if(GameMode::showsGraphics()) 42 42 this->clientConnected(0); //server client id 43 43 ClientInformation *client = ClientInformation::getBegin(); -
code/branches/gui/src/network/packet/Gamestate.cc
r2773 r2848 34 34 #include "../synchronisable/Synchronisable.h" 35 35 #include "../TrafficControl.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "core/CoreIncludes.h" 38 38 #include "core/Iterator.h" … … 162 162 if(!s) 163 163 { 164 if (! Core::isMaster())164 if (!GameMode::isMaster()) 165 165 { 166 166 Synchronisable::fabricate(mem, mode); -
code/branches/gui/src/network/synchronisable/SynchronisableVariable.cc
r2798 r2848 30 30 #include <cstring> 31 31 #include "util/Math.h" 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 34 34 … … 41 41 if ( state_ == 0x0 ) 42 42 { 43 state_ = Core::isMaster() ? 0x1 : 0x2; // set the appropriate mode here43 state_ = GameMode::isMaster() ? 0x1 : 0x2; // set the appropriate mode here 44 44 } 45 45 } -
code/branches/gui/src/orxonox/CameraManager.cc
r2834 r2848 35 35 #include <OgreResource.h> 36 36 37 #include "core/ Core.h"37 #include "core/GameMode.h" 38 38 #include "core/Iterator.h" 39 39 #include "objects/worldentities/Camera.h" … … 75 75 void CameraManager::requestFocus(Camera* camera) 76 76 { 77 if (! Core::showsGraphics())77 if (!GameMode::showsGraphics()) 78 78 return; 79 79 … … 100 100 void CameraManager::releaseFocus(Camera* camera) 101 101 { 102 if (! Core::showsGraphics())102 if (!GameMode::showsGraphics()) 103 103 return; 104 104 -
code/branches/gui/src/orxonox/GraphicsManager.cc
r2842 r2848 62 62 #include "core/CoreIncludes.h" 63 63 #include "core/Core.h" 64 #include "core/GameMode.h" 64 65 #include "tools/WindowEventListener.h" 65 66 #include "tools/ParticleInterface.h" … … 102 103 void GraphicsManager::initialise() 103 104 { 104 Core::setShowsGraphics(true);105 106 105 // Ogre setup procedure 107 106 setupOgre(); … … 156 155 this->ogreLogger_->destroyLog(Ogre::LogManager::getSingleton().getDefaultLog()); 157 156 delete this->ogreLogger_; 158 159 // Don't showing graphics anymore160 Core::setShowsGraphics(false);161 157 } 162 158 -
code/branches/gui/src/orxonox/PlayerManager.cc
r2662 r2848 31 31 32 32 #include "LevelManager.h" 33 #include "core/ Core.h"33 #include "core/GameMode.h" 34 34 #include "core/CoreIncludes.h" 35 35 #include "objects/Level.h" … … 58 58 void PlayerManager::clientConnected(unsigned int clientID) 59 59 { 60 if ( Core::isMaster())60 if (GameMode::isMaster()) 61 61 { 62 62 COUT(3) << "client connected" << std::endl; … … 77 77 void PlayerManager::clientDisconnected(unsigned int clientID) 78 78 { 79 if ( Core::isMaster())79 if (GameMode::isMaster()) 80 80 { 81 81 COUT(3) << "client disconnected" << std::endl; … … 97 97 PlayerInfo* PlayerManager::getClient(unsigned int clientID) const 98 98 { 99 if ( Core::isMaster())99 if (GameMode::isMaster()) 100 100 { 101 101 std::map<unsigned int, PlayerInfo*>::const_iterator it = this->clients_.find(clientID); -
code/branches/gui/src/orxonox/gamestates/GSClient.cc
r2846 r2848 33 33 #include "core/Clock.h" 34 34 #include "core/CommandLine.h" 35 #include "core/Core.h" 35 #include "core/Game.h" 36 #include "core/GameMode.h" 36 37 #include "network/Client.h" 37 #include "core/Game.h"38 38 39 39 namespace orxonox … … 55 55 void GSClient::activate() 56 56 { 57 Core::setIsClient(true);57 GameMode::setIsClient(true); 58 58 59 59 this->client_ = new Client(CommandLine::getValue("ip").getString(), CommandLine::getValue("port")); … … 72 72 delete this->client_; 73 73 74 Core::setIsClient(false);74 GameMode::setIsClient(false); 75 75 } 76 76 -
code/branches/gui/src/orxonox/gamestates/GSDedicated.cc
r2844 r2848 32 32 #include "core/Clock.h" 33 33 #include "core/CommandLine.h" 34 #include "core/Core.h" 34 #include "core/Game.h" 35 #include "core/GameMode.h" 35 36 #include "core/Iterator.h" 36 37 #include "network/Server.h" 37 38 #include "objects/Tickable.h" 38 39 #include "util/Sleep.h" 39 #include "core/Game.h"40 40 41 41 namespace orxonox … … 56 56 void GSDedicated::activate() 57 57 { 58 Core::setHasServer(true);58 GameMode::setHasServer(true); 59 59 60 60 this->server_ = new Server(CommandLine::getValue("port")); … … 69 69 delete this->server_; 70 70 71 Core::setHasServer(false);71 GameMode::setHasServer(false); 72 72 } 73 73 -
code/branches/gui/src/orxonox/gamestates/GSGUI.cc
r2845 r2848 33 33 #include "core/Clock.h" 34 34 #include "core/ConsoleCommand.h" 35 #include "core/Game.h" 35 36 #include "core/input/InputManager.h" 36 37 #include "core/input/SimpleInputState.h" 37 38 #include "gui/GUIManager.h" 38 39 #include "GraphicsManager.h" 39 #include "core/Game.h"40 40 41 41 namespace orxonox -
code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
r2847 r2848 38 38 #include "core/CoreIncludes.h" 39 39 #include "core/Game.h" 40 #include "core/GameMode.h" 40 41 #include "core/input/InputManager.h" 41 42 #include "core/input/KeyBinder.h" … … 74 75 void GSGraphics::activate() 75 76 { 76 Core::setShowsGraphics(true);77 GameMode::setShowsGraphics(true); 77 78 78 79 setConfigValues(); … … 128 129 delete graphicsManager_; 129 130 130 Core::setShowsGraphics(false);131 GameMode::setShowsGraphics(false); 131 132 } 132 133 -
code/branches/gui/src/orxonox/gamestates/GSLevel.cc
r2844 r2848 39 39 #include "core/CommandLine.h" 40 40 #include "core/ConfigValueIncludes.h" 41 #include "core/Core.h" 41 42 #include "core/CoreIncludes.h" 42 #include "core/Core.h" 43 #include "core/Game.h" 44 #include "core/GameMode.h" 43 45 #include "objects/Tickable.h" 44 46 #include "objects/Radar.h" … … 47 49 #include "LevelManager.h" 48 50 #include "PlayerManager.h" 49 #include "core/Game.h"50 51 51 52 namespace orxonox … … 83 84 setConfigValues(); 84 85 85 if ( Core::showsGraphics())86 if (GameMode::showsGraphics()) 86 87 { 87 88 inputState_ = InputManager::getInstance().createInputState<SimpleInputState>("game"); … … 99 100 this->playerManager_ = new PlayerManager(); 100 101 101 if ( Core::isMaster())102 if (GameMode::isMaster()) 102 103 { 103 104 // create the global LevelManager … … 107 108 } 108 109 109 if ( Core::showsGraphics())110 if (GameMode::showsGraphics()) 110 111 { 111 112 // TODO: insert slomo console command with … … 149 150 //Loader::close(); 150 151 151 if ( Core::showsGraphics())152 if (GameMode::showsGraphics()) 152 153 InputManager::getInstance().requestLeaveState("game"); 153 154 154 if ( Core::isMaster())155 if (GameMode::isMaster()) 155 156 this->unloadLevel(); 156 157 … … 179 180 } 180 181 181 if ( Core::showsGraphics())182 if (GameMode::showsGraphics()) 182 183 { 183 184 inputState_->setHandler(0); … … 240 241 void GSLevel::keybindInternal(const std::string& command, bool bTemporary) 241 242 { 242 if ( Core::showsGraphics())243 if (GameMode::showsGraphics()) 243 244 { 244 245 static std::string bindingString = ""; -
code/branches/gui/src/orxonox/gamestates/GSRoot.cc
r2846 r2848 33 33 #include "util/Debug.h" 34 34 #include "core/Clock.h" 35 #include "core/Core.h" 35 #include "core/Game.h" 36 #include "core/GameMode.h" 36 37 #include "core/CommandLine.h" 37 38 #include "core/ConsoleCommand.h" … … 39 40 #include "tools/Timer.h" 40 41 #include "objects/Tickable.h" 41 #include "core/Game.h"42 42 43 43 namespace orxonox … … 142 142 void GSRoot::setTimeFactor(float factor) 143 143 { 144 if ( Core::isMaster())144 if (GameMode::isMaster()) 145 145 { 146 146 if (!this->bPaused_) … … 160 160 void GSRoot::pause() 161 161 { 162 if ( Core::isMaster())162 if (GameMode::isMaster()) 163 163 { 164 164 if (!this->bPaused_) -
code/branches/gui/src/orxonox/gamestates/GSServer.cc
r2844 r2848 31 31 32 32 #include "core/CommandLine.h" 33 #include "core/Core.h" 33 #include "core/Game.h" 34 #include "core/GameMode.h" 34 35 #include "network/Server.h" 35 #include "core/Game.h"36 36 37 37 namespace orxonox … … 53 53 void GSServer::activate() 54 54 { 55 Core::setHasServer(true);55 GameMode::setHasServer(true); 56 56 57 57 this->server_ = new Server(CommandLine::getValue("port")); … … 66 66 delete this->server_; 67 67 68 Core::setHasServer(false);68 GameMode::setHasServer(false); 69 69 } 70 70 -
code/branches/gui/src/orxonox/gamestates/GSStandalone.cc
r2844 r2848 32 32 #include <OgreViewport.h> 33 33 #include <OgreCamera.h> 34 #include "core/Core.h" 34 #include "core/Game.h" 35 #include "core/GameMode.h" 35 36 #include "core/ConsoleCommand.h" 36 37 #include "gui/GUIManager.h" 37 38 #include "GraphicsManager.h" 38 #include "core/Game.h"39 39 40 40 namespace orxonox … … 54 54 void GSStandalone::activate() 55 55 { 56 Core::setIsStandalone(true);56 GameMode::setIsStandalone(true); 57 57 58 58 guiManager_ = GUIManager::getInstancePtr(); … … 63 63 void GSStandalone::deactivate() 64 64 { 65 Core::setIsStandalone(false);65 GameMode::setIsStandalone(false); 66 66 } 67 67 -
code/branches/gui/src/orxonox/objects/Scene.cc
r2662 r2848 41 41 42 42 #include "core/CoreIncludes.h" 43 #include "core/ Core.h"43 #include "core/GameMode.h" 44 44 #include "core/XMLPort.h" 45 45 #include "tools/BulletConversions.h" … … 57 57 this->bShadows_ = true; 58 58 59 if ( Core::showsGraphics())59 if (GameMode::showsGraphics()) 60 60 { 61 61 if (Ogre::Root::getSingletonPtr()) … … 99 99 Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_); 100 100 } 101 else if (! Core::showsGraphics())101 else if (!GameMode::showsGraphics()) 102 102 { 103 103 delete this->sceneManager_; … … 227 227 void Scene::tick(float dt) 228 228 { 229 if (! Core::showsGraphics())229 if (!GameMode::showsGraphics()) 230 230 { 231 231 // We need to update the scene nodes if we don't render … … 256 256 void Scene::setSkybox(const std::string& skybox) 257 257 { 258 if ( Core::showsGraphics() && this->sceneManager_)258 if (GameMode::showsGraphics() && this->sceneManager_) 259 259 this->sceneManager_->setSkyBox(true, skybox); 260 260 … … 264 264 void Scene::setAmbientLight(const ColourValue& colour) 265 265 { 266 if ( Core::showsGraphics() && this->sceneManager_)266 if (GameMode::showsGraphics() && this->sceneManager_) 267 267 this->sceneManager_->setAmbientLight(colour); 268 268 … … 272 272 void Scene::setShadow(bool bShadow) 273 273 { 274 if ( Core::showsGraphics() && this->sceneManager_)274 if (GameMode::showsGraphics() && this->sceneManager_) 275 275 { 276 276 if (bShadow) -
code/branches/gui/src/orxonox/objects/controllers/AIController.cc
r2662 r2848 30 30 #include "AIController.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/Executor.h" … … 45 45 RegisterObject(AIController); 46 46 47 if ( Core::isMaster())47 if (GameMode::isMaster()) 48 48 this->actionTimer_.setTimer(ACTION_INTERVAL, true, this, createExecutor(createFunctor(&AIController::action))); 49 49 } -
code/branches/gui/src/orxonox/objects/gametypes/Gametype.cc
r2710 r2848 36 36 #include "core/ConfigValueIncludes.h" 37 37 #include "core/Template.h" 38 #include "core/ Core.h"38 #include "core/GameMode.h" 39 39 #include "overlays/OverlayGroup.h" 40 40 #include "objects/infos/PlayerInfo.h" … … 69 69 70 70 // load the corresponding score board 71 if ( Core::showsGraphics() && this->scoreboardTemplate_ != "")71 if (GameMode::showsGraphics() && this->scoreboardTemplate_ != "") 72 72 { 73 73 this->scoreboard_ = new OverlayGroup(this); -
code/branches/gui/src/orxonox/objects/infos/Bot.cc
r2662 r2848 30 30 #include "Bot.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 46 46 47 47 this->bHumanPlayer_ = false; 48 this->bLocalPlayer_ = Core::isMaster();48 this->bLocalPlayer_ = GameMode::isMaster(); 49 49 this->bSetUnreadyAfterSpawn_ = false; 50 50 this->setReadyToSpawn(true); -
code/branches/gui/src/orxonox/objects/infos/HumanPlayer.cc
r2662 r2848 30 30 #include "HumanPlayer.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/ConfigValueIncludes.h" … … 47 47 RegisterObject(HumanPlayer); 48 48 49 this->server_initialized_ = Core::isMaster();49 this->server_initialized_ = GameMode::isMaster(); 50 50 this->client_initialized_ = false; 51 51 … … 82 82 this->synchronize_nick_ = this->nick_; 83 83 84 if ( Core::isMaster())84 if (GameMode::isMaster()) 85 85 this->setName(this->nick_); 86 86 } … … 105 105 this->client_initialized_ = true; 106 106 107 if (! Core::isMaster())107 if (!GameMode::isMaster()) 108 108 this->setObjectMode(objectDirection::bidirectional); 109 109 else -
code/branches/gui/src/orxonox/objects/items/MultiStateEngine.cc
r2782 r2848 30 30 #include "MultiStateEngine.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" … … 123 123 } 124 124 125 if ( Core::isMaster())125 if (GameMode::isMaster()) 126 126 { 127 127 for (std::list<WorldEntity*>::const_iterator it = this->activeEffects_.begin(); it != this->activeEffects_.end(); ++it) -
code/branches/gui/src/orxonox/objects/weaponSystem/projectiles/BillboardProjectile.cc
r2662 r2848 32 32 #include <OgreBillboardSet.h> 33 33 34 #include "core/ Core.h"34 #include "core/GameMode.h" 35 35 #include "core/CoreIncludes.h" 36 36 #include "objects/Scene.h" … … 44 44 RegisterObject(BillboardProjectile); 45 45 46 if ( Core::showsGraphics())46 if (GameMode::showsGraphics()) 47 47 { 48 48 assert(this->getScene()->getSceneManager()); // getScene() was already checked by WorldEntity … … 56 56 BillboardProjectile::~BillboardProjectile() 57 57 { 58 if (this->isInitialized() && Core::showsGraphics() && this->billboard_.getBillboardSet())58 if (this->isInitialized() && GameMode::showsGraphics() && this->billboard_.getBillboardSet()) 59 59 this->detachOgreObject(this->billboard_.getBillboardSet()); 60 60 } -
code/branches/gui/src/orxonox/objects/weaponSystem/projectiles/ParticleProjectile.cc
r2662 r2848 33 33 #include <OgreParticleEmitter.h> 34 34 35 #include "core/ Core.h"35 #include "core/GameMode.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/ConfigValueIncludes.h" … … 46 46 RegisterObject(ParticleProjectile); 47 47 48 if ( Core::showsGraphics())48 if (GameMode::showsGraphics()) 49 49 { 50 50 this->particles_ = new ParticleInterface(this->getScene()->getSceneManager(), "Orxonox/shot3_small", LODParticle::normal); -
code/branches/gui/src/orxonox/objects/weaponSystem/projectiles/Projectile.cc
r2782 r2848 41 41 #include "objects/worldentities/ParticleSpawner.h" 42 42 #include "objects/collisionshapes/SphereCollisionShape.h" 43 #include "core/ Core.h"43 #include "core/GameMode.h" 44 44 45 45 namespace orxonox … … 55 55 // Get notification about collisions 56 56 57 if ( Core::isMaster())57 if (GameMode::isMaster()) 58 58 { 59 59 this->enableCollisionCallback(); … … 93 93 void Projectile::destroyObject() 94 94 { 95 if ( Core::isMaster())95 if (GameMode::isMaster()) 96 96 delete this; 97 97 } … … 99 99 bool Projectile::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 100 100 { 101 if (!this->bDestroy_ && Core::isMaster())101 if (!this->bDestroy_ && GameMode::isMaster()) 102 102 { 103 103 this->bDestroy_ = true; -
code/branches/gui/src/orxonox/objects/worldentities/Backlight.cc
r2782 r2848 33 33 #include <OgreSceneManager.h> 34 34 35 #include "core/ Core.h"35 #include "core/GameMode.h" 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/Executor.h" … … 58 58 this->tickcount_ = 0; 59 59 60 if ( Core::showsGraphics())60 if (GameMode::showsGraphics()) 61 61 { 62 62 if (!this->getScene()) -
code/branches/gui/src/orxonox/objects/worldentities/Billboard.cc
r2662 r2848 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/XMLPort.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "objects/Scene.h" 38 38 … … 81 81 if (!this->billboard_.getBillboardSet()) 82 82 { 83 if (this->getScene() && Core::showsGraphics())83 if (this->getScene() && GameMode::showsGraphics()) 84 84 { 85 85 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); … … 98 98 { 99 99 /* 100 if (this->getScene() && Core::showsGraphics() && (this->material_ != ""))100 if (this->getScene() && GameMode::showsGraphics() && (this->material_ != "")) 101 101 { 102 102 this->billboard_.setBillboardSet(this->getScene()->getSceneManager(), this->material_, this->colour_, 1); -
code/branches/gui/src/orxonox/objects/worldentities/BlinkingBillboard.cc
r2662 r2848 30 30 #include "BlinkingBillboard.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" … … 77 77 SUPER(BlinkingBillboard, tick, dt); 78 78 79 if ( Core::isMaster() && this->isActive())79 if (GameMode::isMaster() && this->isActive()) 80 80 { 81 81 this->time_ += dt; -
code/branches/gui/src/orxonox/objects/worldentities/ControllableEntity.cc
r2662 r2848 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "core/XMLPort.h" 38 38 #include "core/Template.h" … … 236 236 this->startLocalHumanControl(); 237 237 238 if (! Core::isMaster())238 if (!GameMode::isMaster()) 239 239 { 240 240 this->client_overwrite_ = this->server_overwrite_; … … 331 331 if (!this->isDynamic()) 332 332 { 333 if ( Core::isMaster())333 if (GameMode::isMaster()) 334 334 { 335 335 this->server_position_ = this->getPosition(); … … 446 446 void ControllableEntity::setPosition(const Vector3& position) 447 447 { 448 if ( Core::isMaster())448 if (GameMode::isMaster()) 449 449 { 450 450 MobileEntity::setPosition(position); … … 461 461 void ControllableEntity::setOrientation(const Quaternion& orientation) 462 462 { 463 if ( Core::isMaster())463 if (GameMode::isMaster()) 464 464 { 465 465 MobileEntity::setOrientation(orientation); … … 476 476 void ControllableEntity::setVelocity(const Vector3& velocity) 477 477 { 478 if ( Core::isMaster())478 if (GameMode::isMaster()) 479 479 { 480 480 MobileEntity::setVelocity(velocity); … … 491 491 void ControllableEntity::setAngularVelocity(const Vector3& velocity) 492 492 { 493 if ( Core::isMaster())493 if (GameMode::isMaster()) 494 494 { 495 495 MobileEntity::setAngularVelocity(velocity); … … 507 507 { 508 508 MobileEntity::setWorldTransform(worldTrans); 509 if ( Core::isMaster())509 if (GameMode::isMaster()) 510 510 { 511 511 this->server_position_ = this->getPosition(); -
code/branches/gui/src/orxonox/objects/worldentities/ExplosionChunk.cc
r2759 r2848 32 32 #include <OgreParticleSystem.h> 33 33 34 #include "core/ Core.h"34 #include "core/GameMode.h" 35 35 #include "core/CoreIncludes.h" 36 36 #include "core/Executor.h" … … 47 47 RegisterObject(ExplosionChunk); 48 48 49 if ( Core::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) )49 if ( GameMode::showsGraphics() && ( !this->getScene() || !this->getScene()->getSceneManager() ) ) 50 50 ThrowException(AbortLoading, "Can't create ExplosionChunk, no scene or no scene manager given."); 51 51 … … 53 53 this->LOD_ = LODParticle::normal; 54 54 55 if ( Core::showsGraphics() )55 if ( GameMode::showsGraphics() ) 56 56 { 57 57 try … … 75 75 } 76 76 77 if ( Core::isMaster())77 if (GameMode::isMaster()) 78 78 { 79 79 Vector3 velocity(rnd(-1, 1), rnd(-1, 1), rnd(-1, 1)); … … 132 132 this->smoke_->setEnabled(false); 133 133 134 if ( Core::isMaster())134 if (GameMode::isMaster()) 135 135 { 136 136 this->bStop_ = true; … … 148 148 static const unsigned int CHANGES_PER_SECOND = 5; 149 149 150 if ( Core::isMaster() && rnd() < dt*CHANGES_PER_SECOND)150 if (GameMode::isMaster() && rnd() < dt*CHANGES_PER_SECOND) 151 151 { 152 152 float length = this->getVelocity().length(); -
code/branches/gui/src/orxonox/objects/worldentities/Light.cc
r2662 r2848 37 37 #include "util/String.h" 38 38 #include "util/Exception.h" 39 #include "core/ Core.h"39 #include "core/GameMode.h" 40 40 #include "core/CoreIncludes.h" 41 41 #include "core/XMLPort.h" … … 57 57 this->spotlightRange_ = Vector3(40.0f, 30.0f, 1.0f); 58 58 59 if ( Core::showsGraphics())59 if (GameMode::showsGraphics()) 60 60 { 61 61 if (!this->getScene()) -
code/branches/gui/src/orxonox/objects/worldentities/Model.cc
r2799 r2848 31 31 #include <OgreEntity.h> 32 32 #include "Model.h" 33 #include "core/ Core.h"33 #include "core/GameMode.h" 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/XMLPort.h" … … 71 71 void Model::changedMesh() 72 72 { 73 if ( Core::showsGraphics())73 if (GameMode::showsGraphics()) 74 74 { 75 75 if (this->mesh_.getEntity()) -
code/branches/gui/src/orxonox/objects/worldentities/MovableEntity.cc
r2662 r2848 34 34 #include "core/XMLPort.h" 35 35 #include "core/Executor.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 38 38 namespace orxonox … … 89 89 void MovableEntity::resynchronize() 90 90 { 91 if ( Core::isMaster() && !this->continuousResynchroTimer_)91 if (GameMode::isMaster() && !this->continuousResynchroTimer_) 92 92 { 93 93 // Resynchronise every few seconds because we only work with velocities (no positions) -
code/branches/gui/src/orxonox/objects/worldentities/ParticleEmitter.cc
r2799 r2848 39 39 #include "tools/ParticleInterface.h" 40 40 #include "util/Exception.h" 41 #include "core/ Core.h"41 #include "core/GameMode.h" 42 42 #include "core/CoreIncludes.h" 43 43 #include "core/XMLPort.h" … … 52 52 RegisterObject(ParticleEmitter); 53 53 54 if ( Core::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager()))54 if (GameMode::showsGraphics() && (!this->getScene() || !this->getScene()->getSceneManager())) 55 55 ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given."); 56 56 … … 108 108 } 109 109 110 if ( Core::showsGraphics() && this->getScene() && this->getScene()->getSceneManager())110 if (GameMode::showsGraphics() && this->getScene() && this->getScene()->getSceneManager()) 111 111 { 112 112 try -
code/branches/gui/src/orxonox/objects/worldentities/pawns/Pawn.cc
r2782 r2848 30 30 #include "Pawn.h" 31 31 32 #include "core/ Core.h"32 #include "core/GameMode.h" 33 33 #include "core/CoreIncludes.h" 34 34 #include "core/XMLPort.h" … … 63 63 this->getPickUp().setPlayer(this); 64 64 65 if ( Core::isMaster())65 if (GameMode::isMaster()) 66 66 { 67 67 this->weaponSystem_ = new WeaponSystem(this); … … 187 187 this->getPlayer()->stopControl(this); 188 188 189 if ( Core::isMaster())189 if (GameMode::isMaster()) 190 190 this->deatheffect(); 191 191 } … … 234 234 { 235 235 this->setHealth(this->initialHealth_); 236 if ( Core::isMaster())236 if (GameMode::isMaster()) 237 237 this->spawneffect(); 238 238 } -
code/branches/gui/src/orxonox/objects/worldentities/pawns/Spectator.cc
r2662 r2848 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/ConfigValueIncludes.h" 36 #include "core/ Core.h"36 #include "core/GameMode.h" 37 37 #include "objects/worldentities/Model.h" 38 38 #include "objects/Scene.h" … … 63 63 this->setDestroyWhenPlayerLeft(true); 64 64 65 if ( Core::showsGraphics())65 if (GameMode::showsGraphics()) 66 66 { 67 67 this->greetingFlare_ = new BillboardSet(); … … 206 206 this->bGreeting_ = !this->bGreeting_; 207 207 208 if ( Core::isMaster())208 if (GameMode::isMaster()) 209 209 { 210 210 this->bGreetingFlareVisible_ = this->bGreeting_; -
code/branches/gui/src/orxonox/objects/worldentities/triggers/Trigger.cc
r2710 r2848 36 36 #include "core/ConsoleCommand.h" 37 37 #include "core/XMLPort.h" 38 #include "core/ Core.h"38 #include "core/GameMode.h" 39 39 #include "objects/Scene.h" 40 40 … … 67 67 // this->bUpdating_ = false; 68 68 69 if (this->getScene() && Core::showsGraphics())69 if (this->getScene() && GameMode::showsGraphics()) 70 70 { 71 71 this->debugBillboard_.setBillboardSet(this->getScene()->getSceneManager(), "Examples/Flare", ColourValue(1.0, 0.0, 0.0), 1); -
code/branches/gui/src/orxonox/overlays/OrxonoxOverlay.cc
r2801 r2848 44 44 #include "util/Exception.h" 45 45 #include "util/String.h" 46 #include "core/ Core.h"46 #include "core/GameMode.h" 47 47 #include "core/CoreIncludes.h" 48 48 #include "core/XMLPort.h" … … 67 67 this->group_ = 0; 68 68 69 if (! Core::showsGraphics())69 if (!GameMode::showsGraphics()) 70 70 ThrowException(NoGraphics, "Can't create OrxonoxOverlay, graphics engine not initialized"); 71 71 -
code/branches/gui/src/orxonox/tools/BillboardSet.cc
r2662 r2848 37 37 #include <OgreBillboard.h> 38 38 39 #include "core/ Core.h"39 #include "core/GameMode.h" 40 40 #include "util/Convert.h" 41 41 #include "util/String.h" … … 72 72 try 73 73 { 74 if ( Core::showsGraphics())74 if (GameMode::showsGraphics()) 75 75 { 76 76 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count); … … 95 95 try 96 96 { 97 if ( Core::showsGraphics())97 if (GameMode::showsGraphics()) 98 98 { 99 99 this->billboardSet_ = scenemanager->createBillboardSet("Billboard" + convertToString(BillboardSet::billboardSetCounter_s++), count); -
code/branches/gui/src/orxonox/tools/Mesh.cc
r2662 r2848 35 35 #include <cassert> 36 36 37 #include "core/ Core.h"37 #include "core/GameMode.h" 38 38 #include "util/Convert.h" 39 39 #include "util/String.h" … … 64 64 this->scenemanager_->destroyEntity(this->entity_); 65 65 66 if ( Core::showsGraphics())66 if (GameMode::showsGraphics()) 67 67 { 68 68 try -
code/branches/gui/src/orxonox/tools/ParticleInterface.cc
r2801 r2848 41 41 42 42 #include "GraphicsManager.h" 43 #include "core/ Core.h"43 #include "core/GameMode.h" 44 44 #include "core/CoreIncludes.h" 45 45 #include "util/Convert.h" … … 64 64 this->speedFactor_ = 1.0f; 65 65 66 if ( Core::showsGraphics())66 if (GameMode::showsGraphics()) 67 67 { 68 68 try … … 178 178 { 179 179 this->detaillevel_ = level; 180 if ( Core::showsGraphics())180 if (GameMode::showsGraphics()) 181 181 this->detailLevelChanged(GraphicsManager::getInstance().getDetailLevelParticle()); 182 182 } -
code/branches/gui/src/orxonox/tools/Shader.cc
r2801 r2848 36 36 #include <OgrePlugin.h> 37 37 38 #include "core/ Core.h"38 #include "core/GameMode.h" 39 39 #include "core/CoreIncludes.h" 40 40 #include "core/Executor.h" … … 59 59 this->compositorInstance_ = 0; 60 60 this->bVisible_ = true; 61 this->bLoadCompositor_ = Core::showsGraphics();61 this->bLoadCompositor_ = GameMode::showsGraphics(); 62 62 this->bViewportInitialized_ = false; 63 63 this->compositor_ = ""; … … 246 246 Shader::ParameterPointer* Shader::getParameterPointer(const std::string& material, size_t technique, size_t pass, const std::string& parameter) 247 247 { 248 if (! Core::showsGraphics() || !Shader::bLoadedCgPlugin_s)248 if (!GameMode::showsGraphics() || !Shader::bLoadedCgPlugin_s) 249 249 return 0; 250 250
Note: See TracChangeset
for help on using the changeset viewer.