aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/script/common/c_content.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp
index 3a9e9e049..9eba4cbf2 100644
--- a/src/script/common/c_content.cpp
+++ b/src/script/common/c_content.cpp
@@ -1529,13 +1529,15 @@ void read_groups(lua_State *L, int index, ItemGroupList &result)
return;
result.clear();
lua_pushnil(L);
- if(index < 0)
+ if (index < 0)
index -= 1;
- while(lua_next(L, index) != 0){
+ while (lua_next(L, index) != 0) {
// key at index -2 and value at index -1
std::string name = luaL_checkstring(L, -2);
int rating = luaL_checkinteger(L, -1);
- result[name] = rating;
+ // zero rating indicates not in the group
+ if (rating != 0)
+ result[name] = rating;
// removes value, keeps key for next iteration
lua_pop(L, 1);
}