summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/show.cc
diff options
context:
space:
mode:
authorFlorian Diebold <flodiebold@gmail.com>2012-01-10 02:52:43 +0100
committerFlorian Diebold <flodiebold@gmail.com>2012-01-10 02:52:43 +0100
commitcdb425331929581a07090a3fcecba99826877d8e (patch)
tree4ca9e40109af24e72376e7d9bb67ce0c453b2799 /crawl-ref/source/show.cc
parent76a9179fa4006d3a38914b12be3140e9f46a3767 (diff)
downloadcrawl-ref-cdb425331929581a07090a3fcecba99826877d8e.tar.gz
crawl-ref-cdb425331929581a07090a3fcecba99826877d8e.zip
Fix #5111: Items under a plant aren't indicated [in tiles].
The problem was that tile picking happened concurrently to the show update, i.e. while the map cell was being built. This meant that when placing the plant tile, the item wasn't yet in map_knowledge, so no indicator was added. I've refactored the code so that all tile picking happens at the end of show_update_at. I fear this may lead to new bugs, but the alternative (going back to directly accessing igrd) would have been hacky and would likely have caused new (if small) information leaks.
Diffstat (limited to 'crawl-ref/source/show.cc')
-rw-r--r--crawl-ref/source/show.cc47
1 files changed, 15 insertions, 32 deletions
diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc
index f59dd12a03..c88f7a3f3e 100644
--- a/crawl-ref/source/show.cc
+++ b/crawl-ref/source/show.cc
@@ -243,13 +243,6 @@ static void _update_item_at(const coord_def &gp)
more_items = true;
}
env.map_knowledge(gp).set_item(get_item_info(eitem), more_items);
-
-#ifdef USE_TILE
- if (feat_is_stair(env.grid(gp)))
- tile_place_item_marker(gp, eitem);
- else
- tile_place_item(gp, eitem);
-#endif
}
static void _update_cloud(int cloudno)
@@ -282,10 +275,6 @@ static void _update_cloud(int cloudno)
cloud_info ci(cloud.type, get_cloud_colour(cloudno), dur, ch, gp);
env.map_knowledge(gp).set_cloud(ci);
-
-#ifdef USE_TILE
- tile_place_cloud(gp, *env.map_knowledge(gp).cloudinfo());
-#endif
}
static void _check_monster_pos(const monster* mons)
@@ -360,9 +349,6 @@ static int _hashed_rand(const monster* mons, uint32_t id, uint32_t die)
static void _mark_invisible_monster(const coord_def &where)
{
env.map_knowledge(where).set_invisible_monster();
-#ifdef USE_TILE
- tile_place_invisible_monster(where);
-#endif
}
/**
@@ -447,10 +433,6 @@ static void _update_monster(monster* mons)
mons->ensure_has_client_id();
monster_info mi(mons);
env.map_knowledge(gp).set_monster(mi);
-
-#ifdef USE_TILE
- tile_place_monster(mons->pos(), *env.map_knowledge(gp).monsterinfo());
-#endif
}
void show_update_at(const coord_def &gp, bool terrain_only)
@@ -465,26 +447,27 @@ void show_update_at(const coord_def &gp, bool terrain_only)
// The sequence is grid, items, clouds, monsters.
_update_feat_at(gp);
- if (terrain_only)
- return;
-
// If there's items on the boundary (shop inventory),
// we don't show them.
- if (!in_bounds(gp))
- return;
+ if (!terrain_only && in_bounds(gp))
+ {
+ monster* mons = monster_at(gp);
+ if (mons && mons->alive())
+ _update_monster(mons);
- monster* mons = monster_at(gp);
- if (mons && mons->alive())
- _update_monster(mons);
+ const int cloud = env.cgrid(gp);
+ if (cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_NONE
+ && env.cloud[cloud].pos == gp)
+ {
+ _update_cloud(cloud);
+ }
- const int cloud = env.cgrid(gp);
- if (cloud != EMPTY_CLOUD && env.cloud[cloud].type != CLOUD_NONE
- && env.cloud[cloud].pos == gp)
- {
- _update_cloud(cloud);
+ _update_item_at(gp);
}
- _update_item_at(gp);
+#ifdef USE_TILE
+ tile_draw_map_cell(gp, true);
+#endif
}
void show_init(bool terrain_only)