Revert "Object Interation Menu: Request displayed amount from objects" (#1970)

This reverts commit 8698aa25cf.

Tackling #1970. The implementation in the reverted commit was incorrect (i.e. only one out of two "GetStackCount" were replaced with GetInteractionMenuAmount, leading to weird behaviour). If you want to replace it, please do it in a way that no call to IsInfiniteStack will be required. And this hack would probably require so much more bloat code that nothing would be gained (i.e. what happens when you put two infinite arrow stacks in one container?).
The bug report complains about the "display stopping at 999" *in some situations*, which was due to Stackable_Max_Display_Count. It's gone now. And that it was not limited to 999 in all situations (like the code would have suggested) is probably due to the things I described above.

# Conflicts:
#	planet/Objects.ocd/Libraries.ocd/LiquidControl.ocd/Liquid.ocd/Script.c
#	planet/Objects.ocd/Libraries.ocd/Stackable.ocd/Script.c
install-platforms
David Dormagen 2018-01-07 17:42:27 +01:00
parent 0d38a3fb33
commit 0f049800c5
2 changed files with 4 additions and 15 deletions

View File

@ -1048,7 +1048,10 @@ func FxIntRefreshContentsMenuTimer(object target, effect, int time)
}
}
// How many objects are this object?!
var object_amount = obj->~GetInteractionMenuAmount() ?? 1;
var object_amount = obj->~GetStackCount() ?? 1;
// Infinite stacks work differently - showing an arbitrary amount would not make sense.
if (object_amount > 1 && obj->~IsInfiniteStackCount())
object_amount = 1;
// Empty containers can be stacked.
for (var inv in inventory)
{

View File

@ -42,7 +42,6 @@ local count, count_is_infinite;
// Max size of stack
static const Stackable_Max_Count = 2147483647;
static const Stackable_Max_Display_Count = 999;
// What GetStackCount should return if the count is set to infinite
// Set this to a fairly large number and not e.g. -1, so naive
@ -415,19 +414,6 @@ public func SaveScenarioObject(props)
}
/**
* Tells the interaction menu as how many objects this object should be displayed.
*/
func GetInteractionMenuAmount()
{
var object_amount = this->GetStackCount() ?? 1;
// Infinite stacks work differently - showing an arbitrary amount would not make sense.
if (object_amount > 1 && this->IsInfiniteStackCount())
object_amount = 1;
return Min(object_amount, Stackable_Max_Display_Count);
}
/**
* Offers editor properties for stack count and inifnite setting
*/