[Orxonox-commit 4018] r8692 - code/branches/presentation/src/orxonox/gamestates

rgrieder at orxonox.net rgrieder at orxonox.net
Tue May 31 17:34:19 CEST 2011


Author: rgrieder
Date: 2011-05-31 17:34:18 +0200 (Tue, 31 May 2011)
New Revision: 8692

Modified:
   code/branches/presentation/src/orxonox/gamestates/GSRoot.cc
   code/branches/presentation/src/orxonox/gamestates/GSRoot.h
Log:
Added "getTimeFactor" console command.

Modified: code/branches/presentation/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSRoot.cc	2011-05-31 14:57:50 UTC (rev 8691)
+++ code/branches/presentation/src/orxonox/gamestates/GSRoot.cc	2011-05-31 15:34:18 UTC (rev 8692)
@@ -44,6 +44,7 @@
     DeclareGameState(GSRoot, "root", false, false);
 
     static const std::string __CC_setTimeFactor_name = "setTimeFactor";
+    static const std::string __CC_getTimeFactor_name = "getTimeFactor";
     static const std::string __CC_setPause_name = "setPause";
     static const std::string __CC_pause_name = "pause";
 
@@ -51,6 +52,7 @@
 
     SetConsoleCommand("printObjects", &GSRoot::printObjects).hide();
     SetConsoleCommand(__CC_setTimeFactor_name, &GSRoot::setTimeFactor).accessLevel(AccessLevel::Master).defaultValues(1.0);
+    SetConsoleCommand(__CC_getTimeFactor_name, &GSRoot::getTimeFactor).accessLevel(AccessLevel::Master);
     SetConsoleCommand(__CC_setPause_name,      &GSRoot::setPause     ).accessLevel(AccessLevel::Master).hide();
     SetConsoleCommand(__CC_pause_name,         &GSRoot::pause        ).accessLevel(AccessLevel::Master);
 
@@ -88,6 +90,7 @@
         TimeFactorListener::setTimeFactor(1.0f);
 
         ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(this);
+        ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(this);
         ModifyConsoleCommand(__CC_setPause_name).setObject(this);
         ModifyConsoleCommand(__CC_pause_name).setObject(this);
     }
@@ -95,6 +98,7 @@
     void GSRoot::deactivate()
     {
         ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(0);
+        ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(0);
         ModifyConsoleCommand(__CC_setPause_name).setObject(0);
         ModifyConsoleCommand(__CC_pause_name).setObject(0);
     }
@@ -152,6 +156,11 @@
         }
     }
 
+    float GSRoot::getTimeFactor()
+    {
+        return TimeFactorListener::getTimeFactor();
+    }
+
     void GSRoot::pause()
     {
         if (GameMode::isMaster())

Modified: code/branches/presentation/src/orxonox/gamestates/GSRoot.h
===================================================================
--- code/branches/presentation/src/orxonox/gamestates/GSRoot.h	2011-05-31 14:57:50 UTC (rev 8691)
+++ code/branches/presentation/src/orxonox/gamestates/GSRoot.h	2011-05-31 15:34:18 UTC (rev 8692)
@@ -53,6 +53,8 @@
         void setPause(bool pause);
         void pause();
 
+        float getTimeFactor();
+
         static void delayedStartMainMenu(void);
 
     protected:




More information about the Orxonox-commit mailing list