[Orxonox-commit 2669] r7374 - in code/branches/doc/src: libraries/core libraries/core/command orxonox/gamestates
landauf at orxonox.net
landauf at orxonox.net
Wed Sep 8 01:01:23 CEST 2010
Author: landauf
Date: 2010-09-08 01:01:23 +0200 (Wed, 08 Sep 2010)
New Revision: 7374
Modified:
code/branches/doc/src/libraries/core/GameMode.cc
code/branches/doc/src/libraries/core/GameMode.h
code/branches/doc/src/libraries/core/command/ConsoleCommand.cc
code/branches/doc/src/orxonox/gamestates/GSServer.cc
Log:
renamed GameMode::hasServer() as GameMode::isServer() for consistency.
added documentation.
Modified: code/branches/doc/src/libraries/core/GameMode.cc
===================================================================
--- code/branches/doc/src/libraries/core/GameMode.cc 2010-09-07 21:24:47 UTC (rev 7373)
+++ code/branches/doc/src/libraries/core/GameMode.cc 2010-09-07 23:01:23 UTC (rev 7374)
@@ -32,7 +32,7 @@
{
bool GameMode::bShowsGraphics_s = false;
bool GameMode::bPlaysSound_s = false;
- bool GameMode::bHasServer_s = false;
+ bool GameMode::bIsServer_s = false;
bool GameMode::bIsClient_s = false;
bool GameMode::bIsStandalone_s = false;
bool GameMode::bIsMaster_s = false;
Modified: code/branches/doc/src/libraries/core/GameMode.h
===================================================================
--- code/branches/doc/src/libraries/core/GameMode.h 2010-09-07 21:24:47 UTC (rev 7373)
+++ code/branches/doc/src/libraries/core/GameMode.h 2010-09-07 23:01:23 UTC (rev 7374)
@@ -40,6 +40,7 @@
// tolua_begin
namespace orxonox
{
+ /// Helper class, stores and returns the current mode of the game.
class _CoreExport GameMode
{
// tolua_end
@@ -47,35 +48,36 @@
public:
// tolua_begin
- static bool showsGraphics() { return bShowsGraphics_s; }
- static bool playsSound() { return bPlaysSound_s; }
- static bool hasServer() { return bHasServer_s; }
- static bool isClient() { return bIsClient_s; }
- static bool isStandalone() { return bIsStandalone_s; }
- static bool isMaster() { return bIsMaster_s; }
+ static bool showsGraphics() { return bShowsGraphics_s; } ///< Returns true if the game shows graphics, false if it is in text-console mode
+ static bool playsSound() { return bPlaysSound_s; } ///< Returns true if the game is able to play sounds
+ static bool isServer() { return bIsServer_s; } ///< Returns true if we're currently a server (online)
+ static bool isClient() { return bIsClient_s; } ///< Returns true if we're currently a client (online)
+ static bool isStandalone() { return bIsStandalone_s; } ///< Returns true if we're in standalone mode (offline)
+ static bool isMaster() { return bIsMaster_s; } ///< Returns true if we're in control of the game (either standalone or server)
// tolua_end
- static void setPlaysSound (bool val) { bPlaysSound_s = val; }
- static void setHasServer (bool val) { bHasServer_s = val; updateIsMaster(); }
- static void setIsClient (bool val) { bIsClient_s = val; updateIsMaster(); }
- static void setIsStandalone (bool val) { bIsStandalone_s = val; updateIsMaster(); }
+ static void setPlaysSound (bool val) { bPlaysSound_s = val; } ///< Defines if the game can play sounds
+ static void setIsServer (bool val) { bIsServer_s = val; updateIsMaster(); } ///< Defines if the program is in server mode (online)
+ static void setIsClient (bool val) { bIsClient_s = val; updateIsMaster(); } ///< Defines if the program is in client mode (online)
+ static void setIsStandalone (bool val) { bIsStandalone_s = val; updateIsMaster(); } ///< Defines if the program is in standalone mode (offline)
private:
GameMode();
GameMode(const GameMode& inst);
~GameMode();
+ /// Checks if we're in control of the game (either standalone or server).
static void updateIsMaster()
{
- bIsMaster_s = (bHasServer_s || bIsStandalone_s);
+ bIsMaster_s = (bIsServer_s || bIsStandalone_s);
}
static bool bShowsGraphics_s; //!< global variable that tells whether to show graphics
static bool bPlaysSound_s; //!< global variable that tells whether to sound works
- static bool bHasServer_s; //!< global variable that tells whether this is a server
- static bool bIsClient_s;
- static bool bIsStandalone_s;
- static bool bIsMaster_s;
+ static bool bIsServer_s; //!< global variable that tells whether this is a server (online)
+ static bool bIsClient_s; //!< global variable that tells whether this is a client (online)
+ static bool bIsStandalone_s; //!< global variable that tells whether the game is running in standalone mode (offline)
+ static bool bIsMaster_s; //!< global variable that tells whether we're in control of the game (standalone or server)
}; // tolua_export
} // tolua_export
Modified: code/branches/doc/src/libraries/core/command/ConsoleCommand.cc
===================================================================
--- code/branches/doc/src/libraries/core/command/ConsoleCommand.cc 2010-09-07 21:24:47 UTC (rev 7373)
+++ code/branches/doc/src/libraries/core/command/ConsoleCommand.cc 2010-09-07 23:01:23 UTC (rev 7374)
@@ -136,9 +136,9 @@
case AccessLevel::All: return true;
case AccessLevel::Standalone: return GameMode::isStandalone();
case AccessLevel::Master: return GameMode::isMaster();
- case AccessLevel::Server: return GameMode::hasServer();
+ case AccessLevel::Server: return GameMode::isServer();
case AccessLevel::Client: return GameMode::isClient();
- case AccessLevel::Online: return (GameMode::hasServer() || GameMode::isClient());
+ case AccessLevel::Online: return (GameMode::isServer() || GameMode::isClient());
case AccessLevel::Offline: return GameMode::isStandalone();
case AccessLevel::None: return false;
default: return false;
Modified: code/branches/doc/src/orxonox/gamestates/GSServer.cc
===================================================================
--- code/branches/doc/src/orxonox/gamestates/GSServer.cc 2010-09-07 21:24:47 UTC (rev 7373)
+++ code/branches/doc/src/orxonox/gamestates/GSServer.cc 2010-09-07 23:01:23 UTC (rev 7374)
@@ -52,7 +52,7 @@
void GSServer::activate()
{
- GameMode::setHasServer(true);
+ GameMode::setIsServer(true);
this->server_ = new Server(CommandLineParser::getValue("port"));
COUT(0) << "Loading scene in server mode" << std::endl;
@@ -65,7 +65,7 @@
this->server_->close();
delete this->server_;
- GameMode::setHasServer(false);
+ GameMode::setIsServer(false);
}
void GSServer::update(const Clock& time)
More information about the Orxonox-commit
mailing list