summaryrefslogtreecommitdiff
path: root/src/files.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:13 +0200
committerBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:13 +0200
commit0a16384475488d682e33c8d55691e5d9417412ac (patch)
tree25b73201916e8b63cf012dbf0d8392af42e1d16f /src/files.cc
parentf507d6fb86fe7cfaf4dec69afa36875a1a4aaae4 (diff)
Unify opval/oflags in player_* structs into player_level_flag
Diffstat (limited to 'src/files.cc')
-rw-r--r--src/files.cc23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/files.cc b/src/files.cc
index 4cd95447..ec569e73 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -1575,6 +1575,16 @@ static object_flag_set wield_monster_flags()
}
+template<class LF>
+static void apply_lflags(LF const &lflags, object_flag_set *f)
+{
+ for (int i = 1; i <= p_ptr->lev; i++)
+ {
+ (*f) |= lflags[i].oflags;
+ }
+}
+
+
/*
* Obtain the "flags" for the player as if he was an item
*/
@@ -1680,20 +1690,13 @@ object_flag_set player_flags()
}
/* Classes */
- for (int i = 1; i <= p_ptr->lev; i++)
- {
- f |= cp_ptr->oflags[i];
- }
+ apply_lflags(cp_ptr->lflags, &f);
/* Races */
if ((!p_ptr->mimic_form) && (!p_ptr->body_monster))
{
- for (int i = 1; i <= p_ptr->lev; i++)
- {
- f |= rp_ptr->oflags[i];
-
- f |= rmp_ptr->oflags[i];
- }
+ apply_lflags(rp_ptr->lflags, &f);
+ apply_lflags(rmp_ptr->lflags, &f);
}
else
{