- fixed: Trying to remove the first item in an actor's inventory would lose all owned items.

This commit is contained in:
Christoph Oelckers 2019-01-04 18:56:14 +01:00
parent b47a3804d2
commit d898cadda5

View file

@ -110,14 +110,12 @@ extend class Actor
virtual void RemoveInventory(Inventory item) virtual void RemoveInventory(Inventory item)
{ {
Inventory invp;
if (item != NULL && item.Owner != NULL) // can happen if the owner was destroyed by some action from an item's use state. if (item != NULL && item.Owner != NULL) // can happen if the owner was destroyed by some action from an item's use state.
{ {
if (Inv == item) Inv = item.Inv; if (Inv == item) Inv = item.Inv;
else else
{ {
for (invp = Inv; invp != null; invp = invp.Inv) for (Actor invp = self; invp != null; invp = invp.Inv)
{ {
if (invp.Inv == item) if (invp.Inv == item)
{ {