Changeset 6412 for code/branches/pickup2/src/orxonox/gamestates/GSRoot.cc
- Timestamp:
- Dec 25, 2009, 1:18:03 PM (15 years ago)
- Location:
- code/branches/pickup2
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/pickup2
- Property svn:mergeinfo changed
-
code/branches/pickup2/src/orxonox/gamestates/GSRoot.cc
r5929 r6412 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 … … 90 90 void GSRoot::update(const Clock& time) 91 91 { 92 if (this->getActivity().topState)92 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 93 93 { 94 // This state can not 'survive' on its own.95 // Load a user interface therefore96 Game::getInstance().requestState("ioConsole");94 Timer* object = *it; 95 ++it; 96 object->tick(time); 97 97 } 98 99 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; )100 (it++)->tick(time);101 98 102 99 /*** HACK *** HACK ***/ … … 108 105 leveldt = 0.0f; 109 106 } 107 float realdt = leveldt * TimeFactorListener::getTimeFactor(); 110 108 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ) 111 (it++)->tick(leveldt * this->timeFactor_); 109 { 110 Tickable* object = *it; 111 ++it; 112 object->tick(realdt); 113 } 112 114 /*** HACK *** HACK ***/ 113 115 } … … 126 128 if (!this->bPaused_) 127 129 { 128 TimeFactorListener::timefactor_s = factor; 129 130 for (ObjectList<TimeFactorListener>::iterator it = ObjectList<TimeFactorListener>::begin(); it != ObjectList<TimeFactorListener>::end(); ++it) 131 it->changedTimeFactor(factor, this->timeFactor_); 132 133 this->timeFactor_ = factor; 130 TimeFactorListener::setTimeFactor(factor); 134 131 } 135 132 else … … 144 141 if (!this->bPaused_) 145 142 { 146 this->timeFactorPauseBackup_ = this->timeFactor_;143 this->timeFactorPauseBackup_ = TimeFactorListener::getTimeFactor(); 147 144 this->setTimeFactor(0.0f); 148 145 this->bPaused_ = true; … … 155 152 } 156 153 } 154 155 float GSRoot::getTimeFactor() 156 { 157 return TimeFactorListener::getTimeFactor(); 158 } 157 159 }
Note: See TracChangeset
for help on using the changeset viewer.