diff options
author | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-16 02:26:06 +0000 |
---|---|---|
committer | dolorous <dolorous@c06c8d41-db1a-0410-9941-cceddc491573> | 2008-06-16 02:26:06 +0000 |
commit | 97c15a38617b933ae5efb6621a361e3fad48a091 (patch) | |
tree | a7c073fe54716705fe5f7ffb339fff3b4ce5cfac | |
parent | fef9f681531bf38dc5a969ba9d502418239f89c4 (diff) | |
download | crawl-ref-97c15a38617b933ae5efb6621a361e3fad48a091.tar.gz crawl-ref-97c15a38617b933ae5efb6621a361e3fad48a091.zip |
Add more miscellaneous minor fixes.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@5871 c06c8d41-db1a-0410-9941-cceddc491573
-rw-r--r-- | crawl-ref/source/command.cc | 5 | ||||
-rw-r--r-- | crawl-ref/source/describe.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/religion.cc | 22 | ||||
-rw-r--r-- | crawl-ref/source/skills2.cc | 4 |
4 files changed, 15 insertions, 20 deletions
diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 83ebe47426..2f348e68e3 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -1146,9 +1146,8 @@ static bool _do_description(std::string key, std::string footer = "") num_lines++; // So the footer doesn't get lonely on large displays. :) - int bottom_line = get_number_of_lines(); - if (bottom_line > 30) - bottom_line = 30; + const int bottom_line = std::min(30, get_number_of_lines()); + cgotoxy(1, bottom_line - num_lines); cprintf(footer.c_str()); diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index a9ac2c0b7a..97dca6d3b5 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -2696,9 +2696,7 @@ static void _detailed_god_description(god_type which_god) formatted_string::parse_block(broken, false).display(); } - int bottom_line = get_number_of_lines(); - if (bottom_line > 30) - bottom_line = 30; + const int bottom_line = std::min(30, get_number_of_lines()); cgotoxy(1, bottom_line-1); formatted_string::parse_string( diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 6aaa64e942..0d784a0126 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -2119,7 +2119,7 @@ std::string god_name( god_type which_god, bool long_name ) god_type string_to_god(const char *name) { god_type god; - for (int i = 0; i < NUM_GODS; i++) + for (int i = 0; i < NUM_GODS; ++i) { god = (god_type) i; if (name == god_name(god, false)) @@ -3363,7 +3363,7 @@ static bool _zin_retribution() { simple_god_message(" draws some chaos from your body!", god); bool success = false; - for (int i = 0; i < 7; i++) + for (int i = 0; i < 7; ++i) if (random2(10) > i && delete_mutation(RANDOM_GOOD_MUTATION)) { @@ -3633,7 +3633,7 @@ static bool _yredelemnul_retribution() int count = 0; int how_many = 1 + random2(1 + (you.experience_level / 5)); - for (int i = 0; i < how_many; i++) + for (int i = 0; i < how_many; ++i) { monster_type punisher = _random_servant(GOD_YREDELEMNUL); @@ -3768,11 +3768,11 @@ static bool _beogh_retribution() case 2: // send out one or two dancing weapons (12.5%) { int num_created = 0; - int num_to_create = (coinflip() ? 1 : 2); + int num_to_create = (coinflip()) ? 1 : 2; // Need a species check, in case this retribution is a result of // drawing the Wrath card. - for (int i = 0; i < num_to_create; i++) + for (int i = 0; i < num_to_create; ++i) { // Create item. int slot = items(0, OBJ_WEAPONS, WPN_CLUB + random2(13), @@ -3821,11 +3821,9 @@ static bool _beogh_retribution() menv[mons].flags |= MF_HARD_RESET; } else // Didn't work out! Delete item. - { mitm[slot].clear(); - } } - if (num_created) + if (num_created > 0) { snprintf(info, INFO_SIZE, " throws %s of %s at you.", num_created > 1 ? "implements" : "an implement", @@ -3883,7 +3881,7 @@ static bool _okawaru_retribution() bool success = false; const int how_many = 1 + (you.experience_level / 5); - for (int i = 0; i < how_many; i++) + for (int i = 0; i < how_many; ++i) { monster_type punisher = _random_servant(GOD_OKAWARU); @@ -4929,7 +4927,7 @@ static bool _bless_weapon( god_type god, int brand, int colour ) holy_word(100, HOLY_WORD_SHINING_ONE, you.x_pos, you.y_pos, true); // Un-bloodify surrounding squares. - for (int i = -3; i <= 3; i++) + for (int i = -3; i <= 3; ++i) for (int j = -3; j <= 3; j++) { if (is_bloodcovered(you.x_pos+i, you.y_pos+j)) @@ -5658,7 +5656,7 @@ void god_smites_you(god_type god, kill_method_type death_type, int divine_hurt = 10 + random2(10); - for (int i = 0; i < 5; i++) + for (int i = 0; i < 5; ++i) divine_hurt += random2( you.experience_level ); simple_god_message( " smites you!", god ); @@ -5722,7 +5720,7 @@ void handle_god_time() god_type which_god = GOD_NO_GOD; unsigned int count = 0; - for (int i = GOD_NO_GOD; i < NUM_GODS; i++) + for (int i = GOD_NO_GOD; i < NUM_GODS; ++i) { // Nemelex penance is special: it's only "active" // when penance > 100, else it's passive. diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index ee99c323bb..4f8283aafd 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -1709,7 +1709,6 @@ static bool _player_knows_aptitudes() static void _display_skill_table(bool show_aptitudes) { menu_letter lcount = 'a'; - const int num_lines = get_number_of_lines(); cgotoxy(1, 1); textcolor(LIGHTGREY); @@ -1728,8 +1727,9 @@ static void _display_skill_table(bool show_aptitudes) int scrln = 3, scrcol = 1; int x; + // Don't want the help line to appear too far down a big window. - const int bottom_line = ((num_lines > 30) ? 30 : num_lines); + const int bottom_line = std::min(30, get_number_of_lines()); for (int i = 0; i < ndisplayed_skills; ++i) { |