Determine end of rewind period by reaching the latest TimeStepInfo
(i.e. the one that was just added for the upcoming timestep that first needed to do the rewind) instead of comparing world time and end time - the latter is prone to floating point differences, causing rewinds to 'rewind' the timestep that has yet being computed.
This commit is contained in:
parent
a13856c6d1
commit
48bbdc0e07
@ -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
|
||||
|
@ -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++()
|
||||
|
Loading…
Reference in New Issue
Block a user