diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-13 20:13:34 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2009-03-13 20:13:34 +0000 |
commit | c806d0576cf54c3f3ab3ecb4c17fb3bf596f9d63 (patch) | |
tree | efe3e18e28fb3554acee672768b920209437dc10 /crawl-ref/source/spells2.cc | |
parent | efa261989c118090a430f48c76d50d248c6c60f2 (diff) | |
download | crawl-ref-c806d0576cf54c3f3ab3ecb4c17fb3bf596f9d63.tar.gz crawl-ref-c806d0576cf54c3f3ab3ecb4c17fb3bf596f9d63.zip |
Add minor cosmetic fixes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9437 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/spells2.cc')
-rw-r--r-- | crawl-ref/source/spells2.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/crawl-ref/source/spells2.cc b/crawl-ref/source/spells2.cc index 3579d68b03..4f635a50cd 100644 --- a/crawl-ref/source/spells2.cc +++ b/crawl-ref/source/spells2.cc @@ -48,12 +48,11 @@ REVISION("$Rev$"); #include "view.h" #include "xom.h" -int detect_traps( int pow ) +int detect_traps(int pow) { - int traps_found = 0; + pow = std::min(50, pow); - if (pow > 50) - pow = 50; + int traps_found = 0; const int range = 8 + random2(8) + pow; @@ -76,14 +75,13 @@ int detect_traps( int pow ) return (traps_found); } -int detect_items( int pow ) +int detect_items(int pow) { int items_found = 0; - const int map_radius = 8 + random2(8) + pow; + const int map_radius = 8 + random2(8) + pow; - for ( radius_iterator ri(you.pos(), map_radius, true, false); ri; ++ri ) + for (radius_iterator ri(you.pos(), map_radius, true, false); ri; ++ri) { - // Don't expose new dug out areas: // Note: assumptions are being made here about how // terrain can change (eg it used to be solid, and @@ -115,10 +113,9 @@ static void _fuzz_detect_creatures(int pow, int *fuzz_radius, int *fuzz_chance) mprf(MSGCH_DIAGNOSTICS, "dc_fuzz: Power is %d", pow); #endif - if (pow < 1) - pow = 1; + pow = std::max(1, pow); - *fuzz_radius = pow >= 50? 1 : 2; + *fuzz_radius = pow >= 50 ? 1 : 2; // Fuzz chance starts off at 100% and declines to a low of 10% for // obscenely powerful castings (pow caps around the 60 mark). @@ -182,13 +179,13 @@ static bool _mark_detected_creature(coord_def where, const monsters *mon, return (found_good); } -int detect_creatures( int pow, bool telepathic ) +int detect_creatures(int pow, bool telepathic) { int fuzz_radius = 0, fuzz_chance = 0; if (!telepathic) _fuzz_detect_creatures(pow, &fuzz_radius, &fuzz_chance); - int creatures_found = 0; + int creatures_found = 0; const int map_radius = 8 + random2(8) + pow; // Clear the map so detect creatures is more useful and the detection |