LCOV - code coverage report
Current view: top level - src - localplayer.h (source / functions) Hit Total Coverage
Test: report Lines: 5 7 71.4 %
Date: 2015-07-11 18:23:49 Functions: 2 3 66.7 %

          Line data    Source code
       1             : /*
       2             : Minetest
       3             : Copyright (C) 2010-2013 celeron55, Perttu Ahola <celeron55@gmail.com>
       4             : 
       5             : This program is free software; you can redistribute it and/or modify
       6             : it under the terms of the GNU Lesser General Public License as published by
       7             : the Free Software Foundation; either version 2.1 of the License, or
       8             : (at your option) any later version.
       9             : 
      10             : This program is distributed in the hope that it will be useful,
      11             : but WITHOUT ANY WARRANTY; without even the implied warranty of
      12             : MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      13             : GNU Lesser General Public License for more details.
      14             : 
      15             : You should have received a copy of the GNU Lesser General Public License along
      16             : with this program; if not, write to the Free Software Foundation, Inc.,
      17             : 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
      18             : */
      19             : 
      20             : #ifndef LOCALPLAYER_HEADER
      21             : #define LOCALPLAYER_HEADER
      22             : 
      23             : #include "player.h"
      24             : #include <list>
      25             : 
      26             : class Environment;
      27             : class GenericCAO;
      28             : class ClientActiveObject;
      29             : 
      30             : enum LocalPlayerAnimations {NO_ANIM, WALK_ANIM, DIG_ANIM, WD_ANIM};  // no local animation, walking, digging, both
      31             : 
      32             : class LocalPlayer : public Player
      33             : {
      34             : public:
      35             :         LocalPlayer(IGameDef *gamedef, const char *name);
      36             :         virtual ~LocalPlayer();
      37             : 
      38     1441734 :         bool isLocal() const
      39             :         {
      40     1441734 :                 return true;
      41             :         }
      42             : 
      43             :         ClientActiveObject *parent;
      44             : 
      45             :         bool isAttached;
      46             : 
      47             :         v3f overridePosition;
      48             :         
      49             :         void move(f32 dtime, Environment *env, f32 pos_max_d);
      50             :         void move(f32 dtime, Environment *env, f32 pos_max_d,
      51             :                         std::vector<CollisionInfo> *collision_info);
      52             : 
      53             :         void applyControl(float dtime);
      54             : 
      55             :         v3s16 getStandingNodePos();
      56             : 
      57             :         // Used to check if anything changed and prevent sending packets if not
      58             :         v3f last_position;
      59             :         v3f last_speed;
      60             :         float last_pitch;
      61             :         float last_yaw;
      62             :         unsigned int last_keyPressed;
      63             : 
      64             :         float camera_impact;
      65             : 
      66             :         int last_animation;
      67             :         float last_animation_speed;
      68             : 
      69             :         std::string hotbar_image;
      70             :         std::string hotbar_selected_image;
      71             : 
      72             :         video::SColor light_color;
      73             : 
      74           0 :         GenericCAO* getCAO() const {
      75           0 :                 return m_cao;
      76             :         }
      77             : 
      78           1 :         void setCAO(GenericCAO* toset) {
      79             :                 assert( m_cao == NULL ); // Pre-condition
      80           1 :                 m_cao = toset;
      81           1 :         }
      82             : 
      83             : private:
      84             :         // This is used for determining the sneaking range
      85             :         v3s16 m_sneak_node;
      86             :         // Whether the player is allowed to sneak
      87             :         bool m_sneak_node_exists;
      88             :         // Node below player, used to determine whether it has been removed,
      89             :         // and its old type
      90             :         v3s16 m_old_node_below;
      91             :         std::string m_old_node_below_type;
      92             :         // Whether recalculation of the sneak node is needed
      93             :         bool m_need_to_get_new_sneak_node;
      94             :         bool m_can_jump;
      95             : 
      96             :         GenericCAO* m_cao;
      97             : };
      98             : 
      99             : #endif
     100             : 

Generated by: LCOV version 1.11