summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authordolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-03 21:21:26 +0000
committerdolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573>2008-01-03 21:21:26 +0000
commitd107e792196a1eba3e5dd2c3c50a0454ac68088d (patch)
tree54974d350f7e4555fb0b2856be4c2d2a17b67a3e /crawl-ref/source
parent90c66b94944ca1f5428c737d68261d86e927c7a2 (diff)
downloadcrawl-ref-d107e792196a1eba3e5dd2c3c50a0454ac68088d.tar.gz
crawl-ref-d107e792196a1eba3e5dd2c3c50a0454ac68088d.zip
Add miscellaneous type cleanups and comment fixes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3177 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/dungeon.cc17
-rw-r--r--crawl-ref/source/mon-data.h6
-rw-r--r--crawl-ref/source/mon-util.cc25
-rw-r--r--crawl-ref/source/mon-util.h17
-rw-r--r--crawl-ref/source/monplace.cc9
-rw-r--r--crawl-ref/source/monplace.h7
-rw-r--r--crawl-ref/source/monstuff.cc8
7 files changed, 44 insertions, 45 deletions
diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc
index 3028c6f658..ad0c0e276d 100644
--- a/crawl-ref/source/dungeon.cc
+++ b/crawl-ref/source/dungeon.cc
@@ -7051,13 +7051,13 @@ void define_zombie( int mid, int ztype, int cs, int power )
case MONS_ZOMBIE_SMALL:
case MONS_SIMULACRUM_SMALL:
case MONS_SKELETON_SMALL:
- zombie_size = 1;
+ zombie_size = Z_SMALL;
break;
case MONS_ZOMBIE_LARGE:
case MONS_SIMULACRUM_LARGE:
case MONS_SKELETON_LARGE:
- zombie_size = 2;
+ zombie_size = Z_BIG;
break;
case MONS_SPECTRAL_THING:
@@ -7125,7 +7125,7 @@ void define_zombie( int mid, int ztype, int cs, int power )
}
// size must match, but you can make a spectral thing out of anything.
- if (mons_zombie_size(cls) != zombie_size && zombie_size >= 0)
+ if (mons_zombie_size(cls) != zombie_size && zombie_size != -1)
continue;
// hack -- non-dungeon zombies are always made out of nastier
@@ -7139,7 +7139,7 @@ void define_zombie( int mid, int ztype, int cs, int power )
level = mons_level( cls ) - 4;
diff = level - power;
- chance = (ignore_rarity) ? 100
+ chance = (ignore_rarity) ? 100
: mons_rarity(cls) - (diff * diff) / 2;
if (power > level - relax && power < level + relax
@@ -7188,11 +7188,10 @@ void define_zombie( int mid, int ztype, int cs, int power )
menv[mid].speed = 3;
menv[mid].speed_increment = 70;
- menv[mid].number = mons_sec2;
if (cs == MONS_ZOMBIE_SMALL || cs == MONS_ZOMBIE_LARGE)
{
- menv[mid].type = ((mons_zombie_size(menv[mid].number) == 2)
+ menv[mid].type = ((mons_zombie_size(menv[mid].number) == Z_BIG)
? MONS_ZOMBIE_LARGE : MONS_ZOMBIE_SMALL);
}
else if (cs == MONS_SKELETON_SMALL || cs == MONS_SKELETON_LARGE)
@@ -7210,15 +7209,15 @@ void define_zombie( int mid, int ztype, int cs, int power )
if (menv[mid].ev < 0)
menv[mid].ev = 0;
- menv[mid].type = ((mons_zombie_size( menv[mid].number ) == 2)
+ menv[mid].type = ((mons_zombie_size( menv[mid].number ) == Z_BIG)
? MONS_SKELETON_LARGE : MONS_SKELETON_SMALL);
}
else if (cs == MONS_SIMULACRUM_SMALL || cs == MONS_SIMULACRUM_LARGE)
{
- // Simulacrum aren't tough, but you can create piles of them. -- bwr
+ // Simulacrum aren't tough, but you can create piles of them. -- bwr
menv[mid].hit_points = hit_points( menv[mid].hit_dice, 1, 4 );
menv[mid].max_hit_points = menv[mid].hit_points;
- menv[mid].type = ((mons_zombie_size( menv[mid].number ) == 2)
+ menv[mid].type = ((mons_zombie_size( menv[mid].number ) == Z_BIG)
? MONS_SIMULACRUM_LARGE : MONS_SIMULACRUM_SMALL);
}
else if (cs == MONS_SPECTRAL_THING)
diff --git a/crawl-ref/source/mon-data.h b/crawl-ref/source/mon-data.h
index 719d4f64b1..eb3f5a3bac 100644
--- a/crawl-ref/source/mon-data.h
+++ b/crawl-ref/source/mon-data.h
@@ -103,7 +103,7 @@
// monster 250: The Thing That Should Not Be(tm)
// do not remove, or seekmonster will crash on unknown mc request
-// it is also a good prototype for new monstersst
+// it is also a good prototype for new monsters
{
MONS_PROGRAM_BUG, 'B', LIGHTRED, "program bug",
M_NO_EXP_GAIN,
@@ -1643,8 +1643,8 @@
9, DEFAULT_ENERGY, MONUSE_NOTHING, SIZE_BIG
},
-// these are named more explicitly when they attack, also when you use 'x'
-// to examine them.
+// These are named more explicitly when they attack, also when you use 'x'
+// to examine them.
{
MONS_DANCING_WEAPON, '(', BLACK, "dancing weapon",
M_FIGHTER | M_LEVITATE,
diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc
index 8caa6245f6..124f70caa1 100644
--- a/crawl-ref/source/mon-util.cc
+++ b/crawl-ref/source/mon-util.cc
@@ -634,7 +634,7 @@ bool mons_see_invis(const monsters *mon)
{
if (mon->type == MONS_PLAYER_GHOST || mon->type == MONS_PANDEMONIUM_DEMON)
return (mon->ghost->values[ GVAL_SEE_INVIS ]);
- else if (((get_monster_data(mon->type))->bitfields & M_SEE_INVIS) != 0)
+ else if (mons_class_flag(mon->type, M_SEE_INVIS))
return (true);
else if (scan_mon_inv_randarts( mon, RAP_EYESIGHT ) > 0)
return (true);
@@ -1107,45 +1107,42 @@ bool mons_has_lifeforce( const monsters *mon )
// && !mon->has_ench(ENCH_PETRIFY));
}
-int mons_skeleton(int mc)
+bool mons_skeleton(int mc)
{
- if (mons_zombie_size(mc) == 0
- || mons_weight(mc) == 0 || ((smc->bitfields & M_NO_SKELETON) != 0))
+ if (mons_zombie_size(mc) == Z_NOZOMBIE
+ || mons_weight(mc) == 0 || (mons_class_flag(mc, M_NO_SKELETON)))
{
- return (0);
+ return false;
}
- return (1);
+ return true;
} // end mons_skeleton()
flight_type mons_class_flies(int mc)
{
- int f = smc->bitfields;
-
- if (f & M_FLIES)
+ if (mons_class_flag(mc, M_FLIES))
return (FL_FLY);
- if (f & M_LEVITATE)
+ if (mons_class_flag(mc, M_LEVITATE))
return (FL_LEVITATE);
return (FL_NONE);
}
-flight_type mons_flies( const monsters *mon )
+flight_type mons_flies(const monsters *mon)
{
if (mon->type == MONS_PANDEMONIUM_DEMON
&& mon->ghost->values[ GVAL_DEMONLORD_FLY ])
{
return (FL_FLY);
}
-
+
const flight_type ret = mons_class_flies( mon->type );
return (ret ? ret
: (scan_mon_inv_randarts(mon, RAP_LEVITATE) > 0) ? FL_LEVITATE
: FL_NONE);
} // end mons_flies()
-
// this nice routine we keep in exactly the way it was
int hit_points(int hit_dice, int min_hp, int rand_hp)
{
@@ -1160,7 +1157,7 @@ int hit_points(int hit_dice, int min_hp, int rand_hp)
return (hrolled);
} // end hit_points()
-// This function returns the standard number of hit dice for a type
+// This function returns the standard number of hit dice for a type
// of monster, not a pacticular monsters current hit dice. -- bwr
int mons_type_hit_dice( int type )
{
diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h
index 4c8f250d6e..3188d8c90b 100644
--- a/crawl-ref/source/mon-util.h
+++ b/crawl-ref/source/mon-util.h
@@ -154,7 +154,7 @@ enum mon_itemuse_type
MONUSE_EATS_ITEMS,
MONUSE_OPEN_DOORS,
MONUSE_STARTING_EQUIPMENT,
- MONUSE_WEAPONS_ARMOUR,
+ MONUSE_WEAPONS_ARMOUR,
MONUSE_MAGIC_ITEMS
};
@@ -223,7 +223,7 @@ enum shout_type
enum zombie_size_type
{
- Z_NOZOMBIE,
+ Z_NOZOMBIE = 0,
Z_SMALL,
Z_BIG
};
@@ -326,13 +326,13 @@ monsters *monster_at(const coord_def &pos);
// this is the old moname()
std::string mons_type_name(int type, description_level_type desc );
-
+
// last updated 12may2000 {dlb}
/* ***********************************************************************
* called from: beam - direct - fight - monstuff - mstuff2 - spells4 - view
* *********************************************************************** */
-flight_type mons_class_flies( int mc );
-flight_type mons_flies( const monsters *mon );
+flight_type mons_class_flies(int mc);
+flight_type mons_flies(const monsters *mon);
// last updated XXmay2000 {dlb}
@@ -428,7 +428,8 @@ bool mons_is_summoned(const monsters *m);
/* ***********************************************************************
* called from: monstuff - spells4 - view
* *********************************************************************** */
-mon_intel_type mons_intel(int mclass);
+mon_intel_type mons_intel(int mc);
+
bool intelligent_ally(const monsters *mon);
@@ -468,7 +469,7 @@ bool mons_res_asphyx( const monsters *mon );
/* ***********************************************************************
* called from: dungeon - items - spells2 - spells4
* *********************************************************************** */
-int mons_skeleton(int mcls);
+bool mons_skeleton(int mc);
// last updated 12may2000 {dlb}
@@ -490,7 +491,7 @@ int mons_speed(int mclass);
/* ***********************************************************************
* called from: dungeon - mon-util - spells2
* *********************************************************************** */
-int mons_zombie_size(int mclass);
+int mons_zombie_size(int mc);
// last updated 12may2000 {dlb}
diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc
index 5a5f753a72..182c7d2e71 100644
--- a/crawl-ref/source/monplace.cc
+++ b/crawl-ref/source/monplace.cc
@@ -74,7 +74,8 @@ bool grid_compatible(dungeon_feature_type grid_wanted,
//
// If you have an actual monster, use this instead of the overloaded function
// that uses only the monster class to make decisions.
-bool monster_habitable_grid(const monsters *m, dungeon_feature_type actual_grid)
+bool monster_habitable_grid(const monsters *m,
+ dungeon_feature_type actual_grid)
{
return (monster_habitable_grid(m->type, actual_grid, mons_flies(m),
m->paralysed()));
@@ -84,7 +85,7 @@ inline static bool mons_airborne(int mcls, int flies, bool paralysed)
{
if (flies == -1)
flies = mons_class_flies(mcls);
- return (paralysed? flies == 2 : flies != 0);
+ return (paralysed ? flies == FL_LEVITATE : flies != FL_NONE);
}
// Can monsters of class monster_class live happily on actual_grid? Use flies
@@ -92,7 +93,7 @@ inline static bool mons_airborne(int mcls, int flies, bool paralysed)
//
// [dshaligram] We're trying to harmonise the checks from various places into
// one check, so we no longer care if a water elemental springs into existence
-// on dry land, because they're supposed to be able to move onto dry land
+// on dry land, because they're supposed to be able to move onto dry land
// anyway.
bool monster_habitable_grid(int monster_class,
dungeon_feature_type actual_grid,
@@ -106,7 +107,7 @@ bool monster_habitable_grid(int monster_class,
// only have to check for the additional valid grids of deep
// water and lava.
|| (mons_airborne(monster_class, flies, paralysed)
- && (actual_grid == DNGN_LAVA
+ && (actual_grid == DNGN_LAVA
|| actual_grid == DNGN_DEEP_WATER))
// Amphibious critters are happy in water or on land.
diff --git a/crawl-ref/source/monplace.h b/crawl-ref/source/monplace.h
index 7f343b81f0..2b318710ef 100644
--- a/crawl-ref/source/monplace.h
+++ b/crawl-ref/source/monplace.h
@@ -174,11 +174,12 @@ void mark_interesting_monst(struct monsters* monster,
bool grid_compatible(dungeon_feature_type grid_wanted,
dungeon_feature_type actual_grid,
bool generation = false);
-bool monster_habitable_grid(int monster_class,
- dungeon_feature_type actual_grid,
- int flies = -1, bool paralysed = false);
bool monster_habitable_grid(const monsters *m,
dungeon_feature_type actual_grid);
+bool monster_habitable_grid(int monster_class,
+ dungeon_feature_type actual_grid,
+ int flies = -1,
+ bool paralysed = false);
bool monster_can_submerge(int monster_class, int grid);
coord_def find_newmons_square(int mons_class, int x, int y);
diff --git a/crawl-ref/source/monstuff.cc b/crawl-ref/source/monstuff.cc
index 5d77b3838b..c4d0cce55e 100644
--- a/crawl-ref/source/monstuff.cc
+++ b/crawl-ref/source/monstuff.cc
@@ -1501,7 +1501,7 @@ bool swap_places(monsters *monster)
bool swap = mon_dest_okay;
- // chose an appropiate habitat square at random around the target.
+ // Choose an appropriate habitat square at random around the target.
if (!swap)
{
int num_found = 0;
@@ -5457,12 +5457,12 @@ static bool monster_move(monsters *monster)
}
return false;
}
-
+
// let's not even bother with this if mmov_x and mmov_y are zero.
if (mmov_x == 0 && mmov_y == 0)
return false;
- if (mons_flies(monster) > 0
+ if (mons_flies(monster) != FL_NONE
|| habitat != DNGN_FLOOR
|| mons_class_flag( monster->type, M_AMPHIBIOUS ))
{
@@ -5553,7 +5553,7 @@ static bool monster_move(monsters *monster)
&& deep_water_available
&& grd[monster->x][monster->y] != DNGN_DEEP_WATER
&& grd[monster->x + mmov_x][monster->y + mmov_y] != DNGN_DEEP_WATER
- && (monster->x + mmov_x != you.x_pos
+ && (monster->x + mmov_x != you.x_pos
|| monster->y + mmov_y != you.y_pos)
&& (one_chance_in(3)
|| monster->hit_points <= (monster->max_hit_points * 3) / 4))