mirror of https://github.com/axmolengine/axmol.git
Fixed `Scheduler::update` can lead to an infinite loop when the value of `dt` is zero.
This commit is contained in:
parent
c4af7b8c45
commit
d855722c20
|
@ -129,12 +129,17 @@ void Timer::update(float dt)
|
||||||
{
|
{
|
||||||
trigger(interval);
|
trigger(interval);
|
||||||
_elapsed -= interval;
|
_elapsed -= interval;
|
||||||
|
_timesExecuted += 1;
|
||||||
|
if (_elapsed <= 0.f)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if (_runForever)
|
if (_runForever)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
_timesExecuted += 1;
|
|
||||||
if (_timesExecuted > _repeat)
|
if (_timesExecuted > _repeat)
|
||||||
{ //unschedule timer
|
{ //unschedule timer
|
||||||
cancel();
|
cancel();
|
||||||
|
|
Loading…
Reference in New Issue