Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7374


Ignore:
Timestamp:
Sep 8, 2010, 1:01:23 AM (14 years ago)
Author:
landauf
Message:

renamed GameMode::hasServer() as GameMode::isServer() for consistency.
added documentation.

Location:
code/branches/doc/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • code/branches/doc/src/libraries/core/GameMode.cc

    r5929 r7374  
    3333    bool GameMode::bShowsGraphics_s = false;
    3434    bool GameMode::bPlaysSound_s    = false;
    35     bool GameMode::bHasServer_s     = false;
     35    bool GameMode::bIsServer_s      = false;
    3636    bool GameMode::bIsClient_s      = false;
    3737    bool GameMode::bIsStandalone_s  = false;
  • code/branches/doc/src/libraries/core/GameMode.h

    r7363 r7374  
    4141namespace orxonox
    4242{
     43    /// Helper class, stores and returns the current mode of the game.
    4344    class _CoreExport GameMode
    4445    {
     
    4849        public:
    4950// 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)
    5657// tolua_end
    5758
    58             static void setPlaysSound   (bool val) { bPlaysSound_s    = val; }
    59             static void setHasServer    (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)
    6263
    6364        private:
     
    6667            ~GameMode();
    6768
     69            /// Checks if we're in control of the game (either standalone or server).
    6870            static void updateIsMaster()
    6971            {
    70                 bIsMaster_s = (bHasServer_s || bIsStandalone_s);
     72                bIsMaster_s = (bIsServer_s || bIsStandalone_s);
    7173            }
    7274
    7375            static bool bShowsGraphics_s;                   //!< global variable that tells whether to show graphics
    7476            static bool bPlaysSound_s;                      //!< global variable that tells whether to sound works
    75             static bool bHasServer_s;                       //!< global variable that tells whether this is a server
    76             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)
    7981    }; // tolua_export
    8082} // tolua_export
  • code/branches/doc/src/libraries/core/command/ConsoleCommand.cc

    r7352 r7374  
    137137            case AccessLevel::Standalone: return GameMode::isStandalone();
    138138            case AccessLevel::Master:     return GameMode::isMaster();
    139             case AccessLevel::Server:     return GameMode::hasServer();
     139            case AccessLevel::Server:     return GameMode::isServer();
    140140            case AccessLevel::Client:     return GameMode::isClient();
    141             case AccessLevel::Online:     return (GameMode::hasServer() || GameMode::isClient());
     141            case AccessLevel::Online:     return (GameMode::isServer() || GameMode::isClient());
    142142            case AccessLevel::Offline:    return GameMode::isStandalone();
    143143            case AccessLevel::None:       return false;
  • code/branches/doc/src/orxonox/gamestates/GSServer.cc

    r7357 r7374  
    5353    void GSServer::activate()
    5454    {
    55         GameMode::setHasServer(true);
     55        GameMode::setIsServer(true);
    5656
    5757        this->server_ = new Server(CommandLineParser::getValue("port"));
     
    6666        delete this->server_;
    6767
    68         GameMode::setHasServer(false);
     68        GameMode::setIsServer(false);
    6969    }
    7070
Note: See TracChangeset for help on using the changeset viewer.