summaryrefslogtreecommitdiff
path: root/src/object1.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-06-20 22:49:05 +0200
committerBardur Arantsson <bardur@scientician.net>2016-06-20 22:49:05 +0200
commit2fcc9f1712b630055ae9ce5c3ecf017b8a93fbbb (patch)
tree49f48e7f03ebeb6fda174e730b0d7455d86618c8 /src/object1.cc
parent9c26f78ce556d3a0717e4bc5668a1ed59217f414 (diff)
Change flags_group to non-POD type
Diffstat (limited to 'src/object1.cc')
-rw-r--r--src/object1.cc30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/object1.cc b/src/object1.cc
index fd3ab769..ae803db9 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -2667,19 +2667,17 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait
if ((f4 & TR4_LEVELS) && (!trim_down))
{
- int j = 0;
-
if (count_bits(o_ptr->pval3) == 0) text_out("It is sentient");
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 ");
bool_ first = TRUE;
- for (j = 0; j < MAX_FLAG_GROUP; j++)
+ for (std::size_t j = 0; j < flags_groups().size(); j++)
{
if (BIT(j) & o_ptr->pval3)
{
check_first(&first);
- text_out_c(flags_groups[j].color, flags_groups[j].name);
+ text_out_c(flags_groups()[j].color, flags_groups()[j].name);
}
}
@@ -6057,13 +6055,13 @@ static void gain_flag_group(object_type *o_ptr)
while (tries--)
{
- grp = rand_int(MAX_FLAG_GROUP);
+ grp = rand_int(flags_groups().size());
/* If we already got this group continue */
if (o_ptr->pval3 & BIT(grp)) continue;
/* Not enough points ? */
- if (flags_groups[grp].price > o_ptr->pval2) continue;
+ if (flags_groups()[grp].price > o_ptr->pval2) continue;
/* Ok, enough points and not already got it */
break;
@@ -6072,7 +6070,7 @@ static void gain_flag_group(object_type *o_ptr)
/* Ack, nothing found */
if (tries <= 1) return;
- o_ptr->pval2 -= flags_groups[grp].price;
+ o_ptr->pval2 -= flags_groups()[grp].price;
o_ptr->pval3 |= BIT(grp);
/* Message */
@@ -6080,7 +6078,7 @@ static void gain_flag_group(object_type *o_ptr)
char o_name[80];
object_desc(o_name, o_ptr, FALSE, 0);
- msg_format("%s gains access to the %s realm.", o_name, flags_groups[grp].name);
+ msg_format("%s gains access to the %s realm.", o_name, flags_groups()[grp].name);
}
}
@@ -6097,27 +6095,27 @@ static u32b get_flag(object_type *o_ptr, int grp, int k)
switch (k)
{
case 0:
- flag_set = flags_groups[grp].flags1;
+ flag_set = flags_groups()[grp].flags1;
flag_test = f1;
break;
case 1:
- flag_set = flags_groups[grp].flags2;
+ flag_set = flags_groups()[grp].flags2;
flag_test = f2;
break;
case 2:
- flag_set = flags_groups[grp].flags3;
+ flag_set = flags_groups()[grp].flags3;
flag_test = f3;
break;
case 3:
- flag_set = flags_groups[grp].flags4;
+ flag_set = flags_groups()[grp].flags4;
flag_test = f4;
break;
case 4:
- flag_set = flags_groups[grp].esp;
+ flag_set = flags_groups()[grp].esp;
flag_test = esp;
break;
default:
- flag_set = flags_groups[grp].flags1;
+ flag_set = flags_groups()[grp].flags1;
flag_test = f1;
break;
}
@@ -6159,7 +6157,7 @@ static void gain_flag_group_flag(object_type *o_ptr)
k = rand_int(5);
/* get a flag group */
- grp = rand_int(MAX_FLAG_GROUP);
+ grp = rand_int(flags_groups().size());
if (!(BIT(grp) & o_ptr->pval3)) continue;
@@ -6197,7 +6195,7 @@ static void gain_flag_group_flag(object_type *o_ptr)
char o_name[80];
object_desc(o_name, o_ptr, FALSE, 0);
- msg_format("%s gains a new power from the %s realm.", o_name, flags_groups[grp].name);
+ msg_format("%s gains a new power from the %s realm.", o_name, flags_groups()[grp].name);
}
}