diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-02 13:29:13 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-03-05 09:45:58 +0100 |
commit | f9d3ab01d35cbad6d9bd0f203c6647fbfe251754 (patch) | |
tree | 31c0dcfca14d1734f400213ba95dfdcc9f26c6d0 | |
parent | 28ba013a4a31c7496044a26fcedea3771dd22aa2 (diff) | |
download | minetest-f9d3ab01d35cbad6d9bd0f203c6647fbfe251754.tar.xz |
Code quality in files that were changed
-rw-r--r-- | src/client/camera.cpp | 5 | ||||
-rw-r--r-- | src/itemdef.cpp | 5 | ||||
-rw-r--r-- | src/script/common/c_content.cpp | 2 | ||||
-rw-r--r-- | src/script/common/c_content.h | 3 | ||||
-rw-r--r-- | src/script/lua_api/l_item.cpp | 2 | ||||
-rw-r--r-- | src/wieldanimation.h | 2 |
6 files changed, 10 insertions, 9 deletions
diff --git a/src/client/camera.cpp b/src/client/camera.cpp index f3aa4bafe..c359f3365 100644 --- a/src/client/camera.cpp +++ b/src/client/camera.cpp @@ -174,12 +174,13 @@ void Camera::step(f32 dtime) bool was_under_zero = m_wield_change_timer < 0; m_wield_change_timer = MYMIN(m_wield_change_timer + dtime, 0.125); -if (m_wield_change_timer >= 0 && was_under_zero) { + if (m_wield_change_timer >= 0 && was_under_zero) + { m_wieldnode->setItem(m_wield_item_next, m_client); m_wield_animation = m_wield_item_next .getDefinition(m_client->getItemDefManager()) .wield_animation; -} + } if (m_view_bobbing_state != 0) { diff --git a/src/itemdef.cpp b/src/itemdef.cpp index 84ad96c7f..c535ef28c 100644 --- a/src/itemdef.cpp +++ b/src/itemdef.cpp @@ -221,10 +221,9 @@ void ItemDefinition::deSerialize(std::istream &is) // If you add anything here, insert it primarily inside the try-catch // block to not need to increase the version. try { - short_description = deSerializeString16(is); wield_animation = deSerializeString16(is); - } catch (SerializationError &e) { - } + short_description = deSerializeString16(is); + } catch (SerializationError &e) {}; } diff --git a/src/script/common/c_content.cpp b/src/script/common/c_content.cpp index 90787e13d..585e664fd 100644 --- a/src/script/common/c_content.cpp +++ b/src/script/common/c_content.cpp @@ -123,6 +123,7 @@ void read_item_definition(lua_State* L, int index, getstringfield(L, index, "node_placement_prediction", def.node_placement_prediction); } + /******************************************************************************/ void read_wield_animation(lua_State *L, int index) { @@ -230,6 +231,7 @@ void read_wield_animation(lua_State *L, int index) anim.setDuration(totalDuration); lua_pop(L, 1); } + /******************************************************************************/ void push_item_definition(lua_State *L, const ItemDefinition &i) { diff --git a/src/script/common/c_content.h b/src/script/common/c_content.h index 2733be663..181176efe 100644 --- a/src/script/common/c_content.h +++ b/src/script/common/c_content.h @@ -47,7 +47,6 @@ class NodeDefManager; struct PointedThing; struct ItemStack; struct ItemDefinition; - struct ToolCapabilities; struct ObjectProperties; struct SimpleSoundSpec; @@ -109,7 +108,7 @@ void push_item_definition (lua_State *L, const ItemDefinition &i); void push_item_definition_full (lua_State *L, const ItemDefinition &i); -void read_wield_animation(lua_State *L, int index); +void read_wield_animation(lua_State *L, int index); void read_object_properties (lua_State *L, int index, ServerActiveObject *sao, diff --git a/src/script/lua_api/l_item.cpp b/src/script/lua_api/l_item.cpp index a765c96df..cf58055ba 100644 --- a/src/script/lua_api/l_item.cpp +++ b/src/script/lua_api/l_item.cpp @@ -677,10 +677,10 @@ int ModApiItemMod::l_register_wield_animation(lua_State *L) void ModApiItemMod::Initialize(lua_State *L, int top) { - API_FCT(register_wield_animation); API_FCT(register_item_raw); API_FCT(unregister_item_raw); API_FCT(register_alias_raw); API_FCT(get_content_id); API_FCT(get_name_from_content_id); + API_FCT(register_wield_animation); } diff --git a/src/wieldanimation.h b/src/wieldanimation.h index 774ee9a8c..86ea48e42 100644 --- a/src/wieldanimation.h +++ b/src/wieldanimation.h @@ -43,4 +43,4 @@ public: static void fillRepository(); WieldAnimation deSerialize(std::istream &is); void serialize(std::ostream &os, u16 protocol_version); -};
\ No newline at end of file +}; |