summaryrefslogtreecommitdiff
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
commit98ae117c0944ca54417088a55eb8f22a9e1e0733 (patch)
tree2c71ac2f113a9749cf729e67a2e7a3986c261413
parent6006546b4d015619b7d119d400fac819da6bc826 (diff)
Factor out 'disturb_state' option handling
-rw-r--r--src/cave.cc13
-rw-r--r--src/cave.hpp1
-rw-r--r--src/dungeon.cc2
-rw-r--r--src/xtra2.cc23
4 files changed, 26 insertions, 13 deletions
diff --git a/src/cave.cc b/src/cave.cc
index 52855a8b..b9cc4fe7 100644
--- a/src/cave.cc
+++ b/src/cave.cc
@@ -4460,6 +4460,19 @@ void disturb(int stop_search)
/*
+ * Disturb if option 'disturb_state' is set.
+ */
+void disturb_on_state()
+{
+ if (disturb_state)
+ {
+ disturb(0);
+ }
+}
+
+
+
+/*
* Return the index of the random quest on this level
* (or zero)
*/
diff --git a/src/cave.hpp b/src/cave.hpp
index 64f67dba..5b29054d 100644
--- a/src/cave.hpp
+++ b/src/cave.hpp
@@ -37,6 +37,7 @@ extern void health_track(int m_idx);
extern void monster_race_track(int r_idx, int ego);
extern void object_track(object_type *o_ptr);
extern void disturb(int stop_search);
+extern void disturb_on_state();
extern int is_quest(int level);
extern int new_effect(int type, int dam, int time, int cy, int cx, int rad, s32b flags);
extern bool cave_floor_bold(int y, int x);
diff --git a/src/dungeon.cc b/src/dungeon.cc
index 138d8c66..076369dd 100644
--- a/src/dungeon.cc
+++ b/src/dungeon.cc
@@ -2229,7 +2229,7 @@ static void process_world(void)
att &= ~(CLASS_LEGS);
att &= ~(CLASS_WALL);
- if (disturb_state) disturb(0);
+ disturb_on_state();
}
p_ptr->update |= (PU_BODY);
diff --git a/src/xtra2.cc b/src/xtra2.cc
index 8b444058..9581a7ee 100644
--- a/src/xtra2.cc
+++ b/src/xtra2.cc
@@ -134,7 +134,7 @@ bool_ set_parasite(int v, int r)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -187,8 +187,7 @@ static bool_ set_simple_field(
return (FALSE);
/* Disturb */
- if (disturb_state)
- disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -460,7 +459,7 @@ bool_ set_mimic(int v, int p, int level)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Redraw title */
p_ptr->redraw |= (PR_FRAME);
@@ -757,7 +756,7 @@ bool_ set_fast(int v, int p)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -1060,7 +1059,7 @@ bool_ set_tim_thunder(int v, int p1, int p2)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -1267,7 +1266,7 @@ bool_ set_tim_regen(int v, int p)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Handle stuff */
handle_stuff();
@@ -1407,7 +1406,7 @@ bool_ set_stun(int v)
/* None */
case 0:
msg_print("You are no longer stunned.");
- if (disturb_state) disturb(0);
+ disturb_on_state();
break;
}
@@ -1422,7 +1421,7 @@ bool_ set_stun(int v)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -1615,7 +1614,7 @@ bool_ set_cut(int v)
/* None */
case 0:
msg_print("You are no longer bleeding.");
- if (disturb_state) disturb(0);
+ disturb_on_state();
break;
}
@@ -1630,7 +1629,7 @@ bool_ set_cut(int v)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);
@@ -1844,7 +1843,7 @@ bool_ set_food(int v)
if (!notice) return (FALSE);
/* Disturb */
- if (disturb_state) disturb(0);
+ disturb_on_state();
/* Recalculate bonuses */
p_ptr->update |= (PU_BONUS);