diff options
author | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-01 18:07:11 +0000 |
---|---|---|
committer | dshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573> | 2007-07-01 18:07:11 +0000 |
commit | aad41516e2895a328be17ecea2a1e9c4add416ee (patch) | |
tree | e97718f51e0a0585d595c9a074d8a8a7867814d9 /crawl-ref/source/mapdef.cc | |
parent | fc78d02aee0c39be4fb45b3b640a17f2af18cd45 (diff) | |
download | crawl-ref-aad41516e2895a328be17ecea2a1e9c4add416ee.tar.gz crawl-ref-aad41516e2895a328be17ecea2a1e9c4add416ee.zip |
Moved hellmouths back to hells.des after discussions with David.
Restored a couple of other maps.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1707 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/mapdef.cc')
-rw-r--r-- | crawl-ref/source/mapdef.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 0f8b161c2b..5e46f86774 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -1046,17 +1046,25 @@ coord_def map_lines::find_first_glyph(int gly) const { for (int y = 0, h = height(); y < h; ++y) { - for (int x = 0, w = width(); x < w; ++x) - { - const coord_def c(x, y); - if ((*this)(c) == gly) - return (c); - } + std::string::size_type pos = lines[y].find(gly); + if (pos != std::string::npos) + return coord_def(pos, y); } return coord_def(-1, -1); } +coord_def map_lines::find_first_glyph(const std::string &glyphs) const +{ + for (int y = 0, h = height(); y < h; ++y) + { + std::string::size_type pos = lines[y].find_first_of(glyphs); + if (pos != std::string::npos) + return coord_def(pos, y); + } + return coord_def(-1, -1); +} + /////////////////////////////////////////////// // dlua_set_map @@ -1172,6 +1180,11 @@ coord_def map_def::find_first_glyph(int glyph) const return map.find_first_glyph(glyph); } +coord_def map_def::find_first_glyph(const std::string &s) const +{ + return map.find_first_glyph(s); +} + void map_def::write_index(FILE *outf) const { if (!cache_offset) |