Fix: MagAmmo.MagFill may be called with non-existing parent ammo.

This commit is contained in:
Mari the Deer 2020-08-28 09:50:34 +02:00
commit 7ae5f693cc
3 changed files with 13 additions and 2 deletions

View file

@ -1,2 +1,2 @@
[default]
SWWM_MODVER="\chSWWM \cwGZ\c- r505 (Sun 23 Aug 16:32:44 CEST 2020)";
SWWM_MODVER="\chSWWM \cwGZ\c- r505 (Fri 28 Aug 09:50:34 CEST 2020)";

View file

@ -235,6 +235,17 @@ Class MagAmmo : Inventory abstract
bool MagFill()
{
// double-check that parent ammo exists
if ( !pamo )
{
pamo = Ammo(Owner.FindInventory(ParentAmmo));
if ( !pamo )
{
pamo = Ammo(Spawn(ParentAmmo));
pamo.AttachToOwner(Owner);
pamo.Amount = 0;
}
}
bool given = false;
while ( (pamo.Amount < pamo.MaxAmount) && (Amount >= ClipSize) )
{

View file

@ -92,7 +92,7 @@ Class SWWMCrashHandler : StaticEventHandler
let hnd = SWWMBrutalHandler(StaticEventHandler.Find("SWWMBrutalHandler"));
if ( hnd && hnd.detected ) Console.Printf(TEXTCOLOR_GOLD.."Don't blame me. Shouldn't have tried running this with Brutal Doom."..TEXTCOLOR_NORMAL);
else Console.Printf(TEXTCOLOR_GOLD.."If you didn't trigger it manually, it's best if you take a screenshot and show it to Marisa."..TEXTCOLOR_NORMAL);
Console.Printf(TEXTCOLOR_GOLD.."Version Information: %s"..TEXTCOLOR_NORMAL,StringTable.Localize("SWWM_MODVER"));
Console.Printf(TEXTCOLOR_GOLD.."Version Information: %s"..TEXTCOLOR_NORMAL,StringTable.Localize("$SWWM_MODVER"));
}
timer++;
}