summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/cave.cc80
-rw-r--r--src/melee2.cc174
-rw-r--r--src/object1.cc168
3 files changed, 207 insertions, 215 deletions
diff --git a/src/cave.cc b/src/cave.cc
index 66e274f1..1ef32839 100644
--- a/src/cave.cc
+++ b/src/cave.cc
@@ -1044,33 +1044,31 @@ static void map_info(int y, int x, byte *ap, char *cp)
/**** Layer 2 -- Objects ****/
+ for (auto const o_idx: c_ptr->o_idxs)
{
- for (auto const o_idx: c_ptr->o_idxs)
- {
- /* Acquire object */
- object_type *o_ptr = &o_list[o_idx];
+ /* Acquire object */
+ object_type *o_ptr = &o_list[o_idx];
- /* Memorized objects */
- if (o_ptr->marked)
- {
- /* Normal char */
- *cp = object_char(o_ptr);
+ /* Memorized objects */
+ if (o_ptr->marked)
+ {
+ /* Normal char */
+ *cp = object_char(o_ptr);
- /* Normal attr */
- *ap = object_attr(o_ptr);
+ /* Normal attr */
+ *ap = object_attr(o_ptr);
- /* Multi-hued attr */
- if (!options->avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
- {
- *ap = get_shimmer_color();
- }
+ /* Multi-hued attr */
+ if (!options->avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
+ {
+ *ap = get_shimmer_color();
+ }
- /* Hack -- hallucination */
- if (p_ptr->image) image_object(ap, cp);
+ /* Hack -- hallucination */
+ if (p_ptr->image) image_object(ap, cp);
- /* Done */
- break;
- }
+ /* Done */
+ break;
}
}
@@ -1436,33 +1434,31 @@ void map_info_default(int y, int x, byte *ap, char *cp)
/**** Layer 2 -- Objects ****/
+ for (auto const this_o_idx: c_ptr->o_idxs)
{
- for (auto const this_o_idx: c_ptr->o_idxs)
- {
- /* Acquire object */
- object_type *o_ptr = &o_list[this_o_idx];
+ /* Acquire object */
+ object_type *o_ptr = &o_list[this_o_idx];
- /* Memorized objects */
- if (o_ptr->marked)
- {
- /* Normal char */
- *cp = object_char_default(o_ptr);
+ /* Memorized objects */
+ if (o_ptr->marked)
+ {
+ /* Normal char */
+ *cp = object_char_default(o_ptr);
- /* Normal attr */
- *ap = object_attr_default(o_ptr);
+ /* Normal attr */
+ *ap = object_attr_default(o_ptr);
- /* Multi-hued attr */
- if (!avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
- {
- *ap = get_shimmer_color();
- }
+ /* Multi-hued attr */
+ if (!avoid_other && (k_info[o_ptr->k_idx].flags & TR_ATTR_MULTI))
+ {
+ *ap = get_shimmer_color();
+ }
- /* Hack -- hallucination */
- if (p_ptr->image) image_object(ap, cp);
+ /* Hack -- hallucination */
+ if (p_ptr->image) image_object(ap, cp);
- /* Done */
- break;
- }
+ /* Done */
+ break;
}
}
diff --git a/src/melee2.cc b/src/melee2.cc
index df9ee6d3..691021a5 100644
--- a/src/melee2.cc
+++ b/src/melee2.cc
@@ -6136,116 +6136,114 @@ static void process_monster(int m_idx, bool_ is_frien)
}
+ /* Copy list of objects; we need a copy because we're mutating the list. */
+ auto const object_idxs(c_ptr->o_idxs);
+
+ /* Scan all objects in the grid */
+ for (auto const this_o_idx: object_idxs)
{
- /* Copy list of objects; we need a copy because we're mutating the list. */
- auto const object_idxs(c_ptr->o_idxs);
+ /* Acquire object */
+ object_type * o_ptr = &o_list[this_o_idx];
+
+ /* Skip gold */
+ if (o_ptr->tval == TV_GOLD) continue;
+
+ /* Incarnate ? */
+ if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags & RF_POSSESSOR) &&
+ ((o_ptr->sval == SV_CORPSE_CORPSE) || (o_ptr->sval == SV_CORPSE_SKELETON)))
+ {
+ if (ai_possessor(m_idx, this_o_idx)) return;
+ }
- /* Scan all objects in the grid */
- for (auto const this_o_idx: object_idxs)
+ /* Take or Kill objects on the floor */
+ /* rr9: Pets will no longer pick up/destroy items */
+ if ((((r_ptr->flags & RF_TAKE_ITEM) &&
+ ((is_friend(m_ptr) <= 0) || p_ptr->pet_pickup_items)) ||
+ (r_ptr->flags & RF_KILL_ITEM)) &&
+ (is_friend(m_ptr) <= 0))
{
- /* Acquire object */
- object_type * o_ptr = &o_list[this_o_idx];
+ char m_name[80];
+ char o_name[80];
- /* Skip gold */
- if (o_ptr->tval == TV_GOLD) continue;
+ /* Extract some flags */
+ auto const flags = object_flags(o_ptr);
- /* Incarnate ? */
- if ((o_ptr->tval == TV_CORPSE) && (r_ptr->flags & RF_POSSESSOR) &&
- ((o_ptr->sval == SV_CORPSE_CORPSE) || (o_ptr->sval == SV_CORPSE_SKELETON)))
- {
- if (ai_possessor(m_idx, this_o_idx)) return;
- }
+ /* Acquire the object name */
+ object_desc(o_name, o_ptr, TRUE, 3);
- /* Take or Kill objects on the floor */
- /* rr9: Pets will no longer pick up/destroy items */
- if ((((r_ptr->flags & RF_TAKE_ITEM) &&
- ((is_friend(m_ptr) <= 0) || p_ptr->pet_pickup_items)) ||
- (r_ptr->flags & RF_KILL_ITEM)) &&
- (is_friend(m_ptr) <= 0))
+ /* Acquire the monster name */
+ monster_desc(m_name, m_ptr, 0x04);
+
+ /* React to objects that hurt the monster */
+ monster_race_flag_set flg;
+ if (flags & TR_KILL_DEMON) flg |= RF_DEMON;
+ if (flags & TR_KILL_UNDEAD) flg |= RF_UNDEAD;
+ if (flags & TR_SLAY_DRAGON) flg |= RF_DRAGON;
+ if (flags & TR_SLAY_TROLL) flg |= RF_TROLL;
+ if (flags & TR_SLAY_GIANT) flg |= RF_GIANT;
+ if (flags & TR_SLAY_ORC) flg |= RF_ORC;
+ if (flags & TR_SLAY_DEMON) flg |= RF_DEMON;
+ if (flags & TR_SLAY_UNDEAD) flg |= RF_UNDEAD;
+ if (flags & TR_SLAY_ANIMAL) flg |= RF_ANIMAL;
+ if (flags & TR_SLAY_EVIL) flg |= RF_EVIL;
+
+ /* The object cannot be picked up by the monster */
+ if (artifact_p(o_ptr) || (r_ptr->flags & flg))
{
- char m_name[80];
- char o_name[80];
-
- /* Extract some flags */
- auto const flags = object_flags(o_ptr);
-
- /* Acquire the object name */
- object_desc(o_name, o_ptr, TRUE, 3);
-
- /* Acquire the monster name */
- monster_desc(m_name, m_ptr, 0x04);
-
- /* React to objects that hurt the monster */
- monster_race_flag_set flg;
- if (flags & TR_KILL_DEMON) flg |= RF_DEMON;
- if (flags & TR_KILL_UNDEAD) flg |= RF_UNDEAD;
- if (flags & TR_SLAY_DRAGON) flg |= RF_DRAGON;
- if (flags & TR_SLAY_TROLL) flg |= RF_TROLL;
- if (flags & TR_SLAY_GIANT) flg |= RF_GIANT;
- if (flags & TR_SLAY_ORC) flg |= RF_ORC;
- if (flags & TR_SLAY_DEMON) flg |= RF_DEMON;
- if (flags & TR_SLAY_UNDEAD) flg |= RF_UNDEAD;
- if (flags & TR_SLAY_ANIMAL) flg |= RF_ANIMAL;
- if (flags & TR_SLAY_EVIL) flg |= RF_EVIL;
-
- /* The object cannot be picked up by the monster */
- if (artifact_p(o_ptr) || (r_ptr->flags & flg))
+ /* Only give a message for "take_item" */
+ if (r_ptr->flags & RF_TAKE_ITEM)
{
- /* Only give a message for "take_item" */
- if (r_ptr->flags & RF_TAKE_ITEM)
+ /* Describe observable situations */
+ if (m_ptr->ml && player_has_los_bold(ny, nx))
{
- /* Describe observable situations */
- if (m_ptr->ml && player_has_los_bold(ny, nx))
- {
- /* Dump a message */
- msg_format("%^s tries to pick up %s, but fails.",
- m_name, o_name);
- }
+ /* Dump a message */
+ msg_format("%^s tries to pick up %s, but fails.",
+ m_name, o_name);
}
}
+ }
- /* Pick up the item */
- else if (r_ptr->flags & RF_TAKE_ITEM)
+ /* Pick up the item */
+ else if (r_ptr->flags & RF_TAKE_ITEM)
+ {
+ /* Describe observable situations */
+ if (player_has_los_bold(ny, nx))
{
- /* Describe observable situations */
- if (player_has_los_bold(ny, nx))
- {
- /* Dump a message */
- msg_format("%^s picks up %s.", m_name, o_name);
- }
+ /* Dump a message */
+ msg_format("%^s picks up %s.", m_name, o_name);
+ }
- /* Put into inventory of monster */
- {
- /* Excise the object */
- excise_object_idx(this_o_idx);
+ /* Put into inventory of monster */
+ {
+ /* Excise the object */
+ excise_object_idx(this_o_idx);
- /* Forget mark */
- o_ptr->marked = FALSE;
+ /* Forget mark */
+ o_ptr->marked = FALSE;
- /* Forget location */
- o_ptr->iy = o_ptr->ix = 0;
+ /* Forget location */
+ o_ptr->iy = o_ptr->ix = 0;
- /* Memorize monster */
- o_ptr->held_m_idx = m_idx;
+ /* Memorize monster */
+ o_ptr->held_m_idx = m_idx;
- /* Carry object */
- m_ptr->hold_o_idxs.push_back(this_o_idx);
- }
+ /* Carry object */
+ m_ptr->hold_o_idxs.push_back(this_o_idx);
}
+ }
- /* Destroy the item */
- else
+ /* Destroy the item */
+ else
+ {
+ /* Describe observable situations */
+ if (player_has_los_bold(ny, nx))
{
- /* Describe observable situations */
- if (player_has_los_bold(ny, nx))
- {
- /* Dump a message */
- msg_format("%^s crushes %s.", m_name, o_name);
- }
-
- /* Delete the object */
- delete_object_idx(this_o_idx);
+ /* Dump a message */
+ msg_format("%^s crushes %s.", m_name, o_name);
}
+
+ /* Delete the object */
+ delete_object_idx(this_o_idx);
}
}
}
diff --git a/src/object1.cc b/src/object1.cc
index e81c5742..7a9f7543 100644
--- a/src/object1.cc
+++ b/src/object1.cc
@@ -2876,101 +2876,99 @@ bool_ object_out_desc(object_type *o_ptr, FILE *fff, bool_ trim_down, bool_ wait
text_out("It makes you invisible. ");
}
+ vn = 0;
+ if (flags & TR_SUST_STR)
{
- vn = 0;
- if (flags & TR_SUST_STR)
- {
- vp[vn++] = "strength";
- }
- if (flags & TR_SUST_INT)
- {
- vp[vn++] = "intelligence";
- }
- if (flags & TR_SUST_WIS)
- {
- vp[vn++] = "wisdom";
- }
- if (flags & TR_SUST_DEX)
- {
- vp[vn++] = "dexterity";
- }
- if (flags & TR_SUST_CON)
- {
- vp[vn++] = "constitution";
- }
- if (flags & TR_SUST_CHR)
- {
- vp[vn++] = "charisma";
- }
- /* Describe */
- if (vn)
- {
- int i;
+ vp[vn++] = "strength";
+ }
+ if (flags & TR_SUST_INT)
+ {
+ vp[vn++] = "intelligence";
+ }
+ if (flags & TR_SUST_WIS)
+ {
+ vp[vn++] = "wisdom";
+ }
+ if (flags & TR_SUST_DEX)
+ {
+ vp[vn++] = "dexterity";
+ }
+ if (flags & TR_SUST_CON)
+ {
+ vp[vn++] = "constitution";
+ }
+ if (flags & TR_SUST_CHR)
+ {
+ vp[vn++] = "charisma";
+ }
+ /* Describe */
+ if (vn)
+ {
+ int i;
- /* Intro */
- text_out("It sustains ");
+ /* Intro */
+ text_out("It sustains ");
- /* List */
- for (i = 0; i < vn; i++)
- {
- /* Connectives */
- if (i == 0) text_out("your ");
- else if (i < (vn - 1)) text_out(", ");
- else text_out(" and ");
+ /* List */
+ for (i = 0; i < vn; i++)
+ {
+ /* Connectives */
+ if (i == 0) text_out("your ");
+ else if (i < (vn - 1)) text_out(", ");
+ else text_out(" and ");
- /* Dump the stat */
- text_out(vp[i]);
- }
- text_out(". ");
+ /* Dump the stat */
+ text_out(vp[i]);
}
+ text_out(". ");
+ }
- vn = 0;
- if (flags & TR_IM_ACID)
- {
- vc[vn] = TERM_GREEN;
- vp[vn++] = "acid";
- }
- if (flags & TR_IM_ELEC)
- {
- vc[vn] = TERM_L_BLUE;
- vp[vn++] = "electricity";
- }
- if (flags & TR_IM_FIRE)
- {
- vc[vn] = TERM_RED;
- vp[vn++] = "fire";
- }
- if (flags & TR_IM_COLD)
- {
- vc[vn] = TERM_L_WHITE;
- vp[vn++] = "cold";
- }
- if (flags & TR_IM_NETHER)
- {
- vc[vn] = TERM_L_GREEN;
- vp[vn++] = "nether";
- }
- /* Describe */
- if (vn)
- {
- int i;
+ vn = 0;
+ if (flags & TR_IM_ACID)
+ {
+ vc[vn] = TERM_GREEN;
+ vp[vn++] = "acid";
+ }
+ if (flags & TR_IM_ELEC)
+ {
+ vc[vn] = TERM_L_BLUE;
+ vp[vn++] = "electricity";
+ }
+ if (flags & TR_IM_FIRE)
+ {
+ vc[vn] = TERM_RED;
+ vp[vn++] = "fire";
+ }
+ if (flags & TR_IM_COLD)
+ {
+ vc[vn] = TERM_L_WHITE;
+ vp[vn++] = "cold";
+ }
+ if (flags & TR_IM_NETHER)
+ {
+ vc[vn] = TERM_L_GREEN;
+ vp[vn++] = "nether";
+ }
+ /* Describe */
+ if (vn)
+ {
+ int i;
- /* Intro */
- text_out("It provides immunity ");
+ /* Intro */
+ text_out("It provides immunity ");
- /* List */
- for (i = 0; i < vn; i++)
- {
- /* Connectives */
- if (i == 0) text_out("to ");
- else if (i < (vn - 1)) text_out(", ");
- else text_out(" and ");
+ /* List */
+ for (i = 0; i < vn; i++)
+ {
+ /* Connectives */
+ if (i == 0) text_out("to ");
+ else if (i < (vn - 1)) text_out(", ");
+ else text_out(" and ");
- /* Dump the stat */
- text_out_c(vc[i], vp[i]);
- }
- text_out(". ");
+ /* Dump the stat */
+ text_out_c(vc[i], vp[i]);
}
+ text_out(". ");
}
if (flags & TR_FREE_ACT)