summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-03-10 18:41:54 +0100
committerBardur Arantsson <bardur@scientician.net>2016-03-10 19:02:23 +0100
commitea91fcd36198086ea21d167e27a1e5fef7185f88 (patch)
treed7af83b4fac973a718426082ccc216e3782c5d36 /src
parentbebfa9aab4b7ae71e4674db3cdc2e08a739be10b (diff)
Change CHECK_FIRST() from macro to function
Diffstat (limited to 'src')
-rw-r--r--src/object1.cc29
1 files changed, 16 insertions, 13 deletions
diff --git a/src/object1.cc b/src/object1.cc
index 17a2d096..04faa90b 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -2546,8 +2546,16 @@ static bool_ grab_tval_desc(int tval)
return TRUE;
}
-#define CHECK_FIRST(txt, first) \
-if ((first)) { (first) = FALSE; text_out((txt)); } else text_out(", ");
+static void check_first(bool_ *first)
+{
+ if (*first) {
+ *first = FALSE;
+ }
+ else
+ {
+ text_out(", ");
+ }
+}
/*
* Display the damage done with a multiplier
@@ -2559,7 +2567,7 @@ void output_dam(object_type *o_ptr, int mult, int mult2, cptr against, cptr agai
dam = (o_ptr->dd + (o_ptr->dd * o_ptr->ds)) * 5 * mult;
dam += (o_ptr->to_d + p_ptr->to_d + p_ptr->to_d_melee) * 10;
dam *= p_ptr->num_blow;
- CHECK_FIRST("", *first);
+ check_first(first);
if (dam > 0)
{
if (dam % 10)
@@ -2576,7 +2584,7 @@ void output_dam(object_type *o_ptr, int mult, int mult2, cptr against, cptr agai
dam = (o_ptr->dd + (o_ptr->dd * o_ptr->ds)) * 5 * mult2;
dam += (o_ptr->to_d + p_ptr->to_d + p_ptr->to_d_melee) * 10;
dam *= p_ptr->num_blow;
- CHECK_FIRST("", *first);
+ check_first(first);
if (dam > 0)
{
if (dam % 10)
@@ -2656,7 +2664,7 @@ void output_ammo_dam(object_type *o_ptr, int mult, int mult2, cptr against, cptr
dam *= tmul;
if (!is_boomerang) dam += (p_ptr->to_d_ranged) * 10;
dam *= mult;
- CHECK_FIRST("", *first);
+ check_first(first);
if (dam > 0)
{
if (dam % 10)
@@ -2676,7 +2684,7 @@ void output_ammo_dam(object_type *o_ptr, int mult, int mult2, cptr against, cptr
dam *= tmul;
if (!is_boomerang) dam += (p_ptr->to_d_ranged) * 10;
dam *= mult2;
- CHECK_FIRST("", *first);
+ check_first(first);
if (dam > 0)
{
if (dam % 10)
@@ -2829,14 +2837,10 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait
{
u32b f1, f2, f3, f4, f5, esp;
- const char *txt;
-
cptr vp[64];
byte vc[64];
int vn;
- bool_ first = TRUE;
-
/* Extract the flags */
if ((!(o_ptr->ident & (IDENT_MENTAL))) && (!fff))
{
@@ -2907,13 +2911,12 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait
else if (count_bits(o_ptr->pval3) > 1) text_out("It is sentient and can have access to the realms of ");
else text_out("It is sentient and can have access to the realm of ");
- first = TRUE;
- txt = "";
+ bool_ first = TRUE;
for (j = 0; j < MAX_FLAG_GROUP; j++)
{
if (BIT(j) & o_ptr->pval3)
{
- CHECK_FIRST(txt, first);
+ check_first(&first);
text_out_c(flags_groups[j].color, flags_groups[j].name);
}
}