mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-25 11:52:40 +01:00
Fix segfault when script timer runs out
This commit is contained in:
parent
1945d67818
commit
7dece398f4
@ -510,10 +510,7 @@ void RWGame::tick(float dt) {
|
||||
while (scriptTimerAccumulator >= timerClockRate) {
|
||||
// Original game uses milliseconds
|
||||
(*state.scriptTimerVariable) -= timerClockRate * 1000;
|
||||
if (*state.scriptTimerVariable <= 0) {
|
||||
(*state.scriptTimerVariable) = 0;
|
||||
state.scriptTimerVariable = nullptr;
|
||||
}
|
||||
|
||||
// 11 seconds
|
||||
if (*state.scriptTimerVariable <= 11000 &&
|
||||
beepTime - *state.scriptTimerVariable >= 1000) {
|
||||
@ -521,6 +518,12 @@ void RWGame::tick(float dt) {
|
||||
|
||||
// @todo beep
|
||||
}
|
||||
|
||||
if (*state.scriptTimerVariable <= 0) {
|
||||
(*state.scriptTimerVariable) = 0;
|
||||
state.scriptTimerVariable = nullptr;
|
||||
}
|
||||
|
||||
scriptTimerAccumulator -= timerClockRate;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user