summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-04 18:46:44 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-04 18:46:44 +0000
commit88f95c1514069173d88bea833b9ee44ba124d391 (patch)
tree493f66299a1338ee2b0186877b74bd5f7550b500
parentca64bade7f7c4290031cfad630174d4e888b8ac6 (diff)
downloadcrawl-ref-88f95c1514069173d88bea833b9ee44ba124d391.tar.gz
crawl-ref-88f95c1514069173d88bea833b9ee44ba124d391.zip
Actually use the new rock habitat properly (oops).
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3189 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r--crawl-ref/source/debug.cc2
-rw-r--r--crawl-ref/source/mon-data.h2
-rw-r--r--crawl-ref/source/mon-util.cc18
-rw-r--r--crawl-ref/source/mon-util.h2
-rw-r--r--crawl-ref/source/terrain.cc7
-rw-r--r--crawl-ref/source/terrain.h1
6 files changed, 18 insertions, 14 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 5f56eaceeb..8d76a489df 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -1411,7 +1411,7 @@ void stethoscope(int mwh)
"hab=%s beh=%s(%d) foe=%s(%d) mem=%d target=(%d,%d)",
((hab == HT_WATER) ? "water" :
(hab == HT_LAVA) ? "lava" :
- (hab == HT_ROCK_WALL) ? "rock wall" :
+ (hab == HT_ROCK) ? "rock" :
(hab == HT_LAND) ? "floor"
: "unknown"),
((menv[i].behaviour == BEH_SLEEP) ? "sleep" :
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index 015f558b61..16419a8675 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -3938,7 +3938,7 @@
{ {AT_BITE, AF_PLAIN, 20}, AT_NO_ATK, AT_NO_ATK, AT_NO_ATK },
{ 5, 5, 5, 0 },
3, 12, MST_NO_SPELLS, CE_NOCORPSE, Z_SMALL, S_SILENT, I_PLANT,
- HT_LAND, 12, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_LARGE
+ HT_ROCK, 12, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_LARGE
},
// end "move through rock" monsters {mpc}
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index f06a1b7856..9af1d5eeec 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -91,12 +91,13 @@ habitat_type grid2habitat(dungeon_feature_type grid)
if (grid_is_watery(grid))
return (HT_WATER);
+ if (grid_is_rock(grid) && !grid_is_permarock(grid))
+ return (HT_ROCK);
+
switch (grid)
{
case DNGN_LAVA:
return (HT_LAVA);
- case DNGN_ROCK_WALL:
- return (HT_ROCK_WALL);
case DNGN_FLOOR:
default:
return (HT_LAND);
@@ -111,7 +112,7 @@ dungeon_feature_type habitat2grid(habitat_type ht)
return (DNGN_DEEP_WATER);
case HT_LAVA:
return (DNGN_LAVA);
- case HT_ROCK_WALL:
+ case HT_ROCK:
return (DNGN_ROCK_WALL);
case HT_LAND:
default:
@@ -2435,14 +2436,11 @@ bool monsters::floundering() const
bool mons_class_can_pass(const int mclass, const dungeon_feature_type grid)
{
- // Permanent walls can't be passed through.
- if (grid == DNGN_CLEAR_PERMAROCK_WALL || grid == DNGN_PERMAROCK_WALL)
- return false;
-
- switch (mclass)
+ if (mons_habitat(mclass) == HT_ROCK)
{
- case MONS_ROCK_WORM:
- return (!grid_is_solid(grid) || grid_is_rock(grid));
+ // Permanent walls can't be passed through.
+ return (!grid_is_solid(grid) ||
+ (grid_is_rock(grid) && !grid_is_permarock(grid)));
}
return !grid_is_solid(grid);
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 5f79e9bf3e..076eb18c2c 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -153,7 +153,7 @@ enum habitat_type
HT_LAND = 0, // Land critters
HT_WATER, // Water critters
HT_LAVA, // Lava critters
- HT_ROCK_WALL, // Rock wall critters
+ HT_ROCK, // Rock critters
NUM_HABITATS
};
diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc
index 79e10609ae..934e9e9b4f 100644
--- a/crawl-ref/source/terrain.cc
+++ b/crawl-ref/source/terrain.cc
@@ -176,7 +176,7 @@ bool grid_is_solid(const coord_def &c)
return (grid_is_solid(grd(c)));
}
-bool grid_is_rock( dungeon_feature_type grid )
+bool grid_is_rock(dungeon_feature_type grid)
{
return (grid == DNGN_ORCISH_IDOL
|| grid == DNGN_GRANITE_STATUE
@@ -185,6 +185,11 @@ bool grid_is_rock( dungeon_feature_type grid )
&& grid <= DNGN_CLEAR_PERMAROCK_WALL));
}
+bool grid_is_permarock(dungeon_feature_type grid)
+{
+ return (grid == DNGN_PERMAROCK_WALL || grid == DNGN_CLEAR_PERMAROCK_WALL);
+}
+
bool grid_is_trap(dungeon_feature_type grid)
{
return (grid == DNGN_TRAP_MECHANICAL || grid == DNGN_TRAP_MAGICAL
diff --git a/crawl-ref/source/terrain.h b/crawl-ref/source/terrain.h
index 24724a5713..cd980bd298 100644
--- a/crawl-ref/source/terrain.h
+++ b/crawl-ref/source/terrain.h
@@ -31,6 +31,7 @@ bool grid_is_solid(dungeon_feature_type grid);
bool grid_is_solid(int x, int y);
bool grid_is_solid(const coord_def &c);
bool grid_is_rock(dungeon_feature_type grid);
+bool grid_is_permarock(dungeon_feature_type grid);
bool grid_is_stone_stair(dungeon_feature_type grid);
bool grid_is_rock_stair(dungeon_feature_type grid);
bool grid_is_trap(dungeon_feature_type grid);