GiveDefaultInventory() always gives another BasicArmor

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
User avatar
Fishytza
Posts: 781
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference
Contact:

GiveDefaultInventory() always gives another BasicArmor

Post by Fishytza »

IE it gives another one without checking if the player already has one.
https://github.com/coelckers/gzdoom/blo ... r.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
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GiveDefaultInventory() always gives another BasicArmor

Post by Graf Zahl »

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
Fishytza
Posts: 781
Joined: Wed Feb 23, 2011 11:04 am
Preferred Pronouns: No Preference
Contact:

Re: GiveDefaultInventory() always gives another BasicArmor

Post by Fishytza »

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 Fishytza on Fri Jun 14, 2019 6:31 am, edited 1 time in total.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: GiveDefaultInventory() always gives another BasicArmor

Post by _mental_ »

In my opinion, these lines

Code: Select all

let barmor = BasicArmor(Spawn('BasicArmor'));
barmor.BecomeItem ();
AddInventory (barmor);
should be replaced with

Code: Select all

GiveInventoryType('BasicArmor');
It's the same thing that already works for Hexen armor.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49056
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: GiveDefaultInventory() always gives another BasicArmor

Post by Graf Zahl »

fixed
Post Reply

Return to “Closed Bugs [GZDoom]”