summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/monstuff.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-28 08:42:47 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-07-28 08:42:47 +0000
commit5549c15ba74e62433508e9bbaa23d117610f81e2 (patch)
tree8f462e0f7b7f516629af0b773fc5a7a176060f4e /crawl-ref/source/monstuff.cc
parent9b909453a2e070df3ac33277d0a7f07deb6e9132 (diff)
downloadcrawl-ref-5549c15ba74e62433508e9bbaa23d117610f81e2.tar.gz
crawl-ref-5549c15ba74e62433508e9bbaa23d117610f81e2.zip
Added wizmode &L command to place a map on the current level by name. This
only really works for non-encompass vaults, and dungeon fixups are not applied (so random deep water -> shallow water conversion, auto-placement of water creatures, etc. will not happen). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1942 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/monstuff.cc')
-rw-r--r--crawl-ref/source/monstuff.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 13ef4ef37f..dfe32abfe5 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -4270,6 +4270,13 @@ static bool is_trap_safe(const monsters *monster, const trap_struct &trap)
return (!mechanical || mons_flies(monster));
}
+static void mons_open_door(const coord_def &pos)
+{
+ if (grd(pos) == DNGN_SECRET_DOOR && !see_grid(pos))
+ set_terrain_changed(pos);
+ grd(pos) = DNGN_OPEN_DOOR;
+}
+
static void monster_move(monsters *monster)
{
FixedArray < bool, 3, 3 > good_move;
@@ -4512,10 +4519,11 @@ static void monster_move(monsters *monster)
}
} // now we know where we _can_ move.
+ const coord_def newpos = monster->pos() + coord_def(mmov_x, mmov_y);
// normal/smart monsters know about secret doors (they _live_ in the
// dungeon!)
- if (grd[monster->x + mmov_x][monster->y + mmov_y] == DNGN_CLOSED_DOOR
- || (grd[monster->x + mmov_x][monster->y + mmov_y] == DNGN_SECRET_DOOR
+ if (grd(newpos) == DNGN_CLOSED_DOOR
+ || (grd(newpos) == DNGN_SECRET_DOOR
&& (mons_intel(monster_index(monster)) == I_HIGH
|| mons_intel(monster_index(monster)) == I_NORMAL)))
{
@@ -4530,13 +4538,13 @@ static void monster_move(monsters *monster)
// for zombies, monster type is kept in mon->number
if (mons_itemuse(monster->number) >= MONUSE_OPEN_DOORS)
{
- grd[monster->x + mmov_x][monster->y + mmov_y] = DNGN_OPEN_DOOR;
+ mons_open_door(newpos);
return;
}
}
else if (mons_itemuse(monster->type) >= MONUSE_OPEN_DOORS)
{
- grd[monster->x + mmov_x][monster->y + mmov_y] = DNGN_OPEN_DOOR;
+ mons_open_door(newpos);
return;
}
} // endif - secret/closed doors
@@ -4698,6 +4706,7 @@ forget_it:
&& good_move[mmov_x + 1][mmov_y + 1] == true)
{
grd[monster->x + mmov_x][monster->y + mmov_y] = DNGN_FLOOR;
+ set_terrain_changed(monster->pos() + coord_def(mmov_x, mmov_y));
if (!silenced(you.x_pos, you.y_pos))
mpr("You hear a grinding noise.", MSGCH_SOUND);