diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-06 23:35:51 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-06 23:35:51 +0000 |
commit | 673f730759ef96de4eb4a08da857b582d888762b (patch) | |
tree | 0da7dd8737410fa221d15ddab271eb01445d6267 /crawl-ref | |
parent | bc0e74bb8ed94b852b5e4fa1037ae3d3ab5cd7bc (diff) | |
download | crawl-ref-673f730759ef96de4eb4a08da857b582d888762b.tar.gz crawl-ref-673f730759ef96de4eb4a08da857b582d888762b.zip |
Properly calculate speed on the level of individual monsters.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9362 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref')
-rw-r--r-- | crawl-ref/source/describe.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/mon-util.h | 5 | ||||
-rw-r--r-- | crawl-ref/source/monplace.cc | 4 |
4 files changed, 13 insertions, 7 deletions
diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index dd29a70745..80ba34ff21 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2683,7 +2683,7 @@ static std::string _monster_stat_description(const monsters& mon) result << pronoun << " can sense the presence of invisible creatures.$"; // Unusual monster speed. - const int speed = mons_speed(mon.type); + const int speed = mons_speed(&mon); if (speed != 10) { result << pronoun << " is "; diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 300882dfc7..52ac2ecd6b 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1575,7 +1575,7 @@ int exper_value(const monsters *monster) const int maxhp = monster->max_hit_points; // These are some values we care about. - const int speed = mons_speed(monster->type); + const int speed = mons_speed(monster); const int modifier = _mons_exp_mod(mclass); const int item_usage = mons_itemuse(monster); @@ -2294,12 +2294,17 @@ static int _mons_exp_mod(int mc) return (smc->exp_mod); } -int mons_speed(int mc) +int mons_class_speed(int mc) { ASSERT(smc); return (smc->speed); } +int mons_speed(const monsters *mon) +{ + return (mon->speed); +} + mon_intel_type mons_class_intel(int mc) { ASSERT(smc); diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index a814e39549..191da8b724 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -617,14 +617,15 @@ bool mons_skeleton(int mc); * called from: describe - fight - items - misc - monstuff - mon-util - * player - spells2 - spells3 * *********************************************************************** */ -int mons_weight(int mclass); +int mons_weight(int mc); // last updated 08may2001 {gdl} /* *********************************************************************** * called from: monplace mon-util * *********************************************************************** */ -int mons_speed(int mc); +int mons_class_speed(int mc); +int mons_speed(const monsters *mon); // last updated 12may2000 {dlb} diff --git a/crawl-ref/source/monplace.cc b/crawl-ref/source/monplace.cc index 4922974dbf..42e8220dcd 100644 --- a/crawl-ref/source/monplace.cc +++ b/crawl-ref/source/monplace.cc @@ -767,7 +767,7 @@ int place_monster(mgen_data mg, bool force_pos) // For some cases disallow monsters on stairs. if (mons_class_is_stationary(mg.cls) || (pval == 2 // Stairs occupied by player. - && (mons_speed(mg.cls) == 0 + && (mons_class_speed(mg.cls) == 0 || grd(mg.pos) == DNGN_LAVA || grd(mg.pos) == DNGN_DEEP_WATER))) { @@ -835,7 +835,7 @@ int place_monster(mgen_data mg, bool force_pos) if (pval == 2) // player on stairs { // 0 speed monsters can't shove player out of their way. - if (mons_speed(mg.cls) == 0) + if (mons_class_speed(mg.cls) == 0) { proxOK = false; break; |