OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
player.hpp
Go to the documentation of this file.
1 #ifndef GAME_MWWORLD_PLAYER_H
2 #define GAME_MWWORLD_PLAYER_H
3 
4 #include "../mwworld/refdata.hpp"
5 #include "../mwworld/livecellref.hpp"
6 
7 #include "../mwmechanics/drawstate.hpp"
8 #include "../mwmechanics/stat.hpp"
9 
11 #include <components/esm/attr.hpp>
12 
13 namespace ESM
14 {
15  struct NPC;
16  class ESMWriter;
17  class ESMReader;
18 }
19 
20 namespace Loading
21 {
22  class Listener;
23 }
24 
25 namespace MWWorld
26 {
27  class CellStore;
28 
30  class Player
31  {
34  std::string mSign;
35 
37 
39  // If no position was marked, this is NULL
41 
42  bool mAutoMove;
45 
46  int mCurrentCrimeId; // the id assigned witnesses
47  int mPaidCrimeId; // the last id paid off (0 bounty)
48 
49  // Saved skills and attributes prior to becoming a werewolf
52 
54 
55  public:
56 
57  Player(const ESM::NPC *player);
58 
59  void saveSkillsAttributes();
62 
63  // For mark/recall magic effects
64  void markPosition (CellStore* markedCell, ESM::Position markedPosition);
65  void getMarkedPosition (CellStore*& markedCell, ESM::Position& markedPosition) const;
66 
70  void setLastKnownExteriorPosition (const osg::Vec3f& position) { mLastKnownExteriorPosition = position; }
72 
73  void set (const ESM::NPC *player);
74 
75  void setCell (MWWorld::CellStore *cellStore);
76 
78 
79  void setBirthSign(const std::string &sign);
80  const std::string &getBirthSign() const;
81 
84 
86  void activate();
87 
88  bool getAutoMove() const;
89  void setAutoMove (bool enable);
90 
91  void setLeftRight (int value);
92 
93  void setForwardBackward (int value);
94  void setUpDown(int value);
95 
96  void setRunState(bool run);
97  void setSneak(bool sneak);
98 
99  void yaw(float yaw);
100  void pitch(float pitch);
101  void roll(float roll);
102 
103  bool wasTeleported() const;
104  void setTeleported(bool teleported);
105 
106  void setAttackingOrSpell(bool attackingOrSpell);
107  bool getAttackingOrSpell() const;
108 
110  bool isInCombat();
111 
112  bool enemiesNearby();
113 
114  void clear();
115 
116  void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
117 
118  bool readRecord (ESM::ESMReader& reader, uint32_t type);
119 
120  int getNewCrimeId(); // get new id for witnesses
121  void recordCrimeId(); // record the paid crime id when bounty is 0
122  int getCrimeId() const; // get the last paid crime id
123  };
124 }
125 #endif
Definition: stat.hpp:108
bool getAutoMove() const
Definition: player.cpp:131
MWWorld::CellStore * mCellStore
Definition: player.hpp:33
const std::string & getBirthSign() const
Definition: player.cpp:120
void setLeftRight(int value)
Definition: player.cpp:150
bool readRecord(ESM::ESMReader &reader, uint32_t type)
Definition: player.cpp:318
int mPaidCrimeId
Definition: player.hpp:47
bool isInCombat()
Checks all nearby actors to see if anyone has an aipackage against you.
Definition: player.cpp:249
Definition: esmreader.hpp:21
void setTeleported(bool teleported)
Definition: player.cpp:234
NPC object representing the player and additional player data.
Definition: player.hpp:30
CellStore * mMarkedCell
Definition: player.hpp:40
int getCrimeId() const
Definition: player.cpp:429
void pitch(float pitch)
Definition: player.cpp:191
void restoreSkillsAttributes()
Definition: player.cpp:59
Definition: loadskil.hpp:74
std::string mSign
Definition: player.hpp:34
Definition: loadinglistener.hpp:8
MWMechanics::AttributeValue mSaveAttributes[ESM::Attribute::Length]
Definition: player.hpp:51
void setLastKnownExteriorPosition(const osg::Vec3f &position)
Definition: player.hpp:70
void setDrawState(MWMechanics::DrawState_ state)
Definition: player.cpp:125
void yaw(float yaw)
Definition: player.cpp:186
void setBirthSign(const std::string &sign)
Definition: player.cpp:115
MWMechanics::DrawState_ getDrawState()
Definition: player.cpp:202
Definition: esmwriter.hpp:17
void recordCrimeId()
Definition: player.cpp:424
MWMechanics::SkillValue mSaveSkills[ESM::Skill::Length]
Definition: player.hpp:50
void clear()
Definition: player.cpp:271
void setWerewolfSkillsAttributes()
Definition: player.cpp:68
void activate()
Activate the object under the crosshair, if any.
Definition: player.cpp:208
osg::Vec3f getLastKnownExteriorPosition() const
Definition: player.hpp:71
void write(ESM::ESMWriter &writer, Loading::Listener &progress) const
Definition: player.cpp:281
void getMarkedPosition(CellStore *&markedCell, ESM::Position &markedPosition) const
Definition: player.cpp:264
DrawState_
Definition: drawstate.hpp:7
Definition: loadnpc.hpp:23
bool enemiesNearby()
Definition: player.cpp:253
int mCurrentCrimeId
Definition: player.hpp:46
void setRunState(bool run)
Definition: player.cpp:174
bool getAttackingOrSpell() const
Definition: player.cpp:244
bool wasTeleported() const
Definition: player.cpp:229
LiveCellRef< ESM::NPC > mPlayer
Definition: player.hpp:32
Mutable state of a cell.
Definition: cellstore.hpp:53
void saveSkillsAttributes()
Definition: player.cpp:50
void set(const ESM::NPC *player)
Definition: player.cpp:99
void setForwardBackward(int value)
Definition: player.cpp:156
void setAttackingOrSpell(bool attackingOrSpell)
Definition: player.cpp:239
bool mAutoMove
Definition: player.hpp:42
int mForwardBackward
Definition: player.hpp:43
Definition: defs.hpp:38
void setAutoMove(bool enable)
Definition: player.cpp:136
MWWorld::Ptr getPlayer()
Definition: player.cpp:109
void setSneak(bool sneak)
Definition: player.cpp:180
Definition: stat.hpp:137
void setUpDown(int value)
Definition: player.cpp:168
Definition: attr.hpp:24
Player(const ESM::NPC *player)
Definition: player.cpp:29
void roll(float roll)
Definition: player.cpp:196
Pointer to a LiveCellRef.
Definition: ptr.hpp:19
int getNewCrimeId()
Definition: player.cpp:419
bool mTeleported
Definition: player.hpp:44
void enable(CodeContainer &code, Literals &literals, const std::string &id)
Definition: generator.cpp:870
bool mAttackingOrSpell
Definition: player.hpp:53
osg::Vec3f mLastKnownExteriorPosition
Definition: player.hpp:36
ESM::Position mMarkedPosition
Definition: player.hpp:38
void markPosition(CellStore *markedCell, ESM::Position markedPosition)
Definition: player.cpp:258
void setCell(MWWorld::CellStore *cellStore)
Definition: player.cpp:104