summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--crawl-ref/source/items.cc2
-rw-r--r--crawl-ref/source/monstuff.cc16
2 files changed, 6 insertions, 12 deletions
diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc
index a8e235b098..07377e47b6 100644
--- a/crawl-ref/source/items.cc
+++ b/crawl-ref/source/items.cc
@@ -2328,7 +2328,7 @@ bool item_needs_autopickup(const item_def &item)
if (item_is_stationary(item))
return (false);
- if (strstr(item.inscription.c_str(), "=g") != 0)
+ if (item.inscription.find("=g") != std::string::npos)
return (true);
if ((item.flags & ISFLAG_THROWN) && Options.pickup_thrown)
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 328a02357e..8f7c849b53 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -3618,10 +3618,7 @@ static void _check_wander_target(monsters *mon, bool isPacified = false,
// wandering monsters at least appear to have some sort of
// attention span. -- bwr
if (need_target)
- {
- mon->target.set(10 + random2(X_BOUND_2 - 10),
- 10 + random2(Y_BOUND_2 - 10));
- }
+ mon->target = random_in_bounds();
}
}
@@ -3752,8 +3749,7 @@ static void _handle_behaviour(monsters *mon)
// Check for confusion -- early out.
if (mon->has_ench(ENCH_CONFUSION))
{
- mon->target.set(10 + random2(X_BOUND_2 - 10),
- 10 + random2(Y_BOUND_2 - 10));
+ mon->target = random_in_bounds();
return;
}
@@ -4050,8 +4046,7 @@ static void _handle_behaviour(monsters *mon)
// Sometimes, your friends will wander a bit.
if (isFriendly && one_chance_in(8))
{
- mon->target.set(10 + random2(X_BOUND_2 - 10),
- 10 + random2(Y_BOUND_2 - 10));
+ mon->target = random_in_bounds();
mon->foe = MHITNOT;
new_beh = BEH_WANDER;
}
@@ -4106,9 +4101,8 @@ static void _handle_behaviour(monsters *mon)
{
mon->travel_target = MTRAV_NONE;
patrolling = false;
- mon->patrol_point = coord_def(0, 0);
- mon->target.set(10 + random2(X_BOUND_2 - 10),
- 10 + random2(Y_BOUND_2 - 10));
+ mon->patrol_point.reset();
+ mon->target = random_in_bounds();
}
}