1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-09-05 18:41:05 +00:00

Various random code cleanups

This commit is contained in:
sfan5 2025-03-01 11:53:37 +01:00
parent 358658fa34
commit 7892541383
73 changed files with 216 additions and 285 deletions

View file

@ -411,7 +411,7 @@ static void push_craft_recipe(lua_State *L, IGameDef *gdef,
CraftOutput output = recipe->getOutput(input, gdef);
lua_newtable(L); // items
std::vector<ItemStack>::const_iterator iter = input.items.begin();
auto iter = input.items.begin();
for (u16 j = 1; iter != input.items.end(); ++iter, j++) {
if (iter->empty())
continue;
@ -457,7 +457,7 @@ static void push_craft_recipes(lua_State *L, IGameDef *gdef,
lua_createtable(L, recipes.size(), 0);
std::vector<CraftDefinition*>::const_iterator it = recipes.begin();
auto it = recipes.begin();
for (unsigned i = 0; it != recipes.end(); ++it) {
lua_newtable(L);
push_craft_recipe(L, gdef, *it, output);

View file

@ -250,7 +250,7 @@ bool read_schematic_def(lua_State *L, int index,
u8 param2 = getintfield_default(L, -1, "param2", 0);
//// Find or add new nodename-to-ID mapping
std::unordered_map<std::string, content_t>::iterator it = name_id_map.find(name);
auto it = name_id_map.find(name);
content_t name_index;
if (it != name_id_map.end()) {
name_index = it->second;

View file

@ -36,7 +36,7 @@ int ModApiRollback::l_rollback_get_node_actions(lua_State *L)
}
std::list<RollbackAction> actions = rollback->getNodeActors(pos, range, seconds, limit);
std::list<RollbackAction>::iterator iter = actions.begin();
auto iter = actions.begin();
lua_createtable(L, actions.size(), 0);
for (unsigned int i = 1; iter != actions.end(); ++iter, ++i) {
@ -86,8 +86,7 @@ int ModApiRollback::l_rollback_revert_actions_by(lua_State *L)
lua_pushboolean(L, success);
lua_createtable(L, log.size(), 0);
unsigned long i = 0;
for(std::list<std::string>::const_iterator iter = log.begin();
iter != log.end(); ++i, ++iter) {
for(auto iter = log.begin(); iter != log.end(); ++i, ++iter) {
lua_pushnumber(L, i);
lua_pushstring(L, iter->c_str());
lua_settable(L, -3);