mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 13:47:58 +03:00
Fix integer overflow in wait command that would cause infinite loop in stock scripts
It was causing a rare infinite loop in anim/stand.scr where it waits for 9999999 if the actor is unarmed and medic
This commit is contained in:
parent
824cfd789c
commit
b68bb4cee7
1 changed files with 7 additions and 2 deletions
|
@ -2711,12 +2711,17 @@ void ScriptThread::EventDelayThrow(Event *ev)
|
|||
|
||||
void ScriptThread::EventWait(Event *ev)
|
||||
{
|
||||
Wait((int)roundf(ev->GetFloat(1) * 1000.0f));
|
||||
float timeSeconds;
|
||||
|
||||
// Fixed in OPM
|
||||
// Clamp to make sure to not overflow when converting to integer
|
||||
timeSeconds = Q_clamp_float(ev->GetFloat(1), 0, 2000000);
|
||||
Wait((int)roundf(timeSeconds * 1000));
|
||||
}
|
||||
|
||||
void ScriptThread::EventWaitFrame(Event *ev)
|
||||
{
|
||||
Wait((int)roundf(level.frametime * 1000.0f));
|
||||
Wait((int)roundf(level.frametime * 1000));
|
||||
}
|
||||
|
||||
void ScriptThread::EventResume(Event *ev)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue