[Fixed] GiveDefaultInventory() always gives another BasicArmor

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

GiveDefaultInventory() always gives another BasicArmor

Postby FishyClockwork » Fri Jun 14, 2019 1:39 am

IE it gives another one without checking if the player already has one.
https://github.com/coelckers/gzdoom/blob/2d1c7ba17cac3ccd201e77ad01a9dd06ab22cb2e/wadsrc/static/zscript/actors/player/player.zs#L1837

I only noticed this while playing a mapset that utilizes ResetInventory in its MAPINFO by typing printinv right after finishing a map (was testing stuff) and seeing multiple BasicArmors being listed.

As I understand it, there should be only one "BasicArmor" in the inventory chain at any time.

Quick edit: was testing in 4.1.3
User avatar
FishyClockwork
 
Joined: 23 Feb 2011

Re: GiveDefaultInventory() always gives another BasicArmor

Postby Graf Zahl » Fri Jun 14, 2019 1:56 am

This function was actually never meant to be called on a PlayerPawn with an initialized inventory. It really should clear the entire inventory before doing its stuff.
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: GiveDefaultInventory() always gives another BasicArmor

Postby FishyClockwork » Fri Jun 14, 2019 2:06 am

Hmm. In that case maybe change ClearInventory() to DestroyAllInventory() here?
[EDIT]Nevermind. I think mental has the right approach.[/EDIT]

Again, I found out about this without any custom PlayerPawn actors.
Last edited by FishyClockwork on Fri Jun 14, 2019 7:31 am, edited 1 time in total.
User avatar
FishyClockwork
 
Joined: 23 Feb 2011

Re: GiveDefaultInventory() always gives another BasicArmor

Postby _mental_ » Fri Jun 14, 2019 2:08 am

In my opinion, these lines
Code: Select allExpand view
let barmor = BasicArmor(Spawn('BasicArmor'));
barmor.BecomeItem ();
AddInventory (barmor);

should be replaced with
Code: Select allExpand view
GiveInventoryType('BasicArmor');

It's the same thing that already works for Hexen armor.
_mental_
 
 
 
Joined: 07 Aug 2011

Re: GiveDefaultInventory() always gives another BasicArmor

Postby Graf Zahl » Wed Jul 17, 2019 1:07 pm

fixed
User avatar
Graf Zahl
Lead GZDoom Developer
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 0 guests