diff options
author | Loic Blot <loic.blot@unix-experience.fr> | 2016-10-08 17:56:38 +0200 |
---|---|---|
committer | Ner'zhul <nerzhul@users.noreply.github.com> | 2016-10-08 22:27:44 +0200 |
commit | 7bbd716426bf989bf071e2322a9b797cc5f78acb (patch) | |
tree | 0c626a1cb5dd84a04c5963c020c0c9d29863e770 /src/localplayer.cpp | |
parent | edba6e50d9c9c0a7120c251bed36a87b51f4c826 (diff) | |
download | minetest-7bbd716426bf989bf071e2322a9b797cc5f78acb.tar.gz minetest-7bbd716426bf989bf071e2322a9b797cc5f78acb.tar.bz2 minetest-7bbd716426bf989bf071e2322a9b797cc5f78acb.zip |
RemotePlayer/LocalPlayer Player base class proper separation (code cleanup) (patch 3 of X)
* remove IGameDef from Player class, only LocalPlayer has it now
* move many attributes/functions only used by LocalPlayer from Player to LocalPlayer
* move many attributes/functions only used by RemotePlayer from Player to RemotePlayer
* make some functions const
* hudGetHotbarSelectedImage now returns const ref
* RemotePlayer getHotbarSelectedImage now returns const ref
* various code style fixes
Diffstat (limited to 'src/localplayer.cpp')
-rw-r--r-- | src/localplayer.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/localplayer.cpp b/src/localplayer.cpp index 732ca8acf..bc242a59d 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -26,16 +26,29 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "settings.h" #include "environment.h" #include "map.h" -#include "util/numeric.h" +#include "client.h" /* LocalPlayer */ -LocalPlayer::LocalPlayer(IGameDef *gamedef, const char *name): - Player(gamedef, name), +LocalPlayer::LocalPlayer(Client *gamedef, const char *name): + Player(name, gamedef->idef()), parent(0), + got_teleported(false), isAttached(false), + touching_ground(false), + in_liquid(false), + in_liquid_stable(false), + liquid_viscosity(0), + is_climbing(false), + swimming_vertical(false), + // Movement overrides are multipliers and must be 1 by default + physics_override_speed(1.0f), + physics_override_jump(1.0f), + physics_override_gravity(1.0f), + physics_override_sneak(true), + physics_override_sneak_glitch(true), overridePosition(v3f(0,0,0)), last_position(v3f(0,0,0)), last_speed(v3f(0,0,0)), @@ -47,6 +60,8 @@ LocalPlayer::LocalPlayer(IGameDef *gamedef, const char *name): hotbar_image(""), hotbar_selected_image(""), light_color(255,255,255,255), + hurt_tilt_timer(0.0f), + hurt_tilt_strength(0.0f), m_sneak_node(32767,32767,32767), m_sneak_node_exists(false), m_need_to_get_new_sneak_node(true), @@ -54,7 +69,8 @@ LocalPlayer::LocalPlayer(IGameDef *gamedef, const char *name): m_old_node_below(32767,32767,32767), m_old_node_below_type("air"), m_can_jump(false), - m_cao(NULL) + m_cao(NULL), + m_gamedef(gamedef) { // Initialize hp to 0, so that no hearts will be shown if server // doesn't support health points |