From 76be103a91d6987527af19e87d93007be8ba8a67 Mon Sep 17 00:00:00 2001 From: Loïc Blot Date: Fri, 16 Jun 2017 11:25:52 +0200 Subject: C++11 patchset 9: move hardcoded init parameters to class definitions (part 1) (#5984) * C++11 patchset 9: move hardcoded init parameters to class definitions C++11 introduced the possibility to define the default values directly in class definitions, do it on current code Also remove some unused attributes * CollisionInfo::bouncy * collisionMoveResult::collides_xy * collisionMoveResult::standing_on_unloaded * Clouds::speed * More constructor cleanups + some variables removal * remove only write guiFormSpecMenu::m_old_tooltip * move header included inside defintions in genericobject.h * remove some unused since years exception classes * remove unused & empty debug_stacks_init * remove unused & empty content_nodemeta_serialize_legacy * remove forgotten useless bool (bouncy) in collision.cpp code --- src/content_cao.cpp | 68 ++--------------------------------------------------- 1 file changed, 2 insertions(+), 66 deletions(-) (limited to 'src/content_cao.cpp') diff --git a/src/content_cao.cpp b/src/content_cao.cpp index a5a55fd7e..0b9df6451 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -51,16 +51,6 @@ struct ToolCapabilities; std::unordered_map ClientActiveObject::m_types; -SmoothTranslator::SmoothTranslator(): - vect_old(0,0,0), - vect_show(0,0,0), - vect_aim(0,0,0), - anim_counter(0), - anim_time(0), - anim_time_counter(0), - aim_is_end(true) -{} - void SmoothTranslator::init(v3f vect) { vect_old = vect; @@ -72,11 +62,6 @@ void SmoothTranslator::init(v3f vect) aim_is_end = true; } -void SmoothTranslator::sharpen() -{ - init(vect_show); -} - void SmoothTranslator::update(v3f vect_new, bool is_end_position, float update_interval) { aim_is_end = is_end_position; @@ -113,11 +98,6 @@ void SmoothTranslator::translate(f32 dtime) vect_show = vect_old + vect_move * moveratio; } -bool SmoothTranslator::is_moving() -{ - return ((anim_time_counter / anim_time) < 1.4); -} - /* Other stuff */ @@ -325,8 +305,6 @@ private: std::string m_infotext; }; -#include "inventory.h" - // Prototype ItemCAO proto_ItemCAO(NULL, NULL); @@ -538,49 +516,7 @@ void ItemCAO::initialize(const std::string &data) #include "genericobject.h" GenericCAO::GenericCAO(Client *client, ClientEnvironment *env): - ClientActiveObject(0, client, env), - // - m_is_player(false), - m_is_local_player(false), - // - m_smgr(NULL), - m_irr(NULL), - m_client(NULL), - m_selection_box(-BS/3.,-BS/3.,-BS/3., BS/3.,BS/3.,BS/3.), - m_meshnode(NULL), - m_animated_meshnode(NULL), - m_wield_meshnode(NULL), - m_spritenode(NULL), - m_nametag(NULL), - m_position(v3f(0,10*BS,0)), - m_velocity(v3f(0,0,0)), - m_acceleration(v3f(0,0,0)), - m_yaw(0), - m_hp(1), - m_tx_size(1,1), - m_tx_basepos(0,0), - m_initial_tx_basepos_set(false), - m_tx_select_horiz_by_yawpitch(false), - m_animation_range(v2s32(0,0)), - m_animation_speed(15), - m_animation_blend(0), - m_animation_loop(true), - m_bone_position(), - m_attachment_bone(""), - m_attachment_position(v3f(0,0,0)), - m_attachment_rotation(v3f(0,0,0)), - m_attached_to_local(false), - m_anim_frame(0), - m_anim_num_frames(1), - m_anim_framelength(0.2), - m_anim_timer(0), - m_reset_textures_timer(-1), - m_previous_texture_modifier(""), - m_current_texture_modifier(""), - m_visuals_expired(false), - m_step_distance_counter(0), - m_last_light(255), - m_is_visible(false) + ClientActiveObject(0, client, env) { if (client == NULL) { ClientActiveObject::registerType(getType(), create); @@ -639,7 +575,7 @@ void GenericCAO::processInitData(const std::string &data) if (version == 1) { // In PROTOCOL_VERSION 14 m_name = deSerializeString(is); m_is_player = readU8(is); - m_id = readS16(is); + m_id = readU16(is); m_position = readV3F1000(is); m_yaw = readF1000(is); m_hp = readS16(is); -- cgit v1.2.3