summaryrefslogtreecommitdiff
path: root/src/inventory.h
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2016-09-06 19:13:52 +0200
committerkwolekr <kwolekr@minetest.net>2016-09-08 03:37:03 -0400
commit2de8c22a9971153d594b2bb4736eb293753f1212 (patch)
tree65427e44febaa2211107991c2ce006f6fe3ffcfb /src/inventory.h
parentaa33166386f737f213f1f3005ffd6a6adfd2d97f (diff)
downloadminetest-2de8c22a9971153d594b2bb4736eb293753f1212.tar.gz
minetest-2de8c22a9971153d594b2bb4736eb293753f1212.tar.bz2
minetest-2de8c22a9971153d594b2bb4736eb293753f1212.zip
Make getStackMax return the correct maximal stack size
Diffstat (limited to 'src/inventory.h')
-rw-r--r--src/inventory.h5
1 files changed, 2 insertions, 3 deletions
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;
}