summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/exclude.cc
diff options
context:
space:
mode:
authorLuca Barbieri <luca@luca-barbieri.com>2010-06-07 06:46:42 +0200
committerRobert Vollmert <rvollmert@gmx.net>2010-07-29 00:43:59 +0200
commitaf76f809d3f1679210469c3b194f1b06dc85536b (patch)
treeeadc06efba7cf8bb94ab139fa3b8e5d538e6ef10 /crawl-ref/source/exclude.cc
parent7184b88d886d74490447b01699bd2f95dc9cc804 (diff)
downloadcrawl-ref-af76f809d3f1679210469c3b194f1b06dc85536b.tar.gz
crawl-ref-af76f809d3f1679210469c3b194f1b06dc85536b.zip
Make map_cell store feat+cloud+item+mons instead of only the topmost one (BREAKS SAVES) (v3)
Changes in v3 (rob): - update to current master - fix colouring of out-of-LOS clouds - fix reload crash due to env.cgrid Changes in v2: - Features and monsters should now be properly grayed Currently map_cell only stores the topmost "thing" in a cell. This is good enough for the console view, but not for more sophisticated clients (e.g. tiles). This commit refactors the code so that all player knowledge about a cell (including detailed monster and item information) is represented in map_cell, and so that map_cell is used to build the console view. Save compatibility is broken since the new map_cell is serialized instead of the old one. This will allow, for instance, to load console savegames in the tiles version, and still get proper tiles for the explored area. Furthermore, this new map_cell will be the basis of the Crawl protocol for the client/server split. Signed-off-by: Robert Vollmert <rvollmert@gmx.net>
Diffstat (limited to 'crawl-ref/source/exclude.cc')
-rw-r--r--crawl-ref/source/exclude.cc23
1 files changed, 10 insertions, 13 deletions
diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc
index 255d28c006..3ae6fc76c0 100644
--- a/crawl-ref/source/exclude.cc
+++ b/crawl-ref/source/exclude.cc
@@ -112,18 +112,15 @@ public:
opacity_type operator()(const coord_def& p) const
{
- if (!env.map_knowledge(p).seen())
+ map_cell& cell = env.map_knowledge(p);
+ if (!cell.seen())
return OPC_CLEAR;
- else if (!env.map_knowledge(p).changed())
+ else if (!cell.changed())
return _feat_opacity(env.grid(p));
- else if (env.map_knowledge(p).object.cls == SH_FEATURE)
- return _feat_opacity(env.map_knowledge(p).object.feat);
+ else if (cell.feat() != DNGN_UNSEEN)
+ return _feat_opacity(cell.feat());
else
- {
- // If you have seen monsters, items or clouds there,
- // it must have been passable.
return OPC_CLEAR;
- }
}
};
static opacity_excl opc_excl;
@@ -481,17 +478,17 @@ void set_exclude(const coord_def &p, int radius, bool autoexcl, bool vaultexcl,
{
// Don't list a monster in the exclusion annotation if the
// exclusion was triggered by e.g. the flamethrowers' lua check.
- const show_type& obj = env.map_knowledge(p).object;
- if (obj.cls == SH_MONSTER)
+ const map_cell& cell = env.map_knowledge(p);
+ if (cell.monster() != MONS_NO_MONSTER)
{
- desc = mons_type_name(obj.mons, DESC_PLAIN);
- if (env.map_knowledge(p).detected_monster())
+ desc = mons_type_name(cell.monster(), DESC_PLAIN);
+ if (cell.detected_monster())
desc += " (detected)";
}
else
{
// Maybe it's a door or staircase?
- const dungeon_feature_type feat = env.map_knowledge(p).feat();
+ const dungeon_feature_type feat = cell.feat();
if (feat_is_door(feat))
desc = "door";
else