From 6a1670dbc31cc0e44178bbd9ad34ff0d5981a060 Mon Sep 17 00:00:00 2001 From: Ilya Zhuravlev Date: Thu, 20 Dec 2012 21:19:49 +0400 Subject: Migrate to STL containers/algorithms. --- src/scriptapi.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/scriptapi.cpp') diff --git a/src/scriptapi.cpp b/src/scriptapi.cpp index 074a2eb0d..04af4eb22 100644 --- a/src/scriptapi.cpp +++ b/src/scriptapi.cpp @@ -895,24 +895,24 @@ static int l_get_modpath(lua_State *L) static int l_get_modnames(lua_State *L) { // Get a list of mods - core::list mods_unsorted, mods_sorted; + std::list mods_unsorted, mods_sorted; get_server(L)->getModNames(mods_unsorted); // Take unsorted items from mods_unsorted and sort them into // mods_sorted; not great performance but the number of mods on a // server will likely be small. - for(core::list::Iterator i = mods_unsorted.begin(); - i != mods_unsorted.end(); i++) + for(std::list::iterator i = mods_unsorted.begin(); + i != mods_unsorted.end(); ++i) { bool added = false; - for(core::list::Iterator x = mods_sorted.begin(); - x != mods_unsorted.end(); x++) + for(std::list::iterator x = mods_sorted.begin(); + x != mods_unsorted.end(); ++x) { // I doubt anybody using Minetest will be using // anything not ASCII based :) if((*i).compare(*x) <= 0) { - mods_sorted.insert_before(x, *i); + mods_sorted.insert(x, *i); added = true; break; } @@ -929,7 +929,7 @@ static int l_get_modnames(lua_State *L) // Package them up for Lua lua_newtable(L); int new_table = lua_gettop(L); - core::list::Iterator i = mods_sorted.begin(); + std::list::iterator i = mods_sorted.begin(); while(i != mods_sorted.end()) { lua_pushvalue(L, insertion_func); @@ -939,7 +939,7 @@ static int l_get_modnames(lua_State *L) { script_error(L, "error: %s", lua_tostring(L, -1)); } - i++; + ++i; } return 1; } -- cgit v1.2.3