Permalink
Browse files

inventory bar: stack count always falls back to contained object count

Related to #1970 and 5fc07df
This replaces the very hacky implementation just for the dynamite with a more general solution (and e.g. also works with the grenade launcher).
  • Loading branch information...
walachey committed Jan 13, 2018
1 parent 12da14d commit 6b797e300e5b5bc7ddfcfad138cb624e9b4ad5c1
@@ -218,12 +218,12 @@ private func UpdateInventory()
if (contents)
{
extra_symbol = contents;
- // Stack count: Some contents may provide their own stack count function just for inventory display
- extra_symbol_stack_count = contents->~GetContainedDisplayStackCount();
- if (!GetType(extra_symbol_stack_count))
+ // Stack count: either actual stack count or stacked object count.
+ extra_symbol_stack_count = contents->~GetStackCount();
+ if (extra_symbol_stack_count == nil)
{
// Stack count fallback to actually stacked objects
- extra_symbol_stack_count = contents->~GetStackCount();
+ extra_symbol_stack_count = item->ContentsCount(contents->GetID());
}
}
extra_slot_player = GetOwner();
@@ -243,7 +243,7 @@ private func UpdateInventory()
var extra_text = nil, number_symbol = nil;
if (extra_symbol && extra_symbol_stack_count)
{
- if (contents->IsInfiniteStackCount())
+ if (contents->~IsInfiniteStackCount())
number_symbol = Icon_Number;
else extra_text = Format("%dx", extra_symbol_stack_count);
}
@@ -84,18 +84,6 @@ public func OnFuseFinished(object fuse)
DoExplode();
}
-// This will only when inside a dynamite box to display the remaining dynamite sticks in the HUD
-public func GetContainedDisplayStackCount()
-{
- if (Contained())
- {
- if (Contained()->GetID() == DynamiteBox)
- {
- return Contained()->ContentsCount(GetID());
- }
- }
-}
-
public func IsInfiniteStackCount()
{
return false;

0 comments on commit 6b797e3

Please sign in to comment.