Refactoring: Stackable: IsInfiniteStackCount() instead of count_is_infinite

The interface should be used instead of the internal variable, in case something gets renamed.
liquid_container
Mark 2016-03-07 17:49:11 +01:00
parent fe5e1bc581
commit dc84a1a5e2
1 changed files with 5 additions and 4 deletions

View File

@ -135,10 +135,10 @@ public func TakeObject()
}
else if (count > 1)
{
if (!count_is_infinite) SetStackCount(count - 1);
if (!IsInfiniteStackCount()) SetStackCount(count - 1);
var take = CreateObjectAbove(GetID(), 0, 0, GetOwner());
take->SetStackCount(1);
if (!count_is_infinite) UpdateStackDisplay();
if (!IsInfiniteStackCount()) UpdateStackDisplay();
return take;
}
}
@ -275,14 +275,15 @@ public func TryPutInto(object into, bool only_add_to_existing_stacks)
// Infinite stacks can only be stacked on top of others.
public func CanBeStackedWith(object other)
{
if (other.count_is_infinite != this.count_is_infinite) return false;
//if (other.count_is_infinite != this.count_is_infinite) return false;
if (other->~IsInfiniteStackCount() != this->IsInfiniteStackCount()) return false;
return _inherited(other, ...);
}
// Infinite stacks show a little symbol in their corner.
public func GetInventoryIconOverlay()
{
if (!count_is_infinite) return nil;
if (!IsInfiniteStackCount()) return nil;
return {Left = "50%", Bottom="50%", Symbol=Icon_Number, GraphicsName="Inf"};
}