From 0261eb73e5588f5732aef5df753311d488c45d06 Mon Sep 17 00:00:00 2001 From: Erik Schilling Date: Sun, 28 Apr 2013 11:52:08 +0200 Subject: Fixed a bunch of cppcheck warnings --- src/scripting/luascript.cpp | 8 +++----- src/scripting/luautil.h | 6 +++--- 2 files changed, 6 insertions(+), 8 deletions(-) (limited to 'src/scripting') diff --git a/src/scripting/luascript.cpp b/src/scripting/luascript.cpp index 2b9644d..1617f74 100644 --- a/src/scripting/luascript.cpp +++ b/src/scripting/luascript.cpp @@ -101,14 +101,12 @@ void LuaScript::push(const std::list &itemList) lua_createtable(mCurrentState, itemList.size(), 0); int itemTable = lua_gettop(mCurrentState); - for (std::list::const_iterator i = itemList.begin(); - i != itemList.end(); - i++) + for (const InventoryItem &inventoryItem : itemList) { // create the item structure std::map item; - item["id"] = i->itemId; - item["amount"] = i->amount; + item["id"] = inventoryItem.itemId; + item["amount"] = inventoryItem.amount; pushSTLContainer(mCurrentState, item); lua_rawseti(mCurrentState, itemTable, ++position); } diff --git a/src/scripting/luautil.h b/src/scripting/luautil.h index 8bcc2a3..26ed33c 100644 --- a/src/scripting/luautil.h +++ b/src/scripting/luautil.h @@ -230,7 +230,7 @@ void pushSTLContainer(lua_State *s, const std::list &container) { push(s, *i); lua_rawseti(s, table, key); - i++; + ++i; } } @@ -264,7 +264,7 @@ void pushSTLContainer(lua_State *s, const std::map &container) push(s, i->first); push(s, i->second); lua_settable(s, table); - i++; + ++i; } } @@ -282,7 +282,7 @@ void pushSTLContainer(lua_State *s, const std::set &container) { push(s, *i); lua_rawseti(s, table, key); - i++; + ++i; } } -- cgit