Changeset 6417 for code/trunk/src/orxonox/gamestates/GSRoot.cc
- Timestamp:
- Dec 25, 2009, 10:23:58 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/gamestates/GSRoot.cc
r6105 r6417 30 30 31 31 #include "util/Clock.h" 32 #include "core/BaseObject.h" 32 33 #include "core/ConsoleCommand.h" 33 34 #include "core/Game.h" … … 45 46 GSRoot::GSRoot(const GameStateInfo& info) 46 47 : GameState(info) 47 , timeFactor_(1.0f)48 48 , bPaused_(false) 49 49 , timeFactorPauseBackup_(1.0f) … … 55 55 NetworkFunctionBase::destroyAllNetworkFunctions(); 56 56 } 57 57 58 58 void GSRoot::printObjects() 59 59 { 60 60 unsigned int nr=0; 61 for(ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it){ 62 if( dynamic_cast<Synchronisable*>(*it) ) 61 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it) 62 { 63 if (dynamic_cast<Synchronisable*>(*it)) 63 64 COUT(0) << "object: " << it->getIdentifier()->getName() << " id: " << dynamic_cast<Synchronisable*>(*it)->getObjectID() << std::endl; 64 65 else … … 67 68 } 68 69 COUT(0) << "currently got " << nr << " objects" << std::endl; 69 70 70 } 71 71 … … 73 73 { 74 74 // reset game speed to normal 75 this->timeFactor_ = 1.0f;75 TimeFactorListener::setTimeFactor(1.0f); 76 76 77 77 // time factor console command … … 91 91 { 92 92 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 93 (it++)->tick(time); 93 { 94 Timer* object = *it; 95 ++it; 96 object->tick(time); 97 } 94 98 95 99 /*** HACK *** HACK ***/ … … 101 105 leveldt = 0.0f; 102 106 } 107 float realdt = leveldt * TimeFactorListener::getTimeFactor(); 103 108 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ) 104 (it++)->tick(leveldt * this->timeFactor_); 109 { 110 Tickable* object = *it; 111 ++it; 112 object->tick(realdt); 113 } 105 114 /*** HACK *** HACK ***/ 106 115 } … … 119 128 if (!this->bPaused_) 120 129 { 121 TimeFactorListener::timefactor_s = factor; 122 123 for (ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it) 124 it->changedTimeFactor(factor, this->timeFactor_); 125 126 this->timeFactor_ = factor; 130 TimeFactorListener::setTimeFactor(factor); 127 131 } 128 132 else … … 137 141 if (!this->bPaused_) 138 142 { 139 this->timeFactorPauseBackup_ = this->timeFactor_;143 this->timeFactorPauseBackup_ = TimeFactorListener::getTimeFactor(); 140 144 this->setTimeFactor(0.0f); 141 145 this->bPaused_ = true; … … 148 152 } 149 153 } 154 155 float GSRoot::getTimeFactor() 156 { 157 return TimeFactorListener::getTimeFactor(); 158 } 150 159 }
Note: See TracChangeset
for help on using the changeset viewer.