diff --git a/builtin/fstk/buttonbar.lua b/builtin/fstk/buttonbar.lua index 64ac37f032165..06131a9e22863 100644 --- a/builtin/fstk/buttonbar.lua +++ b/builtin/fstk/buttonbar.lua @@ -40,7 +40,7 @@ local function buttonbar_formspec(self) -- `BASE_SPACING` is used as the minimum spacing, like `gap` in CSS Flexbox. -- The number of buttons per page is always calculated as if the scroll - -- buttons were visible. + -- buttons were visible. local avail_space = self.size.x - 2*BASE_SPACING - 2*get_scroll_btn_width() local btns_per_page = math.floor((avail_space - BASE_SPACING) / (btn_size + BASE_SPACING)) diff --git a/builtin/game/falling.lua b/builtin/game/falling.lua index 33473091d7f1a..8cb776f2a6969 100644 --- a/builtin/game/falling.lua +++ b/builtin/game/falling.lua @@ -80,7 +80,7 @@ core.register_entity(":__builtin:falling_node", { self.floats = core.get_item_group(node.name, "float") ~= 0 -- Save liquidtype for falling water - self.liquidtype = def.liquidtype + self.liquidtype = def.liquidtype -- Set entity visuals if def.drawtype == "torchlike" or def.drawtype == "signlike" then diff --git a/games/devtest/mods/soundstuff/racecar.lua b/games/devtest/mods/soundstuff/racecar.lua index e7eda6d2e4e2c..97906d3eb9a46 100644 --- a/games/devtest/mods/soundstuff/racecar.lua +++ b/games/devtest/mods/soundstuff/racecar.lua @@ -4,14 +4,14 @@ local drive_distance = 30 minetest.register_entity("soundstuff:racecar", { initial_properties = { - physical = false, - collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, - visual = "upright_sprite", - visual_size = {x = 1, y = 1, z = 1}, - textures = {"soundstuff_racecar.png", "soundstuff_racecar.png^[transformFX"}, - static_save = false, - }, + physical = false, + collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + selectionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, + visual = "upright_sprite", + visual_size = {x = 1, y = 1, z = 1}, + textures = {"soundstuff_racecar.png", "soundstuff_racecar.png^[transformFX"}, + static_save = false, + }, on_activate = function(self, _staticdata, _dtime_s) self.min_x = self.object:get_pos().x - drive_distance * 0.5 diff --git a/games/devtest/mods/testentities/selectionbox.lua b/games/devtest/mods/testentities/selectionbox.lua index a455fd459c875..7fbde0dbf42bd 100644 --- a/games/devtest/mods/testentities/selectionbox.lua +++ b/games/devtest/mods/testentities/selectionbox.lua @@ -68,7 +68,7 @@ minetest.register_globalstep(function() hud_ids[pname] = hud_id or player:hud_add({ type = "text", -- See HUD element types position = {x=0.5, y=0.5}, - text = "X", + text = "X", number = 0xFF0000, alignment = {x=0, y=0}, }) diff --git a/games/devtest/mods/tiled/init.lua b/games/devtest/mods/tiled/init.lua index 7e2bdba1a3792..63428bcff1df2 100644 --- a/games/devtest/mods/tiled/init.lua +++ b/games/devtest/mods/tiled/init.lua @@ -2,37 +2,38 @@ local align_help = "Texture spans over a space of 8×8 nodes" local align_help_n = "Tiles looks the same for every node" minetest.register_node("tiled:tiled", { - description = "Tiled Node (world-aligned)".."\n"..align_help, - tiles = {{ - name = "tiled_tiled.png", - align_style = "world", - scale = 8, - }}, - groups = {cracky=3}, + description = "Tiled Node (world-aligned)".."\n"..align_help, + tiles = {{ + name = "tiled_tiled.png", + align_style = "world", + scale = 8, + }}, + groups = {cracky=3}, }) minetest.register_node("tiled:tiled_rooted", { - description = "Tiled 'plantlike_rooted' Node (world-aligned)".."\n".. - "Base node texture spans over a space of 8×8 nodes".."\n".. - "A plantlike thing grows on top", - paramtype = "light", - drawtype = "plantlike_rooted", - tiles = {{ - name = "tiled_tiled.png", - align_style = "world", - scale = 8, - }}, - special_tiles = {"tiled_tiled_node.png"}, - groups = {cracky=3}, + description = + "Tiled 'plantlike_rooted' Node (world-aligned)".."\n".. + "Base node texture spans over a space of 8×8 nodes".."\n".. + "A plantlike thing grows on top", + paramtype = "light", + drawtype = "plantlike_rooted", + tiles = {{ + name = "tiled_tiled.png", + align_style = "world", + scale = 8, + }}, + special_tiles = {"tiled_tiled_node.png"}, + groups = {cracky=3}, }) minetest.register_node("tiled:tiled_n", { - description = "Tiled Node (node-aligned)".."\n"..align_help_n, - tiles = {{ - name = "tiled_tiled_node.png", - align_style = "node", - }}, - groups = {cracky=3}, + description = "Tiled Node (node-aligned)".."\n"..align_help_n, + tiles = {{ + name = "tiled_tiled_node.png", + align_style = "node", + }}, + groups = {cracky=3}, }) stairs.register_stair_and_slab("tiled_n", "tiled:tiled_n", diff --git a/games/devtest/mods/unittests/get_version.lua b/games/devtest/mods/unittests/get_version.lua index 7ef78257d04eb..9903ac381bb7e 100644 --- a/games/devtest/mods/unittests/get_version.lua +++ b/games/devtest/mods/unittests/get_version.lua @@ -1,16 +1,16 @@ unittests.register("test_get_version", function() - local version = core.get_version() - assert(type(version) == "table") - assert(type(version.project) == "string") - assert(type(version.string) == "string") - assert(type(version.proto_min) == "number") - assert(type(version.proto_max) == "number") - assert(version.proto_max >= version.proto_min) - assert(type(version.is_dev) == "boolean") - if version.is_dev then - assert(type(version.hash) == "string") - else - assert(version.hash == nil) - end + local version = core.get_version() + assert(type(version) == "table") + assert(type(version.project) == "string") + assert(type(version.string) == "string") + assert(type(version.proto_min) == "number") + assert(type(version.proto_max) == "number") + assert(version.proto_max >= version.proto_min) + assert(type(version.is_dev) == "boolean") + if version.is_dev then + assert(type(version.hash) == "string") + else + assert(version.hash == nil) + end end) diff --git a/games/devtest/mods/unittests/raycast.lua b/games/devtest/mods/unittests/raycast.lua index 08d6a11205795..f19b787166f28 100644 --- a/games/devtest/mods/unittests/raycast.lua +++ b/games/devtest/mods/unittests/raycast.lua @@ -1,36 +1,36 @@ local function raycast_with_pointabilities(start_pos, end_pos, pointabilities) local ray = core.raycast(start_pos, end_pos, nil, nil, pointabilities) for hit in ray do - if hit.type == "node" then - return hit.under - end + if hit.type == "node" then + return hit.under + end end - return nil + return nil end local function test_raycast_pointabilities(player, pos1) - local pos2 = pos1:offset(0, 0, 1) - local pos3 = pos1:offset(0, 0, 2) + local pos2 = pos1:offset(0, 0, 1) + local pos3 = pos1:offset(0, 0, 2) - local oldnode1 = core.get_node(pos1) - local oldnode2 = core.get_node(pos2) - local oldnode3 = core.get_node(pos3) - core.swap_node(pos1, {name = "air"}) - core.swap_node(pos2, {name = "testnodes:not_pointable"}) - core.swap_node(pos3, {name = "testnodes:pointable"}) + local oldnode1 = core.get_node(pos1) + local oldnode2 = core.get_node(pos2) + local oldnode3 = core.get_node(pos3) + core.swap_node(pos1, {name = "air"}) + core.swap_node(pos2, {name = "testnodes:not_pointable"}) + core.swap_node(pos3, {name = "testnodes:pointable"}) - local p = nil - assert(raycast_with_pointabilities(pos1, pos3, p) == pos3) + local p = nil + assert(raycast_with_pointabilities(pos1, pos3, p) == pos3) - p = core.registered_items["testtools:blocked_pointing_staff"].pointabilities - assert(raycast_with_pointabilities(pos1, pos3, p) == nil) + p = core.registered_items["testtools:blocked_pointing_staff"].pointabilities + assert(raycast_with_pointabilities(pos1, pos3, p) == nil) - p = core.registered_items["testtools:ultimate_pointing_staff"].pointabilities - assert(raycast_with_pointabilities(pos1, pos3, p) == pos2) + p = core.registered_items["testtools:ultimate_pointing_staff"].pointabilities + assert(raycast_with_pointabilities(pos1, pos3, p) == pos2) - core.swap_node(pos1, oldnode1) - core.swap_node(pos2, oldnode2) - core.swap_node(pos3, oldnode3) + core.swap_node(pos1, oldnode1) + core.swap_node(pos2, oldnode2) + core.swap_node(pos3, oldnode3) end unittests.register("test_raycast_pointabilities", test_raycast_pointabilities, {map=true}) diff --git a/games/devtest/mods/util_commands/init.lua b/games/devtest/mods/util_commands/init.lua index 6285d4754f661..1beb533a51ccd 100644 --- a/games/devtest/mods/util_commands/init.lua +++ b/games/devtest/mods/util_commands/init.lua @@ -234,10 +234,10 @@ minetest.register_chatcommand("dump_wear_bar", { }) core.register_chatcommand("set_saturation", { - params = "", - description = "Set the saturation for current player.", - func = function(player_name, param) - local saturation = tonumber(param) - minetest.get_player_by_name(player_name):set_lighting({saturation = saturation }) - end + params = "", + description = "Set the saturation for current player.", + func = function(player_name, param) + local saturation = tonumber(param) + minetest.get_player_by_name(player_name):set_lighting({saturation = saturation }) + end }) diff --git a/src/client/content_cso.cpp b/src/client/content_cso.cpp index 821c2507dd294..2c9dac69642ec 100644 --- a/src/client/content_cso.cpp +++ b/src/client/content_cso.cpp @@ -55,7 +55,7 @@ class SmokePuffCSO: public ClientSimpleObject MapNode n = env->getMap().getNode(floatToInt(pos, BS), &pos_ok); light = pos_ok ? decode_light(n.getLightBlend(env->getDayNightRatio(), env->getGameDef()->ndef()->getLightingFlags(n))) - : 64; + : 64; video::SColor color(255,light,light,light); m_spritenode->setColor(color); } diff --git a/src/client/game.cpp b/src/client/game.cpp index 0a9b4ec58a515..c41e5be7b3b12 100644 --- a/src/client/game.cpp +++ b/src/client/game.cpp @@ -4091,8 +4091,8 @@ void Game::updateFrame(ProfilerGraph *graph, RunStats *stats, f32 dtime, float old_brightness = sky->getBrightness(); direct_brightness = client->getEnv().getClientMap() .getBackgroundBrightness(MYMIN(runData.fog_range * 1.2, 60 * BS), - daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen) - / 255.0; + daynight_ratio, (int)(old_brightness * 255.5), &sunlight_seen) + / 255.0; } float time_of_day_smooth = runData.time_of_day_smooth; diff --git a/src/clientdynamicinfo.cpp b/src/clientdynamicinfo.cpp index c206018f3ea13..dbe71df1e99f7 100644 --- a/src/clientdynamicinfo.cpp +++ b/src/clientdynamicinfo.cpp @@ -27,29 +27,29 @@ with this program; if not, write to the Free Software Foundation, Inc., ClientDynamicInfo ClientDynamicInfo::getCurrent() { - v2u32 screen_size = RenderingEngine::getWindowSize(); - f32 density = RenderingEngine::getDisplayDensity(); - f32 gui_scaling = g_settings->getFloat("gui_scaling", 0.5f, 20.0f); - f32 hud_scaling = g_settings->getFloat("hud_scaling", 0.5f, 20.0f); - f32 real_gui_scaling = gui_scaling * density; - f32 real_hud_scaling = hud_scaling * density; - bool touch_controls = g_touchcontrols; - - return { - screen_size, real_gui_scaling, real_hud_scaling, - ClientDynamicInfo::calculateMaxFSSize(screen_size, gui_scaling), - touch_controls - }; + v2u32 screen_size = RenderingEngine::getWindowSize(); + f32 density = RenderingEngine::getDisplayDensity(); + f32 gui_scaling = g_settings->getFloat("gui_scaling", 0.5f, 20.0f); + f32 hud_scaling = g_settings->getFloat("hud_scaling", 0.5f, 20.0f); + f32 real_gui_scaling = gui_scaling * density; + f32 real_hud_scaling = hud_scaling * density; + bool touch_controls = g_touchcontrols; + + return { + screen_size, real_gui_scaling, real_hud_scaling, + ClientDynamicInfo::calculateMaxFSSize(screen_size, gui_scaling), + touch_controls + }; } v2f32 ClientDynamicInfo::calculateMaxFSSize(v2u32 render_target_size, f32 gui_scaling) { - f32 factor = (g_settings->getBool("touch_gui") ? 10 : 15) / gui_scaling; - f32 ratio = (f32)render_target_size.X / (f32)render_target_size.Y; - if (ratio < 1) - return { factor, factor / ratio }; - else - return { factor * ratio, factor }; + f32 factor = (g_settings->getBool("touch_gui") ? 10 : 15) / gui_scaling; + f32 ratio = (f32)render_target_size.X / (f32)render_target_size.Y; + if (ratio < 1) + return { factor, factor / ratio }; + else + return { factor * ratio, factor }; } #endif diff --git a/src/filesys.cpp b/src/filesys.cpp index 4287c8b05c98a..eeeefdfb5ef39 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -109,7 +109,7 @@ std::vector GetDirListing(const std::string &pathstring) << " Error is " << dwError << std::endl; listing.clear(); return listing; - } + } } return listing; } @@ -726,7 +726,7 @@ bool PathStartsWith(const std::string &path, const std::string &prefix) if(prefixpos == prefixsize) return true; // Return false if path has ended (at delimiter/EOS) - // while prefix did not. + // while prefix did not. if(pathpos == pathsize) return false; } diff --git a/src/gui/guiFormSpecMenu.cpp b/src/gui/guiFormSpecMenu.cpp index 8b572276cb104..083766e4baf5b 100644 --- a/src/gui/guiFormSpecMenu.cpp +++ b/src/gui/guiFormSpecMenu.cpp @@ -3936,7 +3936,7 @@ void GUIFormSpecMenu::acceptInput(FormspecQuitMode quitmode) fields[name] = "CHG:" + itos(e->getPos()); else fields[name] = "VAL:" + itos(e->getPos()); - } + } } else if (s.ftype == f_AnimatedImage) { // No dynamic cast possible due to some distributions shipped // without rtti support in Irrlicht diff --git a/src/gui/guiHyperText.cpp b/src/gui/guiHyperText.cpp index 6f30ac8ce598e..472f1e6077b9e 100644 --- a/src/gui/guiHyperText.cpp +++ b/src/gui/guiHyperText.cpp @@ -791,7 +791,7 @@ void TextDrawer::place(const core::rect &dest_rect) std::max(f.margin, p.margin); } else if (f.rect.UpperLeftCorner.X - f.margin <= left && - f.rect.LowerRightCorner.X + f.margin >= right) { + f.rect.LowerRightCorner.X + f.margin >= right) { // float taking all space left = right; } diff --git a/src/gui/touchcontrols.cpp b/src/gui/touchcontrols.cpp index 1e4f8a99bcaca..28715c53d4a73 100644 --- a/src/gui/touchcontrols.cpp +++ b/src/gui/touchcontrols.cpp @@ -571,7 +571,7 @@ void TouchControls::translateEvent(const SEvent &event) toggleOverflowMenu(); // refresh since visibility of buttons has changed - element = m_guienv->getRootGUIElement()->getElementFromPoint(touch_pos); + element = m_guienv->getRootGUIElement()->getElementFromPoint(touch_pos); // restore after releaseAll in toggleOverflowMenu m_pointer_downpos[pointer_id] = touch_pos; m_pointer_pos[pointer_id] = touch_pos; diff --git a/src/mapblock.cpp b/src/mapblock.cpp index 9a27a9f3d60c2..ced4aa246a470 100644 --- a/src/mapblock.cpp +++ b/src/mapblock.cpp @@ -355,7 +355,7 @@ void MapBlock::serialize(std::ostream &os_compressed, u8 version, bool disk, int Buffer buf; const u8 content_width = 2; const u8 params_width = 2; - if(disk) + if(disk) { MapNode *tmp_nodes = new MapNode[nodecount]; memcpy(tmp_nodes, data, nodecount * sizeof(MapNode)); diff --git a/src/mapgen/mapgen.cpp b/src/mapgen/mapgen.cpp index 80ffebc9e1d7f..e7b9f7ae245a1 100644 --- a/src/mapgen/mapgen.cpp +++ b/src/mapgen/mapgen.cpp @@ -783,7 +783,7 @@ void MapgenBasic::generateBiomes() // If no stone surface detected in mapchunk column and a water surface // biome fallback exists, add it to the biomemap. This avoids water // surface decorations failing in deep water. - if (biomemap[index] == BIOME_NONE && water_biome_index != 0) + if (biomemap[index] == BIOME_NONE && water_biome_index != 0) biomemap[index] = water_biome_index; } } diff --git a/src/mapgen/mapgen_flat.cpp b/src/mapgen/mapgen_flat.cpp index 6b249ea1fe239..c14c6b479c534 100644 --- a/src/mapgen/mapgen_flat.cpp +++ b/src/mapgen/mapgen_flat.cpp @@ -187,7 +187,7 @@ int MapgenFlat::getSpawnLevelAtPoint(v2s16 p) stone_level = ground_level - depress; } else if ((spflags & MGFLAT_HILLS) && n_terrain > hill_threshold) { s16 rise = (n_terrain - hill_threshold) * hill_steepness; - stone_level = ground_level + rise; + stone_level = ground_level + rise; } if (ground_level < water_level) @@ -311,7 +311,7 @@ s16 MapgenFlat::generateTerrain() stone_level = ground_level - depress; } else if ((spflags & MGFLAT_HILLS) && n_terrain > hill_threshold) { s16 rise = (n_terrain - hill_threshold) * hill_steepness; - stone_level = ground_level + rise; + stone_level = ground_level + rise; } u32 vi = vm->m_area.index(x, node_min.Y - 1, z); diff --git a/src/mapgen/treegen.cpp b/src/mapgen/treegen.cpp index eaaa6c3c428bc..1ca2bb18f8e8e 100644 --- a/src/mapgen/treegen.cpp +++ b/src/mapgen/treegen.cpp @@ -292,29 +292,29 @@ treegen::error make_ltree(MMVManip &vmanip, v3s16 p0, Key for Special L-System Symbols used in Axioms - G - move forward one unit with the pen up - F - move forward one unit with the pen down drawing trunks and branches - f - move forward one unit with the pen down drawing leaves (100% chance) - T - move forward one unit with the pen down drawing trunks only - R - move forward one unit with the pen down placing fruit - A - replace with rules set A - B - replace with rules set B - C - replace with rules set C - D - replace with rules set D - a - replace with rules set A, chance 90% - b - replace with rules set B, chance 80% - c - replace with rules set C, chance 70% - d - replace with rules set D, chance 60% - + - yaw the turtle right by angle degrees - - - yaw the turtle left by angle degrees - & - pitch the turtle down by angle degrees - ^ - pitch the turtle up by angle degrees - / - roll the turtle to the right by angle degrees - * - roll the turtle to the left by angle degrees - [ - save in stack current state info - ] - recover from stack state info - - */ + G - move forward one unit with the pen up + F - move forward one unit with the pen down drawing trunks and branches + f - move forward one unit with the pen down drawing leaves (100% chance) + T - move forward one unit with the pen down drawing trunks only + R - move forward one unit with the pen down placing fruit + A - replace with rules set A + B - replace with rules set B + C - replace with rules set C + D - replace with rules set D + a - replace with rules set A, chance 90% + b - replace with rules set B, chance 80% + c - replace with rules set C, chance 70% + d - replace with rules set D, chance 60% + + - yaw the turtle right by angle degrees + - - yaw the turtle left by angle degrees + & - pitch the turtle down by angle degrees + ^ - pitch the turtle up by angle degrees + / - roll the turtle to the right by angle degrees + * - roll the turtle to the left by angle degrees + [ - save in stack current state info + ] - recover from stack state info + + */ s16 x,y,z; for (s16 i = 0; i < (s16)axiom.size(); i++) { diff --git a/src/noise.cpp b/src/noise.cpp index ee1f1acdbd28c..bfd29e4ee65e0 100644 --- a/src/noise.cpp +++ b/src/noise.cpp @@ -160,8 +160,8 @@ void PcgRandom::getState(u64 state[2]) const void PcgRandom::setState(const u64 state[2]) { - m_state = state[0]; - m_inc = state[1]; + m_state = state[0]; + m_inc = state[1]; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/porting.h b/src/porting.h index b7a71bce2da6d..377a206731108 100644 --- a/src/porting.h +++ b/src/porting.h @@ -78,9 +78,9 @@ with this program; if not, write to the Free Software Foundation, Inc., #ifndef _WIN32 // POSIX #include #include - #if defined(__MACH__) && defined(__APPLE__) - #include - #endif + #if defined(__MACH__) && defined(__APPLE__) + #include + #endif #endif namespace porting diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 2e5873bbfaed5..b088ec3276006 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -917,7 +917,7 @@ void read_content_features(lua_State *L, ContentFeatures &f, int index) lua_getfield(L, index, "selection_box"); if(lua_istable(L, -1)) f.selection_box = read_nodebox(L, -1); - lua_pop(L, 1); + lua_pop(L, 1); lua_getfield(L, index, "collision_box"); if(lua_istable(L, -1)) diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h index 178a86cf4b468..f227b285ca429 100644 --- a/src/script/common/c_content.h +++ b/src/script/common/c_content.h @@ -77,130 +77,130 @@ extern struct EnumString es_TileAnimationType[]; extern const std::array object_property_keys; -void read_content_features (lua_State *L, ContentFeatures &f, - int index); -void push_content_features (lua_State *L, - const ContentFeatures &c); +void read_content_features (lua_State *L, ContentFeatures &f, + int index); +void push_content_features (lua_State *L, + const ContentFeatures &c); -void push_nodebox (lua_State *L, - const NodeBox &box); -void push_palette (lua_State *L, - const std::vector *palette); +void push_nodebox (lua_State *L, + const NodeBox &box); +void push_palette (lua_State *L, + const std::vector *palette); -TileDef read_tiledef (lua_State *L, int index, - u8 drawtype, bool special); +TileDef read_tiledef (lua_State *L, int index, + u8 drawtype, bool special); -void read_simplesoundspec (lua_State *L, int index, - SoundSpec &spec); -NodeBox read_nodebox (lua_State *L, int index); +void read_simplesoundspec (lua_State *L, int index, + SoundSpec &spec); +NodeBox read_nodebox (lua_State *L, int index); -void read_server_sound_params (lua_State *L, int index, - ServerPlayingSound ¶ms); +void read_server_sound_params (lua_State *L, int index, + ServerPlayingSound ¶ms); -void push_dig_params (lua_State *L, - const DigParams ¶ms); -void push_hit_params (lua_State *L, - const HitParams ¶ms); +void push_dig_params (lua_State *L, + const DigParams ¶ms); +void push_hit_params (lua_State *L, + const HitParams ¶ms); -ItemStack read_item (lua_State *L, int index, IItemDefManager *idef); +ItemStack read_item (lua_State *L, int index, IItemDefManager *idef); struct TileAnimationParams read_animation_definition(lua_State *L, int index); -PointabilityType read_pointability_type (lua_State *L, int index); -Pointabilities read_pointabilities (lua_State *L, int index); -void push_pointability_type (lua_State *L, PointabilityType pointable); -void push_pointabilities (lua_State *L, const Pointabilities &pointabilities); +PointabilityType read_pointability_type (lua_State *L, int index); +Pointabilities read_pointabilities (lua_State *L, int index); +void push_pointability_type (lua_State *L, PointabilityType pointable); +void push_pointabilities (lua_State *L, const Pointabilities &pointabilities); -ToolCapabilities read_tool_capabilities (lua_State *L, int table); -void push_tool_capabilities (lua_State *L, - const ToolCapabilities &prop); -WearBarParams read_wear_bar_params (lua_State *L, int table); -void push_wear_bar_params (lua_State *L, - const WearBarParams &prop); +ToolCapabilities read_tool_capabilities (lua_State *L, int table); +void push_tool_capabilities (lua_State *L, + const ToolCapabilities &prop); +WearBarParams read_wear_bar_params (lua_State *L, int table); +void push_wear_bar_params (lua_State *L, + const WearBarParams &prop); void read_item_definition (lua_State *L, int index, const ItemDefinition &default_def, ItemDefinition &def); -void push_item_definition (lua_State *L, - const ItemDefinition &i); -void push_item_definition_full (lua_State *L, - const ItemDefinition &i); +void push_item_definition (lua_State *L, + const ItemDefinition &i); +void push_item_definition_full (lua_State *L, + const ItemDefinition &i); -void read_object_properties (lua_State *L, int index, - ServerActiveObject *sao, - ObjectProperties *prop, - IItemDefManager *idef); +void read_object_properties (lua_State *L, int index, + ServerActiveObject *sao, + ObjectProperties *prop, + IItemDefManager *idef); -void push_object_properties (lua_State *L, - const ObjectProperties *prop); +void push_object_properties (lua_State *L, + const ObjectProperties *prop); -void push_inventory_list (lua_State *L, - const InventoryList &invlist); -void push_inventory_lists (lua_State *L, - const Inventory &inv); -void read_inventory_list (lua_State *L, int tableindex, - Inventory *inv, const char *name, - IGameDef *gdef, int forcesize=-1); +void push_inventory_list (lua_State *L, + const InventoryList &invlist); +void push_inventory_lists (lua_State *L, + const Inventory &inv); +void read_inventory_list (lua_State *L, int tableindex, + Inventory *inv, const char *name, + IGameDef *gdef, int forcesize=-1); -MapNode readnode (lua_State *L, int index); -void pushnode (lua_State *L, const MapNode &n); +MapNode readnode (lua_State *L, int index); +void pushnode (lua_State *L, const MapNode &n); -void read_groups (lua_State *L, int index, - ItemGroupList &result); +void read_groups (lua_State *L, int index, + ItemGroupList &result); -void push_groups (lua_State *L, - const ItemGroupList &groups); +void push_groups (lua_State *L, + const ItemGroupList &groups); //TODO rename to "read_enum_field" -int getenumfield (lua_State *L, int table, - const char *fieldname, - const EnumString *spec, - int default_); +int getenumfield (lua_State *L, int table, + const char *fieldname, + const EnumString *spec, + int default_); -bool getflagsfield (lua_State *L, int table, - const char *fieldname, - FlagDesc *flagdesc, - u32 *flags, u32 *flagmask); +bool getflagsfield (lua_State *L, int table, + const char *fieldname, + FlagDesc *flagdesc, + u32 *flags, u32 *flagmask); -bool read_flags (lua_State *L, int index, - FlagDesc *flagdesc, - u32 *flags, u32 *flagmask); +bool read_flags (lua_State *L, int index, + FlagDesc *flagdesc, + u32 *flags, u32 *flagmask); -void push_flags_string (lua_State *L, FlagDesc *flagdesc, - u32 flags, u32 flagmask); +void push_flags_string (lua_State *L, FlagDesc *flagdesc, + u32 flags, u32 flagmask); -u32 read_flags_table (lua_State *L, int table, - FlagDesc *flagdesc, u32 *flagmask); +u32 read_flags_table (lua_State *L, int table, + FlagDesc *flagdesc, u32 *flagmask); -void push_items (lua_State *L, - const std::vector &items); +void push_items (lua_State *L, + const std::vector &items); -std::vector read_items (lua_State *L, - int index, - IGameDef* gdef); +std::vector read_items (lua_State *L, + int index, + IGameDef* gdef); -void push_simplesoundspec (lua_State *L, - const SoundSpec &spec); +void push_simplesoundspec (lua_State *L, + const SoundSpec &spec); -bool string_to_enum (const EnumString *spec, - int &result, - const std::string &str); +bool string_to_enum (const EnumString *spec, + int &result, + const std::string &str); -bool read_noiseparams (lua_State *L, int index, - NoiseParams *np); -void push_noiseparams (lua_State *L, NoiseParams *np); +bool read_noiseparams (lua_State *L, int index, + NoiseParams *np); +void push_noiseparams (lua_State *L, NoiseParams *np); -bool read_tree_def (lua_State *L, int idx, - const NodeDefManager *ndef, - treegen::TreeDef &tree_def); +bool read_tree_def (lua_State *L, int idx, + const NodeDefManager *ndef, + treegen::TreeDef &tree_def); -void luaentity_get (lua_State *L,u16 id); +void luaentity_get (lua_State *L,u16 id); -bool push_json_value (lua_State *L, - const Json::Value &value, - int nullindex); -void read_json_value (lua_State *L, Json::Value &root, - int index, u8 recursion = 0); +bool push_json_value (lua_State *L, + const Json::Value &value, + int nullindex); +void read_json_value (lua_State *L, Json::Value &root, + int index, u8 recursion = 0); /*! * Pushes a Lua `pointed_thing` to the given Lua stack. @@ -210,13 +210,13 @@ void read_json_value (lua_State *L, Json::Value &root, void push_pointed_thing(lua_State *L, const PointedThing &pointed, bool csm = false, bool hitpoint = false); -void push_objectRef (lua_State *L, const u16 id); +void push_objectRef (lua_State *L, const u16 id); -void read_hud_element (lua_State *L, HudElement *elem); +void read_hud_element (lua_State *L, HudElement *elem); -void push_hud_element (lua_State *L, HudElement *elem); +void push_hud_element (lua_State *L, HudElement *elem); -bool read_hud_change (lua_State *L, HudElementStat &stat, HudElement *elem, void **value); +bool read_hud_change (lua_State *L, HudElementStat &stat, HudElement *elem, void **value); void push_collision_move_result(lua_State *L, const collisionMoveResult &res); diff --git a/src/script/common/c_converter.h b/src/script/common/c_converter.h index 04f1ba0f9efd6..876f1830107aa 100644 --- a/src/script/common/c_converter.h +++ b/src/script/common/c_converter.h @@ -36,14 +36,14 @@ extern "C" { #include } -std::string getstringfield_default(lua_State *L, int table, - const char *fieldname, const std::string &default_); -bool getboolfield_default(lua_State *L, int table, - const char *fieldname, bool default_); -float getfloatfield_default(lua_State *L, int table, - const char *fieldname, float default_); -int getintfield_default(lua_State *L, int table, - const char *fieldname, int default_); +std::string getstringfield_default(lua_State *L, int table, + const char *fieldname, const std::string &default_); +bool getboolfield_default(lua_State *L, int table, + const char *fieldname, bool default_); +float getfloatfield_default(lua_State *L, int table, + const char *fieldname, float default_); +int getintfield_default(lua_State *L, int table, + const char *fieldname, int default_); bool check_field_or_nil(lua_State *L, int index, int type, const char *fieldname); @@ -62,69 +62,69 @@ bool getintfield(lua_State *L, int table, } // Retrieve an v3s16 where all components are optional (falls back to default) -v3s16 getv3s16field_default(lua_State *L, int table, - const char *fieldname, v3s16 default_); - -bool getstringfield(lua_State *L, int table, - const char *fieldname, std::string &result); -bool getstringfield(lua_State *L, int table, - const char *fieldname, std::string_view &result); -size_t getstringlistfield(lua_State *L, int table, - const char *fieldname, - std::vector *result); -bool getboolfield(lua_State *L, int table, - const char *fieldname, bool &result); -bool getfloatfield(lua_State *L, int table, - const char *fieldname, float &result); - -void setstringfield(lua_State *L, int table, - const char *fieldname, const std::string &value); -void setintfield(lua_State *L, int table, - const char *fieldname, int value); -void setfloatfield(lua_State *L, int table, - const char *fieldname, float value); -void setboolfield(lua_State *L, int table, - const char *fieldname, bool value); - -v3f checkFloatPos (lua_State *L, int index); -v2f check_v2f (lua_State *L, int index); -v3f check_v3f (lua_State *L, int index); -v3s16 check_v3s16 (lua_State *L, int index); - -v3f read_v3f (lua_State *L, int index); -v2f read_v2f (lua_State *L, int index); -v2s16 read_v2s16 (lua_State *L, int index); -v2s32 read_v2s32 (lua_State *L, int index); -video::SColor read_ARGB8 (lua_State *L, int index); -bool read_color (lua_State *L, int index, - video::SColor *color); -bool is_color_table (lua_State *L, int index); - -aabb3f read_aabb3f (lua_State *L, int index, f32 scale); -v3s16 read_v3s16 (lua_State *L, int index); -std::vector read_aabb3f_vector (lua_State *L, int index, f32 scale); -size_t read_stringlist (lua_State *L, int index, - std::vector *result); - -void push_v2s16 (lua_State *L, v2s16 p); -void push_v2s32 (lua_State *L, v2s32 p); -void push_v2u32 (lua_State *L, v2u32 p); -void push_v3s16 (lua_State *L, v3s16 p); -void push_aabb3f (lua_State *L, aabb3f box, f32 divisor = 1.0f); -void push_ARGB8 (lua_State *L, video::SColor color); -void pushFloatPos (lua_State *L, v3f p); -void push_v3f (lua_State *L, v3f p); -void push_v2f (lua_State *L, v2f p); -void push_aabb3f_vector (lua_State *L, const std::vector &boxes, - f32 divisor = 1.0f); - -void warn_if_field_exists(lua_State *L, int table, - const char *fieldname, - std::string_view name, - std::string_view message); +v3s16 getv3s16field_default(lua_State *L, int table, + const char *fieldname, v3s16 default_); + +bool getstringfield(lua_State *L, int table, + const char *fieldname, std::string &result); +bool getstringfield(lua_State *L, int table, + const char *fieldname, std::string_view &result); +size_t getstringlistfield(lua_State *L, int table, + const char *fieldname, + std::vector *result); +bool getboolfield(lua_State *L, int table, + const char *fieldname, bool &result); +bool getfloatfield(lua_State *L, int table, + const char *fieldname, float &result); + +void setstringfield(lua_State *L, int table, + const char *fieldname, const std::string &value); +void setintfield(lua_State *L, int table, + const char *fieldname, int value); +void setfloatfield(lua_State *L, int table, + const char *fieldname, float value); +void setboolfield(lua_State *L, int table, + const char *fieldname, bool value); + +v3f checkFloatPos (lua_State *L, int index); +v2f check_v2f (lua_State *L, int index); +v3f check_v3f (lua_State *L, int index); +v3s16 check_v3s16 (lua_State *L, int index); + +v3f read_v3f (lua_State *L, int index); +v2f read_v2f (lua_State *L, int index); +v2s16 read_v2s16 (lua_State *L, int index); +v2s32 read_v2s32 (lua_State *L, int index); +video::SColor read_ARGB8 (lua_State *L, int index); +bool read_color (lua_State *L, int index, + video::SColor *color); +bool is_color_table (lua_State *L, int index); + +aabb3f read_aabb3f (lua_State *L, int index, f32 scale); +v3s16 read_v3s16 (lua_State *L, int index); +std::vector read_aabb3f_vector (lua_State *L, int index, f32 scale); +size_t read_stringlist (lua_State *L, int index, + std::vector *result); + +void push_v2s16 (lua_State *L, v2s16 p); +void push_v2s32 (lua_State *L, v2s32 p); +void push_v2u32 (lua_State *L, v2u32 p); +void push_v3s16 (lua_State *L, v3s16 p); +void push_aabb3f (lua_State *L, aabb3f box, f32 divisor = 1.0f); +void push_ARGB8 (lua_State *L, video::SColor color); +void pushFloatPos (lua_State *L, v3f p); +void push_v3f (lua_State *L, v3f p); +void push_v2f (lua_State *L, v2f p); +void push_aabb3f_vector (lua_State *L, const std::vector &boxes, + f32 divisor = 1.0f); + +void warn_if_field_exists(lua_State *L, int table, + const char *fieldname, + std::string_view name, + std::string_view message); size_t write_array_slice_float(lua_State *L, int table_index, float *data, - v3u16 data_size, v3u16 slice_offset, v3u16 slice_size); + v3u16 data_size, v3u16 slice_offset, v3u16 slice_size); // This must match the implementation in builtin/game/misc_s.lua // Note that this returns a floating point result as Lua integers are 32-bit diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp index 4ac998a8f9d7a..41bb293f2154c 100644 --- a/src/script/lua_api/l_item.cpp +++ b/src/script/lua_api/l_item.cpp @@ -460,13 +460,13 @@ int LuaItemStack::l_equals(lua_State *L) NO_MAP_LOCK_REQUIRED; LuaItemStack *o1 = checkObject(L, 1); - // checks for non-userdata argument + // checks for non-userdata argument if (!lua_isuserdata(L, 2)) { lua_pushboolean(L, false); return 1; } - // check that the argument is an ItemStack + // check that the argument is an ItemStack if (!lua_getmetatable(L, 2)) { lua_pushboolean(L, false); return 1; diff --git a/src/unittest/test_map_settings_manager.cpp b/src/unittest/test_map_settings_manager.cpp index acada024b66ef..a272b14bb90e2 100644 --- a/src/unittest/test_map_settings_manager.cpp +++ b/src/unittest/test_map_settings_manager.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest Copyright (C) 2010-2014 kwolekr, Ryan Kwolek diff --git a/src/unittest/test_random.cpp b/src/unittest/test_random.cpp index 5fa7a593202b8..d74b15b70afd0 100644 --- a/src/unittest/test_random.cpp +++ b/src/unittest/test_random.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest Copyright (C) 2010-2014 kwolekr, Ryan Kwolek diff --git a/src/unittest/test_schematic.cpp b/src/unittest/test_schematic.cpp index d2f027eb4c85c..856d1a445c6d6 100644 --- a/src/unittest/test_schematic.cpp +++ b/src/unittest/test_schematic.cpp @@ -1,4 +1,4 @@ - /* +/* Minetest Copyright (C) 2010-2014 kwolekr, Ryan Kwolek diff --git a/src/util/numeric.h b/src/util/numeric.h index cfe0317a108e9..c591aed27c788 100644 --- a/src/util/numeric.h +++ b/src/util/numeric.h @@ -419,9 +419,9 @@ inline void paging(u32 length, u32 page, u32 pagecount, u32 &minindex, u32 &maxi inline float cycle_shift(float value, float by = 0, float max = 1) { - if (value + by < 0) return value + by + max; - if (value + by > max) return value + by - max; - return value + by; + if (value + by < 0) return value + by + max; + if (value + by > max) return value + by - max; + return value + by; } inline bool is_power_of_two(u32 n) diff --git a/src/util/string.h b/src/util/string.h index aae1167b67127..9094b4f12ba8a 100644 --- a/src/util/string.h +++ b/src/util/string.h @@ -743,9 +743,9 @@ inline std::string stringw_to_utf8(const irr::core::stringw &input) return wide_to_utf8(sv); } - /** - * Create an irr::core:stringw from a UTF8 std::string. - */ +/** + * Create an irr::core:stringw from a UTF8 std::string. + */ inline irr::core::stringw utf8_to_stringw(std::string_view input) { std::wstring str = utf8_to_wide(input);