From 5c4b79d03cef77ea0a8ff5af31b91aaaed7a10f8 Mon Sep 17 00:00:00 2001 From: Luan Santos Date: Fri, 13 Oct 2023 15:21:45 -0700 Subject: [PATCH] fix: fluid clamp (#1698) Previous PR did some math on fluids that didn't work when dropping splashes, this fixes it to be more deterministic. --- src/items/item.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index 4677041e777..1b60d82b4e8 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -185,7 +185,8 @@ Item::Item(const uint16_t itemId, uint16_t itemCount /*= 0*/) : const ItemType &it = items[id]; auto itemCharges = it.charges; if (it.isFluidContainer() || it.isSplash()) { - setAttribute(ItemAttribute_t::FLUIDTYPE, itemCount * (itemCount < sizeof(Fluids_t))); + auto fluidType = std::clamp(itemCount, 1, FLUID_INK); + setAttribute(ItemAttribute_t::FLUIDTYPE, fluidType); } else if (it.stackable) { if (itemCount != 0) { setItemCount(static_cast(itemCount));