fs2open.github.com
fs2open.github.com copied to clipboard
Prevent subsystem `fireWeapon` scripting function from triggering an assert
It is possible for a script to call the fireWeapon subsystem function passing wnum as any integer.
Down the line, wnum ends up passed to ai_turret::get_turret_weapon_wip, and could trigger either of those asserts:
Assert(weapon_num < MAX_SHIP_WEAPONS);
Assert(weapon_num >= 0);
This PR prevents that by giving an error and returning early.