From 2de8c22a9971153d594b2bb4736eb293753f1212 Mon Sep 17 00:00:00 2001 From: SmallJoker Date: Tue, 6 Sep 2016 19:13:52 +0200 Subject: Make getStackMax return the correct maximal stack size --- src/inventory.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/inventory.h') diff --git a/src/inventory.h b/src/inventory.h index a690eb5ae..7d7e58d61 100644 --- a/src/inventory.h +++ b/src/inventory.h @@ -80,15 +80,14 @@ struct ItemStack // Maximum size of a stack u16 getStackMax(IItemDefManager *itemdef) const { - s16 max = itemdef->get(name).stack_max; - return (max >= 0) ? max : 0; + return itemdef->get(name).stack_max; } // Number of items that can be added to this stack u16 freeSpace(IItemDefManager *itemdef) const { u16 max = getStackMax(itemdef); - if(count > max) + if (count >= max) return 0; return max - count; } -- cgit v1.2.3