1
0
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:
husho 2018-08-13 03:30:16 +03:00 committed by Daniel Evans
parent 1945d67818
commit 7dece398f4

View File

@ -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;
}
}