Changeset 7374 for code/branches/doc
- Timestamp:
- Sep 8, 2010, 1:01:23 AM (14 years ago)
- Location:
- code/branches/doc/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/doc/src/libraries/core/GameMode.cc
r5929 r7374 33 33 bool GameMode::bShowsGraphics_s = false; 34 34 bool GameMode::bPlaysSound_s = false; 35 bool GameMode::b HasServer_s= false;35 bool GameMode::bIsServer_s = false; 36 36 bool GameMode::bIsClient_s = false; 37 37 bool GameMode::bIsStandalone_s = false; -
code/branches/doc/src/libraries/core/GameMode.h
r7363 r7374 41 41 namespace orxonox 42 42 { 43 /// Helper class, stores and returns the current mode of the game. 43 44 class _CoreExport GameMode 44 45 { … … 48 49 public: 49 50 // tolua_begin 50 static bool showsGraphics() { return bShowsGraphics_s; } 51 static bool playsSound() { return bPlaysSound_s; } 52 static bool hasServer() { return bHasServer_s; }53 static bool isClient() { return bIsClient_s; } 54 static bool isStandalone() { return bIsStandalone_s; } 55 static bool isMaster() { return bIsMaster_s; } 51 static bool showsGraphics() { return bShowsGraphics_s; } ///< Returns true if the game shows graphics, false if it is in text-console mode 52 static bool playsSound() { return bPlaysSound_s; } ///< Returns true if the game is able to play sounds 53 static bool isServer() { return bIsServer_s; } ///< Returns true if we're currently a server (online) 54 static bool isClient() { return bIsClient_s; } ///< Returns true if we're currently a client (online) 55 static bool isStandalone() { return bIsStandalone_s; } ///< Returns true if we're in standalone mode (offline) 56 static bool isMaster() { return bIsMaster_s; } ///< Returns true if we're in control of the game (either standalone or server) 56 57 // tolua_end 57 58 58 static void setPlaysSound (bool val) { bPlaysSound_s = val; } 59 static void set HasServer (bool val) { bHasServer_s = val; updateIsMaster(); }60 static void setIsClient (bool val) { bIsClient_s = val; updateIsMaster(); } 61 static void setIsStandalone (bool val) { bIsStandalone_s = val; updateIsMaster(); } 59 static void setPlaysSound (bool val) { bPlaysSound_s = val; } ///< Defines if the game can play sounds 60 static void setIsServer (bool val) { bIsServer_s = val; updateIsMaster(); } ///< Defines if the program is in server mode (online) 61 static void setIsClient (bool val) { bIsClient_s = val; updateIsMaster(); } ///< Defines if the program is in client mode (online) 62 static void setIsStandalone (bool val) { bIsStandalone_s = val; updateIsMaster(); } ///< Defines if the program is in standalone mode (offline) 62 63 63 64 private: … … 66 67 ~GameMode(); 67 68 69 /// Checks if we're in control of the game (either standalone or server). 68 70 static void updateIsMaster() 69 71 { 70 bIsMaster_s = (b HasServer_s || bIsStandalone_s);72 bIsMaster_s = (bIsServer_s || bIsStandalone_s); 71 73 } 72 74 73 75 static bool bShowsGraphics_s; //!< global variable that tells whether to show graphics 74 76 static bool bPlaysSound_s; //!< global variable that tells whether to sound works 75 static bool b HasServer_s; //!< global variable that tells whether this is a server76 static bool bIsClient_s; 77 static bool bIsStandalone_s; 78 static bool bIsMaster_s; 77 static bool bIsServer_s; //!< global variable that tells whether this is a server (online) 78 static bool bIsClient_s; //!< global variable that tells whether this is a client (online) 79 static bool bIsStandalone_s; //!< global variable that tells whether the game is running in standalone mode (offline) 80 static bool bIsMaster_s; //!< global variable that tells whether we're in control of the game (standalone or server) 79 81 }; // tolua_export 80 82 } // tolua_export -
code/branches/doc/src/libraries/core/command/ConsoleCommand.cc
r7352 r7374 137 137 case AccessLevel::Standalone: return GameMode::isStandalone(); 138 138 case AccessLevel::Master: return GameMode::isMaster(); 139 case AccessLevel::Server: return GameMode:: hasServer();139 case AccessLevel::Server: return GameMode::isServer(); 140 140 case AccessLevel::Client: return GameMode::isClient(); 141 case AccessLevel::Online: return (GameMode:: hasServer() || GameMode::isClient());141 case AccessLevel::Online: return (GameMode::isServer() || GameMode::isClient()); 142 142 case AccessLevel::Offline: return GameMode::isStandalone(); 143 143 case AccessLevel::None: return false; -
code/branches/doc/src/orxonox/gamestates/GSServer.cc
r7357 r7374 53 53 void GSServer::activate() 54 54 { 55 GameMode::set HasServer(true);55 GameMode::setIsServer(true); 56 56 57 57 this->server_ = new Server(CommandLineParser::getValue("port")); … … 66 66 delete this->server_; 67 67 68 GameMode::set HasServer(false);68 GameMode::setIsServer(false); 69 69 } 70 70
Note: See TracChangeset
for help on using the changeset viewer.