Changeset 1949 for code/branches/objecthierarchy/src/orxonox
- Timestamp:
- Oct 19, 2008, 2:24:33 PM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/Settings.cc
r1940 r1949 49 49 */ 50 50 Settings::Settings() 51 : bShowsGraphics_(false)52 , bHasServer_(false)53 , bIsClient_(false)54 , bIsStandalone_(false)55 , bIsMaster_(false)56 51 { 57 52 RegisterRootObject(Settings); -
code/branches/objecthierarchy/src/orxonox/Settings.h
r1940 r1949 50 50 friend class ClassIdentifier<Settings>; 51 51 friend class GSRoot; 52 friend class GSGraphics;53 friend class GSServer;54 friend class GSClient;55 friend class GSDedicated;56 friend class GSStandalone;57 52 58 53 public: … … 62 57 { assert(singletonRef_s); singletonRef_s->_tsetDataPath(path); } 63 58 64 // an alternative to a global game mode variable65 static bool showsGraphics() { assert(singletonRef_s); return singletonRef_s->bShowsGraphics_; }66 static bool hasServer() { assert(singletonRef_s); return singletonRef_s->bHasServer_; }67 static bool isClient() { assert(singletonRef_s); return singletonRef_s->bIsClient_; }68 static bool isStandalone() { assert(singletonRef_s); return singletonRef_s->bIsStandalone_; }69 static bool isMaster() { assert(singletonRef_s); return singletonRef_s->bIsMaster_; }70 71 59 private: 72 // GSRoot has access to these73 static void setShowsGraphics(bool val) { assert(singletonRef_s); singletonRef_s->bShowsGraphics_ = val; singletonRef_s->updateIsMaster(); }74 static void setHasServer (bool val) { assert(singletonRef_s); singletonRef_s->bHasServer_ = val; singletonRef_s->updateIsMaster(); }75 static void setIsClient (bool val) { assert(singletonRef_s); singletonRef_s->bIsClient_ = val; singletonRef_s->updateIsMaster(); }76 static void setIsStandalone (bool val) { assert(singletonRef_s); singletonRef_s->bIsStandalone_ = val; singletonRef_s->updateIsMaster(); }77 static void updateIsMaster () { assert(singletonRef_s); singletonRef_s->bIsMaster_ = (singletonRef_s->bHasServer_ || singletonRef_s->bIsStandalone_); }78 79 60 Settings(); 80 61 Settings(const Settings& instance); … … 87 68 void setConfigValues(); 88 69 89 bool bShowsGraphics_; //!< global variable that tells whether to show graphics90 bool bHasServer_; //!< global variable that tells whether this is a server91 bool bIsClient_;92 bool bIsStandalone_;93 bool bIsMaster_;94 95 70 std::string dataPath_; //!< Path to the game data 96 71 -
code/branches/objecthierarchy/src/orxonox/gamestates/GSClient.cc
r1940 r1949 32 32 #include "core/input/InputManager.h" 33 33 #include "core/CommandLine.h" 34 #include "core/Core.h" 34 35 #include "network/Client.h" 35 #include "Settings.h"36 36 37 37 namespace orxonox … … 51 51 void GSClient::enter() 52 52 { 53 Settings::_getInstance().setIsClient(true);53 Core::setIsClient(true); 54 54 55 55 GSLevel::enter(); … … 81 81 GSLevel::leave(); 82 82 83 Settings::_getInstance().setIsClient(false);83 Core::setIsClient(false); 84 84 } 85 85 -
code/branches/objecthierarchy/src/orxonox/gamestates/GSDedicated.cc
r1940 r1949 35 35 #include "core/CommandLine.h" 36 36 #include "core/Loader.h" 37 #include "core/Core.h" 37 38 #include "network/Server.h" 38 39 #include "objects/Tickable.h" 40 #include "Settings.h" 39 41 #include "GraphicsEngine.h" 40 #include "Settings.h"41 42 42 43 namespace orxonox … … 57 58 void GSDedicated::enter() 58 59 { 59 Settings::_getInstance().setHasServer(true);60 Core::setHasServer(true); 60 61 61 62 // create Ogre SceneManager for the level … … 97 98 Ogre::Root::getSingleton().destroySceneManager(this->sceneManager_); 98 99 99 Settings::_getInstance().setHasServer(false);100 Core::setHasServer(false); 100 101 } 101 102 -
code/branches/objecthierarchy/src/orxonox/gamestates/GSGraphics.cc
r1940 r1949 47 47 #include "core/ConfigValueIncludes.h" 48 48 #include "core/CoreIncludes.h" 49 #include "core/Core.h" 49 50 #include "core/input/InputManager.h" 50 51 #include "core/input/KeyBinder.h" … … 101 102 void GSGraphics::enter() 102 103 { 103 Settings::_getInstance().setShowsGraphics(true);104 Core::setShowsGraphics(true); 104 105 105 106 // initialise graphics engine. Doesn't load the render window yet! … … 196 197 delete graphicsEngine_; 197 198 198 Settings::_getInstance().setShowsGraphics(false);199 Core::setShowsGraphics(false); 199 200 } 200 201 -
code/branches/objecthierarchy/src/orxonox/gamestates/GSLevel.cc
r1942 r1949 44 44 #include "objects/Radar.h" 45 45 //#include "tools/ParticleInterface.h" 46 #include "GraphicsEngine.h" 46 47 #include "Settings.h" 47 #include "GraphicsEngine.h"48 48 49 49 namespace orxonox -
code/branches/objecthierarchy/src/orxonox/gamestates/GSServer.cc
r1940 r1949 33 33 #include "core/input/InputManager.h" 34 34 #include "core/CommandLine.h" 35 #include "core/Core.h" 35 36 #include "network/Server.h" 36 #include "Settings.h"37 37 38 38 namespace orxonox … … 52 52 void GSServer::enter() 53 53 { 54 Settings::_getInstance().setHasServer(true);54 Core::setHasServer(true); 55 55 56 56 GSLevel::enter(); … … 86 86 GSLevel::leave(); 87 87 88 Settings::_getInstance().setHasServer(false);88 Core::setHasServer(false); 89 89 } 90 90 -
code/branches/objecthierarchy/src/orxonox/gamestates/GSStandalone.cc
r1940 r1949 32 32 #include "core/input/InputManager.h" 33 33 #include "core/ConsoleCommand.h" 34 #include " Settings.h"34 #include "core/Core.h" 35 35 36 36 namespace orxonox … … 59 59 InputManager::getInstance().requestEnterState("game"); 60 60 61 Settings::_getInstance().setIsStandalone(true);61 Core::setIsStandalone(true); 62 62 } 63 63 … … 72 72 GSLevel::leave(); 73 73 74 Settings::_getInstance().setIsStandalone(false);74 Core::setIsStandalone(false); 75 75 } 76 76 -
code/branches/objecthierarchy/src/orxonox/objects/infos/LevelInfo.cc
r1947 r1949 34 34 #include "core/CoreIncludes.h" 35 35 #include "core/XMLPort.h" 36 #include "core/Core.h" 36 37 37 #include "Settings.h"38 38 #include "GraphicsEngine.h" 39 39 … … 72 72 void LevelInfo::setSkybox(const std::string& skybox) 73 73 { 74 if ( Settings::showsGraphics())74 if (Core::showsGraphics()) 75 75 if (GraphicsEngine::getInstance().getLevelSceneManager()) 76 76 GraphicsEngine::getInstance().getLevelSceneManager()->setSkyBox(true, skybox); … … 81 81 void LevelInfo::setAmbientLight(const ColourValue& colour) 82 82 { 83 if ( Settings::showsGraphics())83 if (Core::showsGraphics()) 84 84 GraphicsEngine::getInstance().getLevelSceneManager()->setAmbientLight(colour); 85 85 -
code/branches/objecthierarchy/src/orxonox/objects/infos/PlayerInfo.cc
r1947 r1949 35 35 #include "core/ConfigValueIncludes.h" 36 36 #include "core/XMLPort.h" 37 #include "core/Core.h" 37 38 38 39 #include "network/Host.h" 39 40 40 #include "Settings.h"41 41 #include "GraphicsEngine.h" 42 42 #include "objects/gametypes/Gametype.h" … … 51 51 52 52 this->ping_ = -1; 53 this->bLocalPlayer_ = Settings::isStandalone();53 this->bLocalPlayer_ = Core::isStandalone(); 54 54 this->bLocalPlayer_ = false; 55 55 this->bHumanPlayer_ = false; … … 78 78 { 79 79 std::cout << "# PI(" << this->getObjectID() << "): checkName: " << this->bLocalPlayer_ << std::endl; 80 if (this->bLocalPlayer_ && Settings::isMaster())80 if (this->bLocalPlayer_ && Core::isMaster()) 81 81 this->setName(this->playerName_); 82 82 } … … 114 114 //std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): name: " << this->getName() << std::endl; 115 115 116 if ( Settings::isClient())116 if (Core::isClient()) 117 117 { 118 118 std::cout << "# PI(" << this->getObjectID() << "): checkClientID(): we're on a client: set object mode to bidirectional" << std::endl; … … 134 134 { 135 135 std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): " << this->bFinishedSetup_ << std::endl; 136 if ( Settings::isClient())136 if (Core::isClient()) 137 137 { 138 138 std::cout << "# PI(" << this->getObjectID() << "): finishedSetup(): we're a client: finish setup" << std::endl; -
code/branches/objecthierarchy/src/orxonox/tools/Mesh.cc
r1755 r1949 32 32 #include <sstream> 33 33 #include <OgreSceneManager.h> 34 #include "core/Core.h" 34 35 #include "GraphicsEngine.h" 35 #include "Settings.h"36 36 37 37 namespace orxonox … … 48 48 std::ostringstream name; 49 49 name << (Mesh::meshCounter_s++); 50 if ( Settings::showsGraphics())50 if (Core::showsGraphics()) 51 51 this->entity_ = GraphicsEngine::getInstance().getLevelSceneManager()->createEntity("Mesh" + name.str(), file); 52 52 } … … 54 54 Mesh::~Mesh() 55 55 { 56 if (this->entity_ && Settings::showsGraphics())56 if (this->entity_ && Core::showsGraphics()) 57 57 GraphicsEngine::getInstance().getLevelSceneManager()->destroyEntity(this->entity_); 58 58 }
Note: See TracChangeset
for help on using the changeset viewer.