From ad148587dcf5244c2d2011dba339786c765c54c4 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Wed, 4 Nov 2020 16:19:54 +0100 Subject: Make Lint Happy --- src/script/cpp_api/s_node.cpp | 59 ++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 34 deletions(-) (limited to 'src/script/cpp_api/s_node.cpp') diff --git a/src/script/cpp_api/s_node.cpp b/src/script/cpp_api/s_node.cpp index e0f9bcd78..928fda6e2 100644 --- a/src/script/cpp_api/s_node.cpp +++ b/src/script/cpp_api/s_node.cpp @@ -26,10 +26,8 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "environment.h" #include "util/pointedthing.h" - // Should be ordered exactly like enum NodeDrawType in nodedef.h -struct EnumString ScriptApiNode::es_DrawType[] = - { +struct EnumString ScriptApiNode::es_DrawType[] = { {NDT_NORMAL, "normal"}, {NDT_AIRLIKE, "airlike"}, {NDT_LIQUID, "liquid"}, @@ -49,10 +47,9 @@ struct EnumString ScriptApiNode::es_DrawType[] = {NDT_MESH, "mesh"}, {NDT_PLANTLIKE_ROOTED, "plantlike_rooted"}, {0, NULL}, - }; +}; -struct EnumString ScriptApiNode::es_ContentParamType2[] = - { +struct EnumString ScriptApiNode::es_ContentParamType2[] = { {CPT2_NONE, "none"}, {CPT2_FULL, "full"}, {CPT2_FLOWINGLIQUID, "flowingliquid"}, @@ -66,35 +63,32 @@ struct EnumString ScriptApiNode::es_ContentParamType2[] = {CPT2_COLORED_WALLMOUNTED, "colorwallmounted"}, {CPT2_GLASSLIKE_LIQUID_LEVEL, "glasslikeliquidlevel"}, {0, NULL}, - }; +}; -struct EnumString ScriptApiNode::es_LiquidType[] = - { +struct EnumString ScriptApiNode::es_LiquidType[] = { {LIQUID_NONE, "none"}, {LIQUID_FLOWING, "flowing"}, {LIQUID_SOURCE, "source"}, {0, NULL}, - }; +}; -struct EnumString ScriptApiNode::es_ContentParamType[] = - { +struct EnumString ScriptApiNode::es_ContentParamType[] = { {CPT_NONE, "none"}, {CPT_LIGHT, "light"}, {0, NULL}, - }; +}; -struct EnumString ScriptApiNode::es_NodeBoxType[] = - { +struct EnumString ScriptApiNode::es_NodeBoxType[] = { {NODEBOX_REGULAR, "regular"}, {NODEBOX_FIXED, "fixed"}, {NODEBOX_WALLMOUNTED, "wallmounted"}, {NODEBOX_LEVELED, "leveled"}, {NODEBOX_CONNECTED, "connected"}, {0, NULL}, - }; +}; -bool ScriptApiNode::node_on_punch(v3s16 p, MapNode node, - ServerActiveObject *puncher, const PointedThing &pointed) +bool ScriptApiNode::node_on_punch(v3s16 p, MapNode node, ServerActiveObject *puncher, + const PointedThing &pointed) { SCRIPTAPI_PRECHECKHEADER @@ -112,12 +106,11 @@ bool ScriptApiNode::node_on_punch(v3s16 p, MapNode node, objectrefGetOrCreate(L, puncher); pushPointedThing(pointed); PCALL_RES(lua_pcall(L, 4, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler return true; } -bool ScriptApiNode::node_on_dig(v3s16 p, MapNode node, - ServerActiveObject *digger) +bool ScriptApiNode::node_on_dig(v3s16 p, MapNode node, ServerActiveObject *digger) { SCRIPTAPI_PRECHECKHEADER @@ -134,7 +127,7 @@ bool ScriptApiNode::node_on_dig(v3s16 p, MapNode node, pushnode(L, node, ndef); objectrefGetOrCreate(L, digger); PCALL_RES(lua_pcall(L, 3, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler return true; } @@ -153,7 +146,7 @@ void ScriptApiNode::node_on_construct(v3s16 p, MapNode node) // Call function push_v3s16(L, p); PCALL_RES(lua_pcall(L, 1, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler } void ScriptApiNode::node_on_destruct(v3s16 p, MapNode node) @@ -171,7 +164,7 @@ void ScriptApiNode::node_on_destruct(v3s16 p, MapNode node) // Call function push_v3s16(L, p); PCALL_RES(lua_pcall(L, 1, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler } bool ScriptApiNode::node_on_flood(v3s16 p, MapNode node, MapNode newnode) @@ -211,7 +204,7 @@ void ScriptApiNode::node_after_destruct(v3s16 p, MapNode node) push_v3s16(L, p); pushnode(L, node, ndef); PCALL_RES(lua_pcall(L, 2, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler } bool ScriptApiNode::node_on_timer(v3s16 p, MapNode node, f32 dtime) @@ -228,16 +221,14 @@ bool ScriptApiNode::node_on_timer(v3s16 p, MapNode node, f32 dtime) // Call function push_v3s16(L, p); - lua_pushnumber(L,dtime); + lua_pushnumber(L, dtime); PCALL_RES(lua_pcall(L, 2, 1, error_handler)); lua_remove(L, error_handler); return readParam(L, -1, false); } -void ScriptApiNode::node_on_receive_fields(v3s16 p, - const std::string &formname, - const StringMap &fields, - ServerActiveObject *sender) +void ScriptApiNode::node_on_receive_fields(v3s16 p, const std::string &formname, + const StringMap &fields, ServerActiveObject *sender) { SCRIPTAPI_PRECHECKHEADER @@ -255,9 +246,9 @@ void ScriptApiNode::node_on_receive_fields(v3s16 p, return; // Call function - push_v3s16(L, p); // pos + push_v3s16(L, p); // pos lua_pushstring(L, formname.c_str()); // formname - lua_newtable(L); // fields + lua_newtable(L); // fields StringMap::const_iterator it; for (it = fields.begin(); it != fields.end(); ++it) { const std::string &name = it->first; @@ -266,7 +257,7 @@ void ScriptApiNode::node_on_receive_fields(v3s16 p, lua_pushlstring(L, value.c_str(), value.size()); lua_settable(L, -3); } - objectrefGetOrCreate(L, sender); // player + objectrefGetOrCreate(L, sender); // player PCALL_RES(lua_pcall(L, 4, 0, error_handler)); - lua_pop(L, 1); // Pop error handler + lua_pop(L, 1); // Pop error handler } -- cgit v1.2.3