diff options
author | Adam Borowski <kilobyte@angband.pl> | 2013-10-08 13:09:00 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2013-10-08 13:09:00 +0200 |
commit | eb5bc06c58ea50faaaf5629079e316f9dde3f5b3 (patch) | |
tree | 007c420c575f24e22d194f4dd3af18f92bcd3e33 /crawl-ref/source/map_knowledge.cc | |
parent | c71e4c71abacc07063af2d2f72da2d5eb5f21093 (diff) | |
download | crawl-ref-eb5bc06c58ea50faaaf5629079e316f9dde3f5b3.tar.gz crawl-ref-eb5bc06c58ea50faaaf5629079e316f9dde3f5b3.zip |
Don't en-/de-capsulate coord_def over and over in set_terrain_*()
All callers, and all but one internal use, want it as a struct.
Diffstat (limited to 'crawl-ref/source/map_knowledge.cc')
-rw-r--r-- | crawl-ref/source/map_knowledge.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/crawl-ref/source/map_knowledge.cc b/crawl-ref/source/map_knowledge.cc index 364856ee1d..35d42644f5 100644 --- a/crawl-ref/source/map_knowledge.cc +++ b/crawl-ref/source/map_knowledge.cc @@ -22,10 +22,9 @@ #include "view.h" // Used to mark dug out areas, unset when terrain is seen or mapped again. -void set_terrain_changed(int x, int y) +void set_terrain_changed(const coord_def p) { - const coord_def p = coord_def(x, y); - env.map_knowledge[x][y].flags |= MAP_CHANGED_FLAG; + env.map_knowledge(p).flags |= MAP_CHANGED_FLAG; dungeon_events.fire_position_event(DET_FEAT_CHANGE, p); @@ -36,9 +35,8 @@ void set_terrain_changed(int x, int y) act->check_clinging(false, feat_is_door(grd(p))); } -void set_terrain_mapped(int x, int y) +void set_terrain_mapped(const coord_def gc) { - const coord_def gc(x, y); map_cell* cell = &env.map_knowledge(gc); cell->flags &= (~MAP_CHANGED_FLAG); cell->flags |= MAP_MAGIC_MAPPED_FLAG; @@ -120,19 +118,18 @@ void reautomap_level() _automap_from(x, y, passive); } -void set_terrain_seen(int x, int y) +void set_terrain_seen(const coord_def pos) { - const dungeon_feature_type feat = grd[x][y]; - map_cell* cell = &env.map_knowledge[x][y]; + const dungeon_feature_type feat = grd(pos); + map_cell* cell = &env.map_knowledge(pos); // First time we've seen a notable feature. if (!(cell->flags & MAP_SEEN_FLAG)) { - _automap_from(x, y, _map_quality()); + _automap_from(pos.x, pos.y, _map_quality()); if (!is_boring_terrain(feat)) { - coord_def pos(x, y); string desc = feature_description_at(pos, false, DESC_A); take_note(Note(NOTE_SEEN_FEAT, 0, 0, desc.c_str())); } @@ -142,12 +139,11 @@ void set_terrain_seen(int x, int y) cell->flags |= MAP_SEEN_FLAG; #ifdef USE_TILE - coord_def pos(x, y); tiles.update_minimap(pos); #endif } -void set_terrain_visible(const coord_def &c) +void set_terrain_visible(const coord_def c) { map_cell* cell = &env.map_knowledge(c); set_terrain_seen(c); |