summaryrefslogtreecommitdiff
path: root/src/player_type.hpp
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:14 +0200
committerBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:14 +0200
commitcc857c940cfe1bfe8d78674dbce53e5b71acaf41 (patch)
treed1e62b5c66b9bd3d0f8cf1873b8dd858060816c5 /src/player_type.hpp
parent5a3f511fd036dd73152786e83f32c32f274f2398 (diff)
Move ability_type::acquired to p_ptr struct
This is justified by the fact that the 'acquired' flag is actually a player-centered bit of information and must be loaded/saved. Everything else in ability_type is defined by the *.txt files.
Diffstat (limited to 'src/player_type.hpp')
-rw-r--r--src/player_type.hpp20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/player_type.hpp b/src/player_type.hpp
index 1285e018..8f3c06dc 100644
--- a/src/player_type.hpp
+++ b/src/player_type.hpp
@@ -378,6 +378,9 @@ struct player_type
bool_ powers[POWER_MAX] = { FALSE }; /* Actual powers */
bool_ powers_mod[POWER_MAX] = { FALSE }; /* Intrinsinc powers */
+ /* Acquired abilities; indexes into ab_info[] */
+ std::vector<u16b> abilities;
+
/* Skills */
s16b skill_points = 0;
s16b skill_last_level = 0; /* Prevents gaining skills by losing level and regaining them */
@@ -400,5 +403,20 @@ struct player_type
bool_ did_nothing = FALSE; /* True if the last action wasnt a real action */
bool_ leaving = FALSE; /* True if player is leaving */
-};
+ /**
+ * Does the player have the given ability?
+ */
+ bool has_ability(u16b ability_idx) const;
+
+ /**
+ * Gain the given ability.
+ */
+ void gain_ability(u16b ability_idx);
+
+ /**
+ * Lose the given ability.
+ */
+ void lose_ability(u16b ability_idx);
+
+};