summaryrefslogtreecommitdiff
path: root/src/cmd1.cc
diff options
context:
space:
mode:
authorBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:14 +0200
committerBardur Arantsson <bardur@scientician.net>2016-09-17 09:58:14 +0200
commit8bbf783ead4517465445272f9144cf06bdac9be7 (patch)
tree9fa9cc4de0c53df33c557d66a9efbc6781f6fb94 /src/cmd1.cc
parent013e27d39ee8ee513208d2855c7e3f6252f0c0bf (diff)
Refactor object_type 'artifact name' field to std::string
We don't really need quarks for this since we're not nearly as memory-constrained these days.
Diffstat (limited to 'src/cmd1.cc')
-rw-r--r--src/cmd1.cc24
1 files changed, 7 insertions, 17 deletions
diff --git a/src/cmd1.cc b/src/cmd1.cc
index 36b164b5..f1dfaac9 100644
--- a/src/cmd1.cc
+++ b/src/cmd1.cc
@@ -2046,21 +2046,16 @@ void py_attack(int y, int x, int max_blow)
!(p_ptr->stun || p_ptr->confused || p_ptr->image ||
!(m_ptr->ml)))
{
- if (!(p_ptr->inventory[INVEN_WIELD].art_name))
+ // Only 'Stormbringer' can hit friendlies unless player forces attack.
+ if (p_ptr->inventory[INVEN_WIELD].artifact_name == "'Stormbringer'")
{
- msg_format("You stop to avoid hitting %s.", m_name);
- return;
+ msg_format("Your black blade greedily attacks %s!", m_name);
}
-
- if (!
- (streq
- (quark_str(p_ptr->inventory[INVEN_WIELD].art_name), "'Stormbringer'")))
+ else
{
msg_format("You stop to avoid hitting %s.", m_name);
return;
}
-
- msg_format("Your black blade greedily attacks %s!", m_name);
}
/* Break goi/manashield */
@@ -2740,8 +2735,6 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm)
char m_name[80];
- bool_ stormbringer = FALSE;
-
bool_ old_dtrap, new_dtrap;
bool_ oktomove = TRUE;
@@ -2910,12 +2903,6 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm)
m_ptr = &m_list[c_ptr->m_idx];
auto const mr_ptr = m_ptr->race();
- if (p_ptr->inventory[INVEN_WIELD].art_name)
- {
- if (streq(quark_str(p_ptr->inventory[INVEN_WIELD].art_name), "'Stormbringer'"))
- stormbringer = TRUE;
- }
-
/* Hack -- attack monsters */
if (c_ptr->m_idx && (m_ptr->ml || player_can_enter(c_ptr->feat)))
{
@@ -2936,6 +2923,9 @@ void move_player_aux(int dir, int do_pickup, int run, bool_ disarm)
/* Track a new monster */
if (m_ptr->ml) health_track(c_ptr->m_idx);
+ /* Is it Stormbringer? */
+ bool stormbringer = p_ptr->inventory[INVEN_WIELD].artifact_name == "'Stormbringer'";
+
/* displace? */
if (stormbringer && (randint(1000) > 666))
{