Skip to content

Commit

Permalink
Fixed ACS scripts executing a function from another library that caus…
Browse files Browse the repository at this point in the history
…e a division/modulus of zero from aborting the game.
  • Loading branch information
AKMDM authored and RicardoLuis0 committed Jan 28, 2025
1 parent e0394ef commit 162ab3c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/playsim/p_acs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10337,6 +10337,11 @@ int DLevelScript::RunScript()
}
}

// 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);
Expand Down

0 comments on commit 162ab3c

Please sign in to comment.