summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2015-03-07 16:55:42 +0100
committerBardur Arantsson <bardur@scientician.net>2015-03-07 16:55:42 +0100
commitca352fcaf16405a6edf348cca431ea173511af3f (patch)
treeb2253f8f5dff38e90b3243bd1546ff1fd0c12d49 /src
parentd192b228ed08575b7247afc3a3a880550a66637f (diff)
Replace PRACE_FLAG{,2} macros with functions
Diffstat (limited to 'src')
-rw-r--r--src/birth.cc6
-rw-r--r--src/bldg.cc2
-rw-r--r--src/cmd1.cc2
-rw-r--r--src/cmd2.cc2
-rw-r--r--src/cmd6.cc6
-rw-r--r--src/corrupt.cc3
-rw-r--r--src/defines.h4
-rw-r--r--src/dungeon.cc12
-rw-r--r--src/files.cc2
-rw-r--r--src/monster2.cc2
-rw-r--r--src/spells2.cc2
-rw-r--r--src/xtra1.cc20
-rw-r--r--src/xtra1.hpp2
-rw-r--r--src/xtra2.cc8
14 files changed, 41 insertions, 32 deletions
diff --git a/src/birth.cc b/src/birth.cc
index b6470e59..4a822a61 100644
--- a/src/birth.cc
+++ b/src/birth.cc
@@ -2158,7 +2158,7 @@ static bool_ player_birth_aux_ask()
p_ptr->pgod = k;
set_grace(previous_char.grace);
}
- else if (PRACE_FLAG(PR1_NO_GOD))
+ else if (race_flags1_p(PR1_NO_GOD))
{
p_ptr->pgod = GOD_NONE;
}
@@ -2265,7 +2265,7 @@ static bool_ player_birth_aux_ask()
}
/* A god that like us ? more grace ! */
- if (PRACE_FLAGS(PR1_GOD_FRIEND))
+ if (race_flags1_p(PR1_GOD_FRIEND))
{
set_grace(200);
}
@@ -2295,7 +2295,7 @@ static bool_ player_birth_aux_ask()
/* Set birth options: maximize, preserve, sepcial levels and astral */
p_ptr->preserve = preserve;
p_ptr->special = special_lvls;
- p_ptr->astral = (PRACE_FLAG2(PR2_ASTRAL)) ? TRUE : FALSE;
+ p_ptr->astral = (race_flags2_p(PR2_ASTRAL)) ? TRUE : FALSE;
/*
* A note by pelpel. (remove this please)
diff --git a/src/bldg.cc b/src/bldg.cc
index bda47667..065b75c9 100644
--- a/src/bldg.cc
+++ b/src/bldg.cc
@@ -531,7 +531,7 @@ static bool_ inn_comm(int cmd)
/* Extract race info */
- vampire = ((PRACE_FLAG(PR1_VAMPIRE)) || (p_ptr->mimic_form == resolve_mimic_name("Vampire")));
+ vampire = ((race_flags1_p(PR1_VAMPIRE)) || (p_ptr->mimic_form == resolve_mimic_name("Vampire")));
switch (cmd)
{
diff --git a/src/cmd1.cc b/src/cmd1.cc
index a5c882b9..96cb3826 100644
--- a/src/cmd1.cc
+++ b/src/cmd1.cc
@@ -2890,7 +2890,7 @@ bool_ player_can_enter(byte feature)
/* Player can not walk through "walls" unless in Shadow Form */
- if (p_ptr->wraith_form || (PRACE_FLAG(PR1_SEMI_WRAITH)))
+ if (p_ptr->wraith_form || (race_flags1_p(PR1_SEMI_WRAITH)))
pass_wall = TRUE;
else
pass_wall = FALSE;
diff --git a/src/cmd2.cc b/src/cmd2.cc
index 60a7dc47..4354773b 100644
--- a/src/cmd2.cc
+++ b/src/cmd2.cc
@@ -4922,7 +4922,7 @@ void do_cmd_steal()
}
/* Rogues gain some xp */
- if (PRACE_FLAGS(PR1_EASE_STEAL))
+ if (race_flags1_p(PR1_EASE_STEAL))
{
s32b max_point;
diff --git a/src/cmd6.cc b/src/cmd6.cc
index 42673bdd..f0fa7f10 100644
--- a/src/cmd6.cc
+++ b/src/cmd6.cc
@@ -1469,7 +1469,7 @@ void do_cmd_eat_food(void)
/* Food can feed the player, in a different ways */
/* Vampires */
- if ((PRACE_FLAG(PR1_VAMPIRE)) || (p_ptr->mimic_form == resolve_mimic_name("Vampire")))
+ if ((race_flags1_p(PR1_VAMPIRE)) || (p_ptr->mimic_form == resolve_mimic_name("Vampire")))
{
/* Reduced nutritional benefit */
/* (void)set_food(p_ptr->food + (fval / 10)); -- No more */
@@ -1482,9 +1482,9 @@ void do_cmd_eat_food(void)
}
}
- else if (PRACE_FLAG(PR1_NO_FOOD))
+ else if (race_flags1_p(PR1_NO_FOOD))
{
- if (PRACE_FLAG(PR1_UNDEAD))
+ if (race_flags1_p(PR1_UNDEAD))
{
msg_print("The food of mortals is poor sustenance for you.");
}
diff --git a/src/corrupt.cc b/src/corrupt.cc
index ec5d69be..4d375953 100644
--- a/src/corrupt.cc
+++ b/src/corrupt.cc
@@ -2,6 +2,7 @@
#include "init1.hpp"
#include "util.hpp"
#include "variable.hpp"
+#include "xtra1.hpp"
#include "xtra2.hpp"
#include <cassert>
@@ -757,7 +758,7 @@ static bool_ player_allow_corruption(int corruption_idx)
/* Vampire teeth is special */
if (corruption_idx == CORRUPT_VAMPIRE_TEETH)
{
- if (PRACE_FLAG(PR1_NO_SUBRACE_CHANGE))
+ if (race_flags1_p(PR1_NO_SUBRACE_CHANGE))
{
return TRUE;
}
diff --git a/src/defines.h b/src/defines.h
index 54c5a845..ca6fbfd9 100644
--- a/src/defines.h
+++ b/src/defines.h
@@ -514,10 +514,6 @@
#define PR2_ASTRAL 0x00000002L /* Is it an astral being coming from th halls of mandos ? */
/* XXX */
-#define PRACE_FLAG2(f) ((rp_ptr->flags2 | rmp_ptr->flags2 | cp_ptr->flags2 | spp_ptr->flags2) & (f))
-#define PRACE_FLAG(f) ((rp_ptr->flags1 | rmp_ptr->flags1 | cp_ptr->flags1 | spp_ptr->flags1) & (f))
-#define PRACE_FLAGS(f) PRACE_FLAG(f)
-
/* XXX */
#define MKEY_MINDCRAFT 2
#define MKEY_ANTIMAGIC 3
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 9b66d869..f75d13a6 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -1495,7 +1495,7 @@ static void process_world(void)
{
/* Do nothing */
}
- else if (PRACE_FLAG(PR1_SEMI_WRAITH) && (!p_ptr->wraith_form) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags1 & FF1_CAN_PASS))
+ else if (race_flags1_p(PR1_SEMI_WRAITH) && (!p_ptr->wraith_form) && (f_info[cave[p_ptr->py][p_ptr->px].feat].flags1 & FF1_CAN_PASS))
{
int amt = 1 + ((p_ptr->lev) / 5);
@@ -1717,7 +1717,7 @@ static void process_world(void)
PRAY_GOD(GOD_MANWE)
dec++;
- if (PRACE_FLAG(PR1_ELF))
+ if (race_flags1_p(PR1_ELF))
dec -= wisdom_scale(2);
if (dec < 1) dec = 1;
inc_piety(GOD_MANWE, -dec);
@@ -1728,7 +1728,7 @@ static void process_world(void)
PRAY_GOD(GOD_MELKOR)
dec++;
- if (PRACE_FLAG(PR1_ELF))
+ if (race_flags1_p(PR1_ELF))
dec += 5 - wisdom_scale(4);
if (dec < 1) dec = 1;
inc_piety(GOD_MELKOR, -dec);
@@ -2653,7 +2653,7 @@ static void process_world(void)
byte chance = 0;
int plev = p_ptr->lev;
- if (PRACE_FLAG(PR1_RESIST_BLACK_BREATH)) chance = 2;
+ if (race_flags1_p(PR1_RESIST_BLACK_BREATH)) chance = 2;
else chance = 5;
if ((rand_int(100) < chance) && (p_ptr->exp > 0))
@@ -3911,7 +3911,7 @@ static void process_command(void)
if (p_ptr->control) break;
if (p_ptr->wild_mode) break;
- if (PRACE_FLAG(PR1_NO_GOD))
+ if (race_flags1_p(PR1_NO_GOD))
{
msg_print("You cannot worship gods.");
}
@@ -5220,7 +5220,7 @@ void play_game(bool_ new_game)
/* Hack -- enter the world */
/* Mega-hack Vampires and Spectres start in the dungeon */
- if (PRACE_FLAG(PR1_UNDEAD))
+ if (race_flags1_p(PR1_UNDEAD))
{
turn = (10L * DAY / 2) + (START_DAY * 10) + 1;
}
diff --git a/src/files.cc b/src/files.cc
index 4bc44d6a..9585a249 100644
--- a/src/files.cc
+++ b/src/files.cc
@@ -2682,7 +2682,7 @@ errr file_character(cptr name, bool_ full)
if (noscore)
fprintf(fff, "\n You have done something illegal.");
- if (PRACE_FLAGS(PR1_EXPERIMENTAL))
+ if (race_flags1_p(PR1_EXPERIMENTAL))
fprintf(fff, "\n You have done something experimental.");
{
diff --git a/src/monster2.cc b/src/monster2.cc
index d0103815..7d705dc5 100644
--- a/src/monster2.cc
+++ b/src/monster2.cc
@@ -1599,7 +1599,7 @@ static void sanity_blast(monster_type * m_ptr, bool_ necro)
}
/* Undead characters are 50% likely to be unaffected */
- if ((PRACE_FLAG(PR1_UNDEAD)) || (p_ptr->mimic_form == resolve_mimic_name("Vampire")))
+ if ((race_flags1_p(PR1_UNDEAD)) || (p_ptr->mimic_form == resolve_mimic_name("Vampire")))
{
if (randint(100) < (25 + (p_ptr->lev))) return;
}
diff --git a/src/spells2.cc b/src/spells2.cc
index f128700d..a15c0e39 100644
--- a/src/spells2.cc
+++ b/src/spells2.cc
@@ -4795,7 +4795,7 @@ void earthquake(int cy, int cx, int r)
map[16 + p_ptr->py - cy][16 + p_ptr->px - cx] = FALSE;
/* Semi-wraiths have to be hurt *some*, says DG */
- if (PRACE_FLAG(PR1_SEMI_WRAITH))
+ if (race_flags1_p(PR1_SEMI_WRAITH))
damage /= 4;
/* Take some damage */
diff --git a/src/xtra1.cc b/src/xtra1.cc
index c01f9c24..80638d9e 100644
--- a/src/xtra1.cc
+++ b/src/xtra1.cc
@@ -3038,7 +3038,7 @@ void calc_bonuses(bool_ silent)
apply_flags(rmp_ptr->oflags1[i], rmp_ptr->oflags2[i], rmp_ptr->oflags3[i], rmp_ptr->oflags4[i], rmp_ptr->oflags5[i], rmp_ptr->oesp[i], rmp_ptr->opval[i], 0, 0, 0, 0);
}
- if (PRACE_FLAG(PR1_HURT_LITE))
+ if (race_flags1_p(PR1_HURT_LITE))
p_ptr->sensible_lite = TRUE;
}
@@ -3156,7 +3156,7 @@ void calc_bonuses(bool_ silent)
/* Hack -- aura of fire also provides light */
if (p_ptr->sh_fire) p_ptr->lite = TRUE;
- if (PRACE_FLAG(PR1_AC_LEVEL))
+ if (race_flags1_p(PR1_AC_LEVEL))
{
p_ptr->to_a += 20 + (p_ptr->lev / 5);
p_ptr->dis_to_a += 20 + (p_ptr->lev / 5);
@@ -3624,13 +3624,13 @@ void calc_bonuses(bool_ silent)
if (p_ptr->num_fire < 1) p_ptr->num_fire = 1;
}
- if (PRACE_FLAG(PR1_XTRA_MIGHT_BOW) && p_ptr->tval_ammo == TV_ARROW)
+ if (race_flags1_p(PR1_XTRA_MIGHT_BOW) && p_ptr->tval_ammo == TV_ARROW)
p_ptr->xtra_might += 1;
- if (PRACE_FLAG(PR1_XTRA_MIGHT_SLING) && p_ptr->tval_ammo == TV_SHOT)
+ if (race_flags1_p(PR1_XTRA_MIGHT_SLING) && p_ptr->tval_ammo == TV_SHOT)
p_ptr->xtra_might += 1;
- if (PRACE_FLAG(PR1_XTRA_MIGHT_XBOW) && p_ptr->tval_ammo == TV_BOLT)
+ if (race_flags1_p(PR1_XTRA_MIGHT_XBOW) && p_ptr->tval_ammo == TV_BOLT)
p_ptr->xtra_might += 1;
/* Examine the "current tool" */
@@ -4686,3 +4686,13 @@ int luck(int min, int max)
return (luck + min);
}
+
+bool race_flags1_p(u32b flags1_mask)
+{
+ return (rp_ptr->flags1 | rmp_ptr->flags1 | cp_ptr->flags1 | spp_ptr->flags1) & flags1_mask;
+}
+
+bool race_flags2_p(u32b flags2_mask)
+{
+ return (rp_ptr->flags2 | rmp_ptr->flags2 | cp_ptr->flags2 | spp_ptr->flags2) & flags2_mask;
+}
diff --git a/src/xtra1.hpp b/src/xtra1.hpp
index f5d193ff..5cd4f9f1 100644
--- a/src/xtra1.hpp
+++ b/src/xtra1.hpp
@@ -20,3 +20,5 @@ extern void calc_bonuses(bool_ silent);
extern void gain_fate(byte fate);
extern void fate_desc(char *desc, int fate);
extern void dump_fates(FILE *OutFile);
+extern bool race_flags1_p(u32b flags1_mask);
+extern bool race_flags2_p(u32b flags2_mask);
diff --git a/src/xtra2.cc b/src/xtra2.cc
index fcd71db3..07747a32 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -1337,7 +1337,7 @@ bool_ set_stun(int v)
/* Hack -- Force good values */
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
- if (PRACE_FLAG(PR1_NO_STUN)) v = 0;
+ if (race_flags1_p(PR1_NO_STUN)) v = 0;
/* Knocked out */
if (p_ptr->stun > 100)
@@ -1498,7 +1498,7 @@ bool_ set_cut(int v)
/* Hack -- Force good values */
v = (v > 10000) ? 10000 : (v < 0) ? 0 : v;
- if (PRACE_FLAG(PR1_NO_CUT)) v = 0;
+ if (race_flags1_p(PR1_NO_CUT)) v = 0;
/* Mortal wound */
if (p_ptr->cut > 1000)
@@ -1973,7 +1973,7 @@ void check_experience(void)
if (p_ptr->lev > p_ptr->max_plv)
{
p_ptr->max_plv = p_ptr->lev;
- if ((PRACE_FLAG(PR1_CORRUPT)) &&
+ if ((race_flags1_p(PR1_CORRUPT)) &&
(randint(3) == 1))
{
level_corruption = TRUE;
@@ -2102,7 +2102,7 @@ void gain_exp(s32b amount)
}
}
- if ((p_ptr->max_exp > 0) && (PRACE_FLAG(PR1_CORRUPT)))
+ if ((p_ptr->max_exp > 0) && (race_flags1_p(PR1_CORRUPT)))
{
if ((randint(p_ptr->max_exp) < amount) || (randint(12000000) < amount))
{