summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/target.cc
diff options
context:
space:
mode:
authorAdam Borowski <kilobyte@angband.pl>2013-11-13 16:39:05 +0100
committerAdam Borowski <kilobyte@angband.pl>2013-11-15 21:03:43 +0100
commitcede7d61d912750e3bd04ef9d54f3ffd63fb308f (patch)
tree49c3bf8553811a790fbf991aee59448c99d9baad /crawl-ref/source/target.cc
parent1eb5ba87ee17c68aa806a7df4ce309b84829a593 (diff)
downloadcrawl-ref-cede7d61d912750e3bd04ef9d54f3ffd63fb308f.tar.gz
crawl-ref-cede7d61d912750e3bd04ef9d54f3ffd63fb308f.zip
Don't allocate pointless iterators.
map or set.count() can test the presence of a given key and return 0 or 1 outright.
Diffstat (limited to 'crawl-ref/source/target.cc')
-rw-r--r--crawl-ref/source/target.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/crawl-ref/source/target.cc b/crawl-ref/source/target.cc
index 57c9691d30..b80b65cb88 100644
--- a/crawl-ref/source/target.cc
+++ b/crawl-ref/source/target.cc
@@ -569,7 +569,7 @@ bool targetter_cloud::set_aim(coord_def a)
{
coord_def c = queue[d1][i];
for (adjacent_iterator ai(c); ai; ++ai)
- if (_cloudable(*ai) && seen.find(*ai) == seen.end())
+ if (_cloudable(*ai) && !seen.count(*ai))
{
unsigned int d2 = d1 + ((*ai - c).abs() == 1 ? 5 : 7);
if (d2 >= queue.size())
@@ -782,7 +782,7 @@ bool targetter_thunderbolt::set_aim(coord_def a)
if (left_of(a1, r) && left_of(r, a2))
{
(p = r) += origin;
- if (zapped.find(p) == zapped.end())
+ if (!zapped.count(p))
arc_length[r.range()]++;
if (zapped[p] <= 0 && cell_see_cell(origin, p, LOS_NO_TRANS))
zapped[p] = AFF_MAYBE;