summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authorzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-26 05:08:00 +0000
committerzelgadis <zelgadis@c06c8d41-db1a-0410-9941-cceddc491573>2008-06-26 05:08:00 +0000
commitd4acdf4a6a4b73607d58714a66efd372674adb56 (patch)
tree0674f15a236561657ea9876df0f9b29d29fc7035 /crawl-ref/source/monstuff.cc
parentc84df3ee899f8355c596e84598896e04d3384d84 (diff)
downloadcrawl-ref-d4acdf4a6a4b73607d58714a66efd372674adb56.tar.gz
crawl-ref-d4acdf4a6a4b73607d58714a66efd372674adb56.zip
If a visible monster interupts a delay by opening a door then say that
it opens the door rather than "comes into view". If a visible monster opens a door when the player isn't delayed then give a message about it. Include secret doors in multi-door gates when a monster opens a door. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@6145 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc51
1 files changed, 32 insertions, 19 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 5507f40880..fea7ff7167 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -6841,31 +6841,32 @@ static void _mons_open_door(monsters* monster, const coord_def &pos)
const char *adj = "", *noun = "door";
bool was_secret = false;
+ bool was_seen = false;
- if (grid == DNGN_SECRET_DOOR)
- {
- grid = grid_secret_door_appearance(pos.x, pos.y);
- grd(pos) = DNGN_OPEN_DOOR; // Just a simple door, no gates etc.
+ std::set<coord_def> all_door;
+ find_connected_range(pos, DNGN_CLOSED_DOOR, DNGN_SECRET_DOOR,
+ all_door);
+ get_door_description(all_door.size(), &adj, &noun);
- was_secret = true;
- if (!see_grid(pos))
- set_terrain_changed(pos);
- }
- else // Maybe several connected doors -> gate.
+ for (std::set<coord_def>::iterator i = all_door.begin();
+ i != all_door.end(); ++i)
{
- std::set<coord_def> all_door;
- find_connected_identical(pos, grd(pos), all_door);
- get_door_description(all_door.size(), &adj, &noun);
-
- for (std::set<coord_def>::iterator i = all_door.begin();
- i != all_door.end(); ++i)
+ const coord_def& dc = *i;
+ if (grd(dc) == DNGN_SECRET_DOOR && see_grid(dc))
{
- const coord_def& dc = *i;
- grd[dc.x][dc.y] = DNGN_OPEN_DOOR;
+ grid = grid_secret_door_appearance(dc.x, dc.y);
+ was_secret = true;
}
+
+ if (see_grid(dc))
+ was_seen = true;
+ else
+ set_terrain_changed(dc);
+
+ grd[dc.x][dc.y] = DNGN_OPEN_DOOR;
}
- if (see_grid(pos))
+ if (was_seen)
{
viewwindow(true, false);
@@ -6877,11 +6878,23 @@ static void _mons_open_door(monsters* monster, const coord_def &pos)
learned_something_new(TUT_SEEN_SECRET_DOOR, pos.x, pos.y);
}
+ std::string open_str = "opens the ";
+ open_str += adj;
+ open_str += noun;
+ open_str += ".";
+
+ monster->seen_context = open_str;
+
if (!you.can_see(monster))
{
- mprf("Something unseen opens the %s%s.", adj, noun);
+ mprf("Something unseen %s", open_str.c_str());
interrupt_activity(AI_FORCE_INTERRUPT);
}
+ else if (!you_are_delayed())
+ {
+ mprf("%s %s", monster->name(DESC_CAP_A).c_str(),
+ open_str.c_str());
+ }
}
monster->lose_energy(EUT_MOVE);