aboutsummaryrefslogtreecommitdiff
path: root/src/script
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/script
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/script')
-rw-r--r--src/script/common/c_content.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index c664101ea..19873abc5 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -65,9 +65,8 @@ ItemDefinition read_item_definition(lua_State* L,int index,
}
lua_pop(L, 1);
- def.stack_max = getintfield_default(L, index, "stack_max", def.stack_max);
- if(def.stack_max == 0)
- def.stack_max = 1;
+ int stack_max = getintfield_default(L, index, "stack_max", def.stack_max);
+ def.stack_max = rangelim(stack_max, 1, U16_MAX);
lua_getfield(L, index, "on_use");
def.usable = lua_isfunction(L, -1);