Fix yield_ms().

This fixes
https://code.google.com/p/singularity-viewer/issues/detail?id=714

The problem was a typo in AIStateMachine::sleep, >= should have been <=
which caused a state machine that uses yield_ms() to never run anymore
when next run it already should have run again. AIFilePicker is the only
state machine that currently uses yield_ms and I hadn't spotted this
because I don't have plugin messages on by default which made my viewer
just that much faster that it the yield never expired the first run
already (causing it to expire immediately).

The rest of the changes in this commit are just minor improvements /
conformation to the EXAMPLE_CODE in aistatemachine.cpp.
This commit is contained in:
Aleric Inglewood
2013-03-26 23:30:04 +01:00
parent 524fdf033d
commit 779f697ffb
3 changed files with 19 additions and 11 deletions

View File

@@ -296,7 +296,7 @@ class AIStateMachine : public LLThreadSafeRefCount
return false;
else if (mSleep < 0)
++mSleep;
else if ((U64)mSleep >= current_time)
else if ((U64)mSleep <= current_time)
mSleep = 0;
return mSleep != 0;
}