Fixed ACS scripts executing a function from another library that cause a division/modulus of zero from aborting the game.

This commit is contained in:
Adam Kaminski 2025-01-24 10:33:56 -05:00 committed by Ricardo Luís Vaz Silva
parent e0394ef16a
commit 162ab3c4ec

View file

@ -10337,6 +10337,11 @@ scriptwait:
}
}
// There are several or more p-codes that can trigger a division or modulus of zero.
// Reset the active behavior back to the original if this happens.
if (state == SCRIPT_DivideBy0 || state == SCRIPT_ModulusBy0)
activeBehavior = savedActiveBehavior;
if (runaway != 0 && InModuleScriptNumber >= 0)
{
auto scriptptr = activeBehavior->GetScriptPtr(InModuleScriptNumber);