diff --git a/src/network/rewind_manager.cpp b/src/network/rewind_manager.cpp index 310e7d6d7..23aa4b94d 100755 --- a/src/network/rewind_manager.cpp +++ b/src/network/rewind_manager.cpp @@ -188,8 +188,7 @@ void RewindManager::update(float dt) float time = World::getWorld()->getTime(); m_not_rewound_time = time; - // Clients don't save state, so they just update m_last_saved_state - // (only for the above if test) and exit. + // Clients don't save state, so they just exit. if ( NetworkConfig::get()->isClient() || time - m_last_saved_state < m_state_frequency ) { @@ -336,7 +335,7 @@ void RewindManager::rewindTo(float rewind_time) // Now go forward through the list of rewind infos: // ------------------------------------------------ - while (world->getTime() < current_time) + while (current !=m_rewind_queue.getLast()) { // Now handle all events(!) at the current time (i.e. between // World::getTime() and World::getTime()+dt) before updating diff --git a/src/network/rewind_queue.hpp b/src/network/rewind_queue.hpp index 05f6e293e..ea8028e0b 100755 --- a/src/network/rewind_queue.hpp +++ b/src/network/rewind_queue.hpp @@ -88,6 +88,11 @@ public: bool hasMoreRewindInfo() const; void undoUntil(float undo_time); float determineNextDT(float max_time); + // ------------------------------------------------------------------------ + /** Returns the last (i.e. newest) entry in the TimeStepInfo list. This is + * used for rewinds, since it's the first TimeStep that must not be + * rewound. */ + TimeStepInfo *getLast() { return *m_time_step_info.rbegin(); } // ------------------------------------------------------------------------ RewindQueue::AllTimeStepInfo::iterator& operator++()