diff options
author | Adam Borowski <kilobyte@angband.pl> | 2012-07-05 12:14:09 +0200 |
---|---|---|
committer | Adam Borowski <kilobyte@angband.pl> | 2012-07-05 12:14:09 +0200 |
commit | c41419c4f47bbf0737d3fedf58128c835d2c4e3b (patch) | |
tree | 764ae18c107df39fd90af718922036bd245561ca | |
parent | b80adef8882143cad34f3c8bcc9a8ccbd4440223 (diff) | |
download | crawl-ref-c41419c4f47bbf0737d3fedf58128c835d2c4e3b.tar.gz crawl-ref-c41419c4f47bbf0737d3fedf58128c835d2c4e3b.zip |
Drop parentheses around scalar values in "return".
244 files changed, 6679 insertions, 6679 deletions
diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index cb0bda4b6f..7a50fe1401 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -500,9 +500,9 @@ bool string_matches_ability_name(const std::string& key) const std::string name = lowercase_string(ability_name(abil.ability)); if (name.find(key) != std::string::npos) - return (true); + return true; } - return (false); + return false; } std::string print_abilities() @@ -919,12 +919,12 @@ static ability_type _fixup_ability(ability_type ability) case ABIL_YRED_ANIMATE_REMAINS_OR_DEAD: // Placeholder for Animate Remains or Animate Dead. if (yred_can_animate_dead()) - return (ABIL_YRED_ANIMATE_DEAD); + return ABIL_YRED_ANIMATE_DEAD; else - return (ABIL_YRED_ANIMATE_REMAINS); + return ABIL_YRED_ANIMATE_REMAINS; default: - return (ability); + return ability; } } @@ -1324,7 +1324,7 @@ bool activate_ability() if (you.berserk()) { canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } std::vector<talent> talents = your_talents(false); @@ -1347,7 +1347,7 @@ bool activate_ability() mpr("Sorry, you're not good enough to have a special ability."); crawl_state.zero_turns_taken(); - return (false); + return false; } if (you.confused()) @@ -1357,7 +1357,7 @@ bool activate_ability() { mpr("You're too confused!"); crawl_state.zero_turns_taken(); - return (false); + return false; } } @@ -1375,14 +1375,14 @@ bool activate_ability() if (selected == -1) { canned_msg(MSG_OK); - return (false); + return false; } } else if (key_is_escape(keyin) || keyin == ' ' || keyin == '\r' || keyin == '\n') { canned_msg(MSG_OK); - return (false); + return false; } else if (isaalpha(keyin)) { @@ -1401,7 +1401,7 @@ bool activate_ability() { mpr("You can't do that."); crawl_state.zero_turns_taken(); - return (false); + return false; } } } @@ -1426,7 +1426,7 @@ static bool _check_ability_possible(const ability_def& abil, if (expected_hunger <= 150) { canned_msg(MSG_TOO_HUNGRY); - return (false); + return false; } } @@ -1435,20 +1435,20 @@ static bool _check_ability_possible(const ability_def& abil, case ABIL_ZIN_RECITE: { if (!zin_check_able_to_recite()) - return (false); + return false; const int result = zin_check_recite_to_monsters(0); if (result == -1) { mpr("There's no appreciative audience!"); - return (false); + return false; } else if (result == 0) { mpr("There's no-one here to preach to!"); - return (false); + return false; } - return (true); + return true; } case ABIL_ZIN_CURE_ALL_MUTATIONS: @@ -1458,9 +1458,9 @@ static bool _check_ability_possible(const ability_def& abil, if (env.sanctuary_time) { mpr("There's already a sanctuary in place on this level."); - return (false); + return false; } - return (true); + return true; case ABIL_ELYVILON_PURIFICATION: if (!you.disease && !you.rotting && !you.duration[DUR_POISONING] @@ -1473,9 +1473,9 @@ static bool _check_ability_possible(const ability_def& abil, && !you.duration[DUR_NAUSEA]) { mpr("Nothing ails you!"); - return (false); + return false; } - return (true); + return true; case ABIL_MUMMY_RESTORATION: if (you.strength() == you.max_strength() @@ -1484,17 +1484,17 @@ static bool _check_ability_possible(const ability_def& abil, && !player_rotted()) { mprf("You don't need to restore your stats or hit points!"); - return (false); + return false; } - return (true); + return true; case ABIL_LUGONU_ABYSS_EXIT: if (!player_in_branch(BRANCH_ABYSS)) { mpr("You aren't in the Abyss!"); - return (false); + return false; } - return (true); + return true; case ABIL_LUGONU_CORRUPT: return (!is_level_incorruptible()); @@ -1503,17 +1503,17 @@ static bool _check_ability_possible(const ability_def& abil, if (player_in_branch(BRANCH_ABYSS)) { mpr("You're already here!"); - return (false); + return false; } - return (true); + return true; case ABIL_SIF_MUNA_FORGET_SPELL: if (you.spell_no == 0) { canned_msg(MSG_NO_SPELLS); - return (false); + return false; } - return (true); + return true; case ABIL_SPIT_POISON: case ABIL_BREATHE_FIRE: @@ -1528,18 +1528,18 @@ static bool _check_ability_possible(const ability_def& abil, if (you.duration[DUR_BREATH_WEAPON]) { canned_msg(MSG_CANNOT_DO_YET); - return (false); + return false; } - return (true); + return true; case ABIL_BLINK: case ABIL_EVOKE_BLINK: if (item_blocks_teleport(false, false)) { mpr("You cannot teleport right now."); - return (false); + return false; } - return (true); + return true; case ABIL_EVOKE_BERSERK: case ABIL_TROG_BERSERK: @@ -1549,17 +1549,17 @@ static bool _check_ability_possible(const ability_def& abil, if (you.duration[DUR_EXHAUSTED]) { mpr("You're too exhausted to fly."); - return (false); + return false; } else if (you.burden_state != BS_UNENCUMBERED) { mpr("You're carrying too much weight to fly."); - return (false); + return false; } - return (true); + return true; default: - return (true); + return true; } } @@ -1573,7 +1573,7 @@ static bool _activate_talent(const talent& tal) { mpr("Stopping levitation right now would be fatal!"); crawl_state.zero_turns_taken(); - return (false); + return false; } } else if (tal.which == ABIL_TRAN_BAT) @@ -1582,7 +1582,7 @@ static bool _activate_talent(const talent& tal) && !yesno("Turning into a bat will reduce your strength to zero. Continue?", false, 'n')) { crawl_state.zero_turns_taken(); - return (false); + return false; } } else if (tal.which == ABIL_END_TRANSFORMATION) @@ -1593,13 +1593,13 @@ static bool _activate_talent(const talent& tal) env.grid(you.pos()) == DNGN_LAVA ? "burn" : "drown"); crawl_state.zero_turns_taken(); - return (false); + return false; } if (player_in_bat_form() && you.dex() <= 5 && !yesno("Turning back will reduce your dexterity to zero. Continue?", false, 'n')) { crawl_state.zero_turns_taken(); - return (false); + return false; } } @@ -1607,7 +1607,7 @@ static bool _activate_talent(const talent& tal) && !you.can_go_berserk(true)) { crawl_state.zero_turns_taken(); - return (false); + return false; } if ((tal.which == ABIL_EVOKE_LEVITATE || tal.which == ABIL_TRAN_BAT) @@ -1615,7 +1615,7 @@ static bool _activate_talent(const talent& tal) { mpr("You can't escape from the ground with such puny magic!", MSGCH_WARN); crawl_state.zero_turns_taken(); - return (false); + return false; } // Some abilities don't need a hunger check. @@ -1644,7 +1644,7 @@ static bool _activate_talent(const talent& tal) { canned_msg(MSG_TOO_HUNGRY); crawl_state.zero_turns_taken(); - return (false); + return false; } const ability_def& abil = _get_ability_def(tal.which); @@ -1656,13 +1656,13 @@ static bool _activate_talent(const talent& tal) && !enough_mp(abil.mp_cost, false, !(abil.flags & ABFLAG_PERMANENT_MP))) { crawl_state.zero_turns_taken(); - return (false); + return false; } if (!enough_hp(abil.hp_cost.cost(you.hp_max), false)) { crawl_state.zero_turns_taken(); - return (false); + return false; } int zpcost = _zp_cost(abil); @@ -1671,14 +1671,14 @@ static bool _activate_talent(const talent& tal) if (!enough_zp(zpcost, false)) { crawl_state.zero_turns_taken(); - return (false); + return false; } } if (!_check_ability_possible(abil, hungerCheck)) { crawl_state.zero_turns_taken(); - return (false); + return false; } // No turning back now... {dlb} @@ -1686,7 +1686,7 @@ static bool _activate_talent(const talent& tal) { mpr("You fail to use your ability."); you.turn_is_over = true; - return (false); + return false; } const bool success = _do_ability(abil); @@ -1697,7 +1697,7 @@ static bool _activate_talent(const talent& tal) count_action(tal.is_invocation ? CACT_INVOKE : CACT_ABIL, abil.ability); } - return (success); + return success; } static int _calc_breath_ability_range(ability_type ability) @@ -1749,7 +1749,7 @@ static bool _do_ability(const ability_def& abil) { if (abild.isCancel) canned_msg(MSG_OK); - return (false); + return false; } for (adjacent_iterator ai(abild.target); ai; ++ai) { @@ -1771,7 +1771,7 @@ static bool _do_ability(const ability_def& abil) if (!create_zotdef_ally(_monster_for_ability(abil), _zd_mons_description_for_ability(abil).c_str())) { - return (false); + return false; } break; // End ZotDef Allies @@ -1808,7 +1808,7 @@ static bool _do_ability(const ability_def& abil) { if (abild.isCancel) canned_msg(MSG_OK); - return (false); + return false; } for (adjacent_iterator ai(abild.target); ai; ++ai) { @@ -1835,7 +1835,7 @@ static bool _do_ability(const ability_def& abil) if (is_critical_feature(grd(you.pos()))) { mpr("The dungeon trembles momentarily."); - return (false); + return false; } // Generate a portal to something. @@ -1845,7 +1845,7 @@ static bool _do_ability(const ability_def& abil) else { mpr("A buggy portal flickers into view, then vanishes."); - return (false); + return false; } break; @@ -1855,7 +1855,7 @@ static bool _do_ability(const ability_def& abil) if (!zotdef_create_altar()) { mpr("The dungeon dims for a moment."); - return (false); + return false; } break; @@ -1900,7 +1900,7 @@ static bool _do_ability(const ability_def& abil) if (!did_restore) { canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } break; @@ -1908,7 +1908,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_RECHARGING: if (recharge_wand(-1) <= 0) - return (false); // fail message is already given + return false; // fail message is already given break; case ABIL_DELAYED_FIREBALL: @@ -1918,10 +1918,10 @@ static bool _do_ability(const ability_def& abil) beam.range = spell_range(SPELL_FIREBALL, power); if (!spell_direction(spd, beam, DIR_NONE, TARG_HOSTILE, beam.range)) - return (false); + return false; if (!fireball(power, beam)) - return (false); + return false; // Only one allowed, since this is instantaneous. - bwr you.attribute[ATTR_DELAYED_FIREBALL] = 0; @@ -1937,7 +1937,7 @@ static bool _do_ability(const ability_def& abil) if (!spell_direction(abild, beam) || !player_tracer(ZAP_SPIT_POISON, power, beam)) { - return (false); + return false; } else { @@ -1959,7 +1959,7 @@ static bool _do_ability(const ability_def& abil) NULL, NULL, false, &hitfunc)) { - return (false); + return false; } if (stop_attack_prompt(hitfunc, "spit at")) @@ -1983,7 +1983,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_BREATHE_MEPHITIC: beam.range = _calc_breath_ability_range(abil.ability); if (!spell_direction(abild, beam)) - return (false); + return false; case ABIL_BREATHE_LIGHTNING: // not targeted @@ -2000,7 +2000,7 @@ static bool _do_ability(const ability_def& abil) (power < 15) ? '.':'!'); if (!zapping(ZAP_BREATHE_FIRE, power, beam, true, info)) - return (false); + return false; break; case ABIL_BREATHE_FROST: @@ -2010,7 +2010,7 @@ static bool _do_ability(const ability_def& abil) beam, true, "You exhale a wave of freezing cold.")) { - return (false); + return false; } break; @@ -2018,7 +2018,7 @@ static bool _do_ability(const ability_def& abil) if (!zapping(ZAP_BREATHE_POISON, you.experience_level, beam, true, "You exhale a blast of poison gas.")) { - return (false); + return false; } break; @@ -2033,7 +2033,7 @@ static bool _do_ability(const ability_def& abil) 2 * you.experience_level : you.experience_level, beam, true, "You spit a glob of acid.")) { - return (false); + return false; } break; @@ -2044,7 +2044,7 @@ static bool _do_ability(const ability_def& abil) beam, true, "You spit a bolt of dispelling energy.")) { - return (false); + return false; } break; @@ -2055,7 +2055,7 @@ static bool _do_ability(const ability_def& abil) beam, true, "You spit a glob of burning liquid.")) { - return (false); + return false; } break; @@ -2066,7 +2066,7 @@ static bool _do_ability(const ability_def& abil) beam, true, "You exhale a blast of scalding steam.")) { - return (false); + return false; } break; @@ -2077,7 +2077,7 @@ static bool _do_ability(const ability_def& abil) beam, true, "You exhale a blast of noxious fumes.")) { - return (false); + return false; } break; @@ -2126,7 +2126,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_HELLFIRE: if (your_spells(SPELL_HELLFIRE, you.experience_level * 10, false) == SPRET_ABORT) - return (false); + return false; break; case ABIL_EVOKE_TURN_INVISIBLE: // ring, randarts, darkness items @@ -2182,7 +2182,7 @@ static bool _do_ability(const ability_def& abil) else { mpr("That recitation seems somehow inappropriate."); - return (false); + return false; } break; } @@ -2194,12 +2194,12 @@ static bool _do_ability(const ability_def& abil) { beam.range = LOS_RADIUS; if (!spell_direction(spd, beam, DIR_TARGET, TARG_HOSTILE, 0, false)) - return (false); + return false; if (beam.target == you.pos()) { mpr("You cannot imprison yourself!"); - return (false); + return false; } monster* mons = monster_at(beam.target); @@ -2207,20 +2207,20 @@ static bool _do_ability(const ability_def& abil) if (mons == NULL || !you.can_see(mons)) { mpr("There is no monster there to imprison!"); - return (false); + return false; } power = 3 + roll_dice(6, (30 + you.skill(SK_INVOCATIONS, 10)) / (3 + mons->hit_dice)) / 3; if (!cast_imprison(power, mons, -GOD_ZIN)) - return (false); + return false; break; } case ABIL_ZIN_SANCTUARY: if (!zin_sanctuary()) - return (false); + return false; break; case ABIL_ZIN_CURE_ALL_MUTATIONS: @@ -2288,10 +2288,10 @@ static bool _do_ability(const ability_def& abil) beam.range = LOS_RADIUS; if (!spell_direction(spd, beam)) - return (false); + return false; if (!zapping(ZAP_ENSLAVE_SOUL, power, beam)) - return (false); + return false; break; } @@ -2316,7 +2316,7 @@ static bool _do_ability(const ability_def& abil) if (stasis_blocks_effect(true, true, "%s emits a piercing whistle.", 20, "%s makes your neck tingle.")) { - return (false); + return false; } mprf(MSGCH_DURATION, you.duration[DUR_FINESSE] @@ -2331,7 +2331,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_MAKHLEB_MINOR_DESTRUCTION: if (!spell_direction(spd, beam)) - return (false); + return false; power = you.skill(SK_INVOCATIONS, 1) + random2(1 + you.skill(SK_INVOCATIONS, 1)) @@ -2340,7 +2340,7 @@ static bool _do_ability(const ability_def& abil) // Since the actual beam is random, check with BEAM_MMISSILE and the // highest range possible. if (!player_tracer(ZAP_DEBUGGING_RAY, power, beam, 8)) - return (false); + return false; switch (random2(5)) { @@ -2360,7 +2360,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_MAKHLEB_MAJOR_DESTRUCTION: if (!spell_direction(spd, beam)) - return (false); + return false; power = you.skill(SK_INVOCATIONS, 3) + random2(1 + you.skill(SK_INVOCATIONS, 1)) @@ -2369,7 +2369,7 @@ static bool _do_ability(const ability_def& abil) // Since the actual beam is random, check with BEAM_MMISSILE and the // highest range possible. if (!player_tracer(ZAP_DEBUGGING_RAY, power, beam, 8)) - return (false); + return false; { zap_type ztype = ZAP_DEBUGGING_RAY; @@ -2395,7 +2395,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_TROG_BURN_SPELLBOOKS: if (!trog_burn_spellbooks()) - return (false); + return false; break; case ABIL_TROG_BERSERK: @@ -2417,7 +2417,7 @@ static bool _do_ability(const ability_def& abil) case ABIL_SIF_MUNA_FORGET_SPELL: if (!cast_selective_amnesia()) - return (false); + return false; break; case ABIL_ELYVILON_LIFESAVING: @@ -2442,7 +2442,7 @@ static bool _do_ability(const ability_def& abil) true, self ? you.pos() : coord_def(0, 0), !self, self ? TARG_NUM_MODES : TARG_INJURED_FRIEND) < 0) { - return (false); + return false; } break; @@ -2462,14 +2462,14 @@ static bool _do_ability(const ability_def& abil) true, self ? you.pos() : coord_def(0, 0), !self, self ? TARG_NUM_MODES : TARG_INJURED_FRIEND) < 0) { - return (false); + return false; } break; } case ABIL_ELYVILON_DIVINE_VIGOUR: if (!elyvilon_divine_vigour()) - return (false); + return false; break; case ABIL_LUGONU_ABYSS_EXIT: @@ -2484,24 +2484,24 @@ static bool _do_ability(const ability_def& abil) beam.range = LOS_RADIUS; if (!spell_direction(spd, beam)) - return (false); + return false; if (beam.target == you.pos()) { mpr("You cannot banish yourself!"); - return (false); + return false; } if (!zapping(ZAP_BANISHMENT, 16 + you.skill(SK_INVOCATIONS, 8), beam, true)) { - return (false); + return false; } break; case ABIL_LUGONU_CORRUPT: if (!lugonu_corrupt_level(300 + you.skill(SK_INVOCATIONS, 15))) - return (false); + return false; break; case ABIL_LUGONU_ABYSS_ENTER: @@ -2533,34 +2533,34 @@ static bool _do_ability(const ability_def& abil) } case ABIL_NEMELEX_DRAW_ONE: if (!choose_deck_and_draw()) - return (false); + return false; break; case ABIL_NEMELEX_PEEK_TWO: if (!deck_peek()) - return (false); + return false; break; case ABIL_NEMELEX_TRIPLE_DRAW: if (!deck_triple_draw()) - return (false); + return false; break; case ABIL_NEMELEX_DEAL_FOUR: if (!deck_deal()) - return (false); + return false; break; case ABIL_NEMELEX_STACK_FIVE: if (!deck_stack()) - return (false); + return false; break; case ABIL_BEOGH_SMITING: if (your_spells(SPELL_SMITING, 12 + skill_bump(SK_INVOCATIONS, 6), false) == SPRET_ABORT) { - return (false); + return false; } break; @@ -2572,20 +2572,20 @@ static bool _do_ability(const ability_def& abil) if (!fedhas_sunlight()) { canned_msg(MSG_OK); - return (false); + return false; } break; case ABIL_FEDHAS_PLANT_RING: if (!fedhas_plant_ring_from_fruit()) - return (false); + return false; break; case ABIL_FEDHAS_RAIN: if (!fedhas_rain(you.pos())) { canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } break; @@ -2598,27 +2598,27 @@ static bool _do_ability(const ability_def& abil) mprf("No corpses are in range."); else canned_msg(MSG_OK); - return (false); + return false; } break; } case ABIL_FEDHAS_EVOLUTION: if (!fedhas_evolve_flora()) - return (false); + return false; break; case ABIL_TRAN_BAT: if (!transform(100, TRAN_BAT)) { crawl_state.zero_turns_taken(); - return (false); + return false; } break; case ABIL_BOTTLE_BLOOD: if (!butchery(-1, true)) - return (false); + return false; break; case ABIL_JIYVA_CALL_JELLY: @@ -2629,7 +2629,7 @@ static bool _do_ability(const ability_def& abil) mg.non_actor_summoner = "Jiyva"; if (!create_monster(mg)) - return (false); + return false; break; } @@ -2686,7 +2686,7 @@ static bool _do_ability(const ability_def& abil) if (!ashenzari_transfer_knowledge()) { canned_msg(MSG_OK); - return (false); + return false; } break; @@ -2705,7 +2705,7 @@ static bool _do_ability(const ability_def& abil) else { canned_msg(MSG_OK); - return (false); + return false; } break; @@ -2718,7 +2718,7 @@ static bool _do_ability(const ability_def& abil) die("invalid ability"); } - return (true); + return true; } // [ds] Increase piety cost for god abilities that are particularly @@ -3206,7 +3206,7 @@ std::vector<talent> your_talents(bool check_confused) // here (if you have 53 or more abilities simultaneously). } - return (talents); + return talents; } // Note: we're trying for a behaviour where the player gets @@ -3237,16 +3237,16 @@ static void _set_god_ability_helper(ability_type abil, char letter) static int _is_god_ability(ability_type abil) { if (abil == ABIL_NON_ABILITY) - return (GOD_NO_GOD); + return GOD_NO_GOD; for (int i = 0; i < NUM_GODS; ++i) for (int j = 0; j < MAX_GOD_ABILITIES; ++j) { if (god_abilities[i][j] == abil) - return (i); + return i; } - return (GOD_NO_GOD); + return GOD_NO_GOD; } void set_god_ability_slots() @@ -3316,7 +3316,7 @@ static int _find_ability_slot(const ability_def &abil) // its corresponding ability before comparing the two, so that // we'll find the placeholder's index properly. if (_fixup_ability(you.ability_letter_table[slot]) == abil.ability) - return (slot); + return slot; // No requested slot, find new one and make it preferred. @@ -3332,7 +3332,7 @@ static int _find_ability_slot(const ability_def &abil) if (you.ability_letter_table[slot] == ABIL_NON_ABILITY) { you.ability_letter_table[slot] = abil.ability; - return (slot); + return slot; } } @@ -3342,7 +3342,7 @@ static int _find_ability_slot(const ability_def &abil) if (you.ability_letter_table[slot] == ABIL_NON_ABILITY) { you.ability_letter_table[slot] = abil.ability; - return (slot); + return slot; } } diff --git a/crawl-ref/source/abyss.cc b/crawl-ref/source/abyss.cc index 9406f770b8..294b5de4c5 100644 --- a/crawl-ref/source/abyss.cc +++ b/crawl-ref/source/abyss.cc @@ -96,10 +96,10 @@ static coord_def _place_feature_near(const coord_def ¢re, dungeon_feature_name(replacement), cp.x, cp.y); grd(cp) = replacement; - return (cp); + return cp; } } - return (INVALID_COORD); + return INVALID_COORD; } //#define DEBUG_ABYSS @@ -201,7 +201,7 @@ static int _abyssal_rune_roll() dprf("Abyssal rune odds: %d in %d (%.2f%%)", odds, ABYSSAL_RUNE_MAX_ROLL, odds * 100.0 / ABYSSAL_RUNE_MAX_ROLL); #endif - return (odds); + return odds; } static void _abyss_create_room(const map_mask &abyss_genlevel_mask) @@ -260,7 +260,7 @@ static bool _abyss_place_map(const map_def *mdef) if (did_place) _abyss_erase_stairs_from(env.level_vaults[env.level_vaults.size() - 1]); - return (did_place); + return did_place; } static bool _abyss_place_vault_tagged(const map_mask &abyss_genlevel_mask, @@ -272,7 +272,7 @@ static bool _abyss_place_vault_tagged(const map_mask &abyss_genlevel_mask, unwind_vault_placement_mask vaultmask(&abyss_genlevel_mask); return (_abyss_place_map(map)); } - return (false); + return false; } static bool _abyss_place_rune_vault(const map_mask &abyss_genlevel_mask) @@ -285,7 +285,7 @@ static bool _abyss_place_rune(const map_mask &abyss_genlevel_mask, { // Use a rune vault if there's one. if (use_vaults && _abyss_place_rune_vault(abyss_genlevel_mask)) - return (true); + return true; coord_def chosen_spot; int places_found = 0; @@ -318,7 +318,7 @@ static bool _abyss_place_rune(const map_mask &abyss_genlevel_mask, return (thing_created != NON_ITEM); } - return (false); + return false; } // Returns true if items can be generated on the given square. @@ -404,7 +404,7 @@ static int _abyss_create_items(const map_mask &abyss_genlevel_mask, } } - return (items_placed); + return items_placed; } void push_features_to_abyss() @@ -476,7 +476,7 @@ static bool _abyss_check_place_feat(coord_def p, const map_mask &abyss_genlevel_mask) { if (!which_feat) - return (false); + return false; const bool place_feat = feat_chance && one_chance_in(feat_chance); @@ -502,16 +502,16 @@ static bool _abyss_check_place_feat(coord_def p, if (feats_wanted) --*feats_wanted; - return (true); + return true; } - return (false); + return false; } static dungeon_feature_type _abyss_pick_altar() { // Lugonu has a flat 50% chance of corrupting the altar. if (coinflip()) - return (DNGN_ALTAR_LUGONU); + return DNGN_ALTAR_LUGONU; god_type god; @@ -1019,10 +1019,10 @@ static bool _abyss_teleport_within_level() newspot.x, newspot.y); #endif you.moveto(newspot); - return (true); + return true; } } - return (false); + return false; } static dungeon_feature_type _abyss_grid(const coord_def &p, double depth, @@ -1220,7 +1220,7 @@ static int _abyss_place_vaults(const map_mask &abyss_genlevel_mask) break; } - return (vaults_placed); + return vaults_placed; } static void _generate_area(const map_mask &abyss_genlevel_mask) @@ -1526,7 +1526,7 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos) // [ds] No longer summon hostiles -- don't create the monster if // it would be hostile. if (beh == BEH_HOSTILE) - return (true); + return true; // Thirty tries for a place. for (int i = 0; i < 30; ++i) @@ -1544,7 +1544,7 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos) // Got a place, summon the beast. monster_type mons = pick_random_monster(level_id(BRANCH_ABYSS)); if (invalid_monster_type(mons)) - return (false); + return false; mgen_data mg(mons, beh, 0, 5, 0, p); mg.non_actor_summoner = "Lugonu's corruption"; @@ -1553,7 +1553,7 @@ static bool _spawn_corrupted_servant_near(const coord_def &pos) return create_monster(mg); } - return (false); + return false; } static void _apply_corruption_effect(map_marker *marker, int duration) @@ -1596,19 +1596,19 @@ void run_corruption_effects(int duration) static bool _is_grid_corruptible(const coord_def &c) { if (c == you.pos()) - return (false); + return false; const dungeon_feature_type feat = grd(c); // Stairs and portals cannot be corrupted. if (feat_stair_direction(feat) != CMD_NO_CMD) - return (false); + return false; switch (feat) { case DNGN_PERMAROCK_WALL: case DNGN_CLEAR_PERMAROCK_WALL: - return (false); + return false; case DNGN_METAL_WALL: case DNGN_GREEN_CRYSTAL_WALL: @@ -1623,7 +1623,7 @@ static bool _is_grid_corruptible(const coord_def &c) return (!one_chance_in(3)); default: - return (true); + return true; } } @@ -1642,10 +1642,10 @@ static bool _is_crowded_square(const coord_def &c) continue; if (++neighbours > 4) - return (false); + return false; } - return (true); + return true; } // Returns true if the square has all opaque neighbours. @@ -1653,9 +1653,9 @@ static bool _is_sealed_square(const coord_def &c) { for (adjacent_iterator ai(c); ai; ++ai) if (!feat_is_opaque(grd(*ai))) - return (false); + return false; - return (true); + return true; } static void _corrupt_square(const corrupt_env &cenv, const coord_def &c) @@ -1751,7 +1751,7 @@ static void _corrupt_level_features(const corrupt_env &cenv) static bool _is_level_corrupted() { if (player_in_branch(BRANCH_ABYSS)) - return (true); + return true; return (!!env.markers.find(MAT_CORRUPTION_NEXUS)); } @@ -1761,10 +1761,10 @@ bool is_level_incorruptible() if (_is_level_corrupted()) { mpr("This place is already infused with evil and corruption."); - return (true); + return true; } - return (false); + return false; } static void _corrupt_choose_colours(corrupt_env *cenv) @@ -1785,7 +1785,7 @@ static void _corrupt_choose_colours(corrupt_env *cenv) bool lugonu_corrupt_level(int power) { if (is_level_incorruptible()) - return (false); + return false; simple_god_message("'s Hand of Corruption reaches out!"); take_note(Note(NOTE_MESSAGE, 0, 0, make_stringf("Corrupted %s", @@ -1805,5 +1805,5 @@ bool lugonu_corrupt_level(int power) delay(1000); #endif - return (true); + return true; } diff --git a/crawl-ref/source/acquire.cc b/crawl-ref/source/acquire.cc index 872dc4bbcd..8010656b27 100644 --- a/crawl-ref/source/acquire.cc +++ b/crawl-ref/source/acquire.cc @@ -158,7 +158,7 @@ static armour_type _pick_wearable_armour(const armour_type arm) result = NUM_ARMOURS; } - return (result); + return result; } static armour_type _acquirement_armour_subtype(bool divine) @@ -328,7 +328,7 @@ static armour_type _acquirement_armour_subtype(bool divine) } } - return (result); + return result; } // If armour acquirement turned up a non-ego non-artefact armour item, @@ -391,7 +391,7 @@ static bool _try_give_plain_armour(item_def &arm) // All available secondary slots already filled. if (picked == NUM_ARMOURS) - return (false); + return false; arm.clear(); arm.quantity = 1; @@ -407,7 +407,7 @@ static bool _try_give_plain_armour(item_def &arm) item_colour(arm); ASSERT(arm.is_valid()); - return (true); + return true; } // Write results into arguments. @@ -558,7 +558,7 @@ static int _acquirement_weapon_subtype(bool divine) if (x_chance_in_y(acqweight, count += acqweight)) result = i; } - return (result); + return result; } static bool _have_item_with_types(object_class_type basetype, int subtype) @@ -569,10 +569,10 @@ static bool _have_item_with_types(object_class_type basetype, int subtype) if (item.defined() && item.base_type == basetype && item.sub_type == subtype) { - return (true); + return true; } } - return (false); + return false; } static missile_type _acquirement_missile_subtype() @@ -622,7 +622,7 @@ static missile_type _acquirement_missile_subtype() default: break; } - return (result); + return result; } static int _acquirement_jewellery_subtype() @@ -642,7 +642,7 @@ static int _acquirement_jewellery_subtype() break; } - return (result); + return result; } static bool _want_rod() @@ -737,7 +737,7 @@ static int _acquirement_misc_subtype() result = MISC_CRYSTAL_BALL_OF_ENERGY; } - return (result); + return result; } static int _acquirement_wand_subtype() @@ -789,7 +789,7 @@ static int _acquirement_wand_subtype() picked = type; } - return (picked); + return picked; } static int _find_acquirement_subtype(object_class_type &class_wanted, @@ -863,7 +863,7 @@ static int _find_acquirement_subtype(object_class_type &class_wanted, break; } - return (type_wanted); + return type_wanted; } // The weight of a spell takes into account its disciplines' skill levels @@ -915,7 +915,7 @@ static int _book_weight(book_type book) total_weight += _spell_weight(stype); } - return (total_weight); + return total_weight; } static bool _is_magic_skill(int skill) @@ -942,7 +942,7 @@ static bool _skill_useless_with_god(int skill) case GOD_NO_GOD: return (skill == SK_INVOCATIONS); default: - return (false); + return false; } } @@ -1063,7 +1063,7 @@ static bool _do_book_acquirement(item_def &book, int agent) if (!make_book_theme_randart(book, 0, 0, 5 + coinflip(), 20, SPELL_NO_SPELL, owner)) { - return (false); + return false; } break; @@ -1071,7 +1071,7 @@ static bool _do_book_acquirement(item_def &book, int agent) { book.sub_type = BOOK_RANDART_LEVEL; if (!make_book_level_randart(book, level, -1, owner)) - return (false); + return false; break; } @@ -1079,7 +1079,7 @@ static bool _do_book_acquirement(item_def &book, int agent) { // The Tome of Destruction is rare enough we won't change this. if (book.sub_type == BOOK_DESTRUCTION) - return (true); + return true; int weights[NUM_SKILLS]; int total_weights = 0; @@ -1130,14 +1130,14 @@ static bool _do_book_acquirement(item_def &book, int agent) break; } // manuals } // switch book choice - return (true); + return true; } static int _failed_acquirement(bool quiet) { if (!quiet) mpr("The demon of the infinite void smiles upon you."); - return (NON_ITEM); + return NON_ITEM; } static int _weapon_brand_quality(int brand, bool range) @@ -1590,7 +1590,7 @@ int acquirement_create_item(object_class_type class_wanted, ASSERT(mitm[thing_created].is_valid()); mitm[thing_created].props["acquired"].get_int() = agent; } - return (thing_created); + return thing_created; } bool acquirement(object_class_type class_wanted, int agent, @@ -1637,7 +1637,7 @@ bool acquirement(object_class_type class_wanted, int agent, if (agent == AQ_WIZMODE) { canned_msg(MSG_OK); - return (false); + return false; } // If we've gotten a HUP signal then the player will be unable @@ -1646,7 +1646,7 @@ bool acquirement(object_class_type class_wanted, int agent, { mpr("Acquirement interrupted by HUP signal.", MSGCH_ERROR); you.turn_is_over = false; - return (false); + return false; } break; } @@ -1662,5 +1662,5 @@ bool acquirement(object_class_type class_wanted, int agent, *item_index = acquirement_create_item(class_wanted, agent, quiet, you.pos(), debug); - return (true); + return true; } diff --git a/crawl-ref/source/act-iter.cc b/crawl-ref/source/act-iter.cc index c7ad1791d1..75af9a1145 100644 --- a/crawl-ref/source/act-iter.cc +++ b/crawl-ref/source/act-iter.cc @@ -60,13 +60,13 @@ actor_iterator actor_iterator::operator++(int) { actor_iterator copy = *this; ++(*this); - return (copy); + return copy; } bool actor_iterator::valid(const actor* a) const { if (!a->alive()) - return (false); + return false; switch (restr) { case R_CIRC: @@ -76,7 +76,7 @@ bool actor_iterator::valid(const actor* a) const case R_ACT: return (act->can_see(a)); default: - return (true); + return true; } } diff --git a/crawl-ref/source/actor-los.cc b/crawl-ref/source/actor-los.cc index e770cb7fd1..145fe84c46 100644 --- a/crawl-ref/source/actor-los.cc +++ b/crawl-ref/source/actor-los.cc @@ -16,7 +16,7 @@ bool actor::observable() const bool actor::see_cell(const coord_def &p) const { if (!in_bounds(pos())) - return (false); // actor is off the map + return false; // actor is off the map return (cell_see_cell(pos(), p, LOS_DEFAULT)); } @@ -24,9 +24,9 @@ bool actor::see_cell(const coord_def &p) const bool player::see_cell(const coord_def &p) const { if (!map_bounds(p)) - return (false); + return false; if (crawl_state.game_is_arena() && is_player()) - return (true); + return true; if (xray_vision) return ((pos() - p).abs() <= dist_range(you.current_vision)); return (actor::see_cell(p)); diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc index 0733ad79b1..8db3c9dd0d 100644 --- a/crawl-ref/source/actor.cc +++ b/crawl-ref/source/actor.cc @@ -118,8 +118,8 @@ int actor::res_holy_fire() const if (is_evil() || is_unholy()) return (-1); else if (is_holy()) - return (3); - return (0); + return 3; + return 0; } int actor::check_res_magic(int power) @@ -127,7 +127,7 @@ int actor::check_res_magic(int power) const int mrs = res_magic(); if (mrs == MAG_IMMUNE) - return (100); + return 100; // Evil, evil hack to make weak one hd monsters easier for first level // characters who have resistable 1st level spells. Six is a very special @@ -166,34 +166,34 @@ bool actor::can_hibernate(bool holi_only) const // Undead, nonliving, and plants don't sleep. const mon_holy_type holi = holiness(); if (holi == MH_UNDEAD || holi == MH_NONLIVING || holi == MH_PLANT) - return (false); + return false; if (!holi_only) { // The monster is berserk or already asleep. if (!can_sleep()) - return (false); + return false; // The monster is cold-resistant and can't be hibernated. if (res_cold() > 0) - return (false); + return false; // The monster has slept recently. if (is_monster() && static_cast<const monster* >(this)->has_ench(ENCH_SLEEP_WARY)) { - return (false); + return false; } } - return (true); + return true; } bool actor::can_sleep() const { const mon_holy_type holi = holiness(); if (holi == MH_UNDEAD || holi == MH_NONLIVING || holi == MH_PLANT) - return (false); + return false; return !(berserk() || asleep()); } @@ -219,21 +219,21 @@ int actor::body_weight(bool base) const switch (body_size(PSIZE_BODY, base)) { case SIZE_TINY: - return (150); + return 150; case SIZE_LITTLE: - return (300); + return 300; case SIZE_SMALL: - return (425); + return 425; case SIZE_MEDIUM: - return (550); + return 550; case SIZE_LARGE: - return (1300); + return 1300; case SIZE_BIG: - return (1500); + return 1500; case SIZE_GIANT: - return (1800); + return 1800; case SIZE_HUGE: - return (2200); + return 2200; default: die("invalid body weight"); } @@ -432,7 +432,7 @@ bool actor::is_constricting() const bool actor::is_constricted() const { - return (constricted_by); + return constricted_by; } void actor::accum_has_constricted() diff --git a/crawl-ref/source/actor.h b/crawl-ref/source/actor.h index 5002a6fab8..bee02b83f0 100644 --- a/crawl-ref/source/actor.h +++ b/crawl-ref/source/actor.h @@ -161,7 +161,7 @@ public: virtual bool fights_well_unarmed(int heavy_armour_penalty) { - return (true); + return true; } // Returns true if the actor has no way to attack (plants, statues). // (statues have only indirect attacks). @@ -306,7 +306,7 @@ public: virtual bool cannot_act() const = 0; virtual bool confused() const = 0; virtual bool caught() const = 0; - virtual bool asleep() const { return (false); } + virtual bool asleep() const { return false; } // check_haloed: include halo // self_halo: include own halo (actually if self_halo = false diff --git a/crawl-ref/source/areas.cc b/crawl-ref/source/areas.cc index 066af6b8b4..1e98b332a8 100644 --- a/crawl-ref/source/areas.cc +++ b/crawl-ref/source/areas.cc @@ -253,7 +253,7 @@ coord_def find_centre_for(const coord_def& f, area_centre_type at) continue; if (a.centre == f) - return (f); + return f; int d = distance(a.centre, f); if (d <= a.radius && (d <= dist || dist == 0)) @@ -263,7 +263,7 @@ coord_def find_centre_for(const coord_def& f, area_centre_type at) } } - return (possible); + return possible; } /////////////// @@ -280,7 +280,7 @@ bool remove_sanctuary(bool did_attack) env.sanctuary_time = 0; if (!in_bounds(env.sanctuary_pos)) - return (false); + return false; const int radius = 5; bool seen_change = false; @@ -309,7 +309,7 @@ bool remove_sanctuary(bool did_attack) if (is_resting()) stop_running(); - return (true); + return true; } // For the last (radius) counter turns the sanctuary will slowly shrink. @@ -516,7 +516,7 @@ int monster::silence_radius2() const bool silenced(const coord_def& p) { if (!map_bounds(p)) - return (false); + return false; if (!_agrid_valid) _update_agrid(); return (_check_agrid_flag(p, APROP_SILENCE)); @@ -528,7 +528,7 @@ bool silenced(const coord_def& p) bool haloed(const coord_def& p) { if (!map_bounds(p)) - return (false); + return false; if (!_agrid_valid) _update_agrid(); return (_check_agrid_flag(p, APROP_HALO)); @@ -557,7 +557,7 @@ int player::halo_radius2() const if (player_equip_unrand(UNRAND_BRILLIANCE)) size = std::max(size, 9); - return (size); + return size; } int monster::halo_radius2() const @@ -576,36 +576,36 @@ int monster::halo_radius2() const switch (type) { case MONS_SPIRIT: - return (5); + return 5; case MONS_ANGEL: - return (26); + return 26; case MONS_CHERUB: - return (29); + return 29; case MONS_DAEVA: - return (32); + return 32; case MONS_SERAPH: - return (50); + return 50; case MONS_PEARL_DRAGON: - return (5); + return 5; case MONS_OPHAN: - return (64); // highest rank among sentient ones + return 64; // highest rank among sentient ones case MONS_PHOENIX: - return (10); + return 10; case MONS_SHEDU: - return (10); + return 10; case MONS_APIS: - return (4); + return 4; case MONS_PALADIN: // If a paladin finds the mace of brilliance // it needs a larger halo return (std::max(4, size)); // mere humans case MONS_BLESSED_TOE: - return (17); + return 17; case MONS_SILVER_STAR: - return (40); // dumb but with an immense power + return 40; // dumb but with an immense power case MONS_HOLY_SWINE: - return (1); // only notionally holy + return 1; // only notionally holy default: - return (4); + return 4; } } @@ -632,7 +632,7 @@ int monster::liquefying_radius2() const bool liquefied(const coord_def& p, bool check_actual) { if (!map_bounds(p)) - return (false); + return false; if (!_agrid_valid) _update_agrid(); @@ -656,7 +656,7 @@ bool liquefied(const coord_def& p, bool check_actual) bool orb_haloed(const coord_def& p) { if (!map_bounds(p)) - return (false); + return false; if (!_agrid_valid) _update_agrid(); @@ -670,7 +670,7 @@ bool orb_haloed(const coord_def& p) bool umbraed(const coord_def& p) { if (!map_bounds(p)) - return (false); + return false; if (!_agrid_valid) _update_agrid(); @@ -697,7 +697,7 @@ int monster::umbra_radius2() const switch (type) { case MONS_PROFANE_SERVITOR: - return (40); // Very unholy! + return 40; // Very unholy! default: return (-1); } @@ -709,7 +709,7 @@ int monster::umbra_radius2() const bool suppressed(const coord_def& p) { if (!map_bounds(p)) - return (false); + return false; if (!_agrid_valid) _update_agrid(); @@ -719,7 +719,7 @@ bool suppressed(const coord_def& p) int monster::suppression_radius2() const { if (type == MONS_MOTH_OF_SUPPRESSION) - return (150); + return 150; else return (-1); } diff --git a/crawl-ref/source/arena.cc b/crawl-ref/source/arena.cc index 9849e188f3..c787d295a9 100644 --- a/crawl-ref/source/arena.cc +++ b/crawl-ref/source/arena.cc @@ -284,7 +284,7 @@ namespace arena std::string find_monster_spec() { if (!teams.empty()) - return (teams); + return teams; else return ("random v random"); } @@ -574,7 +574,7 @@ namespace arena faction_a.won = false; faction_b.won = false; } - return (true); + return true; } // Sync up our book-keeping with the actual state, and report @@ -1052,7 +1052,7 @@ monster_type arena_pick_random_monster(const level_id &place, int power, } if (!arena::cycle_random) - return (RANDOM_MONSTER); + return RANDOM_MONSTER; for (int tries = 0; tries <= NUM_MONSTERS; tries++) { @@ -1072,19 +1072,19 @@ monster_type arena_pick_random_monster(const level_id &place, int power, game_ended_with_error( make_stringf("No random monsters for place '%s'", arena::place.describe().c_str())); - return (NUM_MONSTERS); + return NUM_MONSTERS; } bool arena_veto_random_monster(monster_type type) { if (!arena::allow_immobile && mons_class_is_stationary(type)) - return (true); + return true; if (!arena::allow_zero_xp && mons_class_flag(type, M_NO_EXP_GAIN)) - return (true); + return true; if (!(mons_char(type) & !127) && arena::banned_glyphs[mons_char(type)]) - return (true); + return true; - return (false); + return false; } bool arena_veto_place_monster(const mgen_data &mg, bool first_band_member, @@ -1098,12 +1098,12 @@ bool arena_veto_place_monster(const mgen_data &mg, bool first_band_member, if (mg.behaviour == BEH_FRIENDLY && arena::faction_a.active_members > arena::summon_throttle) { - return (true); + return true; } else if (mg.behaviour == BEH_HOSTILE && arena::faction_b.active_members > arena::summon_throttle) { - return (true); + return true; } } @@ -1389,7 +1389,7 @@ int arena_cull_items() { dprf("On turn #%d culled %d items dropped by monsters, done.", arena::turns, cull_count); - return (first_avail); + return first_avail; } dprf("On turn #%d culled %d items dropped by monsters, culling some more.", @@ -1409,12 +1409,12 @@ int arena_cull_items() { dprf("Culled %d (probably) ammo items, done.", cull_count - count1); - return (first_avail); + return first_avail; } dprf("Culled %d items total, short of target %d.", cull_count, cull_target); - return (first_avail); + return first_avail; } // arena_cull_items ///////////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/art-func.h b/crawl-ref/source/art-func.h index 227ff10810..f5bcd12f37 100644 --- a/crawl-ref/source/art-func.h +++ b/crawl-ref/source/art-func.h @@ -70,7 +70,7 @@ static void _ASMODEUS_melee_effect(item_def* weapon, actor* attacker, static bool _evoke_sceptre_of_asmodeus() { if (!x_chance_in_y(you.skill(SK_EVOCATIONS, 100), 3000)) - return (false); + return false; const monster_type mon = random_choose_weighted( 3, MONS_EFREET, @@ -100,7 +100,7 @@ static bool _evoke_sceptre_of_asmodeus() else mpr("The air shimmers briefly."); - return (true); + return true; } @@ -114,7 +114,7 @@ static bool _ASMODEUS_evoke(item_def *item, int* pract, bool* did_work, *pract = 1; } - return (false); + return false; } //////////////////////////////////////////////////// @@ -188,7 +188,7 @@ static bool _DISPATER_evoke(item_def *item, int* pract, bool* did_work, if (your_spells(SPELL_HELLFIRE, power, false) == SPRET_ABORT) { *unevokable = true; - return (false); + return false; } mpr("You feel the staff feeding on your energy!"); @@ -197,7 +197,7 @@ static bool _DISPATER_evoke(item_def *item, int* pract, bool* did_work, make_hungry(100, false, true); *pract = (coinflip() ? 2 : 1); - return (false); + return false; } //////////////////////////////////////////////////// @@ -242,11 +242,11 @@ static bool _OLGREB_evoke(item_def *item, int* pract, bool* did_work, if (!enough_mp(4, false)) { *unevokable = true; - return (true); + return true; } if (!x_chance_in_y(you.skill(SK_EVOCATIONS, 100) + 100, 600)) - return (false); + return false; dec_mp(4); make_hungry(50, false, true); @@ -260,7 +260,7 @@ static bool _OLGREB_evoke(item_def *item, int* pract, bool* did_work, if (x_chance_in_y(you.skill(SK_EVOCATIONS, 100) + 100, 1000)) your_spells(SPELL_VENOM_BOLT, power, false); - return (false); + return false; } static void _OLGREB_melee_effect(item_def* weapon, actor* attacker, @@ -462,12 +462,12 @@ static bool _WUCAD_MU_evoke(item_def *item, int* pract, bool* did_work, } if (!x_chance_in_y(you.skill(SK_EVOCATIONS, 100) + 100, 2500)) - return (false); + return false; if (one_chance_in(4)) { _wucad_miscast(&you, random2(9), random2(70)); - return (false); + return false; } mpr("Magical energy flows into your mind!"); @@ -478,7 +478,7 @@ static bool _WUCAD_MU_evoke(item_def *item, int* pract, bool* did_work, *pract = 1; *did_work = true; - return (false); + return false; } /////////////////////////////////////////////////// diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc index 0666aa093a..5669d0130f 100644 --- a/crawl-ref/source/artefact.cc +++ b/crawl-ref/source/artefact.cc @@ -38,11 +38,11 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item, bool name_check_only = false) { if (which_god == GOD_NO_GOD) - return (false); + return false; // Jellies can't eat artefacts, so their god won't make any. if (which_god == GOD_JIYVA) - return (false); + return false; // First check the item's base_type and sub_type, then check the // item's brand and other randart properties. @@ -112,13 +112,13 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item, } if (type_bad) - return (false); + return false; const int brand = get_weapon_brand(item); const int ego = get_armour_ego_type(item); if (is_evil_god(which_god) && brand == SPWPN_HOLY_WRATH) - return (false); + return false; else if (is_good_god(which_god) && (brand == SPWPN_DRAINING || brand == SPWPN_PAIN @@ -128,7 +128,7 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item, || is_demonic(item) || artefact_wpn_property(item, ARTP_CURSED) != 0)) { - return (false); + return false; } switch (which_god) @@ -136,7 +136,7 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item, case GOD_BEOGH: // Orc god: no orc slaying. if (brand == SPWPN_ORC_SLAYING) - return (false); + return false; break; case GOD_ELYVILON: @@ -144,87 +144,87 @@ static bool _god_fits_artefact(const god_type which_god, const item_def &item, if (artefact_wpn_property(item, ARTP_ANGRY) || artefact_wpn_property(item, ARTP_BERSERK)) { - return (false); + return false; } break; case GOD_ZIN: // Lawful god: no mutagenics. if (artefact_wpn_property(item, ARTP_MUTAGENIC)) - return (false); + return false; break; case GOD_SHINING_ONE: // Crusader god: holiness, honourable combat. if (item.base_type == OBJ_WEAPONS && brand != SPWPN_HOLY_WRATH) - return (false); + return false; if (artefact_wpn_property(item, ARTP_INVISIBLE) || artefact_wpn_property(item, ARTP_STEALTH) > 0) { - return (false); + return false; } break; case GOD_LUGONU: // Abyss god: corruption. if (item.base_type == OBJ_WEAPONS && brand != SPWPN_DISTORTION) - return (false); + return false; break; case GOD_KIKUBAAQUDGHA: // Necromancy god. if (item.base_type == OBJ_WEAPONS && brand != SPWPN_PAIN) - return (false); + return false; case GOD_SIF_MUNA: case GOD_VEHUMET: // The magic gods: no preventing spellcasting. if (artefact_wpn_property(item, ARTP_PREVENT_SPELLCASTING)) - return (false); + return false; break; case GOD_TROG: // Anti-magic god: no spell use, no enhancing magic. if (brand == SPWPN_PAIN) // Pain involves necromantic spell use. - return (false); + return false; if (artefact_wpn_property(item, ARTP_MAGICAL_POWER)) - return (false); + return false; break; case GOD_FEDHAS: // Fedhas forbids necromancy involving corpses, only reaping // really applies. if (brand == SPWPN_REAPING) - return (false); + return false; break; case GOD_CHEIBRIADOS: // Slow god: no speed, no berserking. if (brand == SPWPN_SPEED) - return (false); + return false; if (ego == SPARM_RUNNING) - return (false); + return false; if (artefact_wpn_property(item, ARTP_ANGRY) || artefact_wpn_property(item, ARTP_BERSERK)) { - return (false); + return false; } break; case GOD_ASHENZARI: // Cursed god: no holy wrath (since that brand repels curses). if (brand == SPWPN_HOLY_WRATH) - return (false); + return false; break; default: break; } - return (true); + return true; } std::string replace_name_parts(const std::string &name_in, const item_def& item) @@ -312,7 +312,7 @@ static unrandart_entry *_seekunrandart(const item_def &item); bool is_known_artefact(const item_def &item) { if (!item_type_known(item)) - return (false); + return false; return (is_artefact(item)); } @@ -663,18 +663,18 @@ static int _need_bonus_stat_props(const artefact_properties_t &proprt) else if (i >= ARTP_ACCURACY && i <= ARTP_DAMAGE) num_acc_dam++; else - return (0); + return 0; } num_stats += num_acc_dam; // If an artefact has no properties at all, something is wrong. if (num_stats == 0) - return (2); + return 2; // Artefacts with two of more stat-only properties are fine. if (num_stats >= 2) - return (0); + return 0; // If an artefact has exactly one stat property, we might want to add // some more. (66% chance if it's Acc/Dam, else always.) @@ -1142,11 +1142,11 @@ static bool _redo_book(item_def &book) } if (num_spells <= 5 && num_unknown == 0) - return (true); + return true; else if (num_spells > 5 && num_unknown <= 1) - return (true); + return true; - return (false); + return false; } static bool _init_artefact_book(item_def &book) @@ -1184,7 +1184,7 @@ static bool _init_artefact_book(item_def &book) break; } - return (book_good); + return book_good; } static bool _init_artefact_properties(item_def &item) @@ -1202,7 +1202,7 @@ static bool _init_artefact_properties(item_def &item) for (int i = 0; i < ART_PROPERTIES; i++) rap[i] = static_cast<short>(unrand->prpty[i]); - return (true); + return true; } if (item.base_type == OBJ_BOOKS) @@ -1221,7 +1221,7 @@ static bool _init_artefact_properties(item_def &item) rap[i] = static_cast<short>(prop[i]); } - return (true); + return true; } void artefact_wpn_properties(const item_def &item, @@ -1314,7 +1314,7 @@ int artefact_known_wpn_property(const item_def &item, if (known[prop]) return (proprt[prop]); else - return (0); + return 0; } static int _artefact_num_props(const artefact_properties_t &proprt) @@ -1386,7 +1386,7 @@ static bool _pick_db_name(const item_def &item) case OBJ_JEWELLERY: return one_chance_in(5); default: - return (false); + return false; } } @@ -1462,7 +1462,7 @@ std::string make_artefact_name(const item_def &item, bool appearance) result += appear; result += " "; result += item_base_name(item); - return (result); + return result; } if (_pick_db_name(item)) @@ -1611,7 +1611,7 @@ int find_okay_unrandart(uint8_t aclass, uint8_t atype, bool in_abyss) ret = index; } - return (ret); + return ret; } int get_unrandart_num(const char *name) @@ -1637,7 +1637,7 @@ static bool _randart_is_redundant(const item_def &item, artefact_properties_t &proprt) { if (item.base_type != OBJ_JEWELLERY) - return (false); + return false; artefact_prop_type provides = ARTP_NUM_PROPERTIES; artefact_prop_type provides2 = ARTP_NUM_PROPERTIES; @@ -1729,18 +1729,18 @@ static bool _randart_is_redundant(const item_def &item, } if (provides == ARTP_NUM_PROPERTIES) - return (false); + return false; if (proprt[provides] != 0) - return (true); + return true; if (provides2 == ARTP_NUM_PROPERTIES) - return (false); + return false; if (proprt[provides2] != 0) - return (true); + return true; - return (false); + return false; } static bool _randart_is_conflicting(const item_def &item, @@ -1751,11 +1751,11 @@ static bool _randart_is_conflicting(const item_def &item, && (is_demonic(item) || proprt[ARTP_CURSED] != 0)) { - return (true); + return true; } if (item.base_type != OBJ_JEWELLERY) - return (false); + return false; if (item.sub_type == AMU_STASIS && (proprt[ARTP_BLINK] != 0 @@ -1763,11 +1763,11 @@ static bool _randart_is_conflicting(const item_def &item, || proprt[ARTP_ANGRY] != 0 || proprt[ARTP_BERSERK] != 0)) { - return (true); + return true; } if (item.sub_type == RING_WIZARDRY && proprt[ARTP_INTELLIGENCE] < 0) - return (true); + return true; artefact_prop_type conflicts = ARTP_NUM_PROPERTIES; @@ -1799,28 +1799,28 @@ static bool _randart_is_conflicting(const item_def &item, } if (conflicts == ARTP_NUM_PROPERTIES) - return (false); + return false; if (proprt[conflicts] != 0) - return (true); + return true; - return (false); + return false; } bool randart_is_bad(const item_def &item, artefact_properties_t &proprt) { if (item.base_type == OBJ_BOOKS) - return (false); + return false; if (_artefact_num_props(proprt) == 0) - return (true); + return true; // Weapons must have a brand and at least one other property. if (item.base_type == OBJ_WEAPONS && (proprt[ARTP_BRAND] == SPWPN_NORMAL || _artefact_num_props(proprt) < 2)) { - return (true); + return true; } return (_randart_is_redundant(item, proprt) @@ -1867,7 +1867,7 @@ bool make_item_randart(item_def &item, bool force_mundane) && item.base_type != OBJ_JEWELLERY && item.base_type != OBJ_BOOKS) { - return (false); + return false; } if (item.base_type == OBJ_BOOKS) @@ -1875,21 +1875,21 @@ bool make_item_randart(item_def &item, bool force_mundane) if (item.sub_type != BOOK_RANDART_LEVEL && item.sub_type != BOOK_RANDART_THEME) { - return (false); + return false; } } // This item already is a randart. if (item.flags & ISFLAG_RANDART) - return (true); + return true; // Not a truly random artefact. if (item.flags & ISFLAG_UNRANDART) - return (false); + return false; // Mundane items are much less likely to be artefacts. if (!force_mundane && item.is_mundane() && !one_chance_in(5)) - return (false); + return false; _artefact_setup_prop_vectors(item); item.flags |= ISFLAG_RANDART; @@ -1908,7 +1908,7 @@ bool make_item_randart(item_def &item, bool force_mundane) item.props.erase(ARTEFACT_PROPS_KEY); item.props.erase(KNOWN_PROPS_KEY); item.flags &= ~ISFLAG_RANDART; - return (false); + return false; } } while (randart_is_bad(item) @@ -1927,7 +1927,7 @@ bool make_item_randart(item_def &item, bool force_mundane) item.props[ARTEFACT_APPEAR_KEY].get_string() = make_artefact_name(item, true); - return (true); + return true; } static void _make_faerie_armour(item_def &item) @@ -2050,7 +2050,7 @@ bool make_item_unrandart(item_def &item, int unrand_index) add_autoinscription(item); } - return (true); + return true; } void unrand_reacts() diff --git a/crawl-ref/source/attack.cc b/crawl-ref/source/attack.cc index f8f6d9abe7..b2c725ad40 100644 --- a/crawl-ref/source/attack.cc +++ b/crawl-ref/source/attack.cc @@ -233,7 +233,7 @@ std::string attack::wep_name(description_level_type desc, iflags_t ignre_flags) name += weapon->name(DESC_PLAIN, false, false, false, false, ignre_flags); - return (name); + return name; } /* TODO: Remove this! diff --git a/crawl-ref/source/attitude-change.cc b/crawl-ref/source/attitude-change.cc index ea35f1c04a..34373da50f 100644 --- a/crawl-ref/source/attitude-change.cc +++ b/crawl-ref/source/attitude-change.cc @@ -170,7 +170,7 @@ bool make_god_gifts_disappear() } } - return (count); + return count; } // When under penance, Yredelemnulites can lose all nearby undead slaves. @@ -216,10 +216,10 @@ bool yred_slaves_abandon_you() simple_god_message(" reclaims your granted undead slaves!"); else simple_god_message(" reclaims some of your granted undead slaves!"); - return (true); + return true; } - return (false); + return false; } // When under penance, Beoghites can lose all nearby orcish followers, @@ -289,10 +289,10 @@ bool beogh_followers_abandon_you() chan << std::endl; - return (true); + return true; } - return (false); + return false; } static void _print_good_god_holy_being_speech(bool neutral, diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 4f8cf65c91..9d30568afb 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -129,19 +129,19 @@ void bolt::emit_message(msg_channel_type chan, const char* m) kill_category bolt::whose_kill() const { if (YOU_KILL(thrower)) - return (KC_YOU); + return KC_YOU; else if (MON_KILL(thrower)) { if (beam_source == ANON_FRIENDLY_MONSTER) - return (KC_FRIENDLY); + return KC_FRIENDLY; if (!invalid_monster_index(beam_source)) { const monster* mon = &menv[beam_source]; if (mon->friendly()) - return (KC_FRIENDLY); + return KC_FRIENDLY; } } - return (KC_OTHER); + return KC_OTHER; } // A simple animated flash from Rupert Smith (expanded to be more @@ -272,7 +272,7 @@ bool player_tracer(zap_type ztype, int power, bolt &pbolt, int range) // Non-controlleable during confusion. // (We'll shoot in a different direction anyway.) if (you.confused()) - return (true); + return true; _zappy(ztype, power, pbolt); pbolt.name = "unimportant"; @@ -316,12 +316,12 @@ bool player_tracer(zap_type ztype, int power, bolt &pbolt, int range) dprf("%s", "Beam cancelled."); canned_msg(MSG_OK); you.turn_is_over = false; - return (false); + return false; } // Set to non-tracing for actual firing. pbolt.is_tracer = false; - return (true); + return true; } template<typename T> @@ -403,7 +403,7 @@ void init_zap_index() static const zap_info* _seek_zap(zap_type z_type) { if (zap_index[z_type] == -1) - return (NULL); + return NULL; else return (&zap_data[zap_index[z_type]]); } @@ -500,23 +500,23 @@ bool bolt::actor_wall_shielded(const actor *act) const bool bolt::can_affect_wall_actor(const actor *act) const { if (!can_affect_actor(act)) - return (false); + return false; if (is_enchantment()) - return (true); + return true; const bool superconductor = (grd(act->pos()) == DNGN_METAL_WALL && flavour == BEAM_ELECTRICITY); if (actor_wall_shielded(act) && !superconductor) - return (false); + return false; if (!is_explosion && !is_big_cloud) - return (true); + return true; if (is_bouncy(grd(act->pos()))) - return (false); + return false; - return (false); + return false; } static beam_type _chaos_beam_flavour() @@ -545,7 +545,7 @@ static beam_type _chaos_beam_flavour() 2, BEAM_ENSNARE, 0); - return (flavour); + return flavour; } static void _munge_bounced_bolt(bolt &old_bolt, bolt &new_bolt, @@ -961,10 +961,10 @@ static bool _nuke_wall_msg(dungeon_feature_type feat, const coord_def& p) if (!msg.empty()) { mpr(msg, chan); - return (true); + return true; } else - return (false); + return false; } void bolt::nuke_wall_effect() @@ -1115,7 +1115,7 @@ bool bolt::hit_wall() { beam_cancelled = true; finish_beam(); - return (false); + return false; } // Well, we warned them. @@ -1152,10 +1152,10 @@ bool bolt::hit_wall() } finish_beam(); - return (true); + return true; } - return (false); + return false; } void bolt::affect_cell() @@ -1217,7 +1217,7 @@ bool bolt::apply_hit_funcs(actor* victim, int dmg) for (unsigned int i = 0; i < hit_funcs.size(); ++i) affected = (*hit_funcs[i])(*this, victim, dmg) || affected; - return (affected); + return affected; } bool bolt::apply_dmg_funcs(actor* victim, int &dmg, @@ -1228,11 +1228,11 @@ bool bolt::apply_dmg_funcs(actor* victim, int &dmg, std::string dmg_msg; if ((*damage_funcs[i])(*this, victim, dmg, dmg_msg)) - return (false); + return false; if (!dmg_msg.empty()) messages.push_back(dmg_msg); } - return (true); + return true; } static void _undo_tracer(bolt &orig, bolt ©) @@ -1608,7 +1608,7 @@ int mons_adjust_flavoured(monster* mons, bolt &pbolt, int hurted, { // Early out if no side effects. if (!doFlavouredEffects) - return (hurted); + return hurted; if (mons->observable()) pbolt.obvious_effect = true; @@ -1632,7 +1632,7 @@ int mons_adjust_flavoured(monster* mons, bolt &pbolt, int hurted, { // Early out for tracer/no side effects. if (!doFlavouredEffects) - return (hurted); + return hurted; miasma_monster(mons, pbolt.agent()); @@ -1811,7 +1811,7 @@ int mons_adjust_flavoured(monster* mons, bolt &pbolt, int hurted, break; } - return (hurted); + return hurted; } static bool _monster_resists_mass_enchantment(monster* mons, @@ -1823,10 +1823,10 @@ static bool _monster_resists_mass_enchantment(monster* mons, if (wh_enchant == ENCH_CHARM) { if (mons->friendly()) - return (true); + return true; if (mons->holiness() != MH_UNDEAD) - return (true); + return true; int res_margin = mons->check_res_magic(pow); if (res_margin > 0) @@ -1836,14 +1836,14 @@ static bool _monster_resists_mass_enchantment(monster* mons, { *did_msg = true; } - return (true); + return true; } } else if (wh_enchant == ENCH_CONFUSION && mons->check_clarity(false)) { *did_msg = true; - return (true); + return true; } else if (wh_enchant == ENCH_CONFUSION || mons->holiness() == MH_NATURAL) @@ -1851,13 +1851,13 @@ static bool _monster_resists_mass_enchantment(monster* mons, if (wh_enchant == ENCH_CONFUSION && !mons_class_is_confusable(mons->type)) { - return (true); + return true; } if (wh_enchant == ENCH_FEAR && mons->friendly()) { - return (true); + return true; } int res_margin = mons->check_res_magic(pow); @@ -1868,23 +1868,23 @@ static bool _monster_resists_mass_enchantment(monster* mons, { *did_msg = true; } - return (true); + return true; } } // Mass enchantments around lots of plants/fungi shouldn't cause a flood // of "is unaffected" messages. --Eino else if (mons_is_firewood(mons)) - return (true); + return true; else // trying to enchant an unnatural creature doesn't work { if (simple_monster_message(mons, " is unaffected.")) *did_msg = true; - return (true); + return true; } // If monster was affected, then there was a message. *did_msg = true; - return (false); + return false; } // Enchants all monsters in player's sight. @@ -1994,10 +1994,10 @@ void bolt::apply_bolt_petrify(monster* mons) static bool _curare_hits_monster(actor *agent, monster* mons, int levels) { if (!mons->alive()) - return (false); + return false; if (mons->res_poison() > 0) - return (false); + return false; poison_monster(mons, agent, levels, false); @@ -2030,11 +2030,11 @@ bool poison_monster(monster* mons, const actor *who, int levels, bool force, bool verbose) { if (!mons->alive() || levels <= 0) - return (false); + return false; int res = mons->res_poison(); if (res >= (force ? 3 : 1)) - return (false); + return false; const mon_enchant old_pois = mons->get_ench(ENCH_POISON); mons->add_ench(mon_enchant(ENCH_POISON, levels, who)); @@ -2064,10 +2064,10 @@ bool poison_monster(monster* mons, const actor *who, int levels, bool miasma_monster(monster* mons, const actor* who) { if (!mons->alive()) - return (false); + return false; if (mons->res_rotting()) - return (false); + return false; bool success = poison_monster(mons, who); @@ -2094,7 +2094,7 @@ bool miasma_monster(monster* mons, const actor* who) success = true; } - return (success); + return success; } // Actually napalms a monster (with message). @@ -2102,10 +2102,10 @@ bool napalm_monster(monster* mons, const actor *who, int levels, bool verbose) { if (!mons->alive()) - return (false); + return false; if (mons->res_sticky_flame() || levels <= 0) - return (false); + return false; const mon_enchant old_flame = mons->get_ench(ENCH_STICKY_FLAME); mons->add_ench(mon_enchant(ENCH_STICKY_FLAME, levels, who)); @@ -2289,24 +2289,24 @@ static void _imb_explosion(actor *agent, bool bolt::is_bouncy(dungeon_feature_type feat) const { if (real_flavour == BEAM_CHAOS && feat_is_solid(feat)) - return (true); + return true; if (is_enchantment()) - return (false); + return false; if (flavour == BEAM_ELECTRICITY && feat != DNGN_METAL_WALL && feat != DNGN_TREE && feat != DNGN_MANGROVE) { - return (true); + return true; } if ((flavour == BEAM_FIRE || flavour == BEAM_COLD) && feat == DNGN_GREEN_CRYSTAL_WALL) { - return (true); + return true; } - return (false); + return false; } static int _potion_beam_flavour_to_colour(beam_type flavour) @@ -2314,18 +2314,18 @@ static int _potion_beam_flavour_to_colour(beam_type flavour) switch (flavour) { case BEAM_POTION_MEPHITIC: - return (GREEN); + return GREEN; case BEAM_POTION_POISON: return (coinflip() ? GREEN : LIGHTGREEN); case BEAM_POTION_MIASMA: case BEAM_POTION_BLACK_SMOKE: - return (DARKGREY); + return DARKGREY; case BEAM_POTION_STEAM: case BEAM_POTION_GREY_SMOKE: - return (LIGHTGREY); + return LIGHTGREY; case BEAM_POTION_FIRE: return (coinflip() ? RED : LIGHTRED); @@ -2334,10 +2334,10 @@ static int _potion_beam_flavour_to_colour(beam_type flavour) return (coinflip() ? BLUE : LIGHTBLUE); case BEAM_POTION_BLUE_SMOKE: - return (LIGHTBLUE); + return LIGHTBLUE; case BEAM_POTION_PURPLE_SMOKE: - return (MAGENTA); + return MAGENTA; case BEAM_POTION_RANDOM: default: @@ -2572,7 +2572,7 @@ bool bolt::is_fiery() const bool bolt::is_superhot() const { if (!is_fiery() && flavour != BEAM_ELECTRICITY) - return (false); + return false; return (name == "bolt of fire" || name == "bolt of magma" @@ -2590,7 +2590,7 @@ maybe_bool bolt::affects_wall(dungeon_feature_type wall) const || wall == DNGN_SLIMY_WALL || wall == DNGN_GRATE || wall == DNGN_SECRET_DOOR)) { - return (B_TRUE); + return B_TRUE; } if (is_fiery() && feat_is_tree(wall)) @@ -2614,15 +2614,15 @@ maybe_bool bolt::affects_wall(dungeon_feature_type wall) const || wall == DNGN_DETECTED_SECRET_DOOR || wall == DNGN_SECRET_DOOR) { - return (B_TRUE); + return B_TRUE; } } // Lee's Rapid Deconstruction if (flavour == BEAM_FRAG) - return (B_TRUE); // smite targetting, we don't care + return B_TRUE; // smite targetting, we don't care - return (B_FALSE); + return B_FALSE; } void bolt::affect_place_clouds() @@ -2844,7 +2844,7 @@ bool bolt::fuzz_invis_tracer() // No, ditch this. if (dist > 2) - return (false); + return false; const actor *beam_src = beam_source_as_target(); if (beam_src && beam_src->is_monster() @@ -2862,7 +2862,7 @@ bool bolt::fuzz_invis_tracer() target = newtarget; // Fire away! - return (true); + return true; } // A first step towards to-hit sanity for beams. We're still being @@ -2872,7 +2872,7 @@ static bool _test_beam_hit(int attack, int defence, bool is_beam, int defl, defer_rand &r) { if (attack == AUTOMATIC_HIT) - return (true); + return true; if (is_beam) { @@ -2916,7 +2916,7 @@ bool bolt::is_harmless(const monster* mon) const { case BEAM_VISUAL: case BEAM_DIGGING: - return (true); + return true; case BEAM_HOLY: return (mon->res_holy_energy(agent()) > 0); @@ -2949,7 +2949,7 @@ bool bolt::is_harmless(const monster* mon) const return (mon->res_petrify() || mon->petrified()); default: - return (false); + return false; } } @@ -2961,13 +2961,13 @@ bool bolt::harmless_to_player() const { case BEAM_VISUAL: case BEAM_DIGGING: - return (true); + return true; // Positive enchantments. case BEAM_HASTE: case BEAM_HEALING: case BEAM_INVISIBILITY: - return (true); + return true; case BEAM_HOLY: return (is_good_god(you.religion)); @@ -2995,20 +2995,20 @@ bool bolt::harmless_to_player() const case BEAM_COLD: case BEAM_ACID: // Fire and ice can destroy inventory items, acid damage equipment. - return (false); + return false; case BEAM_PETRIFY: return (you.res_petrify() > 0 || you.petrified()); default: - return (false); + return false; } } bool bolt::is_reflectable(const item_def *it) const { if (range_used() > range) - return (false); + return false; return (it && is_shield(*it) && shield_reflects(*it)); } @@ -3016,9 +3016,9 @@ bool bolt::is_reflectable(const item_def *it) const coord_def bolt::leg_source() const { if (bounces > 0 && map_bounds(bounce_pos)) - return (bounce_pos); + return bounce_pos; else - return (source); + return source; } // Reflect a beam back the direction it came. This is used @@ -3105,7 +3105,7 @@ void bolt::tracer_affect_player() bool bolt::misses_player() { if (is_explosion || aimed_at_feet || auto_hit || is_enchantment()) - return (false); + return false; const int dodge = player_evasion(); const int dodge_less = player_evasion(EV_IGNORE_PHASESHIFT); @@ -3156,7 +3156,7 @@ bool bolt::misses_player() finish_beam(); } you.shield_block_succeeded(agent()); - return (true); + return true; } // Some training just for the "attempt". @@ -3207,7 +3207,7 @@ bool bolt::misses_player() if (train_shields_more) practise(EX_SHIELD_BEAM_FAIL); - return (miss); + return miss; } void bolt::affect_player_enchantment() @@ -3849,7 +3849,7 @@ bool bolt::determine_damage(monster* mon, int& preac, int& postac, int& final, preac = damage.roll(); if (!apply_dmg_funcs(mon, preac, messages)) - return (false); + return false; postac = preac; @@ -3907,7 +3907,7 @@ bool bolt::determine_damage(monster* mon, int& preac, int& postac, int& final, ASSERT(0 <= final); ASSERT(preac > 0 || final == 0); - return (true); + return true; } void bolt::handle_stop_attack_prompt(monster* mon) @@ -4224,7 +4224,7 @@ bool bolt::attempt_block(monster* mon) } } - return (rc); + return rc; } bool bolt::handle_statue_disintegration(monster* mon) @@ -4257,7 +4257,7 @@ bool bolt::handle_statue_disintegration(monster* mon) // Stop here. finish_beam(); } - return (rc); + return rc; } void bolt::affect_monster(monster* mon) @@ -4592,7 +4592,7 @@ void bolt::affect_monster(monster* mon) bool bolt::has_saving_throw() const { if (aimed_at_feet) - return (false); + return false; switch (flavour) { @@ -4603,9 +4603,9 @@ bool bolt::has_saving_throw() const case BEAM_INVISIBILITY: case BEAM_DISPEL_UNDEAD: case BEAM_ENSLAVE_SOUL: // has a different saving throw - return (false); + return false; default: - return (true); + return true; } } @@ -4690,23 +4690,23 @@ bool enchant_monster_invisible(monster* mon, const std::string &how) autotoggle_autopickup(true); } - return (true); + return true; } - return (false); + return false; } mon_resist_type bolt::try_enchant_monster(monster* mon, int &res_margin) { // Early out if the enchantment is meaningless. if (!_ench_flavour_affects_monster(flavour, mon)) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; // Check magic resistance. if (has_saving_throw()) { if (mons_immune_magic(mon)) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; // (Very) ugly things and shapeshifters will never resist // polymorph beams. @@ -4721,7 +4721,7 @@ mon_resist_type bolt::try_enchant_monster(monster* mon, int &res_margin) { res_margin = mon->check_res_magic(ench_power); if (res_margin > 0) - return (MON_RESIST); + return MON_RESIST; } } @@ -4735,27 +4735,27 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) { case BEAM_TELEPORT: if (mon->no_tele()) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; if (mon->observable()) obvious_effect = true; monster_teleport(mon, false); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_BLINK: if (mon->no_tele()) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; if (mon->observable()) obvious_effect = true; monster_blink(mon); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_BLINK_CLOSE: if (mon->no_tele()) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; if (mon->observable()) obvious_effect = true; blink_other_close(mon, source); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_POLYMORPH: if (mon->mutate("polymorph other")) // exact source doesn't matter @@ -4765,7 +4765,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) did_god_conduct(DID_DELIBERATE_MUTATING, 2 + random2(3), effect_known); } - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_BANISH: if (player_in_branch(BRANCH_ABYSS)) @@ -4773,38 +4773,38 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) else mon->banish(agent()); obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_DEGENERATE: if (monster_polymorph(mon, MONS_PULSATING_LUMP)) obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_DISPEL_UNDEAD: if (simple_monster_message(mon, " convulses!")) obvious_effect = true; mon->hurt(agent(), damage.roll()); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_ENSLAVE_SOUL: { dprf("HD: %d; pow: %d", mon->hit_dice, ench_power); if (!mons_can_be_zombified(mon) || mons_intel(mon) < I_NORMAL) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; // The monster can be no more than lightly wounded/damaged. if (mons_get_damage_level(mon) > MDAM_LIGHTLY_DAMAGED) { simple_monster_message(mon, "'s soul is too badly injured."); - return (MON_OTHER); + return MON_OTHER; } obvious_effect = true; const int duration = you.skill_rdiv(SK_INVOCATIONS, 3, 4) + 2; mon->add_ench(mon_enchant(ENCH_SOUL_RIPE, 0, agent(), duration * 10)); simple_monster_message(mon, "'s soul is now ripe for the taking."); - return (MON_AFFECTED); + return MON_AFFECTED; } case BEAM_PAIN: // pain/agony @@ -4815,13 +4815,13 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) mon->hurt(agent(), std::min((mon->hit_points+1)/2, mon->hit_points-1)); else // pain mon->hurt(agent(), damage.roll(), flavour); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_DISINTEGRATION: // disrupt/disintegrate if (simple_monster_message(mon, " is blasted.")) obvious_effect = true; mon->hurt(agent(), damage.roll(), flavour); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_HIBERNATION: if (mon->can_hibernate()) @@ -4829,35 +4829,35 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) if (simple_monster_message(mon, " looks drowsy...")) obvious_effect = true; mon->hibernate(); - return (MON_AFFECTED); + return MON_AFFECTED; } - return (MON_UNAFFECTED); + return MON_UNAFFECTED; case BEAM_CORONA: if (backlight_monsters(mon->pos(), hit, 0)) { obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; } - return (MON_UNAFFECTED); + return MON_UNAFFECTED; case BEAM_SLOW: obvious_effect = do_slow_monster(mon, agent()); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_HASTE: if (YOU_KILL(thrower)) did_god_conduct(DID_HASTY, 6, effect_known); if (mon->check_stasis(false)) - return (MON_AFFECTED); + return MON_AFFECTED; if (mon->del_ench(ENCH_SLOW, true)) { if (simple_monster_message(mon, " is no longer moving slowly.")) obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; } // Not slowed, haste it. @@ -4871,7 +4871,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) obvious_effect = true; } } - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_MIGHT: if (!mon->has_ench(ENCH_MIGHT) @@ -4881,7 +4881,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) if (simple_monster_message(mon, " seems to grow stronger.")) obvious_effect = true; } - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_BERSERK: if (!mon->berserk()) @@ -4891,7 +4891,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) // can't return this from go_berserk, unfortunately obvious_effect = mons_near(mon); } - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_HEALING: if (thrower == KILL_YOU || thrower == KILL_YOU_MISSILE) @@ -4912,29 +4912,29 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) else if (simple_monster_message(mon, " is healed somewhat.")) obvious_effect = true; } - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_PARALYSIS: apply_bolt_paralysis(mon); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_PETRIFY: if (mon->res_petrify()) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; apply_bolt_petrify(mon); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_SPORE: case BEAM_CONFUSION: if (!mons_class_is_confusable(mon->type)) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; if (mon->check_clarity(false)) { if (you.can_see(mon) && !mons_is_lurking(mon)) obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; } if (mon->add_ench(mon_enchant(ENCH_CONFUSION, 0, agent()))) @@ -4944,28 +4944,28 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) if (simple_monster_message(mon, " appears confused.")) obvious_effect = true; } - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_SLEEP: if (mon->has_ench(ENCH_SLEEPY)) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; mon->put_to_sleep(agent(), 0); if (simple_monster_message(mon, " falls asleep!")) obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_INVISIBILITY: { // Mimic or already glowing. if (mons_is_mimic(mon->type) || mon->glows_naturally()) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; if (enchant_monster_invisible(mon, "flickers and vanishes")) obvious_effect = true; - return (MON_AFFECTED); + return MON_AFFECTED; } case BEAM_ENSLAVE: @@ -4973,7 +4973,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) { simple_monster_message(mon, " is repulsed!"); obvious_effect = true; - return (MON_OTHER); + return MON_OTHER; } // Being a puppet on magic strings is a nasty thing. @@ -4988,14 +4988,14 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) if (simple_monster_message(mon, " is charmed.")) obvious_effect = true; mon->add_ench(ENCH_CHARM); - return (MON_AFFECTED); + return MON_AFFECTED; case BEAM_PORKALATOR: { // Monsters which use the ghost structure can't be properly // restored from hog form. if (mons_is_ghost_demon(mon->type)) - return (MON_UNAFFECTED); + return MON_UNAFFECTED; monster orig_mon(*mon); if (monster_polymorph(mon, mon->holiness() == MH_DEMONIC ? @@ -5015,7 +5015,7 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) } - return (MON_AFFECTED); + return MON_AFFECTED; } case BEAM_INNER_FLAME: @@ -5029,13 +5029,13 @@ mon_resist_type bolt::apply_enchantment_to_monster(monster* mon) : " is filled with an inner flame.")) obvious_effect = true; } - return (MON_AFFECTED); + return MON_AFFECTED; default: break; } - return (MON_AFFECTED); + return MON_AFFECTED; } @@ -5072,13 +5072,13 @@ int bolt::range_used_on_hit() const } if (in_explosion_phase) - return (used); + return used; for (unsigned int i = 0; i < range_funcs.size(); ++i) if ((*range_funcs[i])(*this, used)) break; - return (used); + return used; } // Checks whether the beam knocks back the supplied actor. The actor @@ -5321,9 +5321,9 @@ bool bolt::explode(bool show_more, bool hole_in_the_middle) { mprf(MSGCH_GOD, "By Zin's power, the %s is contained.", name.c_str()); - return (true); + return true; } - return (false); + return false; } #ifdef DEBUG_DIAGNOSTICS @@ -5558,15 +5558,15 @@ bool bolt::nasty_to(const monster* mon) const // Take care of other non-enchantments. if (!is_enchantment()) - return (true); + return true; // Now for some non-hurtful enchantments. if (flavour == BEAM_DIGGING) - return (false); + return false; // Positive effects. if (nice_to(mon)) - return (false); + return false; // Friendly and good neutral monsters don't mind being teleported. if (flavour == BEAM_TELEPORT) @@ -5589,7 +5589,7 @@ bool bolt::nasty_to(const monster* mon) const return (!mon->res_negative_energy()); // everything else is considered nasty by everyone - return (true); + return true; } // Return true if the bolt is considered nice by mon. @@ -5609,10 +5609,10 @@ bool bolt::nice_to(const monster* mon) const || flavour == BEAM_HEALING || flavour == BEAM_INVISIBILITY) { - return (true); + return true; } - return (false); + return false; } //////////////////////////////////////////////////////////////////////////// @@ -5650,7 +5650,7 @@ bolt::bolt() : origin_spell(SPELL_NO_SPELL), killer_type bolt::killer() const { if (flavour == BEAM_BANISH) - return (KILL_BANISHED); + return KILL_BANISHED; switch (thrower) { @@ -5661,13 +5661,13 @@ killer_type bolt::killer() const case KILL_MON: case KILL_MON_MISSILE: - return (KILL_MON_MISSILE); + return KILL_MON_MISSILE; case KILL_YOU_CONF: - return (KILL_YOU_CONF); + return KILL_YOU_CONF; default: - return (KILL_MON_MISSILE); + return KILL_MON_MISSILE; } } @@ -5730,7 +5730,7 @@ actor* bolt::agent() const else if (!invalid_monster_index(nominal_source)) return (&menv[nominal_source]); else - return (NULL); + return NULL; } bool bolt::is_enchantment() const @@ -5742,7 +5742,7 @@ bool bolt::is_enchantment() const std::string bolt::get_short_name() const { if (!short_name.empty()) - return (short_name); + return short_name; if (item != NULL && item->defined()) return item->name(DESC_A, false, false, false, false, @@ -5761,7 +5761,7 @@ std::string bolt::get_short_name() const if (flavour == BEAM_NONE || flavour == BEAM_MISSILE || flavour == BEAM_MMISSILE) { - return (name); + return name; } return _beam_type_name(flavour); diff --git a/crawl-ref/source/behold.cc b/crawl-ref/source/behold.cc index 88fdc843fa..5420d3bc73 100644 --- a/crawl-ref/source/behold.cc +++ b/crawl-ref/source/behold.cc @@ -79,8 +79,8 @@ bool player::beheld_by(const monster* mon) const { for (unsigned int i = 0; i < beholders.size(); i++) if (beholders[i] == mon->mindex()) - return (true); - return (false); + return true; + return false; } // Checks whether a beholder keeps you from moving to @@ -94,9 +94,9 @@ monster* player::get_beholder(const coord_def &target) const const int newdist = grid_distance(target, mon->pos()); if (olddist < newdist) - return (mon); + return mon; } - return (NULL); + return NULL; } monster* player::get_any_beholder() const @@ -104,7 +104,7 @@ monster* player::get_any_beholder() const if (!beholders.empty()) return (&menv[beholders[0]]); else - return (NULL); + return NULL; } // Removes a monster from the list of beholders if present. @@ -256,7 +256,7 @@ void player::_removed_beholder() bool player::possible_beholder(const monster* mon) const { if (crawl_state.game_is_arena()) - return (false); + return false; return (mon->alive() && !mon->submerged() && see_cell_no_trans(mon->pos()) && mon->see_cell_no_trans(pos()) diff --git a/crawl-ref/source/bitary.cc b/crawl-ref/source/bitary.cc index c5b31a731b..f6cca8fc11 100644 --- a/crawl-ref/source/bitary.cc +++ b/crawl-ref/source/bitary.cc @@ -69,5 +69,5 @@ bit_array bit_array::operator & (const bit_array& other) const bit_array res = bit_array(size); for (int w = 0; w < nwords; ++w) res.data[w] = data[w] & other.data[w]; - return (res); + return res; } diff --git a/crawl-ref/source/branch.cc b/crawl-ref/source/branch.cc index 69ebd030c9..0fd85b9808 100644 --- a/crawl-ref/source/branch.cc +++ b/crawl-ref/source/branch.cc @@ -60,7 +60,7 @@ branch_type str_to_branch(const std::string &branch, branch_type err) if (branches[i].abbrevname && branches[i].abbrevname == branch) return (static_cast<branch_type>(i)); - return (err); + return err; } int current_level_ambient_noise() diff --git a/crawl-ref/source/chardump.cc b/crawl-ref/source/chardump.cc index 177cedc039..8cfd27adf1 100644 --- a/crawl-ref/source/chardump.cc +++ b/crawl-ref/source/chardump.cc @@ -593,7 +593,7 @@ std::string munge_description(std::string inStr) + "\n"; } - return (outStr); + return outStr; } static void _sdump_messages(dump_params &par) @@ -690,12 +690,12 @@ static bool _dump_item_origin(const item_def &item) #define fs(x) (flags & (x)) const int flags = Options.dump_item_origins; if (flags == IODS_EVERYTHING) - return (true); + return true; if (fs(IODS_ARTEFACTS) && is_artefact(item) && item_ident(item, ISFLAG_KNOW_PROPERTIES)) { - return (true); + return true; } if (fs(IODS_EGO_ARMOUR) && item.base_type == OBJ_ARMOUR && item_type_known(item)) @@ -711,26 +711,26 @@ static bool _dump_item_origin(const item_def &item) } if (fs(IODS_JEWELLERY) && item.base_type == OBJ_JEWELLERY) - return (true); + return true; if (fs(IODS_RUNES) && item.base_type == OBJ_MISCELLANY && item.sub_type == MISC_RUNE_OF_ZOT) { - return (true); + return true; } if (fs(IODS_RODS) && item.base_type == OBJ_RODS) - return (true); + return true; if (fs(IODS_STAVES) && item.base_type == OBJ_STAVES) - return (true); + return true; if (fs(IODS_BOOKS) && item.base_type == OBJ_BOOKS) - return (true); + return true; const int refpr = Options.dump_item_origin_price; if (refpr == -1) - return (false); + return false; return ((int)item_value(item, false) >= refpr); #undef fs } @@ -865,7 +865,7 @@ static std::string spell_type_shortname(int spell_class, bool slash) ret += spelltype_short_name(spell_class); - return (ret); + return ret; } //--------------------------------------------------------------- @@ -1361,7 +1361,7 @@ std::string morgue_directory() if (!dir.empty() && dir[dir.length() - 1] != FILE_SEPARATOR) dir += FILE_SEPARATOR; - return (dir); + return dir; } void dump_map(FILE *fp, bool debug, bool dist) @@ -1470,7 +1470,7 @@ static bool _write_dump(const std::string &fname, dump_params &par, else mprf(MSGCH_ERROR, "Error opening file '%s'", file_name.c_str()); - return (succeeded); + return succeeded; } void display_notes() @@ -1575,7 +1575,7 @@ bool dgl_unknown_timestamp_file(const std::string &filename) fclose(inh); return (file_version != DGL_TIMESTAMP_VERSION); } - return (false); + return false; } // Returns a filehandle to use to write turn timestamps, NULL if diff --git a/crawl-ref/source/cio.cc b/crawl-ref/source/cio.cc index 99c88dec69..cfa61db3e6 100644 --- a/crawl-ref/source/cio.cc +++ b/crawl-ref/source/cio.cc @@ -47,7 +47,7 @@ static keycode_type _numpad2vi(keycode_type key) const char *vikeys = "bjnh.lyku"; return keycode_type(vikeys[key - '1']); } - return (key); + return key; } int unmangle_direction_keys(int keyin, KeymapContext keymap, @@ -100,7 +100,7 @@ int unmangle_direction_keys(int keyin, KeymapContext keymap, #endif } - return (keyin); + return keyin; } // Wrapper around cgotoxy that can draw a fake cursor for Unix terms where @@ -247,7 +247,7 @@ line_reader::~line_reader() std::string line_reader::get_text() const { - return (buffer); + return buffer; } void line_reader::set_input_history(input_history *i) @@ -285,7 +285,7 @@ void line_reader::cursorto(int ncx) int line_reader::read_line(bool clear_previous) { if (bufsz <= 0) - return (false); + return false; cursor_control con(true); @@ -329,7 +329,7 @@ int line_reader::read_line(bool clear_previous) if (crawl_state.seen_hups) { buffer[0] = '\0'; - return (0); + return 0; } if (keyfn) @@ -340,18 +340,18 @@ int line_reader::read_line(bool clear_previous) buffer[length] = 0; if (history && length) history->new_input(buffer); - return (0); + return 0; } else if (whattodo == -1) { buffer[length] = 0; - return (ch); + return ch; } } int ret = process_key(ch); if (ret != -1) - return (ret); + return ret; } } @@ -454,7 +454,7 @@ int line_reader::process_key(int ch) switch (ch) { CASE_ESCAPE - return (CK_ESCAPE); + return CK_ESCAPE; case CK_UP: case CK_DOWN: { @@ -487,7 +487,7 @@ int line_reader::process_key(int ch) buffer[length] = 0; if (history && length) history->new_input(buffer); - return (0); + return 0; case CONTROL('K'): { @@ -612,7 +612,7 @@ c_mouse_event get_mouse_event() c_mouse_event ce = mouse_events.front(); mouse_events.pop(); - return (ce); + return ce; } void new_mouse_event(const c_mouse_event &ce) diff --git a/crawl-ref/source/cio.h b/crawl-ref/source/cio.h index 51ce5a97d5..357404b3b0 100644 --- a/crawl-ref/source/cio.h +++ b/crawl-ref/source/cio.h @@ -100,7 +100,7 @@ struct c_mouse_event // Returns true for valid events. operator bool () const { - return (bstate); + return bstate; } bool left_clicked() const diff --git a/crawl-ref/source/cloud.cc b/crawl-ref/source/cloud.cc index 13bec23cf4..fadbf79981 100644 --- a/crawl-ref/source/cloud.cc +++ b/crawl-ref/source/cloud.cc @@ -157,7 +157,7 @@ static bool _killer_whose_match(kill_category whose, killer_type killer) case KC_NCATEGORIES: die("kill category not matching killer type"); } - return (false); + return false; } #endif @@ -260,7 +260,7 @@ static int _spread_cloud(const cloud_struct &cloud) extra_decay += 8; } - return (extra_decay); + return extra_decay; } static void _spread_fire(const cloud_struct &cloud) @@ -657,7 +657,7 @@ static bool _is_opaque_cloud(cloud_type ctype) bool is_opaque_cloud(int cloud_idx) { if (cloud_idx == EMPTY_CLOUD) - return (false); + return false; return _is_opaque_cloud(env.cloud[cloud_idx].type); } @@ -775,7 +775,7 @@ static int _cloud_base_damage(const actor *act, static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud) { if (is_harmless_cloud(cloud.type)) - return (true); + return true; const bool player = act->is_player(); @@ -785,7 +785,7 @@ static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud) && (cloud.whose == KC_YOU || cloud.whose == KC_FRIENDLY) && (act->as_monster()->friendly() || act->as_monster()->neutral())) { - return (true); + return true; } switch (cloud.type) @@ -813,7 +813,7 @@ static bool _actor_cloud_immune(const actor *act, const cloud_struct &cloud) case CLOUD_PETRIFY: return act->res_petrify() > 0; default: - return (false); + return false; } } @@ -1193,7 +1193,7 @@ bool is_harmless_cloud(cloud_type type) case CLOUD_GLOOM: case CLOUD_INK: case CLOUD_DEBUGGING: - return (true); + return true; default: return (_cloud_is_cosmetic(type)); } @@ -1204,12 +1204,12 @@ bool in_what_cloud(cloud_type type) int cl = env.cgrid(you.pos()); if (env.cgrid(you.pos()) == EMPTY_CLOUD) - return (false); + return false; if (env.cloud[cl].type == type) - return (true); + return true; - return (false); + return false; } std::string cloud_name_at_index(int cloudno) @@ -1270,17 +1270,17 @@ kill_category cloud_struct::killer_to_whose(killer_type _killer) case KILL_YOU: case KILL_YOU_MISSILE: case KILL_YOU_CONF: - return (KC_YOU); + return KC_YOU; case KILL_MON: case KILL_MON_MISSILE: case KILL_MISC: - return (KC_OTHER); + return KC_OTHER; default: die("invalid killer type"); } - return (KC_OTHER); + return KC_OTHER; } killer_type cloud_struct::whose_to_killer(kill_category _whose) @@ -1292,7 +1292,7 @@ killer_type cloud_struct::whose_to_killer(kill_category _whose) case KC_OTHER: return KILL_MISC; case KC_NCATEGORIES: die("invalid kill category"); } - return (KILL_NONE); + return KILL_NONE; } void cloud_struct::set_whose(kill_category _whose) @@ -1457,7 +1457,7 @@ int get_cloud_colour(int cloudno) which_colour = LIGHTGREY; break; } - return (which_colour); + return which_colour; } coord_def get_cloud_originator(const coord_def& pos) diff --git a/crawl-ref/source/clua.cc b/crawl-ref/source/clua.cc index 61ffc76329..bc96451135 100644 --- a/crawl-ref/source/clua.cc +++ b/crawl-ref/source/clua.cc @@ -25,7 +25,7 @@ { \ lua_settop(ls, oldtop); \ } \ - return (retval); \ + return retval; \ } \ while (false) @@ -86,7 +86,7 @@ std::string CLua::setuniqregistry() lua_insert(state(), -2); lua_settable(state(), LUA_REGISTRYINDEX); - return (name); + return name; } void CLua::setregistry(const char *name) @@ -128,20 +128,20 @@ int CLua::file_write(lua_State *ls) if (!lua_islightuserdata(ls, 1)) { luaL_argerror(ls, 1, "Expected filehandle at arg 1"); - return (0); + return 0; } CLuaSave *sf = static_cast<CLuaSave *>(lua_touserdata(ls, 1)); if (!sf) - return (0); + return 0; FILE *f = sf->get_file(); if (!f) - return (0); + return 0; const char *text = luaL_checkstring(ls, 2); if (text) fprintf(f, "%s", text); - return (0); + return 0; } FILE *CLua::CLuaSave::get_file() @@ -149,7 +149,7 @@ FILE *CLua::CLuaSave::get_file() if (!handle) handle = fopen_u(filename, "w"); - return (handle); + return handle; } void CLua::set_error(int err, lua_State *ls) @@ -208,7 +208,7 @@ int CLua::execstring(const char *s, const char *context, int nresults) { int err = 0; if ((err = loadstring(s, context))) - return (err); + return err; lua_State *ls = state(); lua_call_throttle strangler(this); @@ -274,7 +274,7 @@ int CLua::execfile(const char *filename, bool trusted, bool die_on_fail, if (die_on_fail && !error.empty()) end(1, false, "Lua execfile error (%s): %s", filename, dlua.error.c_str()); - return (err); + return err; } bool CLua::runhook(const char *hook, const char *params, ...) @@ -283,7 +283,7 @@ bool CLua::runhook(const char *hook, const char *params, ...) lua_State *ls = state(); if (!ls) - return (false); + return false; // Remember top of stack, for debugging porpoises int stack_top = lua_gettop(ls); @@ -379,7 +379,7 @@ int CLua::push_args(lua_State *ls, const char *format, va_list args, { if (targ) va_copy(*targ, args); - return (0); + return 0; } const char *cs = strchr(format, ':'); @@ -444,13 +444,13 @@ int CLua::push_args(lua_State *ls, const char *format, va_list args, } if (targ) va_copy(*targ, args); - return (argc); + return argc; } int CLua::return_count(lua_State *ls, const char *format) { if (!format) - return (0); + return 0; const char *gs = strchr(format, '>'); if (gs) @@ -467,9 +467,9 @@ int CLua::return_count(lua_State *ls, const char *format) ci = 0; else if (ci > 10) ci = 10; - return (ci); + return ci; } - return (0); + return 0; } bool CLua::calltopfn(lua_State *ls, const char *params, va_list args, @@ -491,7 +491,7 @@ maybe_bool CLua::callmbooleanfn(const char *fn, const char *params, error.clear(); lua_State *ls = state(); if (!ls) - return (B_MAYBE); + return B_MAYBE; int stacktop = lua_gettop(ls); @@ -575,13 +575,13 @@ bool CLua::callfn(const char *fn, const char *params, ...) error.clear(); lua_State *ls = state(); if (!ls) - return (false); + return false; pushglobal(fn); if (!lua_isfunction(ls, -1)) { lua_pop(ls, 1); - return (false); + return false; } va_list args; @@ -596,7 +596,7 @@ bool CLua::callfn(const char *fn, const char *params, ...) } va_end(args); va_end(fnret); - return (ret); + return ret; } bool CLua::callfn(const char *fn, int nargs, int nret) @@ -604,7 +604,7 @@ bool CLua::callfn(const char *fn, int nargs, int nret) error.clear(); lua_State *ls = state(); if (!ls) - return (false); + return false; // If a function is not provided on the stack, get the named function. if (fn) @@ -613,7 +613,7 @@ bool CLua::callfn(const char *fn, int nargs, int nret) if (!lua_isfunction(ls, -1)) { lua_settop(ls, -nargs - 2); - return (false); + return false; } // Slide the function in front of its args and call it. @@ -792,9 +792,9 @@ bool lua_text_pattern::is_lua_pattern(const std::string &s) for (int i = 0, size = ARRAYSZ(pat_ops); i < size; ++i) { if (s.find(pat_ops[i].token) != std::string::npos) - return (true); + return true; } - return (false); + return false; } lua_text_pattern::lua_text_pattern(const std::string &_pattern) @@ -827,7 +827,7 @@ bool lua_text_pattern::matches(const std::string &s) const translate(); if (!isvalid) - return (false); + return false; return clua.callbooleanfn(false, lua_fn_name.c_str(), "s", s.c_str()); } @@ -863,12 +863,12 @@ std::string lua_text_pattern::new_fn_name() bool lua_text_pattern::translate() const { if (translated || !isvalid) - return (false); + return false; if (pattern.find("]]") != std::string::npos || pattern.find("[[") != std::string::npos) { - return (false); + return false; } std::string textp; @@ -947,7 +947,7 @@ static int _clua_panic(lua_State *ls) { save_game(true); } - return (0); + return 0; } static void *_clua_allocator(void *ud, void *ptr, size_t osize, size_t nsize) @@ -958,13 +958,13 @@ static void *_clua_allocator(void *ud, void *ptr, size_t osize, size_t nsize) if (nsize > osize && cl->memory_used >= CLUA_MAX_MEMORY_USE * 1024 && cl->mixed_call_depth) { - return (NULL); + return NULL; } if (!nsize) { free(ptr); - return (NULL); + return NULL; } else return (realloc(ptr, nsize)); @@ -1059,7 +1059,7 @@ static int _clua_loadfile(lua_State *ls) { const char *file = luaL_checkstring(ls, 1); if (!file) - return (0); + return 0; const int err = CLua::loadfile(ls, file, !CLua::is_managed_vm(ls)); if (err) @@ -1067,30 +1067,30 @@ static int _clua_loadfile(lua_State *ls) const int place = lua_gettop(ls); lua_pushnil(ls); lua_insert(ls, place); - return (2); + return 2; } - return (1); + return 1; } static int _clua_require(lua_State *ls) { const char *file = luaL_checkstring(ls, 1); if (!file) - return (0); + return 0; CLua &vm(CLua::get_vm(ls)); if (vm.execfile(file, false, false) != 0) luaL_error(ls, vm.error.c_str()); lua_pushboolean(ls, true); - return (1); + return 1; } static int _clua_dofile(lua_State *ls) { const char *file = luaL_checkstring(ls, 1); if (!file) - return (0); + return 0; const int err = CLua::loadfile(ls, file, !CLua::is_managed_vm(ls)); if (err) diff --git a/crawl-ref/source/cluautil.cc b/crawl-ref/source/cluautil.cc index e5c7819003..e86e264437 100644 --- a/crawl-ref/source/cluautil.cc +++ b/crawl-ref/source/cluautil.cc @@ -94,7 +94,7 @@ void clua_register_metatable(lua_State *ls, const char *tn, int clua_pushcxxstring(lua_State *ls, const std::string &s) { lua_pushstring(ls, s.c_str()); - return (1); + return 1; } int clua_stringtable(lua_State *ls, const std::vector<std::string> &s) @@ -112,5 +112,5 @@ int clua_pushpoint(lua_State *ls, const coord_def &pos) if (!vm.callfn("dgn.point", 2, 1)) luaL_error(ls, "dgn.point(%d,%d) failed: %s", pos.x, pos.y, vm.error.c_str()); - return (1); + return 1; } diff --git a/crawl-ref/source/cluautil.h b/crawl-ref/source/cluautil.h index 1b9511283f..6818decd57 100644 --- a/crawl-ref/source/cluautil.h +++ b/crawl-ref/source/cluautil.h @@ -21,25 +21,25 @@ extern "C" { static int name(lua_State *ls) \ { \ wrapexpr; \ - return (0); \ + return 0; \ } #define PLUARET(type, val) \ { \ lua_push##type(ls, val); \ - return (1); \ + return 1; \ } #define LUARET1(name, type, val) \ static int name(lua_State *ls) \ { \ lua_push##type(ls, val); \ - return (1); \ + return 1; \ } #define LUARET2(name, type, val1, val2) \ static int name(lua_State *ls) \ { \ lua_push##type(ls, val1); \ lua_push##type(ls, val2); \ - return (2); \ + return 2; \ } #define ASSERT_DLUA \ @@ -86,7 +86,7 @@ static int lua_object_gc(lua_State *ls) T **pptr = static_cast<T**>(lua_touserdata(ls, 1)); if (pptr) delete *pptr; - return (0); + return 0; } template <class T> T *clua_new_userdata( @@ -113,7 +113,7 @@ static int dlua_push_object_type(lua_State *ls, const char *meta, const T &data) *ptr = new T(data); else lua_pushnil(ls); - return (1); + return 1; } /* @@ -194,7 +194,7 @@ static int clua_gentable(lua_State *ls, const list &strings, lpush push) push(ls, strings[i]); lua_rawseti(ls, -2, i + 1); } - return (1); + return 1; } int clua_pushcxxstring(lua_State *ls, const std::string &s); diff --git a/crawl-ref/source/colour.cc b/crawl-ref/source/colour.cc index d24a8fdb61..d78c5a6bfd 100644 --- a/crawl-ref/source/colour.cc +++ b/crawl-ref/source/colour.cc @@ -78,7 +78,7 @@ colour_t random_uncommon_colour() result = random_colour(); while (result == LIGHTCYAN || result == CYAN || result == BROWN); - return (result); + return result; } bool is_low_colour(colour_t colour) @@ -96,7 +96,7 @@ colour_t make_low_colour(colour_t colour) if (is_high_colour(colour)) return (colour - 8); - return (colour); + return colour; } colour_t make_high_colour(colour_t colour) @@ -104,7 +104,7 @@ colour_t make_high_colour(colour_t colour) if (is_low_colour(colour)) return (colour + 8); - return (colour); + return colour; } // returns if a colour is one of the special element colours (ie not regular) @@ -587,7 +587,7 @@ int element_colour(int element, bool no_random, const coord_def& loc) { // pass regular colours through for safety. if (!_is_element_colour(element)) - return (element); + return element; // Strip COLFLAGs just in case. element &= 0x007f; @@ -615,7 +615,7 @@ static std::string tile_cols[24] = unsigned int str_to_tile_colour(std::string colour) { if (colour.empty()) - return (0); + return 0; lowercase(colour); @@ -629,9 +629,9 @@ unsigned int str_to_tile_colour(std::string colour) for (unsigned int i = 0; i < 24; i++) { if (tile_cols[i] == colour) - return (i); + return i; } - return (0); + return 0; } #endif @@ -741,26 +741,26 @@ static unsigned short _dos_reverse_brand(unsigned short colour) } } - return (colour); + return colour; } static unsigned short _dos_hilite_brand(unsigned short colour, unsigned short hilite) { if (!hilite) - return (colour); + return colour; if (colour == hilite) colour = 0; colour |= (hilite << 4); - return (colour); + return colour; } static unsigned short _dos_brand(unsigned short colour, unsigned brand) { if ((brand & CHATTR_ATTRMASK) == CHATTR_NORMAL) - return (colour); + return colour; colour &= 0xFF; @@ -791,7 +791,7 @@ static unsigned _colflag2brand(int colflag) case COLFLAG_TRAP_ITEM: return (Options.trap_item_brand); default: - return (CHATTR_NORMAL); + return CHATTR_NORMAL; } } #endif @@ -815,5 +815,5 @@ unsigned real_colour(unsigned raw_colour, const coord_def& loc) } #endif - return (raw_colour); + return raw_colour; } diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 3cb7c5b421..2087c4b153 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -107,7 +107,7 @@ static std::string _get_version_information(void) result += "\n"; - return (result); + return result; } static std::string _get_version_features(void) @@ -122,7 +122,7 @@ static std::string _get_version_features(void) result += "\n"; } - return (result); + return result; } static void _add_file_to_scroller(FILE* fp, formatted_scroller& m, @@ -200,7 +200,7 @@ static std::string _get_version_changes(void) result += "\n\n"; - return (result); + return result; } //#define DEBUG_FILES @@ -619,9 +619,9 @@ static bool _cmdhelp_textfilter(const std::string &tag) { #ifdef WIZARD if (tag == "wiz") - return (true); + return true; #endif - return (false); + return false; } static const char *targetting_help_1 = @@ -763,7 +763,7 @@ static bool _compare_mon_names(MenuEntry *entry_a, MenuEntry* entry_b) monster* b = static_cast<monster* >(entry_b->data); if (a->type == b->type) - return (false); + return false; std::string a_name = mons_type_name(a->type, DESC_PLAIN); std::string b_name = mons_type_name(b->type, DESC_PLAIN); @@ -778,7 +778,7 @@ static bool _compare_mon_toughness(MenuEntry *entry_a, MenuEntry* entry_b) monster* b = static_cast<monster* >(entry_b->data); if (a->type == b->type) - return (false); + return false; int a_toughness = mons_avg_hp(a->type); int b_toughness = mons_avg_hp(b->type); @@ -862,17 +862,17 @@ static std::vector<std::string> _get_desc_keys(std::string regex, filter); if (key_matches.size() == 1) - return (key_matches); + return key_matches; else if (key_matches.size() > 52) - return (key_matches); + return key_matches; std::vector<std::string> body_matches = getLongDescBodiesByRegex(regex, filter); if (key_matches.empty() && body_matches.empty()) - return (key_matches); + return key_matches; else if (key_matches.empty() && body_matches.size() == 1) - return (body_matches); + return body_matches; // Merge key_matches and body_matches, discarding duplicates. std::vector<std::string> tmp = key_matches; @@ -883,7 +883,7 @@ static std::vector<std::string> _get_desc_keys(std::string regex, if (i == 0 || all_matches[all_matches.size() - 1] != tmp[i]) all_matches.push_back(tmp[i]); - return (all_matches); + return all_matches; } static std::vector<std::string> _get_monster_keys(ucs_t showchar) @@ -910,7 +910,7 @@ static std::vector<std::string> _get_monster_keys(ucs_t showchar) mon_keys.push_back(me->name); } - return (mon_keys); + return mon_keys; } static std::vector<std::string> _get_god_keys() @@ -941,7 +941,7 @@ static std::vector<std::string> _get_branch_keys() names.push_back(branch.shortname); } - return (names); + return names; } static bool _monster_filter(std::string key, std::string body) @@ -959,12 +959,12 @@ static bool _spell_filter(std::string key, std::string body) spell_type spell = spell_by_name(key); if (spell == SPELL_NO_SPELL) - return (true); + return true; if (get_spell_flags(spell) & (SPFLAG_MONSTER | SPFLAG_TESTING)) return (!you.wizard); - return (false); + return false; } static bool _item_filter(std::string key, std::string body) @@ -986,9 +986,9 @@ static bool _skill_filter(std::string key, std::string body) name = lowercase_string(skill_name(sk)); if (name.find(key) != std::string::npos) - return (false); + return false; } - return (true); + return true; } static bool _feature_filter(std::string key, std::string body) @@ -1002,24 +1002,24 @@ static bool _card_filter(std::string key, std::string body) // Every card description contains the keyword "card". if (!ends_with(key, " card")) - return (true); + return true; key.erase(key.length() - 5); for (int i = 0; i < NUM_CARDS; ++i) { if (key == lowercase_string(card_name(static_cast<card_type>(i)))) - return (false); + return false; } - return (true); + return true; } static bool _ability_filter(std::string key, std::string body) { lowercase(key); if (string_matches_ability_name(key)) - return (false); + return false; - return (true); + return true; } typedef void (*db_keys_recap)(std::vector<std::string>&); @@ -1108,7 +1108,7 @@ static bool _append_books(std::string &desc, item_def &item, std::string key) spell_type type = spell_by_name(key, true); if (type == SPELL_NO_SPELL) - return (false); + return false; desc += "\nType: "; bool already = false; @@ -1187,7 +1187,7 @@ static bool _append_books(std::string &desc, item_def &item, std::string key) desc += comma_separated_line(rods.begin(), rods.end(), "\n", "\n"); } - return (true); + return true; } // Returns the result of the keypress. @@ -1321,7 +1321,7 @@ static bool _handle_FAQ() if (question_keys.empty()) { mpr("No questions found in FAQ! Please submit a bug report!"); - return (false); + return false; } Menu FAQmenu(MF_SINGLESELECT | MF_ANYPRINTABLE | MF_ALLOW_FORMATTING); MenuEntry *title = new MenuEntry("Frequently Asked Questions"); @@ -1361,7 +1361,7 @@ static bool _handle_FAQ() std::vector<MenuEntry*> sel = FAQmenu.show(); redraw_screen(); if (sel.empty()) - return (false); + return false; else { ASSERT(sel.size() == 1); @@ -1386,7 +1386,7 @@ static bool _handle_FAQ() } } - return (true); + return true; } static void _find_description(bool *again, std::string *error_inout) @@ -1830,7 +1830,7 @@ std::string help_highlighter::get_species_key() const strip_tag(result, "Draconian"); result += " "; - return (result); + return result; } //////////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/coord-circle.cc b/crawl-ref/source/coord-circle.cc index eb15b4bdd2..7efa3ebf22 100644 --- a/crawl-ref/source/coord-circle.cc +++ b/crawl-ref/source/coord-circle.cc @@ -18,7 +18,7 @@ rect_def rect_def::intersect(const rect_def& other) const res.min.y = std::max(min.y, other.min.y); res.max.x = std::min(max.x, other.max.x); res.max.y = std::min(max.y, other.max.y); - return (res); + return res; } rectangle_iterator rect_def::iter() const @@ -91,12 +91,12 @@ void circle_def::init_bbox() const rect_def& circle_def::get_bbox() const { - return (bbox); + return bbox; } const coord_def& circle_def::get_center() const { - return (origin); + return origin; } circle_iterator circle_def::iter() const @@ -107,7 +107,7 @@ circle_iterator circle_def::iter() const bool circle_def::contains(const coord_def &p) const { if (!bbox.contains(p)) - return (false); + return false; switch (shape) { case SH_SQUARE: @@ -118,6 +118,6 @@ bool circle_def::contains(const coord_def &p) const return ((p - origin).abs() <= r_sq); } default: - return (false); + return false; } } diff --git a/crawl-ref/source/coordit.cc b/crawl-ref/source/coordit.cc index 95a925144e..0f98228041 100644 --- a/crawl-ref/source/coordit.cc +++ b/crawl-ref/source/coordit.cc @@ -79,7 +79,7 @@ circle_iterator::circle_iterator(const circle_def &circle_) circle_iterator::operator bool() const { - return (iter); + return iter; } coord_def circle_iterator::operator*() const @@ -145,12 +145,12 @@ void radius_iterator::advance(bool may_stay) radius_iterator::operator bool() const { - return (iter); + return iter; } coord_def radius_iterator::operator *() const { - return (current); + return current; } const coord_def* radius_iterator::operator->() const @@ -161,10 +161,10 @@ const coord_def* radius_iterator::operator->() const bool radius_iterator::is_valid_square(const coord_def &p) const { if (exclude_center && p == circle.get_center()) - return (false); + return false; if (los && !los->see_cell(p)) - return (false); - return (true); + return false; + return true; } void radius_iterator::operator++() diff --git a/crawl-ref/source/ctest.cc b/crawl-ref/source/ctest.cc index 2be6fa9d9d..43ee99df84 100644 --- a/crawl-ref/source/ctest.cc +++ b/crawl-ref/source/ctest.cc @@ -61,7 +61,7 @@ static int crawl_begin_test(lua_State *ls) activity, luaL_checkstring(ls, 1)); lua_pushnumber(ls, ++ntests); - return (1); + return 1; } static int crawl_test_success(lua_State *ls) @@ -69,7 +69,7 @@ static int crawl_test_success(lua_State *ls) if (!crawl_state.script) mprf(MSGCH_PROMPT, "Test success: %s", luaL_checkstring(ls, 1)); lua_pushnumber(ls, ++nsuccess); - return (1); + return 1; } static int crawl_script_args(lua_State *ls) @@ -96,15 +96,15 @@ static void _init_test_bindings() static bool _is_test_selected(const std::string &testname) { if (crawl_state.tests_selected.empty()) - return (true); + return true; for (int i = 0, size = crawl_state.tests_selected.size(); i < size; ++i) { const std::string &phrase(crawl_state.tests_selected[i]); if (testname.find(phrase) != std::string::npos) - return (true); + return true; } - return (false); + return false; } static void run_test(const std::string &file) diff --git a/crawl-ref/source/dactions.cc b/crawl-ref/source/dactions.cc index 9ca51fe5fd..c653e5dc9f 100644 --- a/crawl-ref/source/dactions.cc +++ b/crawl-ref/source/dactions.cc @@ -51,7 +51,7 @@ static const char *daction_names[] = static bool _mons_matches_counter(const monster* mon, daction_type act) { if (!mon || !mon->alive()) - return (false); + return false; switch (act) { @@ -90,7 +90,7 @@ static bool _mons_matches_counter(const monster* mon, daction_type act) && mon->mname != "freed slave"); default: - return (false); + return false; } } diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc index e014d4c134..7cd709cde3 100644 --- a/crawl-ref/source/database.cc +++ b/crawl-ref/source/database.cc @@ -400,7 +400,7 @@ static std::vector<std::string> _database_find_keys(DBM *database, dbKey = dbm_nextkey(database); } - return (matches); + return matches; } static std::vector<std::string> _database_find_bodies(DBM *database, @@ -430,7 +430,7 @@ static std::vector<std::string> _database_find_bodies(DBM *database, dbKey = dbm_nextkey(database); } - return (matches); + return matches; } /////////////////////////////////////////////////////////////////////////// @@ -751,7 +751,7 @@ static std::string _query_database(TextDB &db, std::string key, if (run_lua) _execute_embedded_lua(str); - return (str); + return str; } ///////////////////////////////////////////////////////////////////////////// @@ -776,7 +776,7 @@ std::vector<std::string> getLongDescKeysByRegex(const std::string ®ex, if (!DescriptionDB.get()) { std::vector<std::string> empty; - return (empty); + return empty; } // FIXME: need to match regex against translated keys, which can't @@ -790,7 +790,7 @@ std::vector<std::string> getLongDescBodiesByRegex(const std::string ®ex, if (!DescriptionDB.get()) { std::vector<std::string> empty; - return (empty); + return empty; } // On partial translations, this will match only translated descriptions. @@ -863,7 +863,7 @@ std::vector<std::string> getAllFAQKeys() if (!FAQDB.get()) { std::vector<std::string> empty; - return (empty); + return empty; } return _database_find_keys(FAQDB.get(), "^q.+", false); diff --git a/crawl-ref/source/dbg-maps.cc b/crawl-ref/source/dbg-maps.cc index b43e5298ad..fbd04b05b1 100644 --- a/crawl-ref/source/dbg-maps.cc +++ b/crawl-ref/source/dbg-maps.cc @@ -53,7 +53,7 @@ static bool _mg_is_disconnected_level() // Don't care about non-Dungeon levels. if (!player_in_connected_branch() || (branches[you.where_are_you].branch_flags & BFLAG_ISLANDED)) - return (false); + return false; return dgn_count_disconnected_zones(true); } @@ -78,7 +78,7 @@ static bool mg_do_build_level(int niters) if (kbhit() && key_is_escape(getchk())) { mprf(MSGCH_WARN, "User requested cancel"); - return (false); + return false; } ++mg_levels_tried; @@ -132,10 +132,10 @@ static bool mg_do_build_level(int niters) dump_map(fp); - return (false); + return false; } } - return (true); + return true; } static std::vector<level_id> mg_dungeon_places() @@ -151,7 +151,7 @@ static std::vector<level_id> mg_dungeon_places() for (int depth = 1; depth <= brdepth[br]; ++depth) places.push_back(level_id(branch, depth)); } - return (places); + return places; } static bool mg_build_dungeon() @@ -164,9 +164,9 @@ static bool mg_build_dungeon() you.where_are_you = lid.branch; you.depth = lid.depth; if (!mg_do_build_level(1)) - return (false); + return false; } - return (true); + return true; } static void mg_build_levels(int niters) diff --git a/crawl-ref/source/dbg-scan.cc b/crawl-ref/source/dbg-scan.cc index 8e27005406..886934614a 100644 --- a/crawl-ref/source/dbg-scan.cc +++ b/crawl-ref/source/dbg-scan.cc @@ -267,7 +267,7 @@ static std::vector<std::string> _in_vaults(const coord_def &pos) out.push_back(vault.map.name); } - return (out); + return out; } void debug_mons_scan() diff --git a/crawl-ref/source/dbg-util.cc b/crawl-ref/source/dbg-util.cc index 69cc7a148a..9262054714 100644 --- a/crawl-ref/source/dbg-util.cc +++ b/crawl-ref/source/dbg-util.cc @@ -29,11 +29,11 @@ monster_type debug_prompt_for_monster(void) if (!cancelable_get_line_autohist(specs, sizeof specs)) { if (specs[0] == '\0') - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; return (get_monster_by_name(specs)); } - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; } static void _dump_vault_table(const CrawlHashTable &table) @@ -113,7 +113,7 @@ std::string debug_mon_str(const monster* mon) out += make_stringf("%s [midx = %d]", debug_coord_str(mon->pos()).c_str(), midx); - return (out); + return out; } static void _debug_mid_name(mid_t mid) @@ -350,7 +350,7 @@ skill_type debug_prompt_for_skill(const char *prompt) char specs[80]; msgwin_get_line_autohist(prompt, specs, sizeof(specs)); if (specs[0] == '\0') - return (SK_NONE); + return SK_NONE; return skill_from_name(lowercase_string(specs).c_str()); } @@ -375,7 +375,7 @@ skill_type skill_from_name(const char *name) } } - return (skill); + return skill; } std::string debug_art_val_str(const item_def& item) diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index e21cb3ed28..07a7db46f7 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -394,7 +394,7 @@ static const deck_archetype* _random_sub_deck(uint8_t deck_type) ASSERT(pdeck); - return (pdeck); + return pdeck; } static card_type _choose_from_archetype(const deck_archetype* pdeck, @@ -518,7 +518,7 @@ static bool _check_buggy_deck(item_def& deck) { crawl_state.zero_turns_taken(); strm << "This isn't a deck at all!" << std::endl; - return (true); + return true; } CrawlHashTable &props = deck.props; @@ -567,7 +567,7 @@ static bool _check_buggy_deck(item_def& deck) dec_inv_item_quantity(deck.link, 1); did_god_conduct(DID_CARDS, 1); - return (true); + return true; } bool problems = false; @@ -627,7 +627,7 @@ static bool _check_buggy_deck(item_def& deck) dec_inv_item_quantity(deck.link, 1); did_god_conduct(DID_CARDS, 1); - return (true); + return true; } if (num_cards > deck.plus) @@ -727,7 +727,7 @@ static bool _check_buggy_deck(item_def& deck) } if (!problems) - return (false); + return false; you.wield_change = true; @@ -735,9 +735,9 @@ static bool _check_buggy_deck(item_def& deck) "still use deck?", true, 'n')) { crawl_state.zero_turns_taken(); - return (true); + return true; } - return (false); + return false; } // Choose a deck from inventory and return its slot (or -1). @@ -768,11 +768,11 @@ bool choose_deck_and_draw() if (slot == -1) { crawl_state.zero_turns_taken(); - return (false); + return false; } evoke_deck(you.inv[slot]); - return (true); + return true; } static void _deck_ident(item_def& deck) @@ -812,12 +812,12 @@ bool deck_peek() if (slot == -1) { crawl_state.zero_turns_taken(); - return (false); + return false; } item_def& deck(you.inv[slot]); if (_check_buggy_deck(deck)) - return (false); + return false; if (cards_in_deck(deck) > 2) { @@ -842,7 +842,7 @@ bool deck_peek() deck.plus2 = -1; you.wield_change = true; - return (true); + return true; } card2 = get_card_and_flags(deck, 1, flags2); @@ -866,14 +866,14 @@ bool deck_peek() _deck_ident(deck); you.wield_change = true; - return (true); + return true; } bool deck_identify_first(int slot) { item_def& deck(you.inv[slot]); if (top_card_is_known(deck)) - return (false); + return false; uint8_t flags; card_type card = get_card_and_flags(deck, -1, flags); @@ -882,7 +882,7 @@ bool deck_identify_first(int slot) deck.props["num_marked"]++; mprf("You get a glimpse of the first card. It is %s.", card_name(card)); - return (true); + return true; } @@ -895,24 +895,24 @@ bool deck_deal() if (slot == -1) { crawl_state.zero_turns_taken(); - return (false); + return false; } item_def& deck(you.inv[slot]); if (_check_buggy_deck(deck)) - return (false); + return false; CrawlHashTable &props = deck.props; if (props["num_marked"].get_byte() > 0) { mpr("You cannot deal from marked decks."); crawl_state.zero_turns_taken(); - return (false); + return false; } if (props["stacked"].get_bool()) { mpr("This deck seems insufficiently random for dealing."); crawl_state.zero_turns_taken(); - return (false); + return false; } const int num_cards = cards_in_deck(deck); @@ -955,7 +955,7 @@ bool deck_deal() dec_inv_item_quantity(slot, 1); } - return (true); + return true; } static void _redraw_stacked_cards(const std::vector<card_type>& draws, @@ -1003,19 +1003,19 @@ bool deck_stack() if (slot == -1) { crawl_state.zero_turns_taken(); - return (false); + return false; } item_def& deck(you.inv[slot]); if (_check_buggy_deck(deck)) - return (false); + return false; CrawlHashTable &props = deck.props; if (props["num_marked"].get_byte() > 0) { mpr("You can't stack a marked deck."); crawl_state.zero_turns_taken(); - return (false); + return false; } _deck_ident(deck); @@ -1149,7 +1149,7 @@ bool deck_stack() _check_buggy_deck(deck); you.wield_change = true; - return (true); + return true; } // Draw the next three cards, discard two and pick one. @@ -1159,13 +1159,13 @@ bool deck_triple_draw() if (slot == -1) { crawl_state.zero_turns_taken(); - return (false); + return false; } item_def& deck(you.inv[slot]); if (_check_buggy_deck(deck)) - return (false); + return false; const int num_cards = cards_in_deck(deck); @@ -1178,7 +1178,7 @@ bool deck_triple_draw() { // Only one card to draw, so just draw it. evoke_deck(deck); - return (true); + return true; } const int num_to_draw = (num_cards < 3 ? num_cards : 3); @@ -1258,7 +1258,7 @@ bool deck_triple_draw() card_effect(draws[selected], rarity, flags[selected] | CFLAG_SEEN | CFLAG_MARKED, false); - return (true); + return true; } // This is Nemelex retribution. If deal is true, use the word "deal" @@ -2846,7 +2846,7 @@ static int _card_power(deck_rarity_type rarity) if (result < 0) result = 0; - return (result); + return result; } void card_effect(card_type which_card, deck_rarity_type rarity, @@ -3002,7 +3002,7 @@ void card_effect(card_type which_card, deck_rarity_type rarity, bool top_card_is_known(const item_def &deck) { if (!is_deck(deck)) - return (false); + return false; uint8_t flags; get_card_and_flags(deck, -1, flags); @@ -3013,14 +3013,14 @@ bool top_card_is_known(const item_def &deck) card_type top_card(const item_def &deck) { if (!is_deck(deck)) - return (NUM_CARDS); + return NUM_CARDS; uint8_t flags; card_type card = get_card_and_flags(deck, -1, flags); UNUSED(flags); - return (card); + return card; } bool is_deck(const item_def &item) @@ -3033,7 +3033,7 @@ bool is_deck(const item_def &item) bool bad_deck(const item_def &item) { if (!is_deck(item)) - return (false); + return false; return (!item.props.exists("cards") || item.props["cards"].get_type() != SV_VEC @@ -3068,7 +3068,7 @@ colour_t deck_rarity_to_colour(deck_rarity_type rarity) die("unset deck rarity"); } - return (WHITE); + return WHITE; } void init_deck(item_def &item) diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index a1dc3d2579..fe84cfe921 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -97,7 +97,7 @@ static std::string _get_zin_recite_speech(int trits[], size_t len, int prayertyp // In case nothing is found. return ("mumble mumble buggy mumble"); } - return (str); + return str; } // Returns true if this delay can act as a parent to other delays, i.e. if @@ -124,7 +124,7 @@ static int _push_delay(const delay_queue_item &delay) { size_t pos = i - you.delay_queue.begin(); you.delay_queue.insert(i, delay); - return (pos); + return pos; } } you.delay_queue.push_back(delay); @@ -542,7 +542,7 @@ bool delay_is_run(delay_type delay) bool is_being_drained(const item_def &item) { if (!you_are_delayed()) - return (false); + return false; const delay_queue_item &delay = you.delay_queue.front(); @@ -551,16 +551,16 @@ bool is_being_drained(const item_def &item) const item_def &corpse = mitm[ delay.parm2 ]; if (&corpse == &item) - return (true); + return true; } - return (false); + return false; } bool is_being_butchered(const item_def &item, bool just_first) { if (!you_are_delayed()) - return (false); + return false; for (unsigned int i = 0; i < you.delay_queue.size(); ++i) { @@ -569,7 +569,7 @@ bool is_being_butchered(const item_def &item, bool just_first) { const item_def &corpse = mitm[ you.delay_queue[i].parm1 ]; if (&corpse == &item) - return (true); + return true; if (just_first) break; @@ -578,13 +578,13 @@ bool is_being_butchered(const item_def &item, bool just_first) break; } - return (false); + return false; } bool is_vampire_feeding() { if (!you_are_delayed()) - return (false); + return false; const delay_queue_item &delay = you.delay_queue.front(); return (delay.type == DELAY_FEED_VAMPIRE); @@ -593,7 +593,7 @@ bool is_vampire_feeding() bool is_butchering() { if (!you_are_delayed()) - return (false); + return false; const delay_queue_item &delay = you.delay_queue.front(); return (delay.type == DELAY_BUTCHER || delay.type == DELAY_BOTTLE_BLOOD); @@ -602,7 +602,7 @@ bool is_butchering() bool player_stair_delay() { if (!you_are_delayed()) - return (false); + return false; const delay_queue_item &delay = you.delay_queue.front(); return (delay.type == DELAY_ASCENDING_STAIRS @@ -612,7 +612,7 @@ bool player_stair_delay() bool already_learning_spell(int spell) { if (!you_are_delayed()) - return (false); + return false; for (unsigned int i = 0; i < you.delay_queue.size(); ++i) { @@ -620,9 +620,9 @@ bool already_learning_spell(int spell) continue; if (spell == -1 || you.delay_queue[i].parm1 == spell) - return (true); + return true; } - return (false); + return false; } // Xom is amused by a potential food source going to waste, and is @@ -1535,7 +1535,7 @@ static maybe_bool _userdef_interrupt_activity(const delay_queue_item &idelay, const int delay = idelay.type; lua_State *ls = clua.state(); if (!ls || ai == AI_FORCE_INTERRUPT) - return (B_TRUE); + return B_TRUE; const char *interrupt_name = _activity_interrupt_name(ai); const char *act_name = delay_name(delay); @@ -1548,23 +1548,23 @@ static maybe_bool _userdef_interrupt_activity(const delay_queue_item &idelay, if (lua_isnil(ls, -1)) { lua_pop(ls, 1); - return (B_FALSE); + return B_FALSE; } bool stopact = lua_toboolean(ls, -1); lua_pop(ls, 1); if (stopact) - return (B_TRUE); + return B_TRUE; } if (delay == DELAY_MACRO && clua.callbooleanfn(true, "c_interrupt_macro", "sA", interrupt_name, &at)) { - return (B_TRUE); + return B_TRUE; } #endif - return (B_MAYBE); + return B_MAYBE; } // Returns true if the activity should be interrupted, false otherwise. @@ -1575,9 +1575,9 @@ static bool _should_stop_activity(const delay_queue_item &item, switch (_userdef_interrupt_activity(item, ai, at)) { case B_TRUE: - return (true); + return true; case B_FALSE: - return (false); + return false; case B_MAYBE: break; } @@ -1592,12 +1592,12 @@ static bool _should_stop_activity(const delay_queue_item &item, // No monster will attack you inside a sanctuary, // so presence of monsters won't matter. if (ai == AI_SEE_MONSTER && is_sanctuary(you.pos())) - return (false); + return false; delay_type curr = current_delay_action(); if (ai == AI_SEE_MONSTER && player_stair_delay()) - return (false); + return false; if (ai == AI_FULL_HP || ai == AI_FULL_MP) { @@ -1605,7 +1605,7 @@ static bool _should_stop_activity(const delay_queue_item &item, && (you.magic_points < you.max_magic_points || you.hp < you.hp_max)) { - return (false); + return false; } } @@ -1776,7 +1776,7 @@ bool interrupt_activity(activity_interrupt_type ai, std::vector<std::string>* msgs_buf) { if (interrupt_block::blocked()) - return (false); + return false; const interrupt_block block_recursive_interrupts; if (ai == AI_HIT_MONSTER || ai == AI_MONSTER_ATTACKS) @@ -1824,7 +1824,7 @@ bool interrupt_activity(activity_interrupt_type ai, // Teleport stops stair delays. stop_delay(ai == AI_TELEPORT, ai == AI_MONSTER_ATTACKS); - return (true); + return true; } // Check the other queued delays; the first delay that is interruptible @@ -1844,18 +1844,18 @@ bool interrupt_activity(activity_interrupt_type ai, { _monster_warning(ai, at, you.delay_queue[j].type, msgs_buf); stop_delay(ai == AI_TELEPORT); - return (true); + return true; } } // Non-run queued delays can be discarded without any processing. you.delay_queue.erase(you.delay_queue.begin() + i, you.delay_queue.end()); - return (true); + return true; } } - return (false); + return false; } static const char *activity_interrupt_names[] = @@ -1883,7 +1883,7 @@ activity_interrupt_type get_activity_interrupt(const std::string &name) if (name == activity_interrupt_names[i]) return activity_interrupt_type(i); - return (NUM_AINTERRUPTS); + return NUM_AINTERRUPTS; } static const char *delay_names[] = @@ -1909,18 +1909,18 @@ delay_type get_delay(const std::string &name) // Also check American spellings: if (name == "armor_on") - return (DELAY_ARMOUR_ON); + return DELAY_ARMOUR_ON; if (name == "armor_off") - return (DELAY_ARMOUR_OFF); + return DELAY_ARMOUR_OFF; if (name == "memorize") - return (DELAY_MEMORISE); + return DELAY_MEMORISE; if (name == "jewelry_on") - return (DELAY_JEWELLERY_ON); + return DELAY_JEWELLERY_ON; - return (NUM_DELAYS); + return NUM_DELAYS; } const char *delay_name(int delay) diff --git a/crawl-ref/source/describe.cc b/crawl-ref/source/describe.cc index ee6c9fd886..42318a02db 100644 --- a/crawl-ref/source/describe.cc +++ b/crawl-ref/source/describe.cc @@ -560,18 +560,18 @@ int str_to_trap(const std::string &s) // allow a couple of synonyms if (tspec == "random" || tspec == "any") - return (TRAP_RANDOM); + return TRAP_RANDOM; else if (tspec == "suitable") - return (TRAP_INDEPTH); + return TRAP_INDEPTH; else if (tspec == "nonteleport" || tspec == "noteleport" || tspec == "nontele" || tspec == "notele") { - return (TRAP_NONTELEPORT); + return TRAP_NONTELEPORT; } for (int i = 0; i < NUM_TRAPS; ++i) if (tspec == lowercase_string(trap_names[i])) - return (i); + return i; return (-1); } @@ -1056,7 +1056,7 @@ static std::string _describe_weapon(const item_def &item, bool verbose) description += _corrosion_resistance_string(item); - return (description); + return description; } @@ -1247,7 +1247,7 @@ static std::string _describe_ammo(const item_def &item) else if (item.sub_type != MI_THROWING_NET) append_missile_info(description); - return (description); + return description; } void append_armour_stats(std::string &description, const item_def &item) @@ -1545,7 +1545,7 @@ static std::string _describe_jewellery(const item_def &item, bool verbose) } } - return (description); + return description; } static bool _compare_card_names(card_type a, card_type b) @@ -1563,7 +1563,7 @@ static bool _check_buggy_deck(const item_def &deck, std::string &desc) if (!is_deck(deck)) { desc += "This isn't a deck at all!\n"; - return (true); + return true; } const CrawlHashTable &props = deck.props; @@ -1573,10 +1573,10 @@ static bool _check_buggy_deck(const item_def &deck, std::string &desc) || props["cards"].get_vector().get_type() != SV_BYTE || cards_in_deck(deck) == 0) { - return (true); + return true; } - return (false); + return false; } static std::string _describe_deck(const item_def &item) @@ -1675,7 +1675,7 @@ static std::string _describe_deck(const item_def &item) description += "\n"; } - return (description); + return description; } // Adds a list of all spells contained in a book or rod to its @@ -1731,7 +1731,7 @@ bool is_dumpable_artefact(const item_def &item, bool verbose) ret = true; } - return (ret); + return ret; } @@ -2216,7 +2216,7 @@ static int _print_toggle_message(const describe_info &inf, int& key) { mouse_control mc(MOUSE_MODE_MORE); key = getchm(); - return (false); + return false; } else { @@ -2233,9 +2233,9 @@ static int _print_toggle_message(const describe_info &inf, int& key) key = getchm(); if (key == '!' || key == CK_MOUSE_CMD) - return (true); + return true; - return (false); + return false; } } @@ -2320,7 +2320,7 @@ static bool _describe_spells(const item_def &item) if (c < 'a' || c > 'h') //jmf: was 'g', but 8=h { mesclr(); - return (false); + return false; } const int spell_index = letter_to_index(c); @@ -2328,7 +2328,7 @@ static bool _describe_spells(const item_def &item) spell_type nthing = which_spell_in_book(item, spell_index); if (nthing == SPELL_NO_SPELL) - return (false); + return false; describe_spell(nthing, &item); return item.is_valid(); @@ -2355,7 +2355,7 @@ static bool _describe_spellbook(item_def &item) { // Memorised spell while reading a spellbook. if (already_learning_spell(-1)) - return (false); + return false; _show_item_description(item); _update_inscription(item); @@ -2625,7 +2625,7 @@ static bool _actions_prompt(item_def &item, bool allow_inscribe) bool describe_item(item_def &item, bool allow_inscribe, bool shopping) { if (!item.defined()) - return (true); + return true; #ifdef USE_TILE_WEB tiles_crt_control show_as_menu(CRT_MENU, "describe_item"); @@ -2651,7 +2651,7 @@ bool describe_item(item_def &item, bool allow_inscribe, bool shopping) else getchm(); - return (true); + return true; } static void _safe_newline() @@ -2898,7 +2898,7 @@ static int _get_spell_description(const spell_type spell, _append_spell_stats(spell, description, rod); if (crawl_state.player_is_dead()) - return (BOOK_NEITHER); + return BOOK_NEITHER; const std::string quote = getQuoteString(std::string(spell_title(spell)) + " spell"); if (!quote.empty()) @@ -2914,13 +2914,13 @@ static int _get_spell_description(const spell_type spell, description += "\n(F)orget this spell by destroying the book.\n"; if (you.religion == GOD_SIF_MUNA) description +="Sif Muna frowns upon the destroying of books.\n"; - return (BOOK_FORGET); + return BOOK_FORGET; } else if (player_can_memorise_from_spellbook(*item) && !you_cannot_memorise(spell, undead)) { description += "\n(M)emorise this spell.\n"; - return (BOOK_MEM); + return BOOK_MEM; } return BOOK_NEITHER; @@ -3064,7 +3064,7 @@ static std::string _describe_draconian(const monster_info& mi) description += " " + drac_role; } - return (description); + return description; } static const char* _get_resist_name(mon_resist_flags res_type) @@ -3715,7 +3715,7 @@ static bool _print_final_god_abil_desc(int god, const std::string &final_msg, { // If no message then no power. if (final_msg.empty()) - return (false); + return false; std::string buf = final_msg; @@ -3742,7 +3742,7 @@ static bool _print_final_god_abil_desc(int god, const std::string &final_msg, cprintf("%s\n", buf.c_str()); - return (true); + return true; } static bool _print_god_abil_desc(int god, int numpower) @@ -3753,18 +3753,18 @@ static bool _print_god_abil_desc(int god, int numpower) _print_final_god_abil_desc(god, "You can provide lesser healing for yourself and others.", ABIL_ELYVILON_LESSER_HEALING_SELF); - return (true); + return true; } const char* pmsg = god_gain_power_messages[god][numpower]; // If no message then no power. if (!pmsg[0]) - return (false); + return false; // Don't display ability upgrades here. std::string buf = adjust_abil_message(pmsg, false); if (buf.empty()) - return (false); + return false; if (!isupper(pmsg[0])) // Complete sentence given? buf = "You can " + buf + "."; @@ -3773,7 +3773,7 @@ static bool _print_god_abil_desc(int god, int numpower) const ability_type abil = god_abilities[god][numpower]; _print_final_god_abil_desc(god, buf, abil); - return (true); + return true; } //--------------------------------------------------------------- @@ -4032,7 +4032,7 @@ std::string god_title(god_type which_god, species_type which_species) title = replace_all(title, "%s", species_name(which_species, true, false)); - return (title); + return title; } static std::string _describe_ash_skill_boost() @@ -4755,10 +4755,10 @@ bool alt_desc_proc::chop(std::string &str) loc = i; if (loc == -1) - return (false); + return false; str.resize(loc); - return (true); + return true; } void alt_desc_proc::get_string(std::string &str) diff --git a/crawl-ref/source/dgn-labyrinth.cc b/crawl-ref/source/dgn-labyrinth.cc index bc71ea8296..71ef54499d 100644 --- a/crawl-ref/source/dgn-labyrinth.cc +++ b/crawl-ref/source/dgn-labyrinth.cc @@ -131,18 +131,18 @@ static bool _has_no_floor_neighbours(const coord_def &pos, bool recurse = false) { const coord_def& p = *ai; if (!in_bounds(p)) - return (true); + return true; if (recurse) { if (grd(p) == DNGN_FLOOR) - return (false); + return false; } else if (_has_no_floor_neighbours(p, true)) - return (true); + return true; } - return (recurse); + return recurse; } // Change the borders of the labyrinth to another (undiggable) wall type. @@ -259,10 +259,10 @@ static bool _has_vault_in_radius(const coord_def &pos, int radius, if (!in_bounds(*rad)) continue; if (map_masked(*rad, mask)) - return (true); + return true; } - return (false); + return false; } // Find an entry point that's: @@ -286,10 +286,10 @@ static coord_def _labyrinth_find_entry_point(const dgn_region ®, if (_has_vault_in_radius(place, 6, MMT_VAULT)) continue; - return (place); + return place; } coord_def unfound; - return (unfound); + return unfound; } static void _labyrinth_place_entry_point(const dgn_region ®ion, @@ -335,10 +335,10 @@ static coord_def _find_random_deadend(const dgn_region ®ion) if (!_is_deadend(pos)) continue; - return (pos); + return pos; } - return (result); + return result; } // Adds a bloody trail ending in a dead end with spattered walls. @@ -407,9 +407,9 @@ static bool _find_random_nonmetal_wall(const dgn_region ®ion, continue; if (grd(pos) == DNGN_ROCK_WALL || grd(pos) == DNGN_STONE_WALL) - return (true); + return true; } - return (false); + return false; } static bool _grid_has_wall_neighbours(const coord_def& pos, @@ -425,9 +425,9 @@ static bool _grid_has_wall_neighbours(const coord_def& pos, continue; if (grd(p) == DNGN_ROCK_WALL || grd(p) == DNGN_STONE_WALL) - return (true); + return true; } - return (false); + return false; } static void _vitrify_wall_neighbours(const coord_def& pos, bool first) diff --git a/crawl-ref/source/dgn-layouts.cc b/crawl-ref/source/dgn-layouts.cc index 7d075f64be..5c622546b6 100644 --- a/crawl-ref/source/dgn-layouts.cc +++ b/crawl-ref/source/dgn-layouts.cc @@ -509,7 +509,7 @@ static bool _octa_room(dgn_region& region, int oblique_max, oblique--; } - return (true); + return true; } static dungeon_feature_type _random_wall() @@ -524,7 +524,7 @@ static dungeon_feature_type _random_wall() } while (wall == DNGN_SLIMY_WALL); - return (wall); + return wall; } // Helper function for chequerboard rooms. @@ -654,7 +654,7 @@ static int _box_room_doors(int bx1, int bx2, int by1, int by2, int new_doors) new_doors --; } - return (doors_placed); + return doors_placed; } static void _box_room(int bx1, int bx2, int by1, int by2, @@ -878,10 +878,10 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel) diag_door += _good_door_spot(ex,ey); if ((diag_door + find_door) > 1 && max_doors == 1) - return (false); + return false; if (find_door == 0 || find_door > max_doors) - return (false); + return false; // Convert the area to floor. for (rx = sx; rx <= ex; rx++) @@ -936,7 +936,7 @@ static bool _make_room(int sx,int sy,int ex,int ey,int max_doors, int doorlevel) } } - return (true); + return true; } static void _make_random_rooms(int num, int max_doors, int door_level, @@ -1057,7 +1057,7 @@ static bool _may_overwrite_pos(coord_def c) if (grid >= DNGN_ENTER_SHOP && grid <= DNGN_EXIT_PORTAL_VAULT || grid == DNGN_EXIT_HELL) { - return (false); + return false; } // Don't overwrite feature if there's a monster or item there. diff --git a/crawl-ref/source/dgn-overview.cc b/crawl-ref/source/dgn-overview.cc index d5eb27bd44..4fca7d22a5 100644 --- a/crawl-ref/source/dgn-overview.cc +++ b/crawl-ref/source/dgn-overview.cc @@ -101,7 +101,7 @@ bool move_notable_thing(const coord_def& orig, const coord_def& dest) ASSERT(!is_notable_terrain(grd(dest))); if (!is_notable_terrain(grd(orig))) - return (false); + return false; level_pos pos1(level_id::current(), orig); level_pos pos2(level_id::current(), dest); @@ -113,7 +113,7 @@ bool move_notable_thing(const coord_def& orig, const coord_def& dest) unnotice_feature(pos1); - return (true); + return true; } static std::string coloured_branch(branch_type br) @@ -183,9 +183,9 @@ bool overview_knows_portal(branch_type portal) pl_iter != portals_present.end(); ++pl_iter) { if (pl_iter->second == portal) - return (true); + return true; } - return (false); + return false; } // Ever used only for Pan, Abyss and Hell. @@ -199,7 +199,7 @@ int overview_knows_num_portals(dungeon_feature_type portal) num++; } - return (num); + return num; } static std::string _portals_description_string() @@ -594,9 +594,9 @@ inline static bool _find_erase(Z &map, const Key &k) if (map.find(k) != map.end()) { map.erase(k); - return (true); + return true; } - return (false); + return false; } static bool _unnotice_portal(const level_pos &pos) diff --git a/crawl-ref/source/dgn-shoals.cc b/crawl-ref/source/dgn-shoals.cc index 33044aba6c..c84666cf8a 100644 --- a/crawl-ref/source/dgn-shoals.cc +++ b/crawl-ref/source/dgn-shoals.cc @@ -167,7 +167,7 @@ static dgn_island_plan _shoals_island_plan() plan.island_aux_radius_range = int_range(2, 7); plan.island_aux_point_height_increment = int_range(50, 65); - return (plan); + return plan; } static void _shoals_init_islands(int depth) @@ -464,7 +464,7 @@ _shoals_point_feat_cluster(dungeon_feature_type feat, regions.push_back(weighted_region(featcount, c)); } } - return (regions); + return regions; } static coord_def _shoals_pick_region( @@ -894,14 +894,14 @@ static dungeon_feature_type _shoals_apply_tide_feature_at( // Return DNGN_UNSEEN if the feature isn't changed. if (feat == current_feat) - return (DNGN_UNSEEN); + return DNGN_UNSEEN; if (Generating_Level) grd(c) = feat; else dungeon_terrain_changed(c, feat, true, false, true); - return (feat); + return feat; } // Determines if the tide is rising or falling based on before and diff --git a/crawl-ref/source/dgnevent.cc b/crawl-ref/source/dgnevent.cc index f50718bfcb..b870b012a6 100644 --- a/crawl-ref/source/dgnevent.cc +++ b/crawl-ref/source/dgnevent.cc @@ -57,10 +57,10 @@ bool dgn_event_dispatcher::fire_vetoable_position_event( i != alcopy.listeners.end(); ++i) { if (!(*i)->notify_dgn_event(et)) - return (false); + return false; } } - return (true); + return true; } void dgn_event_dispatcher::fire_position_event( diff --git a/crawl-ref/source/directn.cc b/crawl-ref/source/directn.cc index 480ae8067b..315e5bd6e3 100644 --- a/crawl-ref/source/directn.cc +++ b/crawl-ref/source/directn.cc @@ -296,7 +296,7 @@ static command_type shift_direction(command_type cmd) case CMD_TARGET_DOWN_RIGHT: return CMD_TARGET_DIR_DOWN_RIGHT; case CMD_TARGET_UP_RIGHT: return CMD_TARGET_DIR_UP_RIGHT; case CMD_TARGET_UP_LEFT: return CMD_TARGET_DIR_UP_LEFT; - default: return (cmd); + default: return cmd; } } @@ -450,7 +450,7 @@ static bool _mon_exposed_in_cloud(const monster* mon) static bool _mon_exposed(const monster* mon) { if (!mon || !you.see_cell(mon->pos()) || mon->visible_to(&you)) - return (false); + return false; return (_mon_exposed_in_water(mon) || _mon_exposed_in_cloud(mon)); } @@ -908,7 +908,7 @@ char mlist_index_to_letter(int index) if (index >= 'l') index++; - return (index); + return index; } #endif @@ -944,7 +944,7 @@ bool direction_chooser::move_is_ok() const else mpr("Sorry, you can't target what you can't see.", MSGCH_EXAMINE_FILTER); - return (false); + return false; } if (looking_at_you()) @@ -962,7 +962,7 @@ bool direction_chooser::move_is_ok() const if (cancel_at_self || Options.allow_self_target == CONFIRM_CANCEL) { mpr("That would be overly suicidal.", MSGCH_EXAMINE_FILTER); - return (false); + return false; } else if (Options.allow_self_target == CONFIRM_PROMPT) return yesno("Really target yourself?", false, 'n'); @@ -971,7 +971,7 @@ bool direction_chooser::move_is_ok() const if (cancel_at_self) { mpr("Sorry, you can't target yourself.", MSGCH_EXAMINE_FILTER); - return (false); + return false; } } } @@ -980,7 +980,7 @@ bool direction_chooser::move_is_ok() const if (!moves.isValid && !moves.isCancel) return yesno("Are you sure you want to fizzle?", false, 'n'); - return (true); + return true; } // Assuming the target is in view, is line-of-fire @@ -989,11 +989,11 @@ static bool _blocked_ray(const coord_def &where, dungeon_feature_type* feat = NULL) { if (exists_ray(you.pos(), where, opc_solid_see)) - return (false); + return false; if (feat == NULL) - return (true); + return true; *feat = ray_blocker(you.pos(), where); - return (true); + return true; } static std::string _targ_mode_name(targ_mode_type mode) @@ -1999,10 +1999,10 @@ bool direction_chooser::do_main_loop() if (loop_done) { if (just_looking) - return (true); + return true; if (move_is_ok()) - return (true); + return true; else need_text_redraw = true; } @@ -2282,12 +2282,12 @@ static bool _mons_is_valid_target(const monster* mon, int mode, int range) && (mon->type != MONS_BALLISTOMYCETE || mon->number == 0) && mon->type != MONS_KRAKEN_TENTACLE) { - return (false); + return false; } // Don't target submerged monsters. if (mode != TARG_HOSTILE_SUBMERGED && mon->submerged()) - return (false); + return false; // Don't usually target unseen monsters... if (!mon->visible_to(&you)) @@ -2299,7 +2299,7 @@ static bool _mons_is_valid_target(const monster* mon, int mode, int range) && i_feel_safe(false, false, true, true, range)); } - return (true); + return true; } #ifndef USE_TILE_LOCAL @@ -2307,14 +2307,14 @@ static bool _find_mlist(const coord_def& where, int idx, bool need_path, int range, targetter *hitfunc) { if (static_cast<int>(mlist.size()) <= idx) - return (false); + return false; if (!_is_target_in_range(where, range, hitfunc) || !you.see_cell(where)) - return (false); + return false; const monster_info* mon = env.map_knowledge(where).monsterinfo(); if (mon == NULL) - return (false); + return false; int real_idx = 0; for (unsigned int i = 0; i+1 < mlist.size(); ++i) @@ -2335,15 +2335,15 @@ static bool _find_mlist(const coord_def& where, int idx, bool need_path, const monster* real_mon = monster_at(where); ASSERT(real_mon); if (!_mons_is_valid_target(real_mon, TARG_ANY, range)) - return (false); + return false; if (need_path && _blocked_ray(where)) - return (false); + return false; const monster_info* monl = &mlist[real_idx]; if (mon->attitude != monl->attitude) - return (false); + return false; if (mon->type != monl->type) return (mons_is_mimic(mon->type) && mons_is_mimic(monl->type)); @@ -2361,7 +2361,7 @@ static bool _find_mlist(const coord_def& where, int idx, bool need_path, return (mon->mname == monl->mname); // Else the two monsters are identical. - return (true); + return true; } #endif @@ -2370,18 +2370,18 @@ static bool _find_fprop_unoccupied(const coord_def & where, int mode, { // Don't target out of range. if (!_is_target_in_range(where, range, hitfunc)) - return (false); + return false; monster* mon = monster_at(where); if (mon || !you.see_cell(where)) - return (false); + return false; // Monster in LOS but only via glass walls, so no direct path. if (need_path && !you.see_cell_no_trans(where)) - return (false); + return false; if (need_path && _blocked_ray(where)) - return (false); + return false; return (env.pgrid(where) & mode); } @@ -2402,31 +2402,31 @@ static bool _find_monster(const coord_def& where, int mode, bool need_path, // Target the player for friendly and general spells. if ((mode == TARG_FRIEND || mode == TARG_ANY) && where == you.pos()) - return (true); + return true; // Don't target out of range. if (!_is_target_in_range(where, range, hitfunc)) - return (false); + return false; const monster* mon = monster_at(where); // No monster or outside LOS. if (mon == NULL || !cell_see_cell(you.pos(), where, LOS_DEFAULT)) - return (false); + return false; // Monster in LOS but only via glass walls, so no direct path. if (need_path && !you.see_cell_no_trans(where)) - return (false); + return false; if (!_mons_is_valid_target(mon, mode, range)) - return (false); + return false; if (need_path && _blocked_ray(mon->pos())) - return (false); + return false; // Now compare target modes. if (mode == TARG_ANY) - return (true); + return true; if (mode == TARG_HOSTILE || mode == TARG_HOSTILE_SUBMERGED) return (mons_attitude(mon) == ATT_HOSTILE); @@ -2446,7 +2446,7 @@ static bool _find_monster(const coord_def& where, int mode, bool need_path, ASSERT(mode == TARG_ENEMY); if (mon->friendly()) - return (false); + return false; // Don't target zero xp monsters. return (!mons_class_flag(mon->type, M_NO_EXP_GAIN)); @@ -2457,7 +2457,7 @@ static bool _find_feature(const coord_def& where, int mode, { // The stair need not be in LOS if the square is mapped. if (!you.see_cell(where) && !env.map_knowledge(where).seen()) - return (false); + return false; return is_feature(mode, where); } @@ -2467,10 +2467,10 @@ static bool _find_object(const coord_def& where, int mode, { // Don't target out of range. if (!_is_target_in_range(where, range, hitfunc)) - return (false); + return false; if (need_path && (!you.see_cell(where) || _blocked_ray(where))) - return (false); + return false; return (env.map_knowledge(where).item() || (you.see_cell(where) && top_item_at(where))); @@ -2492,7 +2492,7 @@ static int _next_los(int dir, int los, bool wrap) if (wrap) { if (!flipvh && !fliphv) - return (los); + return los; // We have to invert flipvh and fliphv if we're wrapping. Here's // why: @@ -2509,17 +2509,17 @@ static int _next_los(int dir, int los, bool wrap) else { if (!flipvh && !fliphv) - return (LOS_NONE); + return LOS_NONE; if (flipvh && vis != (dir == 1)) - return (LOS_NONE); + return LOS_NONE; if (fliphv && vis == (dir == 1)) - return (LOS_NONE); + return LOS_NONE; } los = (los & ~LOS_VISMASK) | (vis? LOS_HIDDEN : LOS_VISIBLE); - return (los); + return los; } //--------------------------------------------------------------- @@ -2550,7 +2550,7 @@ static bool _find_square(coord_def &mfp, int direction, int i, j; if (los == LOS_NONE) - return (false); + return false; if (los == LOS_FLIPVH || los == LOS_FLIPHV) { @@ -2600,7 +2600,7 @@ static bool _find_square(coord_def &mfp, int direction, { mfp = vyou; if (find_targ(you.pos(), mode, need_path, range, hitfunc)) - return (true); + return true; return (_find_square(mfp, direction, find_targ, need_path, mode, range, hitfunc, false, _next_los(direction, los, wrap))); @@ -2733,7 +2733,7 @@ static bool _find_square(coord_def &mfp, int direction, if (find_targ(targ, mode, need_path, range, hitfunc)) { mfp.set(temp_xps, temp_yps); - return (true); + return true; } } @@ -2795,7 +2795,7 @@ std::vector<dungeon_feature_type> features_by_desc(const base_pattern &pattern) features.push_back(dungeon_feature_type(i)); } } - return (features); + return features; } void describe_floor() @@ -2866,7 +2866,7 @@ std::string thing_do_grammar(description_level_type dtype, { desc[0] = tolower(desc[0]); }*/ - return (desc); + return desc; } switch (dtype) @@ -2878,7 +2878,7 @@ std::string thing_do_grammar(description_level_type dtype, case DESC_NONE: return (""); default: - return (desc); + return desc; } } @@ -3340,7 +3340,7 @@ static std::string _describe_monster_weapon(const monster_info& mi, bool ident) } if (name1.empty()) - return (desc); + return desc; desc += " wielding "; desc += name1; @@ -3351,7 +3351,7 @@ static std::string _describe_monster_weapon(const monster_info& mi, bool ident) desc += name2; } - return (desc); + return desc; } #ifdef DEBUG_DIAGNOSTICS @@ -3991,7 +3991,7 @@ command_type targetting_behaviour::get_command(int key) command_type cmd = key_to_command(key, KMC_TARGETTING); if (cmd >= CMD_MIN_TARGET && cmd < CMD_TARGET_CYCLE_TARGET_MODE) - return (cmd); + return cmd; #ifndef USE_TILE_LOCAL // Overrides the movement keys while mlist_targetting is active. @@ -4003,7 +4003,7 @@ command_type targetting_behaviour::get_command(int key) if (cmd == CMD_TARGET_SELECT && key == ' ' && just_looking) cmd = CMD_TARGET_CANCEL; - return (cmd); + return cmd; } std::vector<std::string> targetting_behaviour::get_monster_desc(const monster_info& mi) diff --git a/crawl-ref/source/dlua.cc b/crawl-ref/source/dlua.cc index 6dfc5c6257..961203ad4c 100644 --- a/crawl-ref/source/dlua.cc +++ b/crawl-ref/source/dlua.cc @@ -17,7 +17,7 @@ static int dlua_compiled_chunk_writer(lua_State *ls, const void *p, { std::ostringstream &out = *static_cast<std::ostringstream*>(ud); out.write(static_cast<const char *>(p), sz); - return (0); + return 0; } /////////////////////////////////////////////////////////////////////////// @@ -52,7 +52,7 @@ dlua_chunk dlua_chunk::precompiled(const std::string &_chunk) { dlua_chunk dchunk; dchunk.compiled = _chunk; - return (dchunk); + return dchunk; } std::string dlua_chunk::describe(const std::string &name) const @@ -141,7 +141,7 @@ void dlua_chunk::set_chunk(const std::string &s) int dlua_chunk::check_op(CLua &interp, int err) { error = interp.error; - return (err); + return err; } int dlua_chunk::load(CLua &interp) @@ -154,13 +154,13 @@ int dlua_chunk::load(CLua &interp) if (empty()) { chunk.clear(); - return (E_CHUNK_LOAD_FAILURE); + return E_CHUNK_LOAD_FAILURE; } int err = check_op(interp, interp.loadstring(chunk.c_str(), context.c_str())); if (err) - return (err); + return err; std::ostringstream out; err = lua_dump(interp, dlua_compiled_chunk_writer, &out); if (err) @@ -170,14 +170,14 @@ int dlua_chunk::load(CLua &interp) lua_pop(interp, 2); } compiled = out.str(); - return (err); + return err; } int dlua_chunk::run(CLua &interp) { int err = load(interp); if (err) - return (err); + return err; // callfn returns true on success, but we want to return 0 on success. return (check_op(interp, !interp.callfn(NULL, 0, 0))); } @@ -186,9 +186,9 @@ int dlua_chunk::load_call(CLua &interp, const char *fn) { int err = load(interp); if (err == E_CHUNK_LOAD_FAILURE) - return (0); + return 0; if (err) - return (err); + return err; return check_op(interp, !interp.callfn(fn, fn? 1 : 0, 0)); } @@ -196,7 +196,7 @@ int dlua_chunk::load_call(CLua &interp, const char *fn) std::string dlua_chunk::orig_error() const { rewrite_chunk_errors(error); - return (error); + return error; } bool dlua_chunk::empty() const @@ -210,12 +210,12 @@ bool dlua_chunk::rewrite_chunk_errors(std::string &s) const std::string::size_type dlwhere = s.find(contextm); if (dlwhere == std::string::npos) - return (false); + return false; if (!dlwhere) { s = rewrite_chunk_prefix(s); - return (true); + return true; } // Our chunk is mentioned, go back through and rewrite lines. @@ -237,7 +237,7 @@ bool dlua_chunk::rewrite_chunk_errors(std::string &s) const } } s = newmsg; - return (true); + return true; } std::string dlua_chunk::rewrite_chunk_prefix(const std::string &line, @@ -247,7 +247,7 @@ std::string dlua_chunk::rewrite_chunk_prefix(const std::string &line, const std::string contextm = "[string \"" + context + "\"]:"; const std::string::size_type ps = s.find(contextm); if (ps == std::string::npos) - return (s); + return s; const std::string::size_type lns = ps + contextm.length(); std::string::size_type pe = s.find(':', ps + contextm.length()); diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index e2cad6a410..f783bac2ce 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -277,7 +277,7 @@ bool builder(bool enable_random_maps, dungeon_feature_type dest_stairs_type) try { if (_build_level_vetoable(enable_random_maps, dest_stairs_type)) - return (true); + return true; } catch (map_load_exception &mload) { @@ -307,7 +307,7 @@ bool builder(bool enable_random_maps, dungeon_feature_type dest_stairs_type) } env.level_layout_types.clear(); - return (false); + return false; } static bool _build_level_vetoable(bool enable_random_maps, @@ -399,7 +399,7 @@ static bool _build_level_vetoable(bool enable_random_maps, check_map_validity(); - return (true); + return true; } // Things that are bugs where we want to assert rather than to sweep it under @@ -739,7 +739,7 @@ static bool _dgn_fill_zone( points[cur].clear(); cur = !cur; } - return (ret); + return ret; } static bool _is_perm_down_stair(const coord_def &c) @@ -753,9 +753,9 @@ static bool _is_perm_down_stair(const coord_def &c) case DNGN_EXIT_PANDEMONIUM: case DNGN_TRANSIT_PANDEMONIUM: case DNGN_EXIT_ABYSS: - return (true); + return true; default: - return (false); + return false; } } @@ -792,9 +792,9 @@ static bool _is_upwards_exit_stair(const coord_def &c) case DNGN_EXIT_PANDEMONIUM: case DNGN_TRANSIT_PANDEMONIUM: case DNGN_EXIT_ABYSS: - return (true); + return true; default: - return (false); + return false; } } @@ -836,9 +836,9 @@ static bool _is_exit_stair(const coord_def &c) case DNGN_EXIT_PANDEMONIUM: case DNGN_TRANSIT_PANDEMONIUM: case DNGN_EXIT_ABYSS: - return (true); + return true; default: - return (false); + return false; } } @@ -1070,7 +1070,7 @@ bool dgn_ensure_vault_placed(bool vault_success, throw dgn_veto_exception("Vault placement failure."); else if (disable_further_vaults) use_random_maps = false; - return (vault_success); + return vault_success; } static bool _ensure_vault_placed_ex(bool vault_success, const map_def *vault) @@ -1123,7 +1123,7 @@ static bool _is_level_stair_connected(dungeon_feature_type feat) if (up.x && up.y) return _has_connected_downstairs_from(up); - return (false); + return false; } static bool _valid_dungeon_level() @@ -1134,7 +1134,7 @@ static bool _valid_dungeon_level() if (player_in_branch(BRANCH_MAIN_DUNGEON) && you.depth == 1) return _is_level_stair_connected(branches[BRANCH_MAIN_DUNGEON].exit_stairs); - return (true); + return true; } void dgn_reset_level(bool enable_random_maps) @@ -1684,10 +1684,10 @@ static bool _add_feat_if_missing(bool (*iswanted)(const coord_def &), // [ds] Too many normal cases trigger this ASSERT, including // rivers that surround a stair with deep water. // die("Couldn't find region."); - return (false); + return false; } - return (true); + return true; } static bool _add_connecting_escape_hatches() @@ -1696,20 +1696,20 @@ static bool _add_connecting_escape_hatches() // escape hatch. This will always allow (downward) progress. if (branches[you.where_are_you].branch_flags & BFLAG_ISLANDED) - return (true); + return true; if (!player_in_connected_branch()) - return (true); + return true; if (at_branch_bottom()) return (dgn_count_disconnected_zones(true) == 0); if (!_add_feat_if_missing(_is_perm_down_stair, DNGN_ESCAPE_HATCH_DOWN)) - return (false); + return false; // FIXME: shouldn't depend on branch. if (!player_in_branch(BRANCH_ORCISH_MINES)) - return (true); + return true; return (_add_feat_if_missing(_is_upwards_exit_stair, DNGN_ESCAPE_HATCH_UP)); } @@ -1723,10 +1723,10 @@ static bool _branch_entrances_are_connected() if (!feat_is_branch_stairs(grd(*ri))) continue; if (!_has_connected_stone_stairs_from(*ri)) - return (false); + return false; } - return (true); + return true; } static bool _branch_needs_stairs() @@ -2464,7 +2464,7 @@ static const map_def *_dgn_random_map_for_place(bool minivault) const map_def *vault = find_map_by_name(name); if (vault) - return (vault); + return vault; mprf(MSGCH_ERROR, "Unable to find Temple vault '%s'", name.c_str()); @@ -2502,7 +2502,7 @@ static const map_def *_dgn_random_map_for_place(bool minivault) vault = random_map_for_tag("entry"); } - return (vault); + return vault; } static int _setup_temple_altars(CrawlHashTable &temple) @@ -2698,7 +2698,7 @@ struct dummy_estimate { bool operator() (const coord_def & pos) { - return (0); + return 0; } }; @@ -2935,9 +2935,9 @@ static bool _shaft_is_in_corridor(const coord_def& c) for (orth_adjacent_iterator ai(c); ai; ++ai) { if (!in_bounds(*ai) || grd(*ai) < DNGN_MINWALK) - return (true); + return true; } - return (false); + return false; } static void _place_traps() @@ -3127,7 +3127,7 @@ static coord_def _dgn_random_point_in_bounds(dungeon_feature_type searchfeat, chosen = c; } } - return (chosen); + return chosen; } else { @@ -3162,7 +3162,7 @@ static bool _place_vault_by_tag(const std::string &tag) { const map_def *vault = random_map_for_tag(tag, true); if (!vault) - return (false); + return false; return _build_secondary_vault(vault); } @@ -3527,7 +3527,7 @@ static bool _map_feat_is_on_edge(const vault_placement &place, if (!place.map.in_map(*ai - place.pos)) return true; - return (false); + return false; } static void _pick_float_exits(vault_placement &place, @@ -3596,7 +3596,7 @@ bool dgn_place_map(const map_def *mdef, const coord_def &where) { if (!mdef) - return (false); + return false; const dgn_colour_override_manager colour_man; @@ -3609,7 +3609,7 @@ bool dgn_place_map(const map_def *mdef, "Cannot generate encompass map '%s' with check_collision=true", mdef->name.c_str()); - return (false); + return false; } // For encompass maps, clear the entire level. @@ -3618,7 +3618,7 @@ bool dgn_place_map(const map_def *mdef, dungeon_events.clear(); const bool res = dgn_place_map(mdef, check_collision, make_no_exits, where); _fixup_after_vault(); - return (res); + return res; } const int map_index = env.level_vaults.size(); @@ -3643,7 +3643,7 @@ bool dgn_place_map(const map_def *mdef, _dgn_postprocess_level(); } - return (did_map); + return did_map; } // Identical to dgn_place_map, but recovers gracefully from @@ -3681,7 +3681,7 @@ const map_def *dgn_safe_place_map(const map_def *mdef, mdef = find_map_by_name(mapname); } else - return (NULL); + return NULL; } } } @@ -3710,7 +3710,7 @@ static bool _vault_wants_damage(const vault_placement &vp) { const map_def &map = vp.map; if (map.has_tag("ruin")) - return (true); + return true; // Some vaults may want to be ruined only in certain places with // tags like "ruin_abyss" or "ruin_lair" @@ -3773,7 +3773,7 @@ static bool _build_vault_impl(const map_def *vault, place.pos.x, place.pos.y, place.size.x, place.size.y); if (placed_vault_orientation == MAP_NONE) - return (false); + return false; // XXX: Moved this out of dgn_register_place so that vault-set monsters can // be accessed with the '9' and '8' glyphs. (due) @@ -3831,7 +3831,7 @@ static bool _build_vault_impl(const map_def *vault, throw dgn_veto_exception("Post-place hook failed for: " + place.map.name); - return (true); + return true; } static void _build_postvault_level(vault_placement &place) @@ -3922,7 +3922,7 @@ int dgn_place_item(const item_spec &spec, { // Dummy object? if (spec.base_type == OBJ_UNASSIGNED) - return (NON_ITEM); + return NON_ITEM; if (level == INVALID_ABSDEPTH) level = env.absdepth0; @@ -4077,10 +4077,10 @@ retry: if (props.exists("no_mimic")) item.flags |= ISFLAG_NO_MIMIC; - return (item_made); + return item_made; } - return (NON_ITEM); + return NON_ITEM; } void dgn_place_multiple_items(item_list &list, @@ -4442,9 +4442,9 @@ static bool _dgn_place_one_monster(const vault_placement &place, { mons_spec spec = mons.get_monster(i); if (_dgn_place_monster(place, spec, monster_level, where)) - return (true); + return true; } - return (false); + return false; } /* "Oddball grids" are handled in _vault_grid. 'B' is arguably oddball, too, as @@ -4501,7 +4501,7 @@ dungeon_feature_type map_feature_at(map_def *map, const coord_def &c, rawfeat = map->glyph_at(c); if (rawfeat == ' ') - return (NUM_FEATURES); + return NUM_FEATURES; keyed_mapspec *mapsp = map? map->mapspec_at(c) : NULL; if (mapsp) @@ -4513,16 +4513,16 @@ dungeon_feature_type map_feature_at(map_def *map, const coord_def &c, if (f.feat == 1) return trap_category(static_cast<trap_type>(f.trap.get()->tr_type)); else - return (DNGN_UNDISCOVERED_TRAP); + return DNGN_UNDISCOVERED_TRAP; } else if (f.feat >= 0) return static_cast<dungeon_feature_type>(f.feat); else if (f.glyph >= 0) return map_feature_at(NULL, c, f.glyph); else if (f.shop.get()) - return (DNGN_ENTER_SHOP); + return DNGN_ENTER_SHOP; - return (DNGN_FLOOR); + return DNGN_FLOOR; } return _glyph_to_feat(rawfeat); @@ -4739,7 +4739,7 @@ bool seen_replace_feat(dungeon_feature_type old_feat, } } - return (seen); + return seen; } void dgn_replace_area(int sx, int sy, int ex, int ey, @@ -4837,7 +4837,7 @@ static bool _join_the_dots_pathfind(coord_set &coords, } if (curr != to) - return (false); + return false; while (curr != from) { @@ -4851,7 +4851,7 @@ static bool _join_the_dots_pathfind(coord_set &coords, if (!map_masked(curr, mapmask)) grd(curr) = DNGN_FLOOR; - return (true); + return true; } bool join_the_dots(const coord_def &from, const coord_def &to, @@ -4863,7 +4863,7 @@ bool join_the_dots(const coord_def &from, const coord_def &to, coord_set coords(comp); const bool found = _join_the_dots_pathfind(coords, from, to, mapmask); - return (found); + return found; } static dungeon_feature_type _pick_temple_altar(vault_placement &place) @@ -4873,7 +4873,7 @@ static dungeon_feature_type _pick_temple_altar(vault_placement &place) if (_current_temple_hash != NULL) { mpr("Ran out of altars for temple!", MSGCH_ERROR); - return (DNGN_FLOOR); + return DNGN_FLOOR; } // Randomized altar list for mini-temples. _temple_altar_list = temple_god_list(); @@ -5207,42 +5207,42 @@ static object_class_type _item_in_shop(shop_type shop_type) { case SHOP_WEAPON: if (one_chance_in(5)) - return (OBJ_MISSILES); + return OBJ_MISSILES; // *** deliberate fall through here {dlb} *** case SHOP_WEAPON_ANTIQUE: - return (OBJ_WEAPONS); + return OBJ_WEAPONS; case SHOP_ARMOUR: case SHOP_ARMOUR_ANTIQUE: - return (OBJ_ARMOUR); + return OBJ_ARMOUR; case SHOP_GENERAL: case SHOP_GENERAL_ANTIQUE: - return (OBJ_RANDOM); + return OBJ_RANDOM; case SHOP_JEWELLERY: - return (OBJ_JEWELLERY); + return OBJ_JEWELLERY; case SHOP_WAND: - return (OBJ_WANDS); + return OBJ_WANDS; case SHOP_BOOK: - return (OBJ_BOOKS); + return OBJ_BOOKS; case SHOP_FOOD: - return (OBJ_FOOD); + return OBJ_FOOD; case SHOP_DISTILLERY: - return (OBJ_POTIONS); + return OBJ_POTIONS; case SHOP_SCROLL: - return (OBJ_SCROLLS); + return OBJ_SCROLLS; default: die("unknown shop type"); } - return (OBJ_RANDOM); + return OBJ_RANDOM; } // Keep seeds away from the borders so we don't end up with a @@ -5311,7 +5311,7 @@ static bool _connect_spotty(const coord_def& from) for (it = flatten.begin(); it != flatten.end(); ++it) grd(*it) = DNGN_FLOOR; - return (success); + return success; } bool place_specific_trap(const coord_def& where, trap_type spec_type, int charges) @@ -5346,10 +5346,10 @@ static bool _place_specific_trap(const coord_def& where, trap_spec* spec, int ch grd(where) = DNGN_UNDISCOVERED_TRAP; env.tgrid(where) = tcount; env.trap[tcount].prepare_ammo(charges); - return (true); + return true; } - return (false); + return false; } static void _add_plant_clumps(int frequency /* = 10 */, @@ -5498,7 +5498,7 @@ coord_def dgn_find_feature_marker(dungeon_feature_type feat) } } coord_def unfound; - return (unfound); + return unfound; } static coord_def _dgn_find_labyrinth_entry_point() @@ -5546,21 +5546,21 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find, if (player_in_branch(BRANCH_SLIME_PITS)) _fixup_slime_hatch_dest(&pos); if (in_bounds(pos)) - return (pos); + return pos; } if (stair_to_find == DNGN_STONE_ARCH) { const coord_def pos(dgn_find_feature_marker(stair_to_find)); if (in_bounds(pos) && grd(pos) == stair_to_find) - return (pos); + return pos; } if (player_in_branch(BRANCH_LABYRINTH)) { const coord_def pos(_dgn_find_labyrinth_entry_point()); if (in_bounds(pos)) - return (pos); + return pos; // Couldn't find a good place, warn, and use old behaviour. dprf("Oops, couldn't find labyrinth entry marker."); @@ -5571,7 +5571,7 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find, { const coord_def pos(dgn_find_feature_marker(DNGN_STONE_STAIRS_UP_I)); if (in_bounds(pos) && grd(pos) == stair_to_find) - return (pos); + return pos; } // Scan around the player's position first. @@ -5697,7 +5697,7 @@ coord_def dgn_find_nearby_stair(dungeon_feature_type stair_to_find, const coord_def pos(dgn_find_feature_marker(stair_to_find)); if (in_bounds(pos)) - return (pos); + return pos; // Look for any clear terrain and abandon the idea of looking // nearby now. This is used when taking transit Pandemonium gates, @@ -5748,9 +5748,9 @@ bool dgn_region::overlaps_any(const dgn_region_list ®ions) const i != regions.end(); ++i) { if (overlaps(*i)) - return (true); + return true; } - return (false); + return false; } bool dgn_region::overlaps(const dgn_region_list ®ions, @@ -5766,10 +5766,10 @@ bool dgn_region::overlaps(const map_mask &mask) const for (int x = pos.x; x < endp.x; ++x) { if (mask[x][y]) - return (true); + return true; } - return (false); + return false; } coord_def dgn_region::random_edge_point() const @@ -5876,9 +5876,9 @@ static bool _fixup_interlevel_connectivity() // this check. if (!player_in_connected_branch() || brdepth[you.where_are_you] == -1) - return (true); + return true; if (branches[you.where_are_you].branch_flags & BFLAG_ISLANDED) - return (true); + return true; StairConnectivity prev_con; if (you.depth > 1) @@ -5935,7 +5935,7 @@ static bool _fixup_interlevel_connectivity() else { // Too many stairs! - return (false); + return false; } break; } @@ -5953,7 +5953,7 @@ static bool _fixup_interlevel_connectivity() else { // Too many stairs! - return (false); + return false; } break; } @@ -5965,7 +5965,7 @@ static bool _fixup_interlevel_connectivity() // Ensure all up stairs were found. for (int i = 0; i < 3; i++) if (up_region[i] == -1) - return (false); + return false; region_connected.resize(max_region + 1); for (unsigned int i = 0; i < region_connected.size(); i++) @@ -5984,7 +5984,7 @@ static bool _fixup_interlevel_connectivity() bool any_connected = has_down[0] || has_down[1] || has_down[2]; if (!any_connected && !at_branch_bottom()) - return (false); + return false; // Keep track of what stairs we've assigned. int assign_prev[3] = {-1, -1, -1}; @@ -6011,7 +6011,7 @@ static bool _fixup_interlevel_connectivity() } } if (!minimal_connectivity) - return (false); + return false; // For each disconnected stair (in a unique region) on the previous level, // try to reconnect to a connected up stair on the current level. @@ -6102,7 +6102,7 @@ static bool _fixup_interlevel_connectivity() { for (int i = 0; i < 3; i++) if (!region_connected[up_region[i]]) - return (false); + return false; } // Sanity check that we're not duplicating stairs. @@ -6110,7 +6110,7 @@ static bool _fixup_interlevel_connectivity() && assign_cur[1] != assign_cur[2]); ASSERT(stairs_unique); if (!stairs_unique) - return (false); + return false; // Reassign up stair numbers as needed. for (int i = 0; i < 3; i++) @@ -6135,7 +6135,7 @@ static bool _fixup_interlevel_connectivity() connectivity[your_branch().id][you.depth - 2] = prev_con; connectivity[your_branch().id][you.depth - 1] = this_con; - return (true); + return true; } void run_map_epilogues() @@ -6314,7 +6314,7 @@ std::string dump_vault_maps() } out += "\n"; } - return (out); + return out; } /////////////////////////////////////////////////////////////////////////// @@ -6361,7 +6361,7 @@ vault_place_iterator vault_place_iterator::operator ++ (int) { const vault_place_iterator copy = *this; ++*this; - return (copy); + return copy; } ////////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index d7466c606e..8af56332f0 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -237,7 +237,7 @@ int torment_player(actor *attacker, int taux) if (!hploss) { mpr("You feel a surge of unholy energy."); - return (0); + return 0; } mpr("Your body is wracked with pain!"); @@ -281,7 +281,7 @@ int torment_player(actor *attacker, int taux) ouch(hploss, attacker? attacker->mindex() : MHITNOT, type, aux); - return (1); + return 1; } // torment_monsters() is called with power 0 because torment is @@ -300,10 +300,10 @@ int torment_monsters(coord_def where, actor *attacker, int taux) // Is a monster in this cell? monster* mons = monster_at(where); if (mons == NULL) - return (retval); + return retval; if (!mons->alive() || mons->res_torment()) - return (retval); + return retval; int hploss = std::max(0, mons->hit_points / 2 - 1); @@ -323,7 +323,7 @@ int torment_monsters(coord_def where, actor *attacker, int taux) if (hploss) retval = 1; - return (retval); + return retval; } int torment(actor *attacker, int taux, const coord_def& where) @@ -337,7 +337,7 @@ int torment(actor *attacker, int taux, const coord_def& where) continue; r += torment_monsters(*ri, attacker, taux); } - return (r); + return r; } void immolation(int pow, int caster, coord_def where, bool known, @@ -413,15 +413,15 @@ static bool _conduct_electricity_damage(bolt &beam, actor* victim, int &dmg, std::string &dmg_msg) { dmg = (10 + random2(15)) / 2; - return (false); + return false; } static bool _conduct_electricity_aoe(bolt& beam, const coord_def& target) { if (feat_is_water(grd(target))) - return (true); + return true; - return (false); + return false; } void conduct_electricity(coord_def where, actor *attacker) @@ -544,7 +544,7 @@ bool forget_spell(void) ASSERT(!crawl_state.game_is_arena()); if (!you.spell_no) - return (false); + return false; // find a random spell to forget: int slot = -1; @@ -561,13 +561,13 @@ bool forget_spell(void) } if (slot == -1) // should never happen though - return (false); + return false; mprf("Your knowledge of %s becomes hazy all of a sudden, and you forget " "the spell!", spell_title(you.spells[slot])); del_spell_from_memory_by_slot(slot); - return (true); + return true; } void direct_effect(monster* source, spell_type spell, @@ -782,7 +782,7 @@ int recharge_wand(int item_slot, bool known, std::string *pre_msg) } if (wand.base_type != OBJ_WANDS && wand.base_type != OBJ_RODS) - return (0); + return 0; if (wand.base_type == OBJ_WANDS) { @@ -854,7 +854,7 @@ int recharge_wand(int item_slot, bool known, std::string *pre_msg) } if (!work) - return (0); + return 0; if (pre_msg) mpr(pre_msg->c_str()); @@ -863,11 +863,11 @@ int recharge_wand(int item_slot, bool known, std::string *pre_msg) } you.wield_change = true; - return (1); + return 1; } while (true); - return (0); + return 0; } // Berserking monsters cannot be ordered around. @@ -1119,7 +1119,7 @@ inline static dungeon_feature_type _vitrified_feature(dungeon_feature_type feat) bool vitrify_area(int radius) { if (radius < 2) - return (false); + return false; bool something_happened = false; for (radius_iterator ri(you.pos(), radius, C_POINTY); ri; ++ri) @@ -1133,7 +1133,7 @@ bool vitrify_area(int radius) something_happened = true; } } - return (something_happened); + return something_happened; } static void _hell_effects() @@ -1272,7 +1272,7 @@ static bool _feat_is_flanked_by_walls(const coord_def &p) // paranoia! for (unsigned int i = 0; i < ARRAYSZ(adjs); ++i) if (!in_bounds(adjs[i])) - return (false); + return false; return (feat_is_wall(grd(adjs[0])) && feat_is_wall(grd(adjs[1])) && feat_has_solid_floor(grd(adjs[2])) && feat_has_solid_floor(grd(adjs[3])) @@ -1326,7 +1326,7 @@ static bool _deadend_check_wall(const coord_def &p) && (!in_bounds(c) || !in_bounds(d) || !feat_is_wall(grd(c)) || !feat_is_wall(grd(d)))) { - return (false); + return false; } } } @@ -1347,12 +1347,12 @@ static bool _deadend_check_wall(const coord_def &p) && (!in_bounds(c) || !in_bounds(d) || !feat_is_wall(grd(c)) || !feat_is_wall(grd(d)))) { - return (false); + return false; } } } - return (true); + return true; } // Similar to the above, checks whether turning a wall grid into floor @@ -1395,7 +1395,7 @@ static bool _deadend_check_floor(const coord_def &p) const coord_def c(p.x+j, p.y+i); if (feat_has_solid_floor(grd(c)) && !feat_has_solid_floor(grd(b))) - return (false); + return false; } } } @@ -1421,12 +1421,12 @@ static bool _deadend_check_floor(const coord_def &p) const coord_def c(p.x+i, p.y+j); if (feat_has_solid_floor(grd(c)) && !feat_has_solid_floor(grd(b))) - return (false); + return false; } } } - return (true); + return true; } // Changes a small portion of a labyrinth by exchanging wall against floor @@ -1754,32 +1754,32 @@ void change_labyrinth(bool msg) static bool _food_item_needs_time_check(item_def &item) { if (!item.defined()) - return (false); + return false; if (item.base_type != OBJ_CORPSES && item.base_type != OBJ_FOOD && item.base_type != OBJ_POTIONS) { - return (false); + return false; } if (item.base_type == OBJ_CORPSES && item.sub_type > CORPSE_SKELETON) { - return (false); + return false; } if (item.base_type == OBJ_FOOD && item.sub_type != FOOD_CHUNK) - return (false); + return false; if (item.base_type == OBJ_POTIONS && !is_blood_potion(item)) - return (false); + return false; // The object specifically asks not to be checked: if (item.props.exists(CORPSE_NEVER_DECAYS)) - return (false); + return false; - return (true); + return true; } #define ROTTING_WARNED_KEY "rotting_warned" @@ -2667,7 +2667,7 @@ int place_ring(std::vector<coord_def> &ring_points, seen_count++; } - return (spawned_count); + return spawned_count; } // Collect lists of points that are within LOS (under the given env map), @@ -2786,7 +2786,7 @@ static int _mushroom_ring(item_def &corpse, int & seen_count, // Not enough valid points? if (radius_points[chosen_idx].size() < min_spawn) - return (0); + return 0; mgen_data temp(MONS_TOADSTOOL, toadstool_behavior, 0, 0, 0, @@ -2806,7 +2806,7 @@ static int _mushroom_ring(item_def &corpse, int & seen_count, int spawned_count = place_ring(radius_points[chosen_idx], corpse.pos, temp, n_arcs, 1, seen_count); - return (spawned_count); + return spawned_count; } // Try to spawn 'target_count' mushrooms around the position of @@ -2824,7 +2824,7 @@ int spawn_corpse_mushrooms(item_def& corpse, { seen_targets = 0; if (target_count == 0) - return (0); + return 0; int c_size = 8; int permutation[] = {0, 1, 2, 3, 4, 5, 6, 7}; @@ -2856,7 +2856,7 @@ int spawn_corpse_mushrooms(item_def& corpse, seen_targets = -1; - return (res); + return res; } } @@ -2956,7 +2956,7 @@ int spawn_corpse_mushrooms(item_def& corpse, } } - return (placed_targets); + return placed_targets; } int mushroom_prob(item_def & corpse) @@ -2984,7 +2984,7 @@ int mushroom_prob(item_def & corpse) int trial_prob = static_cast<int>(100 * trial_prob_f); - return (trial_prob); + return trial_prob; } bool mushroom_spawn_message(int seen_targets, int seen_corpses) @@ -2999,10 +2999,10 @@ bool mushroom_spawn_message(int seen_targets, int seen_corpses) mprf("%s grow%s from %s.", what.c_str(), seen_targets > 1 ? "" : "s", where.c_str()); - return (true); + return true; } - return (false); + return false; } // Randomly decide whether or not to spawn a mushroom over the given diff --git a/crawl-ref/source/evoke.cc b/crawl-ref/source/evoke.cc index f2263bacdd..302726e51a 100644 --- a/crawl-ref/source/evoke.cc +++ b/crawl-ref/source/evoke.cc @@ -82,13 +82,13 @@ static bool _reaching_weapon_attack(const item_def& wpn) { if (beam.isCancel) canned_msg(MSG_OK); - return (false); + return false; } if (beam.isMe()) { canned_msg(MSG_UNTHINKING_ACT); - return (false); + return false; } if (you.confused()) @@ -112,7 +112,7 @@ static bool _reaching_weapon_attack(const item_def& wpn) if (x_distance > 2 || y_distance > 2) { mpr("Your weapon cannot reach that far!"); - return (false); // Shouldn't happen with confused swings + return false; // Shouldn't happen with confused swings } else if (!feat_is_reachable_past(grd(first_middle)) && !feat_is_reachable_past(grd(second_middle))) @@ -122,12 +122,12 @@ static bool _reaching_weapon_attack(const item_def& wpn) if (you.confused()) { mpr("You swing wildly and hit a wall."); - return (true); + return true; } else { mpr("There's a wall in the way."); - return (false); + return false; } } @@ -189,18 +189,18 @@ static bool _reaching_weapon_attack(const item_def& wpn) " and almost hit yourself!" : "."); else mpr("You attack empty space."); - return (true); + return true; } else { if (!fight_melee(&you, mons)) { canned_msg(MSG_OK); - return (false); + return false; } } - return (true); + return true; } static bool _evoke_horn_of_geryon(item_def &item) @@ -269,7 +269,7 @@ static bool _evoke_horn_of_geryon(item_def &item) mgen_data::hostile_at(MONS_HELL_BEAST, "the horn of Geryon", true, 4, 0, you.pos())); } - return (rc); + return rc; } static bool _efreet_flask(int slot) @@ -308,7 +308,7 @@ static bool _efreet_flask(int slot) dec_inv_item_quantity(slot, 1); - return (true); + return true; } static bool _check_crystal_ball() @@ -316,20 +316,20 @@ static bool _check_crystal_ball() if (you.intel() <= 1) { mpr("You lack the intelligence to focus on the shapes in the ball."); - return (false); + return false; } if (you.confused()) { mpr("You are unable to concentrate on the shapes in the ball."); - return (false); + return false; } if (you.magic_points == you.max_magic_points) { mpr("With no energy to recover, the crystal ball of energy is " "presently useless to you."); - return (false); + return false; } if (you.skill(SK_EVOCATIONS) < 2) @@ -338,7 +338,7 @@ static bool _check_crystal_ball() return false; } - return (true); + return true; } bool disc_of_storms(bool drac_breath) @@ -397,7 +397,7 @@ bool disc_of_storms(bool drac_breath) } } } - return (rc); + return rc; } void tome_of_power(int slot) @@ -613,7 +613,7 @@ static bool _box_of_beasts(item_def &box) } } - return (success); + return success; } static bool _ball_of_energy(void) @@ -652,7 +652,7 @@ static bool _ball_of_energy(void) } } - return (ret); + return ret; } bool evoke_item(int slot) @@ -663,7 +663,7 @@ bool evoke_item(int slot) || weapon_reach(*you.weapon()) <= 2)) { canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } if (slot == -1) @@ -674,10 +674,10 @@ bool evoke_item(int slot) NULL, OPER_EVOKE); if (prompt_failed(slot)) - return (false); + return false; } else if (!check_warning_inscriptions(you.inv[slot], OPER_EVOKE)) - return (false); + return false; ASSERT(slot >= 0); @@ -688,7 +688,7 @@ bool evoke_item(int slot) item_def& item = you.inv[slot]; // Also handles messages. if (!item_is_evokable(item, true, false, false, true)) - return (false); + return false; if (you.suppressed() && weapon_reach(item) <= 2) { @@ -711,14 +711,14 @@ bool evoke_item(int slot) { if (!unevokable) count_action(CACT_EVOKE, EVOC_MISC); - return (did_work); + return did_work; } } else switch (item.base_type) { case OBJ_WANDS: zap_wand(slot); - return (true); + return true; case OBJ_WEAPONS: ASSERT(wielded); @@ -731,7 +731,7 @@ bool evoke_item(int slot) did_work = true; } else - return (false); + return false; } else unevokable = true; @@ -749,7 +749,7 @@ bool evoke_item(int slot) pract = rod_spell(slot); // [ds] Early exit, no turns are lost. if (pract == -1) - return (false); + return false; did_work = true; // rod_spell() will handle messages count_action(CACT_EVOKE, EVOC_ROD); @@ -772,12 +772,12 @@ bool evoke_item(int slot) if (!you.is_undead && you.hunger_state == HS_STARVING) { canned_msg(MSG_TOO_HUNGRY); - return (false); + return false; } else if (you.magic_points >= you.max_magic_points) { mpr("Your reserves of magic are already full."); - return (false); + return false; } else if (x_chance_in_y(you.skill(SK_EVOCATIONS, 100) + 1100, 4000)) { @@ -893,5 +893,5 @@ bool evoke_item(int slot) else crawl_state.zero_turns_taken(); - return (did_work); + return did_work; } diff --git a/crawl-ref/source/exclude.cc b/crawl-ref/source/exclude.cc index 49768637ab..c373ebead4 100644 --- a/crawl-ref/source/exclude.cc +++ b/crawl-ref/source/exclude.cc @@ -53,10 +53,10 @@ static bool _need_auto_exclude(const monster* mon, bool sleepy = false) && (mon->attitude == ATT_HOSTILE || mon->type == MONS_HYPERACTIVE_BALLISTOMYCETE)) { - return (true); + return true; } - return (false); + return false; } // Nightstalker reduces LOS, so reducing the maximum exclusion radius @@ -297,7 +297,7 @@ travel_exclude* exclude_set::get_exclude_root(const coord_def &p) if (it != exclude_roots.end()) return (&(it->second)); - return (NULL); + return NULL; } size_t exclude_set::size() const diff --git a/crawl-ref/source/exercise.cc b/crawl-ref/source/exercise.cc index 6e2e331e65..c73ebc5d70 100644 --- a/crawl-ref/source/exercise.cc +++ b/crawl-ref/source/exercise.cc @@ -25,14 +25,14 @@ skill_type abil_skill(ability_type abil) case ABIL_EVOKE_BERSERK: case ABIL_EVOKE_TURN_INVISIBLE: case ABIL_EVOKE_LEVITATE: - return (SK_EVOCATIONS); + return SK_EVOCATIONS; case ABIL_NEMELEX_DRAW_ONE: case ABIL_NEMELEX_PEEK_TWO: case ABIL_NEMELEX_TRIPLE_DRAW: case ABIL_NEMELEX_DEAL_FOUR: case ABIL_NEMELEX_STACK_FIVE: - return (SK_EVOCATIONS); + return SK_EVOCATIONS; case ABIL_YRED_RECALL_UNDEAD_SLAVES: case ABIL_MAKHLEB_MINOR_DESTRUCTION: @@ -78,14 +78,14 @@ skill_type abil_skill(ability_type abil) case ABIL_YRED_ENSLAVE_SOUL: case ABIL_LUGONU_ABYSS_EXIT: case ABIL_CHEIBRIADOS_DISTORTION: - return (SK_INVOCATIONS); + return SK_INVOCATIONS; case ABIL_KIKU_RECEIVE_CORPSES: case ABIL_KIKU_TORMENT: - return (SK_NECROMANCY); + return SK_NECROMANCY; default: - return (SK_NONE); + return SK_NONE; } } @@ -98,7 +98,7 @@ static int _abil_degree(ability_type abil) case ABIL_EVOKE_BERSERK: case ABIL_EVOKE_TURN_INVISIBLE: case ABIL_EVOKE_LEVITATE: - return (1); + return 1; case ABIL_NEMELEX_DRAW_ONE: return (1 + random2(2)); @@ -116,14 +116,14 @@ static int _abil_degree(ability_type abil) case ABIL_ELYVILON_LESSER_HEALING_SELF: case ABIL_ELYVILON_LESSER_HEALING_OTHERS: case ABIL_BEOGH_RECALL_ORCISH_FOLLOWERS: - return (1); + return 1; case ABIL_SIF_MUNA_CHANNEL_ENERGY: case ABIL_OKAWARU_HEROISM: case ABIL_JIYVA_CALL_JELLY: return (1 + random2(3)); case ABIL_ZIN_RECITE: - return (2); + return 2; case ABIL_ZIN_VITALISATION: case ABIL_TSO_DIVINE_SHIELD: case ABIL_KIKU_RECEIVE_CORPSES: @@ -180,7 +180,7 @@ static int _abil_degree(ability_type abil) return (8 + random2(10)); default: - return (0); + return 0; } } @@ -258,10 +258,10 @@ static bool _check_train_armour(int amount) if (x_chance_in_y(mass, you.skill(SK_ARMOUR, 50))) { exercise(SK_ARMOUR, amount); - return (true); + return true; } } - return (false); + return false; } static bool _check_train_dodging(int amount) @@ -271,9 +271,9 @@ static bool _check_train_dodging(int amount) if (!x_chance_in_y(mass, 800)) { exercise(SK_DODGING, amount); - return (true); + return true; } - return (false); + return false; } static void _check_train_sneak(bool invis) diff --git a/crawl-ref/source/fearmonger.cc b/crawl-ref/source/fearmonger.cc index 9ef652c2c7..8e856a66e2 100644 --- a/crawl-ref/source/fearmonger.cc +++ b/crawl-ref/source/fearmonger.cc @@ -29,7 +29,7 @@ bool player::add_fearmonger(const monster* mon) else mpr("The fearful aura is strangely muted, and has no effect on you."); - return (false); + return false; } if (!duration[DUR_AFRAID]) @@ -46,7 +46,7 @@ bool player::add_fearmonger(const monster* mon) fearmongers.push_back(mon->mindex()); } - return (true); + return true; } // Whether player is afraid. @@ -61,8 +61,8 @@ bool player::afraid_of(const monster* mon) const { for (unsigned int i = 0; i < fearmongers.size(); i++) if (fearmongers[i] == mon->mindex()) - return (true); - return (false); + return true; + return false; } // Checks whether a fearmonger keeps you from moving to @@ -76,9 +76,9 @@ monster* player::get_fearmonger(const coord_def &target) const const int newdist = grid_distance(target, mon->pos()); if (olddist > newdist) - return (mon); + return mon; } - return (NULL); + return NULL; } monster* player::get_any_fearmonger() const @@ -86,7 +86,7 @@ monster* player::get_any_fearmonger() const if (!fearmongers.empty()) return (&menv[fearmongers[0]]); else - return (NULL); + return NULL; } // Removes a monster from the list of fearmongers if present. @@ -179,7 +179,7 @@ void player::_removed_fearmonger() bool player::_possible_fearmonger(const monster* mon) const { if (crawl_state.game_is_arena()) - return (false); + return false; return (mon->alive() && !silenced(pos()) && !silenced(mon->pos()) diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index de482120ba..96497e9e98 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -58,15 +58,15 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) // Friendly and good neutral monsters won't attack unless confused. if (attacker->as_monster()->wont_attack() && !mons_is_confused(attacker->as_monster())) - return (false); + return false; // It's hard to attack from within a shell. if (attacker->as_monster()->withdrawn()) - return (false); + return false; // Boulders can't melee while they're rolling past you if (attacker->as_monster()->rolling()) - return (false); + return false; // In case the monster hasn't noticed you, bumping into it will // change that. @@ -79,7 +79,7 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) if (mons_is_projectile(defender->type) && !you.confused()) { you.turn_is_over = false; - return (false); + return false; } melee_attack attk(&you, defender); @@ -97,7 +97,7 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) && !wielded_weapon_check(attk.weapon)) { you.turn_is_over = false; - return (false); + return false; } if (!attk.attack()) @@ -105,13 +105,13 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) // Attack was cancelled or unsuccessful... if (attk.cancel_attack) you.turn_is_over = false; - return (false); + return false; } if (did_hit) *did_hit = attk.did_hit; - return (true); + return true; } // If execution gets here, attacker != Player, so we can safely continue @@ -131,7 +131,7 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) ++attack_number, ++effective_attack_number) { if (!attacker->alive()) - return (false); + return false; // Monster went away? if (!defender->alive() || defender->pos() != pos) @@ -186,7 +186,7 @@ bool fight_melee(actor *attacker, actor *defender, bool *did_hit, bool simu) *did_hit = melee_attk.did_hit; } - return (true); + return true; } unchivalric_attack_type is_unchivalric_attack(const actor *attacker, @@ -199,7 +199,7 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker, // plants) or monsters the attacker can't see (either due to // invisibility or being behind opaque clouds). if (defender->cannot_fight() || (attacker && !attacker->can_see(defender))) - return (unchivalric); + return unchivalric; // Distracted (but not batty); this only applies to players. if (attacker && attacker->is_player() @@ -244,7 +244,7 @@ unchivalric_attack_type is_unchivalric_attack(const actor *attacker, if (defender->asleep()) unchivalric = UCAT_SLEEPING; - return (unchivalric); + return unchivalric; } static bool is_boolean_resist(beam_type flavour) @@ -256,9 +256,9 @@ static bool is_boolean_resist(beam_type flavour) case BEAM_NAPALM: case BEAM_WATER: // water asphyxiation damage, // bypassed by being water inhabitant. - return (true); + return true; default: - return (false); + return false; } } @@ -271,20 +271,20 @@ static inline int get_resistible_fraction(beam_type flavour) // Drowning damage from water is resistible by being a water thing, or // otherwise asphyx resistant. case BEAM_WATER: - return (40); + return 40; // Assume ice storm and throw icicle are mostly solid. case BEAM_ICE: - return (40); + return 40; case BEAM_LAVA: - return (55); + return 55; case BEAM_POISON_ARROW: - return (70); + return 70; default: - return (100); + return 100; } } @@ -300,7 +300,7 @@ int resist_adjust_damage(actor *defender, beam_type flavour, int res, int rawdamage, bool ranged) { if (!res) - return (rawdamage); + return rawdamage; const bool mons = (defender->is_monster()); @@ -340,10 +340,10 @@ int resist_adjust_damage(actor *defender, beam_type flavour, bool is_melee_weapon(const item_def *weapon) { if (weapon->base_type == OBJ_STAVES || weapon->base_type == OBJ_RODS) - return (true); + return true; if (weapon->base_type != OBJ_WEAPONS) - return (false); + return false; return (!is_range_weapon(*weapon)); } @@ -377,7 +377,7 @@ bool wielded_weapon_check(item_def *weapon, bool no_message) && (weapon_warning || unarmed_warning)) { if (no_message) - return (false); + return false; std::string prompt = "Really attack while "; if (unarmed_warning) @@ -393,10 +393,10 @@ bool wielded_weapon_check(item_def *weapon, bool no_message) if (result) you.received_weapon_warning = true; - return (result); + return result; } - return (true); + return true; } // Returns a value between 0 and 10 representing the weight given to str @@ -459,7 +459,7 @@ int weapon_str_weight(object_class_type wpn_class, int wpn_type) ret = 8; } - return (ret); + return ret; } // Returns a value from 0 to 10 representing the weight of strength to @@ -472,14 +472,14 @@ int player_weapon_str_weight() // but then we'd be punishing Trolls and Ghouls who are strong and // get special unarmed bonuses. if (!weapon) - return (4); + return 4; int ret = weapon_str_weight(weapon->base_type, weapon->sub_type); if (hands_reqd(*weapon, you.body_size()) == HANDS_HALF && !you.shield()) ret += 1; - return (ret); + return ret; } // weapon_dex_weight() + weapon_str_weight == 10, so we only need to diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index 4443fc3ce9..f0e3b193ce 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -194,7 +194,7 @@ std::vector<std::string> get_dir_files_recursive(const std::string &dirname, files.push_back(filename); } } - return (files); + return files; } std::vector<std::string> get_dir_files_ext(const std::string &dir, @@ -226,7 +226,7 @@ std::string get_base_filename(const std::string &filename) if (pos != std::string::npos) return filename.substr(pos + 1); #endif - return (filename); + return filename; } std::string get_cache_name(const std::string &filename) @@ -243,7 +243,7 @@ std::string get_cache_name(const std::string &filename) if (pos != std::string::npos) return replace_all_of(filename.substr(pos + 5), " /\\:", "_"); #endif - return (filename); + return filename; } bool is_absolute_path(const std::string &path) @@ -264,7 +264,7 @@ bool is_absolute_path(const std::string &path) std::string catpath(const std::string &first, const std::string &second) { if (first.empty()) - return (second); + return second; std::string directory = first; if (directory[directory.length() - 1] != FILE_SEPARATOR @@ -274,7 +274,7 @@ std::string catpath(const std::string &first, const std::string &second) } directory += second; - return (directory); + return directory; } // Given a relative path and a reference file name, returns the relative path @@ -299,7 +299,7 @@ time_t file_modtime(const std::string &file) { struct stat filestat; if (stat(file.c_str(), &filestat)) - return (0); + return 0; return (filestat.st_mtime); } @@ -308,7 +308,7 @@ time_t file_modtime(FILE *f) { struct stat filestat; if (fstat(fileno(f), &filestat)) - return (0); + return 0; return (filestat.st_mtime); } @@ -343,11 +343,11 @@ static bool _create_dirs(const std::string &dir) path = FILE_SEPARATOR + path; if (!_create_directory(path.c_str())) - return (false); + return false; path += FILE_SEPARATOR; } - return (true); + return true; } // Checks whether the given path is safe to read from. A path is safe if: @@ -447,7 +447,7 @@ std::string datafile_path(std::string basename, basename = canonicalise_file_separator(basename); if (test_base_path && thing_exists(basename)) - return (basename); + return basename; std::vector<std::string> bases = _get_base_dirs(); @@ -455,7 +455,7 @@ std::string datafile_path(std::string basename, { std::string name = bases[b] + basename; if (thing_exists(name)) - return (name); + return name; } // Die horribly. @@ -482,7 +482,7 @@ std::string datafile_path(std::string basename, bool check_mkdir(const std::string &whatdir, std::string *dir, bool silent) { if (dir->empty()) - return (true); + return true; *dir = canonicalise_file_separator(*dir); @@ -496,10 +496,10 @@ bool check_mkdir(const std::string &whatdir, std::string *dir, bool silent) fprintf(stderr, "%s \"%s\" does not exist " "and I can't create it.\n", whatdir.c_str(), dir->c_str()); - return (false); + return false; } - return (true); + return true; } // Get the directory that contains save files for the current game @@ -512,7 +512,7 @@ static std::string _get_savefile_directory() check_mkdir("Save directory", &dir, false); if (dir.empty()) dir = "."; - return (dir); + return dir; } static std::string _get_bonefile_directory() @@ -522,7 +522,7 @@ static std::string _get_bonefile_directory() check_mkdir("Bones directory", &dir, false); if (dir.empty()) dir = "."; - return (dir); + return dir; } // Returns a subdirectory of the current savefile directory as returned by @@ -656,7 +656,7 @@ static std::vector<player_save_info> _find_saved_characters() std::sort(chars.rbegin(), chars.rend()); #endif // !DISABLE_SAVEGAME_LISTS - return (chars); + return chars; } std::vector<player_save_info> find_all_saved_characters() @@ -680,7 +680,7 @@ std::vector<player_save_info> find_all_saved_characters() chars_in_dir.begin(), chars_in_dir.end()); } - return (saved_characters); + return saved_characters; } bool save_exists(const std::string& filename) @@ -767,7 +767,7 @@ public: filemode, lock? "YES" : "no"); } - return (filep); + return filep; } void close() @@ -937,15 +937,15 @@ static void _clear_clouds() static bool _grab_follower_at(const coord_def &pos) { if (pos == you.pos()) - return (false); + return false; monster* fol = monster_at(pos); if (!fol || !fol->alive()) - return (false); + return false; // The monster has to already be tagged in order to follow. if (!testbits(fol->flags, MF_TAKING_STAIRS)) - return (false); + return false; // If a monster that can't use stairs was marked as a follower, // it's because it's an ally and there might be another ally @@ -953,7 +953,7 @@ static bool _grab_follower_at(const coord_def &pos) // This means we don't actually send it on transit, but we do // return true, so adjacent real followers are handled correctly. (jpeg) if (!mons_can_use_stairs(fol)) - return (true); + return true; level_id dest = level_id::current(); @@ -965,7 +965,7 @@ static bool _grab_follower_at(const coord_def &pos) monster_cleanup(fol); if (could_see) view_update_at(pos); - return (true); + return true; } static void _grab_followers() @@ -1638,7 +1638,7 @@ bool load_ghost(bool creating_level) { if (wiz_cmd && !creating_level) mpr("No ghost files for this level.", MSGCH_PROMPT); - return (false); // no such ghost. + return false; // no such ghost. } if (_ghost_version_compatible(inf)) @@ -1666,7 +1666,7 @@ bool load_ghost(bool creating_level) "Refusing to load buggy ghost from file \"%s\"!", ghost_filename.c_str()); - return (false); + return false; } #ifdef BONES_DIAGNOSTICS @@ -1727,7 +1727,7 @@ bool load_ghost(bool creating_level) more(); #endif - return (true); + return true; } // returns false if a new game should start instead @@ -1930,13 +1930,13 @@ bool get_save_version(reader &file, int &major, int &minor) { // Empty file? major = minor = -1; - return (false); + return false; } major = buf[0]; minor = buf[1]; - return (true); + return true; } static bool _read_char_chunk(package *save) @@ -1990,7 +1990,7 @@ static bool _tagged_chunk_version_compatible(reader &inf, std::string* reason) if (!get_save_version(inf, major, minor)) { *reason = "File is corrupt."; - return (false); + return false; } if (major != TAG_MAJOR_VERSION) @@ -2007,14 +2007,14 @@ static bool _tagged_chunk_version_compatible(reader &inf, std::string* reason) *reason = make_stringf("Major version mismatch: %d (want %d).", major, TAG_MAJOR_VERSION); } - return (false); + return false; } if (minor < 0) { *reason = make_stringf("Minor version %d is negative!", minor); - return (false); + return false; } if (minor > TAG_MINOR_VERSION) @@ -2022,11 +2022,11 @@ static bool _tagged_chunk_version_compatible(reader &inf, std::string* reason) *reason = make_stringf("Minor version mismatch: %d (want <= %d). " "The save is from a newer version.", minor, TAG_MINOR_VERSION); - return (false); + return false; } inf.setMinorVersion(minor); - return (true); + return true; } static bool _restore_tagged_chunk(package *save, const std::string name, @@ -2072,14 +2072,14 @@ static bool _ghost_version_compatible(reader &inf) dprf("Ghost version mismatch: ghost was %d.%d; wanted %d.%d", majorVersion, minorVersion, TAG_MAJOR_VERSION, TAG_MINOR_VERSION); - return (false); + return false; } inf.setMinorVersion(minorVersion); // Check for the DCSS ghost signature. if (unmarshallShort(inf) != GHOST_SIGNATURE) - return (false); + return false; // Discard three more 32-bit words of padding. inf.read(NULL, 3*4); @@ -2089,9 +2089,9 @@ static bool _ghost_version_compatible(reader &inf) mprf(MSGCH_ERROR, "Ghost file \"%s\" seems to be invalid (short read); deleting it.", inf.filename().c_str()); - return (false); + return false; } - return (true); + return true; } void save_ghost(bool force) @@ -2251,7 +2251,7 @@ std::vector<std::string> get_title_files() if (files[j].substr(0, 6) == "title_") titles.push_back(files[j]); } - return (titles); + return titles; } void sighup_save_and_exit() diff --git a/crawl-ref/source/flood_find.h b/crawl-ref/source/flood_find.h index d11a1459e9..e515aa4f9e 100644 --- a/crawl-ref/source/flood_find.h +++ b/crawl-ref/source/flood_find.h @@ -78,7 +78,7 @@ bool flood_find<fgrd, bound_check>::points_connected_from( const coord_def &sp) { if (needed_points.empty()) - return (true); + return true; set_floodseed(sp); pathfind(RMODE_EXPLORE); return (needed_points.empty()); @@ -89,7 +89,7 @@ bool flood_find<fgrd, bound_check>::any_point_connected_from( const coord_def &sp) { if (needed_points.empty()) - return (true); + return true; set_floodseed(sp); const size_t sz = needed_points.size(); pathfind(RMODE_EXPLORE); @@ -116,9 +116,9 @@ bool flood_find<fgrd, bound_check>::path_flood( { greedy_dist = 100; greedy_place = coord_def(-1, -1); - return (true); + return true; } - return (false); + return false; } if (no_vault && (*vaults)[dc.x][dc.y]) @@ -132,7 +132,7 @@ bool flood_find<fgrd, bound_check>::path_flood( { needed_points.erase(i); if (needed_points.empty()) - return (true); + return true; } } @@ -144,23 +144,23 @@ bool flood_find<fgrd, bound_check>::path_flood( { greedy_dist = 100; greedy_place = coord_def(-1, -1); - return (true); + return true; } - return (false); + return false; } if (needed_features[ feat ]) { unexplored_place = dc; unexplored_dist = traveled_distance; - return (true); + return true; } if (check_traversable && !feat_is_traversable(feat) && feat != DNGN_SECRET_DOOR && !feat_is_trap(feat)) { - return (false); + return false; } if (!left_vault && vaults && !(*vaults)[dc.x][dc.y]) @@ -168,7 +168,7 @@ bool flood_find<fgrd, bound_check>::path_flood( good_square(dc); - return (false); + return false; } #endif diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index 69a608a60a..68560a7021 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -208,7 +208,7 @@ static bool _prepare_butchery(bool can_butcher, bool removed_gloves, { // No preparation necessary. if (can_butcher) - return (true); + return true; // At least one of these has to be true, else what are we doing // here? @@ -220,7 +220,7 @@ static bool _prepare_butchery(bool can_butcher, bool removed_gloves, // Actually take off the gloves; this creates a delay. We // assume later on that gloves have a 1-turn takeoff delay! if (!takeoff_armour(you.equip[EQ_GLOVES])) - return (false); + return false; // Ensure that the gloves are taken off by now by finishing the // DELAY_ARMOUR_OFF delay started by takeoff_armour() above. @@ -231,11 +231,11 @@ static bool _prepare_butchery(bool can_butcher, bool removed_gloves, if (wpn_switch && !wield_weapon(true, SLOT_BARE_HANDS, false, true, false, false)) { - return (false); + return false; } // Switched to a good butchering tool. - return (true); + return true; } static bool _should_butcher(int corpse_id, bool bottle_blood = false) @@ -245,7 +245,7 @@ static bool _should_butcher(int corpse_id, bool bottle_blood = false) || !yesno("Desecrating this corpse would be a sin. Continue anyway?", false, 'n'))) { - return (false); + return false; } else if (!bottle_blood && you.species == SP_VAMPIRE && (can_bottle_blood_from_corpse(mitm[corpse_id].mon_type) @@ -256,10 +256,10 @@ static bool _should_butcher(int corpse_id, bool bottle_blood = false) || !yesno("You could drain or bottle this corpse's blood instead. " "Continue anyway?", true, 'n'))) { - return (false); + return false; } - return (true); + return true; } static bool _corpse_butchery(int corpse_id, int butcher_tool, @@ -271,7 +271,7 @@ static bool _corpse_butchery(int corpse_id, int butcher_tool, const bool rotten = food_is_rotten(mitm[corpse_id]); if (!_should_butcher(corpse_id, bottle_blood)) - return (false); + return false; // Start work on the first corpse we butcher. if (first_corpse) @@ -291,7 +291,7 @@ static bool _corpse_butchery(int corpse_id, int butcher_tool, butcher_tool); you.turn_is_over = true; - return (true); + return true; } static void _terminate_butchery(bool wpn_switch, bool removed_gloves, @@ -342,7 +342,7 @@ static bool _have_corpses_in_pack(bool remind, bool bottle_blood = false) const int num = count_corpses_in_pack(bottle_blood); if (num == 0) - return (false); + return false; std::string verb = (bottle_blood ? "bottle" : "butcher"); @@ -369,7 +369,7 @@ static bool _have_corpses_in_pack(bool remind, bool bottle_blood = false) noun.c_str(), verb.c_str(), pronoun.c_str()); } - return (true); + return true; } bool butchery(int which_corpse, bool bottle_blood) @@ -378,11 +378,11 @@ bool butchery(int which_corpse, bool bottle_blood) { if (!_have_corpses_in_pack(false, bottle_blood)) mpr("There isn't anything here!"); - return (false); + return false; } if (!player_can_reach_floor()) - return (false); + return false; // Vampires' fangs are optimised for biting, not for tearing flesh. // (Not that they really need to.) Other species with this mutation @@ -416,7 +416,7 @@ bool butchery(int which_corpse, bool bottle_blood) // somehow true at the point, the following message would be wrong and // (even worse) bottling success would depend on can_butcher == true. mpr("You are too berserk to search for a butchering tool!"); - return (false); + return false; } // First determine how many things there are to butcher. @@ -449,7 +449,7 @@ bool butchery(int which_corpse, bool bottle_blood) mprf("There isn't anything to %s here.", bottle_blood ? "bottle" : "butcher"); } - return (false); + return false; } int old_weapon = you.equip[EQ_WEAPON]; @@ -489,11 +489,11 @@ bool butchery(int which_corpse, bool bottle_blood) { mprf("There isn't anything suitable to %s here.", bottle_blood ? "bottle" : "butcher"); - return (false); + return false; } if (!_prepare_butchery(can_butcher, removed_gloves, wpn_switch)) - return (false); + return false; success = _corpse_butchery(corpse_id, butcher_tool, true, bottle_blood); _terminate_butchery(wpn_switch, removed_gloves, old_weapon, old_gloves); @@ -501,7 +501,7 @@ bool butchery(int which_corpse, bool bottle_blood) // Remind player of corpses in pack that could be butchered or // bottled. _have_corpses_in_pack(true, bottle_blood); - return (success); + return success; } // Now pick what you want to butcher. This is only a problem @@ -533,7 +533,7 @@ bool butchery(int which_corpse, bool bottle_blood) if (!_should_butcher(si->index(), bottle_blood)) continue; if (!_prepare_butchery(can_butcher, removed_gloves, wpn_switch)) - return (false); + return false; corpse_id = si->index(); _corpse_butchery(corpse_id, butcher_tool, true, bottle_blood); @@ -572,7 +572,7 @@ bool butchery(int which_corpse, bool bottle_blood) did_weap_swap = true; } else - return (false); + return false; } corpse_id = si->index(); @@ -585,7 +585,7 @@ bool butchery(int which_corpse, bool bottle_blood) canned_msg(MSG_OK); _terminate_butchery(wpn_switch, removed_gloves, old_weapon, old_gloves); - return (false); + return false; case '?': show_butchering_help(); @@ -627,7 +627,7 @@ bool butchery(int which_corpse, bool bottle_blood) _have_corpses_in_pack(true, bottle_blood); } - return (success); + return success; } bool prompt_eat_inventory_item(int slot) @@ -635,7 +635,7 @@ bool prompt_eat_inventory_item(int slot) if (inv_count() < 1) { canned_msg(MSG_NOTHING_CARRIED); - return (false); + return false; } int which_inventory_slot = slot; @@ -652,7 +652,7 @@ bool prompt_eat_inventory_item(int slot) OPER_EAT); if (prompt_failed(which_inventory_slot)) - return (false); + return false; } // This conditional can later be merged into food::can_ingest() when @@ -662,7 +662,7 @@ bool prompt_eat_inventory_item(int slot) if (you.inv[which_inventory_slot].base_type != OBJ_FOOD) { mpr("You can't eat that!"); - return (false); + return false; } } else @@ -671,19 +671,19 @@ bool prompt_eat_inventory_item(int slot) || you.inv[which_inventory_slot].sub_type != CORPSE_BODY) { mpr("You crave blood!"); - return (false); + return false; } } if (!can_ingest(you.inv[which_inventory_slot], false)) - return (false); + return false; eat_inventory_item(which_inventory_slot); burden_change(); you.turn_is_over = true; - return (true); + return true; } static bool _eat_check(bool check_hunger = true, bool silent = false) @@ -695,7 +695,7 @@ static bool _eat_check(bool check_hunger = true, bool silent = false) mpr("You can't eat."); crawl_state.zero_turns_taken(); } - return (false); + return false; } if (!check_hunger) @@ -708,7 +708,7 @@ static bool _eat_check(bool check_hunger = true, bool silent = false) mpr("You can't stomach food right now!"); crawl_state.zero_turns_taken(); } - return (false); + return false; } if (you.hunger_state >= HS_ENGORGED) @@ -719,9 +719,9 @@ static bool _eat_check(bool check_hunger = true, bool silent = false) you.species == SP_VAMPIRE ? "drain" : "eat"); crawl_state.zero_turns_taken(); } - return (false); + return false; } - return (true); + return true; } static bool _has_edible_chunks() @@ -764,7 +764,7 @@ void end_nausea() bool eat_food(int slot) { if (!_eat_check()) - return (false); + return false; // Skip the prompts if we already know what we're eating. if (slot == -1) @@ -779,9 +779,9 @@ bool eat_food(int slot) { result = eat_from_floor(true); if (result == 1) - return (true); + return true; if (result == -1) - return (false); + return false; } } } @@ -971,7 +971,7 @@ bool food_change(bool suppress_message) break; default: - return (state_changed); + return state_changed; } if (!less_hungry) @@ -979,7 +979,7 @@ bool food_change(bool suppress_message) } } - return (state_changed); + return state_changed; } // food_increment is positive for eating, negative for hungering @@ -1015,12 +1015,12 @@ static void _describe_food_change(int food_increment) static bool _player_can_eat_rotten_meat(bool need_msg = false) { if (player_mutation_level(MUT_SAPROVOROUS)) - return (true); + return true; if (need_msg) mpr("You refuse to eat that rotten meat."); - return (false); + return false; } // Should really be merged into function below. -- FIXME @@ -1087,18 +1087,18 @@ public: ASSERT(food1->base_type == food2->base_type); if (is_inedible(*food1)) - return (false); + return false; if (is_inedible(*food2)) - return (true); + return true; if (food1->base_type == OBJ_FOOD) { // Prefer chunks to non-chunks. (Herbivores handled above.) if (food1->sub_type != FOOD_CHUNK && food2->sub_type == FOOD_CHUNK) - return (false); + return false; if (food2->sub_type != FOOD_CHUNK && food1->sub_type == FOOD_CHUNK) - return (true); + return true; } // Both food types are edible (not rotten, or player is Saprovore). @@ -1107,17 +1107,17 @@ public: { // Always offer poisonous/mutagenic chunks last. if (is_bad_food(*food1) && !is_bad_food(*food2)) - return (false); + return false; if (is_bad_food(*food2) && !is_bad_food(*food1)) - return (true); + return true; if (Options.prefer_safe_chunks && !you.is_undead) { // Offer contaminated chunks last. if (is_contaminated(*food1) && !is_contaminated(*food2)) - return (false); + return false; if (is_contaminated(*food2) && !is_contaminated(*food1)) - return (true); + return true; } } @@ -1129,14 +1129,14 @@ public: int eat_from_floor(bool skip_chunks) { if (!_eat_check()) - return (false); + return false; if (you.flight_mode() == FL_LEVITATE) - return (0); + return 0; // Corpses should have been handled before. if (you.species == SP_VAMPIRE && skip_chunks) - return (0); + return 0; bool need_more = false; int unusable_corpse = 0; @@ -1234,16 +1234,16 @@ int eat_from_floor(bool skip_chunks) if (ilink != NON_ITEM) { eat_floor_item(ilink); - return (true); + return true; } - return (false); + return false; } need_more = true; break; case 'i': case '?': // Directly skip ahead to inventory. - return (0); + return 0; default: // Else no: try next one. break; @@ -1286,13 +1286,13 @@ int eat_from_floor(bool skip_chunks) if (need_more && Options.auto_list) more(); - return (0); + return 0; } bool eat_from_inventory() { if (!_eat_check()) - return (false); + return false; // Corpses should have been handled before. if (you.species == SP_VAMPIRE) @@ -1379,13 +1379,13 @@ bool eat_from_inventory() case 'q': CASE_ESCAPE canned_msg(MSG_OK); - return (false); + return false; case 'e': case 'y': if (can_ingest(*item, false)) { eat_inventory_item(item->link); - return (true); + return true; } break; default: @@ -1425,7 +1425,7 @@ bool eat_from_inventory() } } - return (false); + return false; } // Returns -1 for cancel, 1 for eaten, 0 for not eaten, @@ -1434,14 +1434,14 @@ int prompt_eat_chunks(bool only_auto) { // Full herbivores cannot eat chunks. if (player_mutation_level(MUT_HERBIVOROUS) == 3) - return (0); + return 0; // If we *know* the player can eat chunks, doesn't have the gourmand // effect and isn't hungry, don't prompt for chunks. if (you.species != SP_VAMPIRE && you.hunger_state >= HS_SATIATED + player_likes_chunks()) { - return (0); + return 0; } bool found_valid = false; @@ -1574,7 +1574,7 @@ int prompt_eat_chunks(bool only_auto) if (in_inventory(*item)) { eat_inventory_item(item->link); - return (1); + return 1; } else { @@ -1583,9 +1583,9 @@ int prompt_eat_chunks(bool only_auto) if (ilink != NON_ITEM) { eat_floor_item(ilink); - return (1); + return 1; } - return (0); + return 0; } } break; @@ -1596,7 +1596,7 @@ int prompt_eat_chunks(bool only_auto) } } - return (0); + return 0; } static const char *_chunk_flavour_phrase(bool likes_chunks) @@ -1638,7 +1638,7 @@ static const char *_chunk_flavour_phrase(bool likes_chunks) phrase = "is not very appetising."; } - return (phrase); + return phrase; } void chunk_nutrition_message(int nutrition) @@ -1657,7 +1657,7 @@ static int _apply_herbivore_nutrition_effects(int nutrition) while (how_herbivorous--) nutrition = nutrition * 75 / 100; - return (nutrition); + return nutrition; } static int _apply_gourmand_nutrition_effects(int nutrition, int gourmand) @@ -2164,10 +2164,10 @@ bool is_bad_food(const item_def &food) bool is_poisonous(const item_def &food) { if (food.base_type != OBJ_FOOD && food.base_type != OBJ_CORPSES) - return (false); + return false; if (player_res_poison(false) > 0) - return (false); + return false; return (chunk_is_poisonous(mons_corpse_effect(food.mon_type))); } @@ -2176,11 +2176,11 @@ bool is_poisonous(const item_def &food) bool is_mutagenic(const item_def &food) { if (food.base_type != OBJ_FOOD && food.base_type != OBJ_CORPSES) - return (false); + return false; // Has no effect on ghouls. if (you.species == SP_GHOUL) - return (false); + return false; return (mons_corpse_effect(food.mon_type) == CE_MUTAGEN); } @@ -2190,7 +2190,7 @@ bool is_contaminated(const item_def &food) { if ((food.base_type != OBJ_FOOD || food.sub_type != FOOD_CHUNK) && food.base_type != OBJ_CORPSES) - return (false); + return false; const corpse_effect_type chunk_type = mons_corpse_effect(food.mon_type); return (chunk_type == CE_CONTAMINATED @@ -2203,11 +2203,11 @@ bool is_contaminated(const item_def &food) bool causes_rot(const item_def &food) { if (food.base_type != OBJ_FOOD && food.base_type != OBJ_CORPSES) - return (false); + return false; // Has no effect on ghouls. if (you.species == SP_GHOUL) - return (false); + return false; return (mons_corpse_effect(food.mon_type) == CE_ROT); } @@ -2261,28 +2261,28 @@ bool is_inedible(const item_def &item) { // Mummies don't eat. if (you.is_undead == US_UNDEAD) - return (true); + return true; if (food_is_rotten(item) && !player_mutation_level(MUT_SAPROVOROUS)) { - return (true); + return true; } if (item.base_type == OBJ_FOOD && !can_ingest(item, true, false)) { - return (true); + return true; } if (item.base_type == OBJ_CORPSES && (item.sub_type == CORPSE_SKELETON || you.species == SP_VAMPIRE && !mons_has_blood(item.mon_type))) { - return (true); + return true; } - return (false); + return false; } // As we want to avoid autocolouring the entire food selection, this should @@ -2292,7 +2292,7 @@ bool is_preferred_food(const item_def &food) { // Mummies don't eat. if (you.is_undead == US_UNDEAD) - return (false); + return false; // Vampires don't really have a preferred food type, but they really // like blood potions. @@ -2306,15 +2306,15 @@ bool is_preferred_food(const item_def &food) } if (food.base_type != OBJ_FOOD) - return (false); + return false; // Poisoned, mutagenic, etc. food should never be marked as "preferred". if (is_bad_food(food)) - return (false); + return false; // Honeycombs are tasty for everyone. if (food.sub_type == FOOD_HONEYCOMB || food.sub_type == FOOD_ROYAL_JELLY) - return (true); + return true; // Ghouls specifically like rotten food. if (you.species == SP_GHOUL) @@ -2327,7 +2327,7 @@ bool is_preferred_food(const item_def &food) return (_player_likes_food_type(food.sub_type) > 0); // No food preference. - return (false); + return false; } bool is_forbidden_food(const item_def &food) @@ -2335,29 +2335,29 @@ bool is_forbidden_food(const item_def &food) if (food.base_type != OBJ_CORPSES && (food.base_type != OBJ_FOOD || food.sub_type != FOOD_CHUNK)) { - return (false); + return false; } // Some gods frown upon cannibalistic behaviour. if (god_hates_cannibalism(you.religion) && is_player_same_species(food.mon_type)) { - return (true); + return true; } // Holy gods do not like it if you are eating holy creatures if (is_good_god(you.religion) && mons_class_holiness(food.mon_type) == MH_HOLY) { - return (true); + return true; } // Zin doesn't like it if you eat beings with a soul. if (you.religion == GOD_ZIN && mons_class_intel(food.mon_type) >= I_NORMAL) - return (true); + return true; // Everything else is allowed. - return (false); + return false; } bool can_ingest(const item_def &food, bool suppress_msg, bool check_hunger) @@ -2388,24 +2388,24 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, // [ds] These redundant checks are now necessary - Lua might be calling us. if (!_eat_check(check_hunger, suppress_msg)) - return (false); + return false; if (you.species == SP_VAMPIRE) { if (what_isit == OBJ_CORPSES && kindof_thing == CORPSE_BODY) - return (true); + return true; if (what_isit == OBJ_POTIONS && (kindof_thing == POT_BLOOD || kindof_thing == POT_BLOOD_COAGULATED)) { - return (true); + return true; } if (!suppress_msg) mpr("Blech - you need blood!"); - return (false); + return false; } bool ur_carnivorous = player_mutation_level(MUT_CARNIVOROUS) == 3; @@ -2424,7 +2424,7 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, { if (!suppress_msg) mpr("Blech - you need blood!"); - return (false); + return false; } const int vorous = _player_likes_food_type(kindof_thing); @@ -2434,10 +2434,10 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, { if (!suppress_msg) mpr("Sorry, you're a carnivore."); - return (false); + return false; } else - return (true); + return true; } else if (vorous < 0) // Carnivorous food. { @@ -2445,44 +2445,44 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, { if (!suppress_msg) mpr("Sorry, you're a herbivore."); - return (false); + return false; } else if (kindof_thing == FOOD_CHUNK) { if (rotten && !_player_can_eat_rotten_meat(!suppress_msg)) - return (false); + return false; if (ur_chunkslover) - return (true); + return true; if (!suppress_msg) mpr("You aren't quite hungry enough to eat that!"); - return (false); + return false; } } // Any food types not specifically handled until here (e.g. meat // rations for non-herbivores) are okay. - return (true); + return true; } case OBJ_CORPSES: if (you.species == SP_VAMPIRE) { if (kindof_thing == CORPSE_BODY) - return (true); + return true; else { if (!suppress_msg) mpr("Blech - you need blood!"); - return (false); + return false; } } - return (false); + return false; case OBJ_POTIONS: // called by lua if (get_ident_type(OBJ_POTIONS, kindof_thing) != ID_KNOWN_TYPE) - return (true); + return true; switch (kindof_thing) { @@ -2492,42 +2492,42 @@ bool can_ingest(int what_isit, int kindof_thing, bool suppress_msg, { if (!suppress_msg) mpr("Sorry, you're a herbivore."); - return (false); + return false; } - return (true); + return true; case POT_WATER: if (you.species == SP_VAMPIRE) { if (!suppress_msg) mpr("Blech - you need blood!"); - return (false); + return false; } - return (true); + return true; case POT_PORRIDGE: if (you.species == SP_VAMPIRE) { if (!suppress_msg) mpr("Blech - you need blood!"); - return (false); + return false; } else if (ur_carnivorous) { if (!suppress_msg) mpr("Sorry, you're a carnivore."); - return (false); + return false; } default: - return (true); + return true; } // Other object types are set to return false for now until // someone wants to recode the eating code to permit consumption // of things other than just food. default: - return (false); + return false; } - return (survey_says); + return survey_says; } bool chunk_is_poisonous(int chunktype) @@ -2585,7 +2585,7 @@ static corpse_effect_type _determine_chunk_effect(corpse_effect_type chunktype, } } - return (chunktype); + return chunktype; } static bool _vampire_consume_corpse(int slot, bool invent) @@ -2601,13 +2601,13 @@ static bool _vampire_consume_corpse(int slot, bool invent) if (!mons_has_blood(corpse.mon_type)) { mpr("There is no blood in this body!"); - return (false); + return false; } if (food_is_rotten(corpse)) { mpr("It's not fresh enough."); - return (false); + return false; } // The delay for eating a chunk (mass 1000) is 2 @@ -2625,7 +2625,7 @@ static bool _vampire_consume_corpse(int slot, bool invent) // the continue/finish messages if it takes longer than 1 turn. start_delay(DELAY_FEED_VAMPIRE, duration, invent, slot); - return (true); + return true; } static void _heal_from_food(int hp_amt, bool unrot, bool restore_str) @@ -2667,9 +2667,9 @@ int you_min_hunger() // Vampires can never starve to death. Ghouls will just rot much faster. if (you.is_undead) - return (701); + return 701; - return (0); + return 0; } void handle_starvation() diff --git a/crawl-ref/source/format.cc b/crawl-ref/source/format.cc index 0f87f33b7c..db017e00ca 100644 --- a/crawl-ref/source/format.cc +++ b/crawl-ref/source/format.cc @@ -28,10 +28,10 @@ formatted_string::formatted_string(const std::string &s, int init_colour) int formatted_string::get_colour(const std::string &tag) { if (tag == "h") - return (YELLOW); + return YELLOW; if (tag == "w") - return (WHITE); + return WHITE; const int colour = str_to_colour(tag); return (colour != -1? colour : LIGHTGREY); @@ -226,7 +226,7 @@ formatted_string::operator std::string() const if (ops[i] == FSOP_TEXT) s += ops[i].text; } - return (s); + return s; } static void _replace_all_in_string(std::string& s, const std::string& search, @@ -287,7 +287,7 @@ int formatted_string::width() const for (unsigned i = 0, size = ops.size(); i < size; ++i) if (ops[i] == FSOP_TEXT) len += strwidth(ops[i].text); - return (len); + return len; } inline void cap(int &i, int max) @@ -389,7 +389,7 @@ int formatted_string::find_last_colour() const if (ops[i].type == FSOP_COLOUR) return (ops[i].x); } - return (LIGHTGREY); + return LIGHTGREY; } formatted_string formatted_string::chop(int length) const @@ -562,7 +562,7 @@ static int _tagged_string_printable_length(const std::string& s) else // normal, printable character ++len; } - return (len); + return len; } diff --git a/crawl-ref/source/fprop.cc b/crawl-ref/source/fprop.cc index 094bd89213..2422de8ace 100644 --- a/crawl-ref/source/fprop.cc +++ b/crawl-ref/source/fprop.cc @@ -14,12 +14,12 @@ bool is_sanctuary(const coord_def& p) { if (!map_bounds(p)) - return (false); + return false; const bool sanct = (testbits(env.pgrid(p), FPROP_SANCTUARY_1) || testbits(env.pgrid(p), FPROP_SANCTUARY_2)); if (sanct) ASSERT(in_bounds(env.sanctuary_pos)); - return (sanct); + return sanct; } bool is_bloodcovered(const coord_def& p) @@ -52,27 +52,27 @@ void remove_mold(const coord_def & p) feature_property_type str_to_fprop(const std::string &str) { if (str == "bloody") - return (FPROP_BLOODY); + return FPROP_BLOODY; if (str == "highlight") - return (FPROP_HIGHLIGHT); + return FPROP_HIGHLIGHT; if (str == "mold") - return (FPROP_MOLD); + return FPROP_MOLD; if (str == "no_cloud_gen") - return (FPROP_NO_CLOUD_GEN); + return FPROP_NO_CLOUD_GEN; if (str == "no_rtele_into") - return (FPROP_NO_RTELE_INTO); + return FPROP_NO_RTELE_INTO; if (str == "no_ctele_into") - return (FPROP_NO_CTELE_INTO); + return FPROP_NO_CTELE_INTO; if (str == "no_tele_into") - return (FPROP_NO_TELE_INTO); + return FPROP_NO_TELE_INTO; if (str == "no_tide") - return (FPROP_NO_TIDE); + return FPROP_NO_TIDE; if (str == "no_submerge") - return (FPROP_NO_SUBMERGE); + return FPROP_NO_SUBMERGE; if (str == "no_jiyva") - return (FPROP_NO_JIYVA); + return FPROP_NO_JIYVA; - return (FPROP_NONE); + return FPROP_NONE; } char blood_rotation(const coord_def & p) diff --git a/crawl-ref/source/geom2d.cc b/crawl-ref/source/geom2d.cc index 019a24af8c..1be390b58b 100644 --- a/crawl-ref/source/geom2d.cc +++ b/crawl-ref/source/geom2d.cc @@ -42,7 +42,7 @@ double intersect(const ray &r, const line &l) double fp = l.f(r.start); double fd = l.f(r.dir); double t = (l.val - fp) / fd; - return (t); + return t; } double lineseq::index(const vector &v) const @@ -64,7 +64,7 @@ double nextintersect(const ray &r, const lineseq &ls) if (double_is_zero(k - a)) k += (ls.dist*fd > 0 ? 1 : -1); double t = (k - a) * ls.dist / fd; - return (t); + return t; } // Move the ray towards the next grid line. @@ -95,9 +95,9 @@ bool ray::to_grid(const grid &g, bool half) bool ray::to_next_cell(const grid &g) { if (to_grid(g, false)) - return (true); + return true; to_grid(g, true); - return (false); + return false; } vector normal(const form &f) @@ -127,7 +127,7 @@ vector vector::operator+(const vector &v) const { vector copy = *this; copy += v; - return (copy); + return copy; } vector vector::operator-() const diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index 2d3e2a0921..771a23f2a9 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -363,7 +363,7 @@ static int _player_ghost_base_movement_speed() else if (speed > MAX_GHOST_SPEED) speed = MAX_GHOST_SPEED; - return (speed); + return speed; } void ghost_demon::init_player_ghost() @@ -463,7 +463,7 @@ static colour_t _ugly_thing_assign_colour(colour_t force_colour, while (force_not_colour != BLACK && colour == force_not_colour); } - return (colour); + return colour; } static attack_flavour _very_ugly_thing_flavour_upgrade(attack_flavour u_att_flav) @@ -486,7 +486,7 @@ static attack_flavour _very_ugly_thing_flavour_upgrade(attack_flavour u_att_flav break; } - return (u_att_flav); + return u_att_flav; } static attack_flavour _ugly_thing_colour_to_flavour(colour_t u_colour) @@ -526,7 +526,7 @@ static attack_flavour _ugly_thing_colour_to_flavour(colour_t u_colour) if (is_high_colour(u_colour)) u_att_flav = _very_ugly_thing_flavour_upgrade(u_att_flav); - return (u_att_flav); + return u_att_flav; } void ghost_demon::init_ugly_thing(bool very_ugly, bool only_mutate, @@ -733,7 +733,7 @@ static spell_type search_first_list(int ignore_spell) for (unsigned i = 0; i < ARRAYSZ(search_order_conj); ++i) { if (search_order_conj[i] == SPELL_NO_SPELL) - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; if (search_order_conj[i] == ignore_spell) continue; @@ -742,7 +742,7 @@ static spell_type search_first_list(int ignore_spell) return (search_order_conj[i]); } - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; } static spell_type search_second_list(int ignore_spell) @@ -750,7 +750,7 @@ static spell_type search_second_list(int ignore_spell) for (unsigned i = 0; i < ARRAYSZ(search_order_third); ++i) { if (search_order_third[i] == SPELL_NO_SPELL) - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; if (search_order_third[i] == ignore_spell) continue; @@ -759,7 +759,7 @@ static spell_type search_second_list(int ignore_spell) return (search_order_third[i]); } - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; } static spell_type search_third_list(int ignore_spell) @@ -767,7 +767,7 @@ static spell_type search_third_list(int ignore_spell) for (unsigned i = 0; i < ARRAYSZ(search_order_misc); ++i) { if (search_order_misc[i] == SPELL_NO_SPELL) - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; if (search_order_misc[i] == ignore_spell) continue; @@ -776,7 +776,7 @@ static spell_type search_third_list(int ignore_spell) return (search_order_misc[i]); } - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; } // Used when creating ghosts: goes through and finds spells for the @@ -833,18 +833,18 @@ spell_type ghost_demon::translate_spell(spell_type spell) const switch (spell) { case SPELL_CONTROLLED_BLINK: - return (SPELL_BLINK); // approximate + return SPELL_BLINK; // approximate case SPELL_DEMONIC_HORDE: - return (SPELL_CALL_IMP); + return SPELL_CALL_IMP; case SPELL_DELAYED_FIREBALL: - return (SPELL_FIREBALL); + return SPELL_FIREBALL; case SPELL_EVAPORATE: - return (SPELL_MEPHITIC_CLOUD); + return SPELL_MEPHITIC_CLOUD; default: break; } - return (spell); + return spell; } std::vector<ghost_demon> ghost_demon::find_ghosts() @@ -864,7 +864,7 @@ std::vector<ghost_demon> ghost_demon::find_ghosts() // for the level. find_extra_ghosts(gs, n_extra_ghosts() + 1 - gs.size()); - return (gs); + return gs; } void ghost_demon::find_transiting_ghosts( @@ -921,7 +921,7 @@ void ghost_demon::find_extra_ghosts(std::vector<ghost_demon> &gs, int n) int ghost_demon::n_extra_ghosts() { if (env.absdepth0 < 10) - return (0); + return 0; return (MAX_GHOSTS - 1); } @@ -935,62 +935,62 @@ bool debug_check_ghosts() // Values greater than the allowed maximum or less then the // allowed minimum signalise bugginess. if (ghost.damage < 0 || ghost.damage > MAX_GHOST_DAMAGE) - return (false); + return false; if (ghost.max_hp < 1 || ghost.max_hp > MAX_GHOST_HP) - return (false); + return false; if (ghost.xl < 1 || ghost.xl > 27) - return (false); + return false; if (ghost.ev > MAX_GHOST_EVASION) - return (false); + return false; if (ghost.speed < MIN_GHOST_SPEED || ghost.speed > MAX_GHOST_SPEED) - return (false); + return false; if (ghost.resists.fire < -3 || ghost.resists.fire > 3) - return (false); + return false; if (ghost.resists.cold < -3 || ghost.resists.cold > 3) - return (false); + return false; if (ghost.resists.elec < 0) - return (false); + return false; if (ghost.brand < SPWPN_NORMAL || ghost.brand > MAX_PAN_LORD_BRANDS) - return (false); + return false; if (ghost.species < 0 || ghost.species >= NUM_SPECIES) - return (false); + return false; if (ghost.job < JOB_FIGHTER || ghost.job >= NUM_JOBS) - return (false); + return false; if (ghost.best_skill < SK_FIGHTING || ghost.best_skill >= NUM_SKILLS) - return (false); + return false; if (ghost.best_skill_level < 0 || ghost.best_skill_level > 27) - return (false); + return false; if (ghost.religion < GOD_NO_GOD || ghost.religion >= NUM_GODS) - return (false); + return false; if (ghost.brand == SPWPN_HOLY_WRATH || is_good_god(ghost.religion)) - return (false); + return false; // Only (very) ugly things get non-plain attack types and // flavours. if (ghost.att_type != AT_HIT || ghost.att_flav != AF_PLAIN) - return (false); + return false; // Only Pandemonium lords cycle colours. if (ghost.cycle_colours) - return (false); + return false; // Name validation. if (!validate_player_name(ghost.name, false)) - return (false); + return false; // Many combining characters can come per every letter, but if there's // that much, it's probably a maliciously forged ghost of some kind. if (ghost.name.length() > kNameLen * 10 || ghost.name.empty()) - return (false); + return false; if (ghost.name != trimmed_string(ghost.name)) - return (false); + return false; // Check for non-existing spells. for (int sp = 0; sp < NUM_MONSTER_SPELL_SLOTS; ++sp) if (ghost.spells[sp] < 0 || ghost.spells[sp] >= NUM_SPELLS) - return (false); + return false; } - return (true); + return true; } int ghost_level_to_rank(const int xl) @@ -1035,18 +1035,18 @@ int tile_offset_for_labrat_colour(colour_t l_colour) { switch (l_colour) { - case LIGHTGRAY: return (0); - case CYAN: return (1); - case YELLOW: return (2); - case RED: return (3); - case LIGHTCYAN: return (4); - case LIGHTRED: return (5); - case LIGHTBLUE: return (6); - case LIGHTMAGENTA: return (7); - case MAGENTA: return (8); - case GREEN: return (9); + case LIGHTGRAY: return 0; + case CYAN: return 1; + case YELLOW: return 2; + case RED: return 3; + case LIGHTCYAN: return 4; + case LIGHTRED: return 5; + case LIGHTBLUE: return 6; + case LIGHTMAGENTA: return 7; + case MAGENTA: return 8; + case GREEN: return 9; default: - return (0); + return 0; } } #endif diff --git a/crawl-ref/source/glwrapper-ogl.cc b/crawl-ref/source/glwrapper-ogl.cc index c5b4651045..4900a25420 100644 --- a/crawl-ref/source/glwrapper-ogl.cc +++ b/crawl-ref/source/glwrapper-ogl.cc @@ -240,7 +240,7 @@ OGLShapeBuffer::OGLShapeBuffer(bool texture, bool colour, drawing_modes prim) : const char *OGLShapeBuffer::print_statistics() const { - return (NULL); + return NULL; } unsigned int OGLShapeBuffer::size() const diff --git a/crawl-ref/source/glwrapper.cc b/crawl-ref/source/glwrapper.cc index 768741591a..9e6392c57a 100644 --- a/crawl-ref/source/glwrapper.cc +++ b/crawl-ref/source/glwrapper.cc @@ -92,7 +92,7 @@ bool GLStateManager::_valid(int num_verts, drawing_modes mode) case GLW_LINES: return (num_verts % 2 == 0); default: - return (false); + return false; } } #endif // ASSERTS diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc index dfa673e33d..ef72562630 100644 --- a/crawl-ref/source/godabil.cc +++ b/crawl-ref/source/godabil.cc @@ -413,7 +413,7 @@ std::string zin_recite_text(int* trits, size_t len, int prayertype, int step) else recite = turn[step]; - return (recite); + return recite; } typedef FixedVector<int, NUM_RECITE_TYPES> recite_counts; @@ -615,10 +615,10 @@ bool zin_check_able_to_recite() if (you.duration[DUR_BREATH_WEAPON]) { mpr("You're too short of breath to recite."); - return (false); + return false; } - return (true); + return true; } static const char* zin_book_desc[NUM_RECITE_TYPES] = @@ -659,7 +659,7 @@ int zin_check_recite_to_monsters(recite_type *prayertype) if (!found_eligible && !found_ineligible) { dprf("No audience found!"); - return (0); + return 0; } else if (!found_eligible && found_ineligible) { @@ -668,7 +668,7 @@ int zin_check_recite_to_monsters(recite_type *prayertype) } if (!prayertype) - return (1); + return 1; int eligible_types = 0; for (int i = 0; i < NUM_RECITE_TYPES; i++) @@ -684,7 +684,7 @@ int zin_check_recite_to_monsters(recite_type *prayertype) // If we got this far, we're actually reciting: you.increase_duration(DUR_BREATH_WEAPON, 3 + random2(10) + random2(30)); - return (1); + return 1; } // But often, you'll have multiple options... @@ -715,11 +715,11 @@ int zin_check_recite_to_monsters(recite_type *prayertype) break; } else - return (0); + return 0; } // If we got this far, we're actually reciting and are out of breath from it: you.increase_duration(DUR_BREATH_WEAPON, 3 + random2(10) + random2(30)); - return (1); + return 1; } enum zin_eff @@ -749,31 +749,31 @@ bool zin_recite_to_single_monster(const coord_def& where, { // That's a pretty good sanity check, I guess. if (you.religion != GOD_ZIN) - return (false); + return false; monster* mon = monster_at(where); // Once you're already reciting, invis is ok. if (!mon || !cell_see_cell(where, you.pos(), LOS_DEFAULT)) - return (false); + return false; recite_counts eligibility; bool affected = false; if (_zin_check_recite_to_single_monster(mon, eligibility) < 1) - return (false); + return false; // First check: are they even eligible for this kind of recitation? // (Monsters that have been hurt by recitation aren't eligible.) if (eligibility[prayertype] < 1) - return (false); + return false; // Second check: because this affects the whole screen over several turns, // its effects are staggered. There's a 50% chance per monster, per turn, // that nothing will happen - so the cumulative odds of nothing happening // are one in eight, since you recite three times. if (coinflip()) - return (false); + return false; // Resistance is now based on HD. You can affect up to (30+30)/2 = 30 'power' (HD). int power = (skill_bump(SK_INVOCATIONS, 10) + you.piety * 3 / 2) / 20; @@ -791,7 +791,7 @@ bool zin_recite_to_single_monster(const coord_def& where, } if (check <= 0) - return (false); + return false; // To what degree are they eligible for this prayertype? const int degree = eligibility[prayertype]; @@ -1217,7 +1217,7 @@ bool zin_recite_to_single_monster(const coord_def& where, handle_monster_shouts(mon, true); } - return (true); + return true; } static void _zin_saltify(monster* mon) @@ -1293,7 +1293,7 @@ bool zin_remove_all_mutations() if (!how_mutated()) { mpr("You have no mutations to be cured!"); - return (false); + return false; } you.one_time_ability_used[GOD_ZIN] = true; @@ -1302,7 +1302,7 @@ bool zin_remove_all_mutations() simple_god_message(" draws all chaos from your body!"); delete_all_mutations("Zin's power"); - return (true); + return true; } bool zin_sanctuary() @@ -1310,7 +1310,7 @@ bool zin_sanctuary() // Casting is disallowed while previous sanctuary in effect. // (Checked in abl-show.cc.) if (env.sanctuary_time) - return (false); + return false; // Yes, shamelessly stolen from NetHack... if (!silenced(you.pos())) // How did you manage that? @@ -1332,7 +1332,7 @@ bool zin_sanctuary() create_sanctuary(you.pos(), 7 + you.skill_rdiv(SK_INVOCATIONS) / 2); - return (true); + return true; } // shield bonus = attribute for duration turns, then decreasing by 1 @@ -1416,7 +1416,7 @@ bool elyvilon_divine_vigour() else canned_msg(MSG_NOTHING_HAPPENS); - return (success); + return success; } void elyvilon_remove_divine_vigour() @@ -1431,7 +1431,7 @@ void elyvilon_remove_divine_vigour() bool vehumet_supports_spell(spell_type spell) { if (spell_typematch(spell, SPTYP_CONJURATION | SPTYP_SUMMONING)) - return (true); + return true; // Conjurations work by conjuring up a chunk of short-lived matter and // propelling it towards the victim. This is the most popular way, but @@ -1448,17 +1448,17 @@ bool vehumet_supports_spell(spell_type spell) || spell == SPELL_OLGREBS_TOXIC_RADIANCE || spell == SPELL_INNER_FLAME) { - return (true); + return true; } - return (false); + return false; } // Returns false if the invocation fails (no spellbooks in sight, etc.). bool trog_burn_spellbooks() { if (you.religion != GOD_TROG) - return (false); + return false; god_acting gdact; @@ -1467,7 +1467,7 @@ bool trog_burn_spellbooks() if (item_is_spellbook(*si)) { mpr("Burning your own feet might not be such a smart idea!"); - return (false); + return false; } } @@ -1560,15 +1560,15 @@ bool trog_burn_spellbooks() { discover_mimic(*it, false); } - return (false); + return false; } else { mpr("You cannot see a spellbook to ignite!"); - return (false); + return false; } - return (true); + return true; } bool beogh_water_walk() @@ -1614,18 +1614,18 @@ bool jiyva_remove_bad_mutation() if (!how_mutated()) { mpr("You have no bad mutations to be cured!"); - return (false); + return false; } // Ensure that only bad mutations are removed. if (!delete_mutation(RANDOM_BAD_MUTATION, "Jiyva's power", true, false, true, true)) { canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } mpr("You feel cleansed."); - return (true); + return true; } bool yred_injury_mirror() @@ -1865,13 +1865,13 @@ bool kiku_receive_corpses(int pow, coord_def where) : " delivers you a corpse!"); } maybe_update_stashes(); - return (true); + return true; } else { if (you.religion == GOD_KIKUBAAQUDGHA) simple_god_message(" can find no cadavers for you!"); - return (false); + return false; } } @@ -1928,7 +1928,7 @@ bool fedhas_shoot_through(const bolt & beam, const monster* victim) { actor * originator = beam.agent(); if (!victim || !originator) - return (false); + return false; bool origin_worships_fedhas; mon_attitude_type origin_attitude; @@ -1941,7 +1941,7 @@ bool fedhas_shoot_through(const bolt & beam, const monster* victim) { monster* temp = originator->as_monster(); if (!temp) - return (false); + return false; origin_worships_fedhas = temp->god == GOD_FEDHAS; origin_attitude = temp->attitude; } @@ -2097,13 +2097,13 @@ int fedhas_fungal_bloom() gain_piety(piety_gain, 10); } - return (processed_count); + return processed_count; } static bool _create_plant(coord_def & target, int hp_adjust = 0) { if (actor_at(target) || !mons_class_can_pass(MONS_PLANT, grd(target))) - return (0); + return 0; if (monster *plant = create_monster(mgen_data (MONS_PLANT, @@ -2155,7 +2155,7 @@ bool fedhas_sunlight() direction(spelld, args); if (!spelld.isValid) - return (false); + return false; const coord_def base = spelld.target; @@ -2209,7 +2209,7 @@ bool fedhas_sunlight() "an invisible shape" : "some invisible shapes"); } - return (true); + return true; } void process_sunlights(bool future) @@ -2424,7 +2424,7 @@ bool prioritise_adjacent(const coord_def &target, std::vector<coord_def> & candi if (mons_positions.empty()) { std::random_shuffle(candidates.begin(), candidates.end()); - return (true); + return true; } std::vector<int> distances; @@ -2445,7 +2445,7 @@ bool prioritise_adjacent(const coord_def &target, std::vector<coord_def> & candi for (unsigned i = 0; i < candidates.size(); ++i) candidates[i] = possible_moves[i].first; - return (true); + return true; } static bool _prompt_amount(int max, int& selected, const std::string& prompt) @@ -2462,24 +2462,24 @@ static bool _prompt_amount(int max, int& selected, const std::string& prompt) if (key_is_escape(keyin) || keyin == ' ' || keyin == '0') { canned_msg(MSG_OK); - return (false); + return false; } // Default is max if (keyin == '\n' || keyin == '\r') - return (true); + return true; // Otherwise they should enter a digit if (isadigit(keyin)) { selected = keyin - '0'; if (selected > 0 && selected <= max) - return (true); + return true; } // else they entered some garbage? } - return (max); + return max; } static int _collect_fruit(std::vector<std::pair<int,int> >& available_fruit) @@ -2496,7 +2496,7 @@ static int _collect_fruit(std::vector<std::pair<int,int> >& available_fruit) } std::sort(available_fruit.begin(), available_fruit.end()); - return (total); + return total; } static void _decrease_amount(std::vector<std::pair<int, int> >& available, @@ -2548,7 +2548,7 @@ bool fedhas_plant_ring_from_fruit() else mpr("No fruit available."); - return (false); + return false; } prioritise_adjacent(you.pos(), adjacent); @@ -2575,7 +2575,7 @@ bool fedhas_plant_ring_from_fruit() "How many plants will you create?")) { // User canceled at the prompt. - return (false); + return false; } const int hp_adjust = you.skill(SK_INVOCATIONS, 10); @@ -2619,7 +2619,7 @@ bool fedhas_plant_ring_from_fruit() _decrease_amount(collected_fruit, created_count); - return (created_count); + return created_count; } // Create a circle of water around the target, with a radius of @@ -2722,7 +2722,7 @@ int fedhas_rain(const coord_def &target) (spawned_count > 1 ? "" : "s")); } - return (processed_count); + return processed_count; } // Destroy corpses in the player's LOS (first corpse on a stack only) @@ -2753,7 +2753,7 @@ int fedhas_corpse_spores(beh_type behavior, bool interactive) } if (count == 0) - return (count); + return count; viewwindow(false); for (unsigned i = 0; i < positions.size(); ++i) @@ -2813,7 +2813,7 @@ int fedhas_corpse_spores(beh_type behavior, bool interactive) viewwindow(false); - return (count); + return count; } struct monster_conversion @@ -2864,10 +2864,10 @@ static bool _possible_evolution(const monster* input, break; default: - return (false); + return false; } - return (true); + return true; } bool mons_is_evolvable(const monster* mon) @@ -2892,14 +2892,14 @@ static bool _place_ballisto(const coord_def & pos) mpr("The mold grows into a ballistomycete."); mpr("Your piety has decreased."); lose_piety(1); - return (true); + return true; } // Monster placement failing should be quite unusual, but it could happen. // Not entirely sure what to say about it, but a more informative message // might be good. -cao canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } bool fedhas_evolve_flora() @@ -2924,7 +2924,7 @@ bool fedhas_evolve_flora() if (!in_range) { mpr("No evolvable flora in sight."); - return (false); + return false; } dist spelld; @@ -2944,7 +2944,7 @@ bool fedhas_evolve_flora() { // Check for user cancel. canned_msg(MSG_OK); - return (false); + return false; } monster* const target = monster_at(spelld.target); @@ -2959,7 +2959,7 @@ bool fedhas_evolve_flora() mpr("The tree has already reached the pinnacle of evolution."); else mpr("You must target a plant or fungus."); - return (false); + return false; } return (_place_ballisto(spelld.target)); @@ -2975,7 +2975,7 @@ bool fedhas_evolve_flora() else mpr("Only plants or fungi may be evolved."); - return (false); + return false; } std::vector<std::pair<int, int> > collected_fruit; @@ -2986,14 +2986,14 @@ bool fedhas_evolve_flora() if (total_fruit < upgrade.fruit_cost) { mpr("Not enough fruit available."); - return (false); + return false; } } if (upgrade.piety_cost && upgrade.piety_cost > you.piety) { mpr("Not enough piety available."); - return (false); + return false; } switch (target->type) @@ -3064,13 +3064,13 @@ bool fedhas_evolve_flora() mpr("Your piety has decreased."); } - return (true); + return true; } static int _lugonu_warp_monster(monster* mon, int pow) { if (mon == NULL) - return (0); + return 0; if (!mon->friendly()) behaviour_event(mon, ME_ANNOY, &you); @@ -3081,7 +3081,7 @@ static int _lugonu_warp_monster(monster* mon, int pow) mprf("%s%s", mon->name(DESC_THE).c_str(), mons_resist_string(mon, res_margin)); - return (1); + return 1; } const int damage = 1 + random2(pow / 6); @@ -3091,13 +3091,13 @@ static int _lugonu_warp_monster(monster* mon, int pow) { mon->hurt(&you, damage); if (!mon->alive()) - return (1); + return 1; } if (!mon->no_tele(true, false)) mon->blink(); - return (1); + return 1; } static void _lugonu_warp_area(int pow) @@ -3155,7 +3155,7 @@ static int _slouchable(coord_def where, int pow, int, actor* agent) || mons_is_projectile(mon->type) || mon->asleep() && !mons_is_confused(mon)) { - return (0); + return 0; } int dmg = (mon->speed - 1000/player_movement_speed()/player_speed()); @@ -3181,7 +3181,7 @@ static int _slouch_monsters(coord_def where, int pow, int dummy, actor* agent) dmg = (dmg > 0 ? roll_dice(dmg*4, 3)/2 : 0); mon->hurt(agent, dmg, BEAM_MMISSILE, true); - return (1); + return 1; } bool cheibriados_slouch(int pow) diff --git a/crawl-ref/source/godconduct.cc b/crawl-ref/source/godconduct.cc index 13b9cd802a..c634ce6f15 100644 --- a/crawl-ref/source/godconduct.cc +++ b/crawl-ref/source/godconduct.cc @@ -1066,7 +1066,7 @@ bool did_god_conduct(conduct_type thing_done, int level, bool known, do_god_revenge(thing_done, victim); - return (retval); + return retval; } // These two arrays deal with the situation where a beam hits a non-fleeing diff --git a/crawl-ref/source/goditem.cc b/crawl-ref/source/goditem.cc index 2995fef749..667faead99 100644 --- a/crawl-ref/source/goditem.cc +++ b/crawl-ref/source/goditem.cc @@ -61,7 +61,7 @@ bool is_holy_item(const item_def& item) unrandart_entry* entry = get_unrand_entry(item.special); if (entry->flags & UNRAND_FLAG_HOLY) - return (true); + return true; } switch (item.base_type) @@ -77,12 +77,12 @@ bool is_holy_item(const item_def& item) break; } - return (retval); + return retval; } bool is_potentially_unholy_item(const item_def& item) { - return (false); + return false; } bool is_unholy_item(const item_def& item) @@ -94,7 +94,7 @@ bool is_unholy_item(const item_def& item) unrandart_entry* entry = get_unrand_entry(item.special); if (entry->flags & UNRAND_FLAG_UNHOLY) - return (true); + return true; } switch (item.base_type) @@ -116,7 +116,7 @@ bool is_unholy_item(const item_def& item) break; } - return (retval); + return retval; } bool is_potentially_evil_item(const item_def& item) @@ -127,25 +127,25 @@ bool is_potentially_evil_item(const item_def& item) { const int item_brand = get_weapon_brand(item); if (item_brand == SPWPN_CHAOS) - return (true); + return true; } break; case OBJ_MISSILES: { const int item_brand = get_ammo_brand(item); if (item_brand == SPMSL_CHAOS) - return (true); + return true; } break; case OBJ_WANDS: if (item.sub_type == WAND_RANDOM_EFFECTS) - return (true); + return true; break; default: break; } - return (false); + return false; } // This is a subset of is_evil_item(). @@ -158,7 +158,7 @@ bool is_corpse_violating_item(const item_def& item) unrandart_entry* entry = get_unrand_entry(item.special); if (entry->flags & UNRAND_FLAG_CORPSE_VIOLATING) - return (true); + return true; } switch (item.base_type) @@ -180,7 +180,7 @@ bool is_corpse_violating_item(const item_def& item) break; } - return (retval); + return retval; } bool is_evil_item(const item_def& item) @@ -190,7 +190,7 @@ bool is_evil_item(const item_def& item) unrandart_entry* entry = get_unrand_entry(item.special); if (entry->flags & UNRAND_FLAG_EVIL) - return (true); + return true; } switch (item.base_type) @@ -228,7 +228,7 @@ bool is_unclean_item(const item_def& item) unrandart_entry* entry = get_unrand_entry(item.special); if (entry->flags & UNRAND_FLAG_UNCLEAN) - return (true); + return true; } if (item.has_spells()) @@ -246,7 +246,7 @@ bool is_chaotic_item(const item_def& item) unrandart_entry* entry = get_unrand_entry(item.special); if (entry->flags & UNRAND_FLAG_CHAOTIC) - return (true); + return true; } switch (item.base_type) @@ -286,7 +286,7 @@ bool is_chaotic_item(const item_def& item) retval = true; } - return (retval); + return retval; } static bool _is_potentially_hasty_item(const item_def& item) @@ -297,25 +297,25 @@ static bool _is_potentially_hasty_item(const item_def& item) { const int item_brand = get_weapon_brand(item); if (item_brand == SPWPN_CHAOS) - return (true); + return true; } break; case OBJ_MISSILES: { const int item_brand = get_ammo_brand(item); if (item_brand == SPMSL_CHAOS || item_brand == SPMSL_RAGE) - return (true); + return true; } break; case OBJ_WANDS: if (item.sub_type == WAND_RANDOM_EFFECTS) - return (true); + return true; break; default: break; } - return (false); + return false; } bool is_hasty_item(const item_def& item) @@ -364,7 +364,7 @@ bool is_hasty_item(const item_def& item) retval = true; } - return (retval); + return retval; } bool is_poisoned_item(const item_def& item) @@ -375,25 +375,25 @@ bool is_poisoned_item(const item_def& item) { const int item_brand = get_weapon_brand(item); if (item_brand == SPWPN_VENOM) - return (true); + return true; } break; case OBJ_MISSILES: { const int item_brand = get_ammo_brand(item); if (item_brand == SPMSL_POISONED || item_brand == SPMSL_CURARE) - return (true); + return true; } break; case OBJ_STAVES: if (item.sub_type == STAFF_POISON) - return (true); + return true; break; default: break; } - return (false); + return false; } bool is_unholy_spell(spell_type spell) @@ -448,21 +448,21 @@ conduct_type good_god_hates_item_handling(const item_def &item) if (!is_good_god(you.religion) || (!is_unholy_item(item) && !is_evil_item(item))) { - return (DID_NOTHING); + return DID_NOTHING; } if (item_type_known(item) || is_unrandom_artefact(item)) { if (is_evil_item(item)) - return (DID_NECROMANCY); + return DID_NECROMANCY; else - return (DID_UNHOLY); + return DID_UNHOLY; } if (is_demonic(item)) - return (DID_UNHOLY); + return DID_UNHOLY; - return (DID_NOTHING); + return DID_NOTHING; } conduct_type god_hates_item_handling(const item_def &item) @@ -471,43 +471,43 @@ conduct_type god_hates_item_handling(const item_def &item) { case GOD_ZIN: if (!item_type_known(item)) - return (DID_NOTHING); + return DID_NOTHING; if (is_unclean_item(item)) - return (DID_UNCLEAN); + return DID_UNCLEAN; if (is_chaotic_item(item)) - return (DID_CHAOS); + return DID_CHAOS; break; case GOD_SHINING_ONE: if (item_type_known(item) && is_poisoned_item(item)) - return (DID_POISON); + return DID_POISON; break; case GOD_YREDELEMNUL: if (item_type_known(item) && is_holy_item(item)) - return (DID_HOLY); + return DID_HOLY; break; case GOD_TROG: if (item_is_spellbook(item)) - return (DID_SPELL_MEMORISE); + return DID_SPELL_MEMORISE; // Only Trog cares about spellsbooks vs rods. if (item.base_type == OBJ_RODS) - return (DID_NOTHING); + return DID_NOTHING; break; case GOD_FEDHAS: if (item_type_known(item) && is_corpse_violating_item(item)) - return (DID_CORPSE_VIOLATION); + return DID_CORPSE_VIOLATION; break; case GOD_CHEIBRIADOS: if (item_type_known(item) && (_is_potentially_hasty_item(item) || is_hasty_item(item))) { - return (DID_HASTY); + return DID_HASTY; } break; @@ -518,27 +518,27 @@ conduct_type god_hates_item_handling(const item_def &item) if (item_type_known(item) && is_potentially_unholy_item(item) && is_good_god(you.religion)) { - return (DID_UNHOLY); + return DID_UNHOLY; } if (item_type_known(item) && is_potentially_evil_item(item) && is_good_god(you.religion)) { - return (DID_NECROMANCY); + return DID_NECROMANCY; } if (item_type_known(item) && _is_bookrod_type(item, _your_god_hates_spell)) { - return (NUM_CONDUCTS); // FIXME: Get the specific reason, if it + return NUM_CONDUCTS; // FIXME: Get the specific reason, if it } // will ever be needed for spellbooks. - return (DID_NOTHING); + return DID_NOTHING; } bool god_dislikes_spell_type(spell_type spell, god_type god) { if (god_hates_spell(spell, god)) - return (true); + return true; unsigned int flags = get_spell_flags(spell); unsigned int disciplines = get_spell_disciplines(spell); @@ -552,7 +552,7 @@ bool god_dislikes_spell_type(spell_type spell, god_type god) || spell == SPELL_CONFUSE || spell == SPELL_MASS_CONFUSION || spell == SPELL_HIBERNATION) { - return (true); + return true; } break; @@ -565,30 +565,30 @@ bool god_dislikes_spell_type(spell_type spell, god_type god) if (flags & (SPFLAG_HELPFUL | SPFLAG_NEUTRAL | SPFLAG_ESCAPE | SPFLAG_RECOVERY | SPFLAG_MAPPING)) { - return (true); + return true; } // Things are more fun for Xom the less the player knows in // advance. if (disciplines & SPTYP_DIVINATION) - return (true); + return true; break; case GOD_ELYVILON: // A peaceful god of healing wouldn't like combat spells. if (disciplines & SPTYP_CONJURATION) - return (true); + return true; // Also doesn't like battle spells of the non-conjuration type. if (flags & SPFLAG_BATTLE) - return (true); + return true; break; default: break; } - return (false); + return false; } bool god_dislikes_spell_discipline(int discipline, god_type god) @@ -596,7 +596,7 @@ bool god_dislikes_spell_discipline(int discipline, god_type god) ASSERT(discipline < (1 << (SPTYP_LAST_EXPONENT + 1))); if (is_good_god(god) && (discipline & SPTYP_NECROMANCY)) - return (true); + return true; switch (god) { @@ -610,5 +610,5 @@ bool god_dislikes_spell_discipline(int discipline, god_type god) break; } - return (false); + return false; } diff --git a/crawl-ref/source/godpassive.cc b/crawl-ref/source/godpassive.cc index e649340900..c7dda4d42a 100644 --- a/crawl-ref/source/godpassive.cc +++ b/crawl-ref/source/godpassive.cc @@ -28,7 +28,7 @@ int che_stat_boost(int piety) { if (you.religion != GOD_CHEIBRIADOS || you.penance[GOD_CHEIBRIADOS]) - return (0); + return 0; if (piety < 30) // Since you've already begun to slow down. return 1; if (piety > 160) // Fudging this slightly to agree with ****** piety. @@ -598,7 +598,7 @@ int ash_detect_portals(bool all) } you.seen_portals += portals_found; - return (portals_found); + return portals_found; } monster_type ash_monster_tier(const monster *mon) diff --git a/crawl-ref/source/godprayer.cc b/crawl-ref/source/godprayer.cc index b1e772b191..e12869f16c 100644 --- a/crawl-ref/source/godprayer.cc +++ b/crawl-ref/source/godprayer.cc @@ -41,7 +41,7 @@ static bool _confirm_pray_sacrifice(god_type god) if (Options.stash_tracking == STM_EXPLICIT && is_stash(you.pos())) { mpr("You can't sacrifice explicitly marked stashes."); - return (false); + return false; } for (stack_iterator si(you.pos(), true); si; ++si) @@ -54,11 +54,11 @@ static bool _confirm_pray_sacrifice(god_type god) prompt += " in it?"; if (!yesno(prompt.c_str(), false, 'n')) - return (false); + return false; } } - return (true); + return true; } std::string god_prayer_reaction() @@ -78,7 +78,7 @@ std::string god_prayer_reaction() : "displeased"; result += "."; - return (result); + return result; } static bool _bless_weapon(god_type god, brand_type brand, int colour) @@ -89,7 +89,7 @@ static bool _bless_weapon(god_type god, brand_type brand, int colour) || (is_range_weapon(wpn) && brand != SPWPN_HOLY_WRATH) || is_artefact(wpn)) { - return (false); + return false; } std::string prompt = "Do you wish to have " + wpn.name(DESC_YOUR) @@ -103,7 +103,7 @@ static bool _bless_weapon(god_type god, brand_type brand, int colour) prompt += "?"; if (!yesno(prompt.c_str(), true, 'n')) - return (false); + return false; you.duration[DUR_WEAPON_BRAND] = 0; // just in case @@ -187,7 +187,7 @@ static bool _bless_weapon(god_type god, brand_type brand, int colour) delay(1000); #endif - return (true); + return true; } // Prayer at your god's altar. @@ -261,14 +261,14 @@ static bool _altar_prayer() if (!kiku_did_bless_weapon) { if (!yesno("Do you wish to receive the Necronomicon?", true, 'n')) - return (false); + return false; int thing_created = items(1, OBJ_BOOKS, BOOK_NECRONOMICON, true, 1, MAKE_ITEM_RANDOM_RACE, 0, 0, you.religion); if (thing_created == NON_ITEM) - return (false); + return false; move_item_to_grid(&thing_created, you.pos()); @@ -285,10 +285,10 @@ static bool _altar_prayer() } // Return early so we don't offer our Necronomicon to Kiku. - return (did_bless); + return did_bless; } - return (did_bless); + return did_bless; } void pray() @@ -562,16 +562,16 @@ static bool _destroyed_valuable_weapon(int value, int type) { // value/500 chance of piety normally if (value > random2(500)) - return (true); + return true; // But all non-missiles are acceptable if you've never reached *. if (you.piety_max[GOD_ELYVILON] < piety_breakpoint(0) && type != OBJ_MISSILES) { - return (true); + return true; } - return (false); + return false; } static piety_gain_t _sac_corpse(const item_def& item) @@ -737,7 +737,7 @@ static piety_gain_t _sacrifice_one_item_noncount(const item_def& item, break; } - return (relative_piety_gain); + return relative_piety_gain; } piety_gain_t sacrifice_item_stack(const item_def& item, int *js) @@ -756,7 +756,7 @@ piety_gain_t sacrifice_item_stack(const item_def& item, int *js) relative_gain = PIETY_LOTS; } } - return (relative_gain); + return relative_gain; } static bool _check_nemelex_sacrificing_item_type(const item_def& item) diff --git a/crawl-ref/source/godwrath.cc b/crawl-ref/source/godwrath.cc index 1c1e161e3c..d462cc28f1 100644 --- a/crawl-ref/source/godwrath.cc +++ b/crawl-ref/source/godwrath.cc @@ -151,7 +151,7 @@ static bool _tso_retribution() } break; } - return (false); + return false; } static void _zin_remove_good_mutations() @@ -229,7 +229,7 @@ static bool _zin_retribution() _zin_remove_good_mutations(); break; } - return (false); + return false; } static void _ely_dull_inventory_weapons() @@ -315,7 +315,7 @@ static bool _elyvilon_retribution() break; } - return (true); + return true; } static bool _cheibriados_retribution() @@ -392,7 +392,7 @@ static bool _cheibriados_retribution() if (wrath_type > 2) dec_penance(god, 1 + random2(wrath_type)); - return (glammer); + return glammer; } static bool _makhleb_retribution() @@ -441,7 +441,7 @@ static bool _makhleb_retribution() : "'s minions fail to arrive.", god); } - return (true); + return true; } static bool _kikubaaqudgha_retribution() @@ -493,7 +493,7 @@ static bool _kikubaaqudgha_retribution() animate_dead(&you, 1 + random2(3), BEH_HOSTILE, MHITYOU, 0, "the malice of Kikubaaqudgha", GOD_KIKUBAAQUDGHA); - return (true); + return true; } static bool _yredelemnul_retribution() @@ -535,7 +535,7 @@ static bool _yredelemnul_retribution() random2avg(88, 3), "the anger of Yredelemnul"); } - return (true); + return true; } static bool _trog_retribution() @@ -627,7 +627,7 @@ static bool _trog_retribution() random2avg(98, 3), "the fiery rage of Trog"); } - return (true); + return true; } static bool _beogh_retribution() @@ -765,7 +765,7 @@ static bool _beogh_retribution() } } - return (true); + return true; } static bool _okawaru_retribution() @@ -782,7 +782,7 @@ static bool _okawaru_retribution() simple_god_message(count > 0 ? " sends forces against you!" : "'s forces are busy with other wars.", god); - return (true); + return true; } static bool _sif_muna_retribution() @@ -834,7 +834,7 @@ static bool _sif_muna_retribution() break; } - return (true); + return true; } static bool _lugonu_retribution() @@ -899,7 +899,7 @@ static bool _lugonu_retribution() : "'s minions fail to arrive.", god); } - return (false); + return false; } static bool _vehumet_retribution() @@ -911,7 +911,7 @@ static bool _vehumet_retribution() MiscastEffect(&you, -god, coinflip() ? SPTYP_CONJURATION : SPTYP_SUMMONING, 8 + you.experience_level, random2avg(98, 3), "the wrath of Vehumet"); - return (true); + return true; } static bool _nemelex_retribution() @@ -922,7 +922,7 @@ static bool _nemelex_retribution() // like Xom, this might actually help the player -- bwr simple_god_message(" makes you draw from the Deck of Punishment.", god); draw_from_deck_of_punishment(); - return (true); + return true; } static bool _jiyva_retribution() @@ -1027,7 +1027,7 @@ static bool _jiyva_retribution() : "The ground quivers slightly."); } - return (true); + return true; } static bool _fedhas_retribution() @@ -1165,14 +1165,14 @@ static bool _fedhas_retribution() if (success) { god_speaks(god, "Plants grow around you in an ominous manner."); - return (false); + return false; } break; } } - return (true); + return true; } bool divine_retribution(god_type god, bool no_bonus, bool force) @@ -1180,7 +1180,7 @@ bool divine_retribution(god_type god, bool no_bonus, bool force) ASSERT(god != GOD_NO_GOD); if (is_unavailable_god(god)) - return (false); + return false; // Good gods don't use divine retribution on their followers, and // gods don't use divine retribution on followers of gods they don't @@ -1188,7 +1188,7 @@ bool divine_retribution(god_type god, bool no_bonus, bool force) if (!force && ((god == you.religion && is_good_god(god)) || (!god_hates_your_god(god)))) { - return (false); + return false; } god_acting gdact(god, true); @@ -1219,7 +1219,7 @@ bool divine_retribution(god_type god, bool no_bonus, bool force) case GOD_ASHENZARI: // No reduction with time. - return (false); + return false; default: #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_RELIGION) @@ -1227,11 +1227,11 @@ bool divine_retribution(god_type god, bool no_bonus, bool force) god_name(god).c_str()); #endif do_more = false; - return (false); + return false; } if (no_bonus) - return (true); + return true; // Sometimes divine experiences are overwhelming... if (do_more && one_chance_in(5) && you.experience_level < random2(37)) @@ -1257,7 +1257,7 @@ bool divine_retribution(god_type god, bool no_bonus, bool force) // point...the punishment might have reduced penance further. dec_penance(god, 1 + random2(3)); - return (true); + return true; } bool do_god_revenge(conduct_type thing_done, const monster *victim) @@ -1283,7 +1283,7 @@ bool do_god_revenge(conduct_type thing_done, const monster *victim) break; } - return (retval); + return retval; } // Currently only used when orcish idols have been destroyed. @@ -1294,7 +1294,7 @@ static std::string _get_beogh_speech(const std::string key) if (result.empty()) return ("Beogh is angry!"); - return (result); + return result; } // Destroying orcish idols (a.k.a. idols of Beogh) may anger Beogh. @@ -1319,10 +1319,10 @@ static bool _beogh_idol_revenge() _god_smites_you(GOD_BEOGH, revenge); - return (true); + return true; } - return (false); + return false; } static void _tso_blasts_cleansing_flame(const char *message) @@ -1360,7 +1360,7 @@ static std::string _get_tso_speech(const std::string key) if (result.empty()) return ("The Shining One is angry!"); - return (result); + return result; } // Killing holy beings may anger TSO. @@ -1382,10 +1382,10 @@ static bool _tso_holy_revenge() _tso_blasts_cleansing_flame(revenge); - return (true); + return true; } - return (false); + return false; } // Killing apises may make Elyvilon sad. She'll sulk and stuff. @@ -1430,7 +1430,7 @@ static bool _ely_holy_revenge(const monster *victim) (*mi)->heal(10 + random2(10), false); } - return (true); + return true; } static void _god_smites_you(god_type god, const char *message, diff --git a/crawl-ref/source/hints.cc b/crawl-ref/source/hints.cc index 1df5bbb7ff..5414202f0d 100644 --- a/crawl-ref/source/hints.cc +++ b/crawl-ref/source/hints.cc @@ -580,11 +580,11 @@ static bool _advise_use_healing_potion() if (obj.sub_type == POT_CURING || obj.sub_type == POT_HEAL_WOUNDS) { - return (true); + return true; } } - return (false); + return false; } void hints_healing_check() @@ -810,7 +810,7 @@ static bool _advise_use_wand() // Wand type unknown, might be useful. if (!item_type_known(obj)) - return (true); + return true; // Empty wands are no good. if (obj.plus2 == ZAPCOUNT_EMPTY @@ -837,11 +837,11 @@ static bool _advise_use_wand() case WAND_DRAINING: case WAND_RANDOM_EFFECTS: case WAND_DISINTEGRATION: - return (true); + return true; } } - return (false); + return false; } void hints_monster_seen(const monster& mon) @@ -1122,9 +1122,9 @@ static bool _rare_hints_event(hints_event_type event) case HINT_GAINED_RANGED_SKILL: case HINT_CHOOSE_STAT: case HINT_AUTO_EXCLUSION: - return (true); + return true; default: - return (false); + return false; } } @@ -1150,9 +1150,9 @@ static bool _tutorial_interesting(hints_event_type event) case HINT_CLOUD_WARNING: case HINT_ANIMATE_CORPSE_SKELETON: case HINT_SKILL_RAISE: - return (true); + return true; default: - return (false); + return false; } } @@ -3185,7 +3185,7 @@ static std::string _hints_target_mode(bool spells = false) result += "</w> fires at the same target again."; insert_commands(result, cmd, 0); - return (result); + return result; } static std::string _hints_abilities(const item_def& item) @@ -3221,7 +3221,7 @@ static std::string _hints_abilities(const item_def& item) cmd.push_back(CMD_USE_ABILITY); insert_commands(str, cmd); - return (str); + return str; } static std::string _hints_throw_stuff(const item_def &item) @@ -3239,7 +3239,7 @@ static std::string _hints_throw_stuff(const item_def &item) result += _hints_target_mode(); insert_commands(result, CMD_FIRE, 0); - return (result); + return result; } // num_old_talents describes the number of activatable abilities you had @@ -4018,9 +4018,9 @@ static bool _hints_feat_interesting(dungeon_feature_type feat) { // Altars and branch entrances are always interesting. if (feat_is_altar(feat)) - return (true); + return true; if (feat >= DNGN_ENTER_FIRST_BRANCH && feat <= DNGN_ENTER_LAST_BRANCH) - return (true); + return true; switch (feat) { @@ -4040,9 +4040,9 @@ static bool _hints_feat_interesting(dungeon_feature_type feat) case DNGN_ESCAPE_HATCH_DOWN: case DNGN_ESCAPE_HATCH_UP: case DNGN_ENTER_PORTAL_VAULT: - return (true); + return true; default: - return (false); + return false; } } @@ -4404,7 +4404,7 @@ static bool _water_is_disturbed(int x, int y) const monster* mon = monster_at(c); if (!mon || grd(c) != DNGN_SHALLOW_WATER || !you.see_cell(c)) - return (false); + return false; return (!mon->visible_to(&you) && !mons_flies(mon)); } @@ -4412,11 +4412,11 @@ static bool _water_is_disturbed(int x, int y) bool hints_monster_interesting(const monster* mons) { if (mons_is_unique(mons->type) || mons->type == MONS_PLAYER_GHOST) - return (true); + return true; // Highlighted in some way. if (_mons_is_highlighted(mons)) - return (true); + return true; // The monster is (seriously) out of depth. return (mons_level(mons->type) >= you.depth + 8); diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 43c6c81a80..8a2c7a30f9 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -96,7 +96,7 @@ static std::string _score_file_name() ret += crawl_state.game_type_qualifier(); - return (ret); + return ret; } static std::string _log_file_name() @@ -585,13 +585,13 @@ static bool _hs_read(FILE *scores, scorefile_entry &dest) { char inbuf[1300]; if (!scores || feof(scores)) - return (false); + return false; memset(inbuf, 0, sizeof inbuf); dest.reset(); if (!fgets(inbuf, sizeof inbuf, scores)) - return (false); + return false; return (dest.parse(inbuf)); } @@ -658,7 +658,7 @@ static kill_method_type _str_to_kill_method(const std::string &s) return static_cast<kill_method_type>(i); } - return (NUM_KILLBY); + return NUM_KILLBY; } ////////////////////////////////////////////////////////////////////////// @@ -774,7 +774,7 @@ bool scorefile_entry::parse(const std::string &line) if (line[0] == ':') { dprf("Corrupted xlog-line: %s", line.c_str()); - return (false); + return false; } raw_line = line; @@ -799,7 +799,7 @@ bool scorefile_entry::parse_scoreline(const std::string &line) fields.reset(new xlog_fields(line)); init_with_fields(); - return (true); + return true; } static const char* _short_branch_name(int branch) @@ -863,13 +863,13 @@ static int _job_by_name(const std::string& name) int job = get_job_by_name(name.c_str()); if (job != JOB_UNKNOWN) - return (job); + return job; for (job = -1; job > NUM_OLD_JOBS - 2; job--) if (name == _job_name(job)) - return (job); + return job; - return (JOB_UNKNOWN); + return JOB_UNKNOWN; } void scorefile_entry::init_with_fields() @@ -1095,7 +1095,7 @@ std::string scorefile_entry::long_kill_message() const msg = make_oneline(msg); msg[0] = tolower(msg[0]); trim_string(msg); - return (msg); + return msg; } std::string scorefile_entry::short_kill_message() const @@ -1104,7 +1104,7 @@ std::string scorefile_entry::short_kill_message() const msg = make_oneline(msg); msg[0] = tolower(msg[0]); trim_string(msg); - return (msg); + return msg; } void scorefile_entry::init_death_cause(int dam, int dsrc, @@ -1320,7 +1320,7 @@ static int _award_modified_experience() if (xp <= 750000) { result += (xp * 4) / 10; - return (result); + return result; } result += (750000 * 4) / 10; @@ -1329,7 +1329,7 @@ static int _award_modified_experience() if (xp <= 2000000) { result += (xp * 2) / 10; - return (result); + return result; } result += (2000000 * 2) / 10; @@ -1337,7 +1337,7 @@ static int _award_modified_experience() result += (xp / 10); - return (result); + return result; } void scorefile_entry::init(time_t dt) @@ -1517,7 +1517,7 @@ std::string scorefile_entry::hiscore_line(death_desc_verbosity verbosity) const line += death_place(verbosity); line += game_time(verbosity); - return (line); + return line; } std::string scorefile_entry::game_time(death_desc_verbosity verbosity) const @@ -1535,7 +1535,7 @@ std::string scorefile_entry::game_time(death_desc_verbosity verbosity) const line += _hiscore_newline_string(); } - return (line); + return line; } const char *scorefile_entry::damage_verb() const @@ -1550,7 +1550,7 @@ const char *scorefile_entry::damage_verb() const std::string scorefile_entry::death_source_desc() const { - return (death_source_name); + return death_source_name; } std::string scorefile_entry::damage_string(bool terse) const @@ -1558,7 +1558,7 @@ std::string scorefile_entry::damage_string(bool terse) const char scratch[50]; snprintf(scratch, sizeof scratch, "(%d%s)", damage, terse? "" : " damage"); - return (scratch); + return scratch; } std::string scorefile_entry::strip_article_a(const std::string &s) const @@ -1567,7 +1567,7 @@ std::string scorefile_entry::strip_article_a(const std::string &s) const return (s.substr(2)); else if (s.find("an ") == 0) return (s.substr(3)); - return (s); + return s; } std::string scorefile_entry::terse_missile_name() const @@ -1596,7 +1596,7 @@ std::string scorefile_entry::terse_missile_name() const if (missile.find("n ") == 0) missile = missile.substr(2); } - return (missile); + return missile; } std::string scorefile_entry::terse_missile_cause() const @@ -1618,7 +1618,7 @@ std::string scorefile_entry::terse_missile_cause() const if (!missile.empty()) mcause += "/" + missile; - return (mcause); + return mcause; } std::string scorefile_entry::terse_beam_cause() const @@ -1626,7 +1626,7 @@ std::string scorefile_entry::terse_beam_cause() const std::string cause = auxkilldata; if (cause.find("by ") == 0 || cause.find("By ") == 0) cause = cause.substr(3); - return (cause); + return cause; } std::string scorefile_entry::terse_wild_magic() const @@ -1659,11 +1659,11 @@ static std::string _append_sentence_delimiter(const std::string &sentence, const std::string &delimiter) { if (sentence.empty()) - return (sentence); + return sentence; const char lastch = sentence[sentence.length() - 1]; if (lastch == '!' || lastch == '.') - return (sentence); + return sentence; return (sentence + delimiter); } @@ -1764,7 +1764,7 @@ scorefile_entry::character_description(death_desc_verbosity verbosity) const } } - return (desc); + return desc; } std::string scorefile_entry::death_place(death_desc_verbosity verbosity) const @@ -1813,7 +1813,7 @@ std::string scorefile_entry::death_place(death_desc_verbosity verbosity) const place = _append_sentence_delimiter(place, "."); place += _hiscore_newline_string(); - return (place); + return place; } static bool _species_is_undead(int sp) @@ -2434,7 +2434,7 @@ std::string scorefile_entry::death_description(death_desc_verbosity verbosity) desc = strip_article_a(desc); } - return (desc); + return desc; } ////////////////////////////////////////////////////////////////////////////// @@ -2469,7 +2469,7 @@ _xlog_next_separator(const std::string &s, if (p != std::string::npos && p < s.length() - 1 && s[p + 1] == ':') return _xlog_next_separator(s, p + 2); - return (p); + return p; } static std::vector<std::string> _xlog_split_fields(const std::string &s) @@ -2486,7 +2486,7 @@ static std::vector<std::string> _xlog_split_fields(const std::string &s) if (start < s.length()) fs.push_back(s.substr(start)); - return (fs); + return fs; } void xlog_fields::init(const std::string &line) @@ -2565,7 +2565,7 @@ std::string xlog_fields::xlog_line() const line += _xlog_escape(f.second); } - return (line); + return line; } /////////////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index c3604e5c65..fc71cdcafa 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -140,7 +140,7 @@ static msg_colour_type _str_to_channel_colour(const std::string &str) else ret = msg_colour(str_to_colour(str)); - return (ret); + return ret; } static const std::string message_channel_names[] = @@ -184,37 +184,37 @@ std::string channel_to_str(int channel) weapon_type str_to_weapon(const std::string &str) { if (str == "shortsword" || str == "short sword") - return (WPN_SHORT_SWORD); + return WPN_SHORT_SWORD; else if (str == "falchion") - return (WPN_FALCHION); + return WPN_FALCHION; else if (str == "quarterstaff") - return (WPN_QUARTERSTAFF); + return WPN_QUARTERSTAFF; else if (str == "mace") - return (WPN_MACE); + return WPN_MACE; else if (str == "spear") - return (WPN_SPEAR); + return WPN_SPEAR; else if (str == "trident") - return (WPN_TRIDENT); + return WPN_TRIDENT; else if (str == "hand axe" || str == "handaxe") - return (WPN_HAND_AXE); + return WPN_HAND_AXE; else if (str == "unarmed" || str == "claws") - return (WPN_UNARMED); + return WPN_UNARMED; else if (str == "sling") - return (WPN_SLING); + return WPN_SLING; else if (str == "bow") - return (WPN_BOW); + return WPN_BOW; else if (str == "crossbow") - return (WPN_CROSSBOW); + return WPN_CROSSBOW; else if (str == "rocks") - return (WPN_ROCKS); + return WPN_ROCKS; else if (str == "javelins") - return (WPN_JAVELINS); + return WPN_JAVELINS; else if (str == "darts") - return (WPN_DARTS); + return WPN_DARTS; else if (str == "random") - return (WPN_RANDOM); + return WPN_RANDOM; - return (WPN_UNKNOWN); + return WPN_UNKNOWN; } static std::string _weapon_to_str(int weapon) @@ -260,19 +260,19 @@ static std::string _weapon_to_str(int weapon) int str_to_summon_type(const std::string &str) { if (str == "clone") - return (MON_SUMM_CLONE); + return MON_SUMM_CLONE; if (str == "animate") - return (MON_SUMM_ANIMATE); + return MON_SUMM_ANIMATE; if (str == "chaos") - return (MON_SUMM_CHAOS); + return MON_SUMM_CHAOS; if (str == "miscast") - return (MON_SUMM_MISCAST); + return MON_SUMM_MISCAST; if (str == "zot") - return (MON_SUMM_ZOT); + return MON_SUMM_ZOT; if (str == "wrath") - return (MON_SUMM_WRATH); + return MON_SUMM_WRATH; if (str == "aid") - return (MON_SUMM_AID); + return MON_SUMM_AID; return (spell_by_name(str)); } @@ -280,31 +280,31 @@ int str_to_summon_type(const std::string &str) static fire_type _str_to_fire_types(const std::string &str) { if (str == "launcher") - return (FIRE_LAUNCHER); + return FIRE_LAUNCHER; else if (str == "dart") - return (FIRE_DART); + return FIRE_DART; else if (str == "stone") - return (FIRE_STONE); + return FIRE_STONE; else if (str == "rock") - return (FIRE_ROCK); + return FIRE_ROCK; else if (str == "dagger") - return (FIRE_DAGGER); + return FIRE_DAGGER; else if (str == "spear") - return (FIRE_SPEAR); + return FIRE_SPEAR; else if (str == "hand axe" || str == "handaxe" || str == "axe") - return (FIRE_HAND_AXE); + return FIRE_HAND_AXE; else if (str == "club") - return (FIRE_CLUB); + return FIRE_CLUB; else if (str == "javelin") - return (FIRE_JAVELIN); + return FIRE_JAVELIN; else if (str == "net") - return (FIRE_NET); + return FIRE_NET; else if (str == "return" || str == "returning") - return (FIRE_RETURNING); + return FIRE_RETURNING; else if (str == "inscribed") - return (FIRE_INSCRIBED); + return FIRE_INSCRIBED; - return (FIRE_NONE); + return FIRE_NONE; } std::string gametype_to_str(game_type type) @@ -333,9 +333,9 @@ static game_type _str_to_gametype(const std::string& s) { game_type t = static_cast<game_type>(i); if (s == gametype_to_str(t)) - return (t); + return t; } - return (NUM_GAME_TYPE); + return NUM_GAME_TYPE; } #endif @@ -367,7 +367,7 @@ static species_type _str_to_species(const std::string &str) if (ret == SP_UNKNOWN) fprintf(stderr, "Unknown species choice: %s\n", str.c_str()); - return (ret); + return ret; } static std::string _job_to_str(job_type job) @@ -399,7 +399,7 @@ static job_type _str_to_job(const std::string &str) if (job == JOB_UNKNOWN) fprintf(stderr, "Unknown background choice: %s\n", str.c_str()); - return (job); + return job; } static bool _read_bool(const std::string &field, bool def_value) @@ -412,7 +412,7 @@ static bool _read_bool(const std::string &field, bool def_value) if (field == "false" || field == "0" || field == "no") ret = false; - return (ret); + return ret; } // read a value which can be either a boolean (in which case return @@ -432,7 +432,7 @@ static int _read_bool_or_number(const std::string &field, int def_value, if (field.find(num_prefix) == 0) ret = atoi(field.c_str() + num_prefix.size()); - return (ret); + return ret; } @@ -1122,7 +1122,7 @@ ucs_t get_glyph_override(int c) static int read_symbol(std::string s) { if (s.empty()) - return (0); + return 0; if (s.length() > 1 && s[0] == '\\') s = s.substr(1); @@ -1205,7 +1205,7 @@ mon_display game_options::parse_mon_glyph(const std::string &s) const else md.glyph = p == "_"? ' ' : read_symbol(p); } - return (md); + return md; } void game_options::add_mon_glyph_override(const std::string &text) @@ -1324,7 +1324,7 @@ static std::string _find_crawlrc() const std::string rc( catpath(SysEnv.rcdirs[i], rc_dir_filenames[n])); if (file_exists(rc)) - return (rc); + return rc; } } @@ -1337,7 +1337,7 @@ static std::string _find_crawlrc() const std::string rc = catpath(locations_data[i][0], locations_data[i][1]); if (file_exists(rc)) - return (rc); + return rc; } } @@ -1771,7 +1771,7 @@ int game_options::read_explore_stop_conditions(const std::string &field) const else if (c == "rune" || c == "runes") conditions |= ES_RUNE; } - return (conditions); + return conditions; } void game_options::add_alias(const std::string &key, const std::string &val) @@ -3242,7 +3242,7 @@ std::string game_options::resolve_include( const std::string candidate = get_path_relative_to(parent_file, included_file); if (file_exists(candidate)) - return (candidate); + return candidate; } if (rcdirs) @@ -3252,7 +3252,7 @@ std::string game_options::resolve_include( { const std::string candidate(catpath(dirs[i], included_file)); if (file_exists(candidate)) - return (candidate); + return candidate; } } @@ -3269,7 +3269,7 @@ std::string game_options::resolve_include(const std::string &file, if (resolved.empty()) report_error("Cannot find %sfile \"%s\".", type, file.c_str()); - return (resolved); + return resolved; } catch (const std::string &err) { @@ -3704,21 +3704,21 @@ static bool _check_extra_opt(char* _opt) { fprintf(stderr, "An extra option can't use Lua (%s)\n", _opt); - return (false); + return false; } if (opt[0] == '#') { fprintf(stderr, "An extra option can't be a comment (%s)\n", _opt); - return (false); + return false; } if (opt.find_first_of('=') == std::string::npos) { fprintf(stderr, "An extra opt must contain a '=' (%s)\n", _opt); - return (false); + return false; } std::vector<std::string> parts = split_string(opt, "="); @@ -3726,10 +3726,10 @@ static bool _check_extra_opt(char* _opt) { fprintf(stderr, "An extra opt must have an option name (%s)\n", _opt); - return (false); + return false; } - return (true); + return true; } bool parse_args(int argc, char **argv, bool rc_only) @@ -3755,7 +3755,7 @@ bool parse_args(int argc, char **argv, bool rc_only) SysEnv.rcdirs.clear(); if (argc < 2) // no args! - return (true); + return true; char *arg, *next_arg; int current = 1; @@ -3790,7 +3790,7 @@ bool parse_args(int argc, char **argv, bool rc_only) fprintf(stderr, "Option '%s' is invalid; options must be prefixed " "with -\n\n", arg); - return (false); + return false; } // Look for match (we accept both -option and --option). @@ -3806,18 +3806,18 @@ bool parse_args(int argc, char **argv, bool rc_only) // Print the list of commandline options for "--help". if (o == CLO_HELP) - return (false); + return false; if (o == num_cmd_ops) { fprintf(stderr, "Unknown option: %s\n\n", argv[current]); - return (false); + return false; } // Disallow options specified more than once. if (arg_seen[o] == true) - return (false); + return false; // Set arg to 'seen'. arg_seen[o] = true; @@ -3922,20 +3922,20 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_BUILDDB: if (next_is_param) - return (false); + return false; crawl_state.build_db = true; break; case CLO_MACRO: if (!next_is_param) - return (false); + return false; SysEnv.macro_dir = next_arg; nextUsed = true; break; case CLO_MORGUE: if (!next_is_param) - return (false); + return false; if (!rc_only) SysEnv.morgue_dir = next_arg; nextUsed = true; @@ -3943,7 +3943,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_SCOREFILE: if (!next_is_param) - return (false); + return false; if (!rc_only) SysEnv.scorefile = next_arg; nextUsed = true; @@ -3951,7 +3951,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_NAME: if (!next_is_param) - return (false); + return false; if (!rc_only) Options.game.name = next_arg; nextUsed = true; @@ -3960,7 +3960,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_RACE: case CLO_CLASS: if (!next_is_param) - return (false); + return false; if (!rc_only) { @@ -3975,7 +3975,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_PLAIN: if (next_is_param) - return (false); + return false; if (!rc_only) { @@ -3987,7 +3987,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_RCDIR: // Always parse. if (!next_is_param) - return (false); + return false; SysEnv.add_rcdir(next_arg); nextUsed = true; @@ -3996,7 +3996,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_DIR: // Always parse. if (!next_is_param) - return (false); + return false; SysEnv.crawl_dir = next_arg; nextUsed = true; @@ -4005,7 +4005,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_RC: // Always parse. if (!next_is_param) - return (false); + return false; SysEnv.crawl_rc = next_arg; nextUsed = true; @@ -4013,7 +4013,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_HELP: // Shouldn't happen. - return (false); + return false; case CLO_VERSION: _print_version(); @@ -4022,7 +4022,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_SAVE_VERSION: // Always parse. if (!next_is_param) - return (false); + return false; _print_save_version(next_arg); end(0); @@ -4030,17 +4030,17 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_EDIT_SAVE: // Always parse. if (!next_is_param) - return (false); + return false; _edit_save(argc - current - 1, argv + current + 1); end(0); case CLO_SEED: if (!next_is_param) - return (false); + return false; if (!sscanf(next_arg, "%x", &Options.seed)) - return (false); + return false; nextUsed = true; break; @@ -4051,7 +4051,7 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_SPRINT_MAP: if (!next_is_param) - return (false); + return false; nextUsed = true; crawl_state.sprint_map = next_arg; @@ -4101,11 +4101,11 @@ bool parse_args(int argc, char **argv, bool rc_only) case CLO_EXTRA_OPT_FIRST: if (!next_is_param) - return (false); + return false; if (!_check_extra_opt(next_arg)) // Don't print the help message if the opt was wrong - return (true); + return true; SysEnv.extra_opts_first.push_back(next_arg); nextUsed = true; @@ -4119,7 +4119,7 @@ bool parse_args(int argc, char **argv, bool rc_only) if (!_check_extra_opt(next_arg)) // Don't print the help message if the opt was wrong - return (true); + return true; SysEnv.extra_opts_last.push_back(next_arg); nextUsed = true; @@ -4134,7 +4134,7 @@ bool parse_args(int argc, char **argv, bool rc_only) current++; } - return (true); + return true; } ////////////////////////////////////////////////////////////////////////// @@ -4146,7 +4146,7 @@ int game_options::o_int(const char *name, int def) const opt_map::const_iterator i = named_options.find(name); if (i != named_options.end()) val = atoi(i->second.c_str()); - return (val); + return val; } bool game_options::o_bool(const char *name, bool def) const @@ -4155,7 +4155,7 @@ bool game_options::o_bool(const char *name, bool def) const opt_map::const_iterator i = named_options.find(name); if (i != named_options.end()) val = _read_bool(i->second, val); - return (val); + return val; } std::string game_options::o_str(const char *name, const char *def) const @@ -4166,7 +4166,7 @@ std::string game_options::o_str(const char *name, const char *def) const val = i->second; else if (def) val = def; - return (val); + return val; } int game_options::o_colour(const char *name, int def) const diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index 194da34523..5e4e0996e2 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -93,19 +93,19 @@ const std::string &InvEntry::get_basename() const { if (basename.empty()) basename = item->name(DESC_BASENAME); - return (basename); + return basename; } const std::string &InvEntry::get_qualname() const { if (qualname.empty()) qualname = item->name(DESC_QUALNAME); - return (qualname); + return qualname; } const std::string &InvEntry::get_fullname() const { - return (text); + return text; } bool InvEntry::is_item_cursed() const @@ -144,9 +144,9 @@ bool InvEntry::is_item_equipped() const for (int i = 0; i < NUM_EQUIP; i++) if (item->link == you.equip[i]) - return (true); + return true; - return (false); + return false; } // Returns values < 0 for edible chunks (non-rotten except for Saprovores), @@ -364,7 +364,7 @@ InvMenu::xlat_itemvect(const std::vector<item_def> &v) std::vector<const item_def*> xlatitems; for (unsigned i = 0, size = v.size(); i < size; ++i) xlatitems.push_back(&v[i]); - return (xlatitems); + return xlatitems; } void InvMenu::set_type(menu_type t) @@ -424,8 +424,8 @@ static bool _has_melded_armour() { for (int e = EQ_CLOAK; e <= EQ_BODY_ARMOUR; e++) if (you.melded[e]) - return (true); - return (false); + return true; + return false; } static bool _has_tran_unwearable_armour() @@ -437,10 +437,10 @@ static bool _has_tran_unwearable_armour() if (item.defined() && item.base_type == OBJ_ARMOUR && !you_tran_can_wear(item)) { - return (true); + return true; } } - return (false); + return false; } static std::string _no_selectables_message(int item_selector) @@ -520,14 +520,14 @@ void InvMenu::load_inv_items(int item_selector, int excluded_slot, bool InvEntry::get_tiles(std::vector<tile_def>& tileset) const { if (!Options.tile_menu_icons) - return (false); + return false; if (quantity <= 0) - return (false); + return false; tileidx_t idx = tileidx_item(get_item_info(*item)); if (!idx) - return (false); + return false; if (in_inventory(*item)) { @@ -608,7 +608,7 @@ bool InvEntry::get_tiles(std::vector<tile_def>& tileset) const tileset.push_back(tile_def(brand, TEX_DEFAULT)); } - return (true); + return true; } #endif @@ -618,14 +618,14 @@ bool InvMenu::is_selectable(int index) const { InvEntry *item = dynamic_cast<InvEntry*>(items[index]); if (item->is_item_cursed() && item->is_item_equipped()) - return (false); + return false; std::string text = item->get_text(); if (text.find("!*") != std::string::npos || text.find("!d") != std::string::npos) { - return (false); + return false; } } @@ -799,7 +799,7 @@ const menu_sort_condition *InvMenu::find_menu_sort_condition() const if (Options.sort_menus[i].matches(type)) return &Options.sort_menus[i]; - return (NULL); + return NULL; } void InvMenu::sort_menu(std::vector<InvEntry*> &invitems, @@ -909,7 +909,7 @@ std::vector<SelItem> InvMenu::get_selitems() const inv->selected_qty, inv->item)); } - return (selected_items); + return selected_items; } bool InvMenu::process_key(int key) @@ -921,7 +921,7 @@ bool InvMenu::process_key(int key) { Options.show_inventory_weights = !Options.show_inventory_weights; draw_menu(); - return (true); + return true; } if (type == MT_KNOW) @@ -948,7 +948,7 @@ bool InvMenu::process_key(int key) case CK_ENTER: CASE_ESCAPE lastch = key; - return (false); + return false; case '_': show_known_menu_help(); @@ -956,13 +956,13 @@ bool InvMenu::process_key(int key) webtiles_update_scroll_pos(); #endif draw_menu(); - return (true); + return true; case CONTROL('D'): // If we cannot select anything (e.g. on the unknown items // page), ignore Ctrl-D. if (!(flags & (MF_SINGLESELECT | MF_MULTISELECT))) - return (true); + return true; // Reset the next selection to default. if (!resetting) @@ -970,13 +970,13 @@ bool InvMenu::process_key(int key) lastch = CONTROL('D'); set_title("Select to reset item to default: "); update_title(); - return (true); + return true; } else { // Re-enter the menu. lastch = CONTROL('R'); - return (false); + return false; } } } @@ -994,7 +994,7 @@ bool InvMenu::process_key(int key) deselect_all(); sel.clear(); draw_select_count(0, true); - return (true); + return true; } const bool result = Menu::process_key(key); @@ -1007,10 +1007,10 @@ bool InvMenu::process_key(int key) if (result) lastch = CONTROL('R'); - return (false); + return false; } else - return (result); + return result; } unsigned char InvMenu::getkey() const @@ -1027,7 +1027,7 @@ unsigned char InvMenu::getkey() const { mkey = ' '; } - return (mkey); + return mkey; } ////////////////////////////////////////////////////////////////////////////// @@ -1136,7 +1136,7 @@ std::vector<SelItem> select_items(const std::vector<const item_def*> &items, menu.show(); selected = menu.get_selitems(); } - return (selected); + return selected; } static bool _item_class_selected(const item_def &i, int selector) @@ -1145,7 +1145,7 @@ static bool _item_class_selected(const item_def &i, int selector) if (selector == OSEL_ANY || selector == itype && itype != OBJ_FOOD && itype != OBJ_ARMOUR) { - return (true); + return true; } switch (selector) @@ -1168,14 +1168,14 @@ static bool _item_class_selected(const item_def &i, int selector) case OSEL_THROWABLE: { if (i.base_type != OBJ_WEAPONS && i.base_type != OBJ_MISSILES) - return (false); + return false; const launch_retval projected = is_launched(&you, you.weapon(), i); if (projected == LRET_FUMBLED) - return (false); + return false; - return (true); + return true; } case OBJ_WEAPONS: case OSEL_WIELD: @@ -1209,13 +1209,13 @@ static bool _item_class_selected(const item_def &i, int selector) case OSEL_EQUIP: { if (item_is_quivered(i)) - return (true); + return true; for (int eq = 0; eq < NUM_EQUIP; eq++) if (you.equip[eq] == i.link) - return (true); + return true; - return (false); + return false; } case OSEL_CURSED_WORN: @@ -1229,7 +1229,7 @@ static bool _item_class_selected(const item_def &i, int selector) return (!i.cursed() && item_is_equipped(i) && itype == OBJ_JEWELLERY); default: - return (false); + return false; } } @@ -1240,7 +1240,7 @@ static bool _userdef_item_selected(const item_def &i, int selector) : NULL; return (luafn && clua.callbooleanfn(false, luafn, "i", &i)); #else - return (false); + return false; #endif } @@ -1272,7 +1272,7 @@ bool any_items_to_select(int selector, bool msg, int excluded_slot) && you.inv[i].link != excluded_slot && _is_item_selected(you.inv[i], selector)) { - return (true); + return true; } } if (msg) @@ -1280,7 +1280,7 @@ bool any_items_to_select(int selector, bool msg, int excluded_slot) mprf(MSGCH_PROMPT, "%s", _no_selectables_message(selector).c_str()); } - return (false); + return false; } // Use title = NULL for stock Inventory title @@ -1377,7 +1377,7 @@ static unsigned char _get_invent_quant(unsigned char keyin, int &quant) } } - return (keyin); + return keyin; } // This function prompts the user for an item, handles the '?' and '*' @@ -1482,7 +1482,7 @@ std::vector<SelItem> prompt_invent_items( for (unsigned int i = 0; i < items.size(); ++i) items[i].slot = letter_to_index(items[i].slot); - return (items); + return items; } need_redraw = !(keyin == '?' || keyin == '*' @@ -1570,18 +1570,18 @@ static bool _has_warning_inscription(const item_def& item, if (r[i] == '!') { if (r[i+1] == iletter || r[i+1] == '*') - return (true); + return true; else if (oper == OPER_ZAP && r[i+1] == 'z') // for the 0.3.4. keys - return (true); + return true; else if (oper == OPER_EVOKE && (r[i+1] == 'V' || tolower(r[i+1]) == 'z')) { - return (true); + return true; } } } - return (false); + return false; } // Checks if current item (to be removed) has a warning inscription @@ -1594,51 +1594,51 @@ bool check_old_item_warning(const item_def& item, if (oper == OPER_WIELD) // can we safely unwield old item? { if (!you.weapon()) - return (true); + return true; old_item = *you.weapon(); if (!needs_handle_warning(old_item, OPER_WIELD)) - return (true); + return true; prompt += "Really unwield "; } else if (oper == OPER_WEAR) // can we safely take off old item? { if (item.base_type != OBJ_ARMOUR) - return (true); + return true; equipment_type eq_slot = get_armour_slot(item); if (you.equip[eq_slot] == -1) - return (true); + return true; old_item = you.inv[you.equip[eq_slot]]; if (!needs_handle_warning(old_item, OPER_TAKEOFF)) - return (true); + return true; prompt += "Really take off "; } else if (oper == OPER_PUTON) // can we safely remove old item? { if (item.base_type != OBJ_JEWELLERY) - return (true); + return true; if (jewellery_is_amulet(item)) { if (you.equip[EQ_AMULET] == -1) - return (true); + return true; old_item = you.inv[you.equip[EQ_AMULET]]; if (!needs_handle_warning(old_item, OPER_TAKEOFF)) - return (true); + return true; prompt += "Really remove "; } else // rings handled in prompt_ring_to_remove - return (true); + return true; } else // anything else doesn't have a counterpart - return (true); + return true; // now ask prompt += old_item.name(DESC_INVENTORY); @@ -1692,21 +1692,21 @@ static bool _is_wielded(const item_def &item) bool needs_handle_warning(const item_def &item, operation_types oper) { if (_has_warning_inscription(item, oper)) - return (true); + return true; if (!item_ident(item, ISFLAG_KNOW_TYPE)) - return (false); + return false; if (oper == OPER_REMOVE && item.base_type == OBJ_JEWELLERY && item.sub_type == AMU_FAITH && you.religion != GOD_NO_GOD) { - return (true); + return true; } if (_nasty_stasis(item, oper)) - return (true); + return true; if (oper == OPER_WIELD // unwielding uses OPER_WIELD too && is_weapon(item)) @@ -1714,25 +1714,25 @@ bool needs_handle_warning(const item_def &item, operation_types oper) if (get_weapon_brand(item) == SPWPN_DISTORTION && !you.duration[DUR_WEAPON_BRAND]) { - return (true); + return true; } if (get_weapon_brand(item) == SPWPN_VAMPIRICISM && !you.is_undead && !crawl_state.game_is_zotdef()) { - return (true); + return true; } if (item_known_cursed(item) && !_is_wielded(item)) - return (true); + return true; } else if (oper == OPER_PUTON || oper == OPER_WEAR) { if (item_known_cursed(item)) - return (true); + return true; } - return (false); + return false; } // Returns true if user OK'd it (or no warning), false otherwise. @@ -1746,19 +1746,19 @@ bool check_warning_inscriptions(const item_def& item, // If the player really wants to do that, they'll have // to remove the inscription. if (oper == OPER_DESTROY) - return (false); + return false; if (oper == OPER_WIELD) { // Can't use can_wield in item_use.cc because it wants // a non-const item_def. if (!you.can_wield(item)) - return (true); + return true; } else if (oper == OPER_WEAR) { if (!can_wear_armour(item, false, false)) - return (true); + return true; // Don't ask if item already worn. int equip = you.equip[get_armour_slot(item)]; @@ -1768,7 +1768,7 @@ bool check_warning_inscriptions(const item_def& item, else if (oper == OPER_PUTON) { if (item.base_type != OBJ_JEWELLERY) - return (true); + return true; // Don't ask if item already worn. int equip = -1; @@ -1791,7 +1791,7 @@ bool check_warning_inscriptions(const item_def& item, { // Don't ask if it will fail anyway. if (item.cursed()) - return (true); + return true; } std::string prompt = "Really " + _operation_verb(oper) + " "; @@ -1843,7 +1843,7 @@ int prompt_invent_item(const char *prompt, { mprf(MSGCH_PROMPT, "%s", _no_selectables_message(type_expect).c_str()); - return (PROMPT_NOTHING); + return PROMPT_NOTHING; } unsigned char keyin = 0; @@ -1990,13 +1990,13 @@ int prompt_invent_item(const char *prompt, } } - return (ret); + return ret; } bool prompt_failed(int retval, std::string msg) { if (retval != PROMPT_ABORT && retval != PROMPT_NOTHING) - return (false); + return false; if (msg.empty()) { @@ -2008,7 +2008,7 @@ bool prompt_failed(int retval, std::string msg) crawl_state.cancel_cmd_repeat(); - return (true); + return true; } // Most items are wieldable, but this function check for items that needs to be @@ -2045,12 +2045,12 @@ bool item_is_evokable(const item_def &item, bool reach, bool known, if (entry->evoke_func && item_type_known(item)) { if (item_is_equipped(item) && !item_is_melded(item) || !equip) - return (true); + return true; if (msg) mpr(error); - return (false); + return false; } // Unrandart might still be evokable (e.g., reaching) } @@ -2065,23 +2065,23 @@ bool item_is_evokable(const item_def &item, bool reach, bool known, { if (msg) mpr("You cannot grasp it well enough."); - return (false); + return false; } if (all_wands) - return (true); + return true; if (item.plus2 == ZAPCOUNT_EMPTY) { if (msg) mpr("This wand has no charges."); - return (false); + return false; } - return (true); + return true; case OBJ_WEAPONS: if ((!wielded || !reach) && !msg) - return (false); + return false; if (reach && weapon_reach(item) > 2 && item_type_known(item)) { @@ -2089,23 +2089,23 @@ bool item_is_evokable(const item_def &item, bool reach, bool known, { if (msg) mpr(error); - return (false); + return false; } - return (true); + return true; } if (msg) mpr("That item cannot be evoked!"); - return (false); + return false; case OBJ_RODS: if (!wielded) { if (msg) mpr(error); - return (false); + return false; } - return (true); + return true; case OBJ_STAVES: if (!known && !item_type_known(item) @@ -2116,13 +2116,13 @@ bool item_is_evokable(const item_def &item, bool reach, bool known, { if (msg) mpr(error); - return (false); + return false; } - return (true); + return true; } if (msg) mpr("That item cannot be evoked!"); - return (false); + return false; case OBJ_MISCELLANY: if (is_deck(item)) @@ -2131,21 +2131,21 @@ bool item_is_evokable(const item_def &item, bool reach, bool known, { if (msg) mpr(error); - return (false); + return false; } - return (true); + return true; } if (item.sub_type != MISC_LANTERN_OF_SHADOWS && item.sub_type != MISC_EMPTY_EBONY_CASKET && item.sub_type != MISC_RUNE_OF_ZOT) { - return (true); + return true; } // else fall through default: if (msg) mpr("That item cannot be evoked!"); - return (false); + return false; } } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index b0cb40bab9..f0e0160f74 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -74,19 +74,19 @@ bool can_wield(item_def *weapon, bool say_reason, if (!ignore_temporary_disability && you.berserk()) { SAY(canned_msg(MSG_TOO_BERSERK)); - return (false); + return false; } if (you.melded[EQ_WEAPON] && unwield) { SAY(mpr("Your weapon is melded into your body!")); - return (false); + return false; } if (!ignore_temporary_disability && !form_can_wield(you.form)) { SAY(mpr("You can't wield anything in your present form.")); - return (false); + return false; } if (!ignore_temporary_disability @@ -96,26 +96,26 @@ bool can_wield(item_def *weapon, bool say_reason, { SAY(mprf("You can't unwield your weapon%s!", !unwield ? " to draw a new one" : "")); - return (false); + return false; } // If we don't have an actual weapon to check, return now. if (!weapon) - return (true); + return true; for (int i = EQ_MIN_ARMOUR; i <= EQ_MAX_WORN; i++) { if (you.equip[i] != -1 && &you.inv[you.equip[i]] == weapon) { SAY(mpr("You are wearing that object!")); - return (false); + return false; } } if (you.species == SP_FELID && is_weapon(*weapon)) { SAY(mpr("You can't use weapons.")); - return (false); + return false; } // Only ogres and trolls can wield giant clubs (>= 30 aum) @@ -126,7 +126,7 @@ bool can_wield(item_def *weapon, bool say_reason, && item_mass(*weapon) >= 300)) { SAY(mpr("That's too large and heavy for you to wield.")); - return (false); + return false; } // All non-weapons only need a shield check. @@ -135,10 +135,10 @@ bool can_wield(item_def *weapon, bool say_reason, if (!ignore_temporary_disability && is_shield_incompatible(*weapon)) { SAY(mpr("You can't wield that with a shield.")); - return (false); + return false; } else - return (true); + return true; } // Small species wielding large weapons... @@ -146,7 +146,7 @@ bool can_wield(item_def *weapon, bool say_reason, && !check_weapon_wieldable_size(*weapon, you.body_size(PSIZE_BODY))) { SAY(mpr("That's too large for you to wield.")); - return (false); + return false; } if (you.undead_or_demonic() && is_holy_item(*weapon)) @@ -165,7 +165,7 @@ bool can_wield(item_def *weapon, bool say_reason, else if (is_artefact(*weapon) && !item_type_known(*weapon)) artefact_wpn_learn_prop(*weapon, ARTP_BRAND); } - return (false); + return false; } if (!ignore_temporary_disability @@ -188,17 +188,17 @@ bool can_wield(item_def *weapon, bool say_reason, else if (is_artefact(*weapon) && !item_type_known(*weapon)) artefact_wpn_learn_prop(*weapon, ARTP_BRAND); } - return (false); + return false; } if (!ignore_temporary_disability && is_shield_incompatible(*weapon)) { SAY(mpr("You can't wield that with a shield.")); - return (false); + return false; } // We can wield this weapon. Phew! - return (true); + return true; #undef SAY } @@ -212,7 +212,7 @@ static bool _valid_weapon_swap(const item_def &item) if (is_deck(item) || item.base_type == OBJ_MISCELLANY && item.sub_type == MISC_LANTERN_OF_SHADOWS) { - return (true); + return true; } if (item.base_type == OBJ_MISSILES @@ -223,11 +223,11 @@ static bool _valid_weapon_swap(const item_def &item) // Snakable missiles; weapons were already handled above. if (item_is_snakable(item) && you.has_spell(SPELL_STICKS_TO_SNAKES)) - return (true); + return true; // Sublimation of Blood. if (!you.has_spell(SPELL_SUBLIMATION_OF_BLOOD)) - return (false); + return false; if (item.base_type == OBJ_FOOD) return (item.sub_type == FOOD_CHUNK); @@ -238,7 +238,7 @@ static bool _valid_weapon_swap(const item_def &item) || item.sub_type == POT_BLOOD_COAGULATED); } - return (false); + return false; } /** @@ -253,13 +253,13 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, if (inv_count() < 1) { canned_msg(MSG_NOTHING_CARRIED); - return (false); + return false; } // Look for conditions like berserking that could prevent wielding // weapons. if (!can_wield(NULL, true, false, slot == SLOT_BARE_HANDS)) - return (false); + return false; int item_slot = 0; // default is 'a' @@ -298,11 +298,11 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, } if (prompt_failed(item_slot)) - return (false); + return false; else if (item_slot == you.equip[EQ_WEAPON]) { mpr("You are already wielding that!"); - return (true); + return true; } // Now we really change weapons! (Most likely, at least...) @@ -324,11 +324,11 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, const std::string prompt = "Really unwield " + wpn->name(DESC_INVENTORY) + "?"; if (!yesno(prompt.c_str(), false, 'n')) - return (false); + return false; } if (!unwield_item(show_weff_messages)) - return (false); + return false; if (show_unwield_msg) canned_msg(MSG_EMPTY_HANDED_NOW); @@ -341,7 +341,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, else canned_msg(MSG_EMPTY_HANDED_ALREADY); - return (true); + return true; } item_def& new_wpn(you.inv[item_slot]); @@ -350,7 +350,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, if (auto_wield && !force && !check_warning_inscriptions(new_wpn, OPER_WIELD)) { - return (false); + return false; } // Unwield any old weapon. @@ -360,7 +360,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, // Enable skills so they can be re-disabled later update_can_train(); else - return (false); + return false; } // Ensure wieldable, stat loss non-fatal @@ -377,7 +377,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, you.time_taken /= 10; } - return (false); + return false; } const unsigned int old_talents = your_talents(false).size(); @@ -397,7 +397,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, you.m_quiver->on_weapon_changed(); you.turn_is_over = true; - return (true); + return true; } static const char *shield_base_name(const item_def *shield) @@ -476,9 +476,9 @@ bool item_is_worn(int inv_slot) { for (int i = EQ_MIN_ARMOUR; i <= EQ_MAX_WORN; ++i) if (inv_slot == you.equip[i]) - return (true); + return true; - return (false); + return false; } //--------------------------------------------------------------- @@ -519,12 +519,12 @@ bool armour_prompt(const std::string & mesg, int *index, operation_types oper) static bool cloak_is_being_removed(void) { if (current_delay_action() != DELAY_ARMOUR_OFF) - return (false); + return false; if (you.delay_queue.front().parm1 != you.equip[ EQ_CLOAK ]) - return (false); + return false; - return (true); + return true; } //--------------------------------------------------------------- @@ -567,7 +567,7 @@ static int armour_equip_delay(const item_def &item) if (delay < 1) delay = 1; - return (delay); + return delay; } bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) @@ -578,7 +578,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) if (verbose) mpr("You can't wear that."); - return (false); + return false; } const int sub_type = item.sub_type; @@ -588,7 +588,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) { if (verbose) mpr("You can't wear that!"); - return (false); + return false; } if (player_genus(GENPC_DRACONIAN) && slot == EQ_BODY_ARMOUR) @@ -596,7 +596,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) if (verbose) mprf("Your wings%s won't fit in that.", you.mutation[MUT_BIG_WINGS] ? "" : ", even vestigial as they are,"); - return (false); + return false; } if (sub_type == ARM_NAGA_BARDING || sub_type == ARM_CENTAUR_BARDING) @@ -605,13 +605,13 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) || you.species == SP_CENTAUR && sub_type == ARM_CENTAUR_BARDING) { if (ignore_temporary || !player_is_shapechanged()) - return (true); + return true; else if (verbose) mpr("You can wear that only in your normal form."); } else if (verbose) mpr("You can't wear that!"); - return (false); + return false; } size_type player_size = you.body_size(PSIZE_TORSO, ignore_temporary); @@ -623,7 +623,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) mprf("This armour is too %s for you!", (bad_size > 0) ? "big" : "small"); - return (false); + return false; } if (you.form == TRAN_APPENDAGE @@ -642,7 +642,7 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) { if (verbose) mpr("You can't wear gloves with your huge claws!"); - return (false); + return false; } } @@ -652,28 +652,28 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) { if (verbose) mpr("You can't wear boots with hooves!"); - return (false); + return false; } if (you.has_talons(false) == 3) { if (verbose) mpr("Boots don't fit your talons!"); - return (false); + return false; } if (you.species == SP_NAGA) { if (verbose) mpr("You can't wear that!"); - return (false); + return false; } if (!ignore_temporary && you.fishtail) { if (verbose) mpr("You don't currently have feet!"); - return (false); + return false; } } @@ -684,14 +684,14 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) { if (verbose) mpr("You can't wear any headgear with your large horns!"); - return (false); + return false; } if (player_mutation_level(MUT_ANTENNAE) == 3) { if (verbose) mpr("You can't wear any headgear with your large antennae!"); - return (false); + return false; } // Soft helmets (caps and wizard hats) always fit, otherwise. @@ -701,35 +701,35 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) { if (verbose) mpr("You can't wear that with your horns!"); - return (false); + return false; } if (player_mutation_level(MUT_BEAK)) { if (verbose) mpr("You can't wear that with your beak!"); - return (false); + return false; } if (player_mutation_level(MUT_ANTENNAE)) { if (verbose) mpr("You can't wear that with your antennae!"); - return (false); + return false; } if (player_genus(GENPC_DRACONIAN)) { if (verbose) mpr("You can't wear that with your reptilian head."); - return (false); + return false; } if (you.species == SP_OCTOPODE) { if (verbose) mpr("You can't wear that!"); - return (false); + return false; } } } @@ -738,10 +738,10 @@ bool can_wear_armour(const item_def &item, bool verbose, bool ignore_temporary) { if (verbose) mpr("You can't wear that in your present form."); - return (false); + return false; } - return (true); + return true; } bool do_wear_armour(int item, bool quiet) @@ -751,11 +751,11 @@ bool do_wear_armour(int item, bool quiet) { if (!quiet) mpr("You don't have any such object."); - return (false); + return false; } if (!can_wear_armour(invitem, !quiet, false)) - return (false); + return false; const equipment_type slot = get_armour_slot(invitem); @@ -763,7 +763,7 @@ bool do_wear_armour(int item, bool quiet) { if (!quiet) mpr("You are wielding that object!"); - return (false); + return false; } if (item_is_worn(item)) @@ -773,7 +773,7 @@ bool do_wear_armour(int item, bool quiet) else { mpr("You're already wearing that object!"); - return (false); + return false; } } @@ -790,7 +790,7 @@ bool do_wear_armour(int item, bool quiet) else mprf("You'd need three %s to do that!", you.hand_name(true).c_str()); } - return (false); + return false; } bool removed_cloak = false; @@ -809,13 +809,13 @@ bool do_wear_armour(int item, bool quiet) you.inv[you.equip[EQ_BODY_ARMOUR]].name(DESC_YOUR) .c_str()); } - return (false); + return false; } if (!you.inv[you.equip[EQ_CLOAK]].cursed()) { cloak = you.equip[EQ_CLOAK]; if (!takeoff_armour(you.equip[EQ_CLOAK])) - return (false); + return false; removed_cloak = true; } @@ -823,7 +823,7 @@ bool do_wear_armour(int item, bool quiet) { if (!quiet) mpr("Your cloak prevents you from wearing the armour."); - return (false); + return false; } } @@ -836,13 +836,13 @@ bool do_wear_armour(int item, bool quiet) && you.equip[slot] != -1) { if (!takeoff_armour(you.equip[slot])) - return (false); + return false; } you.turn_is_over = true; if (!_safe_to_remove_or_wear(invitem, false)) - return (false); + return false; const int delay = armour_equip_delay(invitem); if (delay) @@ -851,7 +851,7 @@ bool do_wear_armour(int item, bool quiet) if (removed_cloak) start_delay(DELAY_ARMOUR_ON, 1, cloak); - return (true); + return true; } bool takeoff_armour(int item) @@ -861,13 +861,13 @@ bool takeoff_armour(int item) if (invitem.base_type != OBJ_ARMOUR) { mpr("You aren't wearing that!"); - return (false); + return false; } if (you.berserk()) { canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } const equipment_type slot = get_armour_slot(invitem); @@ -875,7 +875,7 @@ bool takeoff_armour(int item) { mprf("%s is melded into your body!", invitem.name(DESC_YOUR).c_str()); - return (false); + return false; } if (!item_is_worn(item)) @@ -885,7 +885,7 @@ bool takeoff_armour(int item) else { mpr("You aren't wearing that object!"); - return (false); + return false; } } @@ -893,11 +893,11 @@ bool takeoff_armour(int item) if (invitem.cursed()) { mprf("%s is stuck to your body!", invitem.name(DESC_YOUR).c_str()); - return (false); + return false; } if (!_safe_to_remove_or_wear(invitem, true)) - return (false); + return false; bool removed_cloak = false; int cloak = -1; @@ -910,14 +910,14 @@ bool takeoff_armour(int item) { cloak = you.equip[ EQ_CLOAK ]; if (!takeoff_armour(you.equip[EQ_CLOAK])) - return (false); + return false; removed_cloak = true; } else { mpr("Your cloak prevents you from removing the armour."); - return (false); + return false; } } } @@ -933,7 +933,7 @@ bool takeoff_armour(int item) if (item != you.equip[slot]) { mpr("You aren't wearing that!"); - return (false); + return false; } break; @@ -950,7 +950,7 @@ bool takeoff_armour(int item) if (removed_cloak) start_delay(DELAY_ARMOUR_ON, 1, cloak); - return (true); + return true; } static int _prompt_ring_to_remove(int new_ring) @@ -1043,7 +1043,7 @@ static int _prompt_ring_to_remove_octopode(int new_ring) mesclr(); if (c == '?') - return (EQ_NONE); + return EQ_NONE; else if (key_is_escape(c) || eqslot == EQ_NONE) return (-2); @@ -1056,7 +1056,7 @@ static int _prompt_ring_to_remove_octopode(int new_ring) static bool _safe_to_remove_or_wear(const item_def &item, bool remove, bool quiet) { if (remove && !safe_to_remove(item, quiet)) - return (false); + return false; int prop_str = 0; int prop_dex = 0; @@ -1122,10 +1122,10 @@ static bool _safe_to_remove_or_wear(const item_def &item, bool remove, bool quie red_stat = STAT_DEX; if (red_stat == NUM_STATS) - return (true); + return true; if (quiet) - return (false); + return false; std::string verb = ""; if (remove) @@ -1148,9 +1148,9 @@ static bool _safe_to_remove_or_wear(const item_def &item, bool remove, bool quie if (!yesno(prompt.c_str(), true, 'n', true, false)) { canned_msg(MSG_OK); - return (false); + return false; } - return (true); + return true; } // Checks whether removing an item would cause levitation to end and the @@ -1178,7 +1178,7 @@ bool safe_to_remove(const item_def &item, bool quiet) || feat == DNGN_DEEP_WATER && !player_likes_water())) { if (quiet) - return (false); + return false; else { std::string fname = (feat == DNGN_LAVA ? "lava" : "deep water"); @@ -1187,7 +1187,7 @@ bool safe_to_remove(const item_def &item, bool quiet) } } - return (true); + return true; } // Assumptions: @@ -1210,7 +1210,7 @@ static bool _swap_rings(int ring_slot) if (lring->cursed() && rring->cursed()) { mprf("You're already wearing two cursed rings!"); - return (false); + return false; } int unwanted; @@ -1236,20 +1236,20 @@ static bool _swap_rings(int ring_slot) if (unwanted == -1) { canned_msg(MSG_OK); - return (false); + return false; } if (!remove_ring(unwanted, false)) - return (false); + return false; // Check for stat loss. if (!_safe_to_remove_or_wear(you.inv[ring_slot], false)) - return (false); + return false; // Put on the new ring. start_delay(DELAY_JEWELLERY_ON, 1, ring_slot); - return (true); + return true; } static bool _swap_rings_octopode(int ring_slot) @@ -1287,20 +1287,20 @@ static bool _swap_rings_octopode(int ring_slot) // Shouldn't happen, because hogs and bats can't put on jewellery at // all and thus won't get this far. mpr("You can't wear that in your present form."); - return (false); + return false; } else if (available == 0) { mprf("You're already wearing %s cursed rings!%s", number_in_words(cursed).c_str(), (cursed == 8 ? " Isn't that enough for you?" : "")); - return (false); + return false; } // The simple case - only one available ring. else if (available == 1) { if (!remove_ring(unwanted, false)) - return (false); + return false; } // We can't put a ring on without swapping - because we found // multiple available rings. @@ -1312,11 +1312,11 @@ static bool _swap_rings_octopode(int ring_slot) if (unwanted < -1) { canned_msg(MSG_OK); - return (false); + return false; } if (!remove_ring(unwanted, false)) - return (false); + return false; } #if 0 @@ -1324,14 +1324,14 @@ static bool _swap_rings_octopode(int ring_slot) if (unwanted == -1) { canned_msg(MSG_OK); - return (false); + return false; } #endif // Put on the new ring. start_delay(DELAY_JEWELLERY_ON, 1, ring_slot); - return (true); + return true; } static bool _puton_item(int item_slot) @@ -1347,20 +1347,20 @@ static bool _puton_item(int item_slot) else { mpr("You're already wearing that object!"); - return (false); + return false; } } if (item_slot == you.equip[EQ_WEAPON]) { mpr("You are wielding that object."); - return (false); + return false; } if (item.base_type != OBJ_JEWELLERY) { mpr("You can only put on jewellery."); - return (false); + return false; } const bool lring = you.slot_item(EQ_LEFT_RING, true); @@ -1389,7 +1389,7 @@ static bool _puton_item(int item_slot) if (!you_tran_can_wear(item)) { mpr("You can't wear that in your present form."); - return (false); + return false; } const item_def* gloves = you.slot_item(EQ_GLOVES, false); @@ -1397,7 +1397,7 @@ static bool _puton_item(int item_slot) if (gloves && gloves->cursed()) { mpr("You can't take your gloves off to put on a ring!"); - return (false); + return false; } if (blinged_octopode) @@ -1412,23 +1412,23 @@ static bool _puton_item(int item_slot) if (!check_warning_inscriptions(*amulet, OPER_REMOVE) || !remove_ring(you.equip[EQ_AMULET], true)) { - return (false); + return false; } // Check for stat loss. if (!_safe_to_remove_or_wear(item, false)) - return (false); + return false; // Put on the new amulet. start_delay(DELAY_JEWELLERY_ON, 1, item_slot); // Assume it's going to succeed. - return (true); + return true; } // Check for stat loss. if (!_safe_to_remove_or_wear(item, false)) - return (false); + return false; equipment_type hand_used; @@ -1469,7 +1469,7 @@ static bool _puton_item(int item_slot) you.time_taken /= 2; you.turn_is_over = true; - return (true); + return true; } bool puton_ring(int slot) @@ -1479,13 +1479,13 @@ bool puton_ring(int slot) if (inv_count() < 1) { canned_msg(MSG_NOTHING_CARRIED); - return (false); + return false; } if (you.berserk()) { canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } if (slot != -1) @@ -1498,7 +1498,7 @@ bool puton_ring(int slot) } if (prompt_failed(item_slot)) - return (false); + return false; return _puton_item(item_slot); } @@ -1539,13 +1539,13 @@ bool remove_ring(int slot, bool announce) else mpr("You aren't wearing any rings or amulets."); - return (false); + return false; } if (you.berserk()) { canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } const item_def* gloves = you.slot_item(EQ_GLOVES); @@ -1553,7 +1553,7 @@ bool remove_ring(int slot, bool announce) if (gloves_cursed && !player_wearing_slot(EQ_AMULET)) { mpr("You can't take your gloves off to remove any rings!"); - return (false); + return false; } if (hand_used == EQ_NONE) @@ -1566,43 +1566,43 @@ bool remove_ring(int slot, bool announce) : slot; if (prompt_failed(equipn)) - return (false); + return false; hand_used = item_equip_slot(you.inv[equipn]); if (hand_used == EQ_NONE) { mpr("You aren't wearing that."); - return (false); + return false; } else if (you.inv[equipn].base_type != OBJ_JEWELLERY) { mpr("That isn't a piece of jewellery."); - return (false); + return false; } } if (you.equip[hand_used] == -1) { mpr("I don't think you really meant that."); - return (false); + return false; } else if (you.melded[hand_used]) { mpr("You can't take that off while it's melded."); - return (false); + return false; } else if (gloves_cursed && (hand_used == EQ_LEFT_RING || hand_used == EQ_RIGHT_RING)) { mpr("You can't take your gloves off to remove any rings!"); - return (false); + return false; } if (!check_warning_inscriptions(you.inv[you.equip[hand_used]], OPER_REMOVE)) { canned_msg(MSG_OK); - return (false); + return false; } if (you.inv[you.equip[hand_used]].cursed()) @@ -1616,14 +1616,14 @@ bool remove_ring(int slot, bool announce) mpr("It's stuck to you!"); set_ident_flags(you.inv[you.equip[hand_used]], ISFLAG_KNOW_CURSE); - return (false); + return false; } ring_wear_2 = you.equip[hand_used]; // Remove the ring. if (!_safe_to_remove_or_wear(you.inv[ring_wear_2], true)) - return (false); + return false; mprf("You remove %s.", you.inv[ring_wear_2].name(DESC_YOUR).c_str()); unequip_item(hand_used); @@ -1631,38 +1631,38 @@ bool remove_ring(int slot, bool announce) you.time_taken /= 2; you.turn_is_over = true; - return (true); + return true; } static int _wand_range(zap_type ztype) { // FIXME: Eventually we should have sensible values here. - return (LOS_RADIUS); + return LOS_RADIUS; } static int _max_wand_range() { - return (LOS_RADIUS); + return LOS_RADIUS; } static bool _dont_use_invis() { if (!you.backlit()) - return (false); + return false; if (you.haloed() || you.glows_naturally()) { mpr("You can't turn invisible."); - return (true); + return true; } else if (get_contamination_level() > 1 && !yesno("Invisibility will do you no good right now; " "use anyway?", false, 'n')) { - return (true); + return true; } - return (false); + return false; } void zap_wand(int slot) @@ -2081,29 +2081,29 @@ static bool _drink_fountain() const dungeon_feature_type feat = grd(you.pos()); if (feat < DNGN_FOUNTAIN_BLUE || feat > DNGN_FOUNTAIN_BLOOD) - return (false); + return false; if (!player_can_reach_floor("fountain")) - return (false); + return false; if (you.berserk()) { canned_msg(MSG_TOO_BERSERK); - return (true); + return true; } potion_type fountain_effect = POT_WATER; if (feat == DNGN_FOUNTAIN_BLUE) { if (!yesno("Drink from the fountain?", true, 'n')) - return (false); + return false; mpr("You drink the pure, clear water."); } else if (feat == DNGN_FOUNTAIN_BLOOD) { if (!yesno("Drink from the fountain of blood?", true, 'n')) - return (false); + return false; mpr("You drink the blood."); fountain_effect = POT_BLOOD; @@ -2111,7 +2111,7 @@ static bool _drink_fountain() else { if (!yesno("Drink from the sparkling fountain?", true, 'n')) - return (false); + return false; mpr("You drink the sparkling water."); @@ -2188,7 +2188,7 @@ static bool _drink_fountain() } you.turn_is_over = true; - return (true); + return true; } static void _explosion(coord_def where, actor *agent, beam_type flavour, @@ -2215,14 +2215,14 @@ static void _explosion(coord_def where, actor *agent, beam_type flavour, static bool _vorpalise_weapon(bool already_known) { if (!you.weapon()) - return (false); + return false; // Check if you're wielding a brandable weapon. item_def& wpn = *you.weapon(); if (wpn.base_type != OBJ_WEAPONS || wpn.sub_type == WPN_BLOWGUN || is_artefact(wpn)) { - return (false); + return false; } you.wield_change = true; @@ -2234,12 +2234,12 @@ static bool _vorpalise_weapon(bool already_known) mprf("%s emits a brilliant flash of light!", wpn.name(DESC_YOUR).c_str()); set_item_ego_type(wpn, OBJ_WEAPONS, SPWPN_VORPAL); - return (true); + return true; } // If there's a permanent brand, fail. if (you.duration[DUR_WEAPON_BRAND] == 0) - return (false); + return false; // There's a temporary brand, attempt to make it permanent. const std::string itname = wpn.name(DESC_YOUR); @@ -2375,7 +2375,7 @@ static bool _vorpalise_weapon(bool already_known) you.duration[DUR_WEAPON_BRAND] = 0; item_set_appearance(wpn); } - return (msg); + return msg; } bool enchant_weapon(item_def &wpn, int acc, int dam, const char *colour) @@ -2456,7 +2456,7 @@ bool enchant_armour(int &ac_change, bool quiet, item_def &arm) if (!quiet) canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } const bool is_cursed = arm.cursed(); @@ -2479,7 +2479,7 @@ bool enchant_armour(int &ac_change, bool quiet, item_def &arm) do_uncurse_item(arm, true, true); // No additional enchantment. - return (true); + return true; } // Even if not affected, it may be uncursed. @@ -2494,14 +2494,14 @@ bool enchant_armour(int &ac_change, bool quiet, item_def &arm) } do_uncurse_item(arm, true, true); - return (true); + return true; } else { if (!quiet) canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } } @@ -2516,7 +2516,7 @@ bool enchant_armour(int &ac_change, bool quiet, item_def &arm) ac_change++; do_uncurse_item(arm, true, true); - return (true); + return true; } static int _handle_enchant_armour(int item_slot, std::string *pre_msg) @@ -2557,7 +2557,7 @@ static int _handle_enchant_armour(int item_slot, std::string *pre_msg) } while (true); - return (0); + return 0; } static void _handle_read_book(int item_slot) @@ -2639,13 +2639,13 @@ static bool _scroll_modify_item(item_def scroll) scroll.link, NULL, OPER_ANY, true); if (item_slot == PROMPT_NOTHING) - return (false); + return false; if (item_slot == PROMPT_ABORT && yesno("Really abort (and waste the scroll)?")) { canned_msg(MSG_OK); - return (false); + return false; } } while (item_slot < 0); @@ -2658,7 +2658,7 @@ static bool _scroll_modify_item(item_def scroll) if (!fully_identified(item)) { identify(-1, item_slot); - return (true); + return true; } else { @@ -2670,10 +2670,10 @@ static bool _scroll_modify_item(item_def scroll) if (item_is_rechargeable(item, false, true)) { if (recharge_wand(item_slot, false)) - return (true); + return true; you.type_id_props["SCR_RC"] = item.name(DESC_PLAIN, false, false, false); - return (false); + return false; } else { @@ -2687,10 +2687,10 @@ static bool _scroll_modify_item(item_def scroll) // Might still fail because of already high enchantment. // (If so, already prints the "Nothing happens" message.) if (_handle_enchant_armour(item_slot) > 0) - return (true); + return true; you.type_id_props["SCR_EA"] = item.name(DESC_PLAIN, false, false, false); - return (false); + return false; } else { @@ -2705,7 +2705,7 @@ static bool _scroll_modify_item(item_def scroll) // Oops, wrong item... canned_msg(MSG_NOTHING_HAPPENS); - return (false); + return false; } static void _vulnerability_scroll() @@ -3262,9 +3262,9 @@ bool stasis_blocks_effect(bool calc_unid, // In all cases, the amulet auto-ids if requested. if (amulet && identify && !item_type_known(*amulet)) wear_id_type(*amulet); - return (true); + return true; } - return (false); + return false; } item_def* get_only_unided_ring() @@ -3338,11 +3338,11 @@ static bool _prompt_eat_bad_food(const item_def food) if (food.base_type != OBJ_CORPSES && (food.base_type != OBJ_FOOD || food.sub_type != FOOD_CHUNK)) { - return (true); + return true; } if (!is_bad_food(food)) - return (true); + return true; const std::string food_colour = menu_colour_item_prefix(food); std::string colour = ""; @@ -3376,9 +3376,9 @@ static bool _prompt_eat_bad_food(const item_def food) if (!yesno(prompt.c_str(), false, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } - return (true); + return true; } void tile_item_eat_floor(int idx) diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index 1cc2bd459f..62e8617089 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -324,9 +324,9 @@ static bool _missile_brand_is_prefix(special_missile_type brand) case SPMSL_EXPLODING: case SPMSL_STEEL: case SPMSL_SILVER: - return (true); + return true; default: - return (false); + return false; } } @@ -1892,24 +1892,24 @@ bool item_type_has_ids(object_class_type base_type) bool item_type_known(const item_def& item) { if (item_ident(item, ISFLAG_KNOW_TYPE)) - return (true); + return true; // Artefacts have different descriptions from other items, // so we can't use general item knowledge for them. if (is_artefact(item)) - return (false); + return false; if (item.base_type == OBJ_MISSILES) - return (true); + return true; if (item.base_type == OBJ_MISCELLANY && (item.sub_type < MISC_FIRST_DECK || item.sub_type > MISC_LAST_DECK)) { - return (true); + return true; } if (item.base_type == OBJ_BOOKS && item.sub_type == BOOK_DESTRUCTION) - return (true); + return true; if (!item_type_has_ids(item.base_type)) return false; @@ -1919,10 +1919,10 @@ bool item_type_known(const item_def& item) bool item_type_unknown(const item_def& item) { if (item_type_known(item)) - return (false); + return false; if (is_artefact(item)) - return (true); + return true; return item_type_has_ids(item.base_type); } @@ -1937,7 +1937,7 @@ bool item_type_known(const object_class_type base_type, const int sub_type) bool item_type_tried(const item_def& item) { if (item_type_known(item)) - return (false); + return false; if (item.flags & ISFLAG_TRIED) return true; @@ -2111,7 +2111,7 @@ static MenuEntry *known_item_mangle(MenuEntry *me) KnownEntry *newme = new KnownEntry(ie); delete me; - return (newme); + return newme; } static MenuEntry *unknown_item_mangle(MenuEntry *me) @@ -2120,7 +2120,7 @@ static MenuEntry *unknown_item_mangle(MenuEntry *me) UnknownEntry *newme = new UnknownEntry(ie); delete me; - return (newme); + return newme; } static bool _identified_item_names(const item_def *it1, @@ -2695,15 +2695,15 @@ static char _random_cons(int seed) bool is_interesting_item(const item_def& item) { if (fully_identified(item) && is_artefact(item)) - return (true); + return true; const std::string iname = menu_colour_item_prefix(item, false) + " " + item.name(DESC_PLAIN); for (unsigned i = 0; i < Options.note_items.size(); ++i) if (Options.note_items[i].matches(iname)) - return (true); + return true; - return (false); + return false; } // Returns true if an item is a potential life saver in an emergency @@ -2711,7 +2711,7 @@ bool is_interesting_item(const item_def& item) bool is_emergency_item(const item_def &item) { if (!item_type_known(item)) - return (false); + return false; switch (item.base_type) { @@ -2720,12 +2720,12 @@ bool is_emergency_item(const item_def &item) { case WAND_HASTING: if (you.religion == GOD_CHEIBRIADOS) - return (false); + return false; case WAND_HEAL_WOUNDS: case WAND_TELEPORTATION: - return (true); + return true; default: - return (false); + return false; } case OBJ_SCROLLS: switch (item.sub_type) @@ -2734,29 +2734,29 @@ bool is_emergency_item(const item_def &item) case SCR_BLINKING: case SCR_FEAR: case SCR_FOG: - return (true); + return true; default: - return (false); + return false; } case OBJ_POTIONS: if (you.species == SP_MUMMY) - return (false); + return false; switch (item.sub_type) { case POT_SPEED: if (you.religion == GOD_CHEIBRIADOS) - return (false); + return false; case POT_CURING: case POT_HEAL_WOUNDS: case POT_RESISTANCE: case POT_MAGIC: - return (true); + return true; default: - return (false); + return false; } default: - return (false); + return false; } } @@ -2764,10 +2764,10 @@ bool is_emergency_item(const item_def &item) bool is_good_item(const item_def &item) { if (!item_type_known(item)) - return (false); + return false; if (is_emergency_item(item)) - return (true); + return true; switch (item.base_type) { @@ -2781,12 +2781,12 @@ bool is_good_item(const item_def &item) case POT_GAIN_INTELLIGENCE: case POT_GAIN_DEXTERITY: case POT_EXPERIENCE: - return (true); + return true; default: - return (false); + return false; } default: - return (false); + return false; } } @@ -2794,7 +2794,7 @@ bool is_good_item(const item_def &item) bool is_bad_item(const item_def &item, bool temp) { if (!item_type_known(item)) - return (false); + return false; switch (item.base_type) { @@ -2813,12 +2813,12 @@ bool is_bad_item(const item_def &item, bool temp) // prevent monsters from reading it.) return (temp && is_good_god(you.religion)); default: - return (false); + return false; } case OBJ_POTIONS: // Can't be bad if you can't use them. if (you.species == SP_MUMMY) - return (false); + return false; switch (item.sub_type) { @@ -2827,7 +2827,7 @@ bool is_bad_item(const item_def &item, bool temp) case POT_DEGENERATION: case POT_DECAY: case POT_PARALYSIS: - return (true); + return true; case POT_POISON: case POT_STRONG_POISON: // Poison is not that bad if you're poison resistant. @@ -2838,17 +2838,17 @@ bool is_bad_item(const item_def &item, bool temp) && (temp || you.species != SP_VAMPIRE || you.hunger_state < HS_SATIATED)); default: - return (false); + return false; } case OBJ_JEWELLERY: // Potentially useful. TODO: check the properties. if (is_artefact(item)) - return (false); + return false; switch (item.sub_type) { case AMU_INACCURACY: - return (true); + return true; case RING_HUNGER: // Even Vampires can use this ring. return (!you.is_undead || you.is_undead == US_HUNGRY_DEAD); @@ -2862,11 +2862,11 @@ bool is_bad_item(const item_def &item, bool temp) return (item_ident(item, ISFLAG_KNOW_PLUSES) && item.plus <= 0 && item.plus2 <= 0); default: - return (false); + return false; } default: - return (false); + return false; } } @@ -2875,7 +2875,7 @@ bool is_bad_item(const item_def &item, bool temp) bool is_dangerous_item(const item_def &item, bool temp) { if (!item_type_known(item)) - return (false); + return false; switch (item.base_type) { @@ -2884,14 +2884,14 @@ bool is_dangerous_item(const item_def &item, bool temp) { case SCR_IMMOLATION: case SCR_NOISE: - return (true); + return true; case SCR_TORMENT: return (!player_mutation_level(MUT_TORMENT_RESISTANCE) || !temp && you.species == SP_VAMPIRE); case SCR_HOLY_WORD: return (you.undead_or_demonic()); default: - return (false); + return false; } case OBJ_POTIONS: @@ -2903,7 +2903,7 @@ bool is_dangerous_item(const item_def &item, bool temp) || temp && you.species == SP_VAMPIRE && you.hunger_state >= HS_SATIATED); default: - return (false); + return false; } case OBJ_BOOKS: @@ -2912,7 +2912,7 @@ bool is_dangerous_item(const item_def &item, bool temp) || is_dangerous_spellbook(item)); default: - return (false); + return false; } } @@ -2922,30 +2922,30 @@ bool is_useless_item(const item_def &item, bool temp) { case OBJ_WEAPONS: if (you.species == SP_FELID) - return (true); + return true; if (!you.could_wield(item, true, !temp) && !is_throwable(&you, item)) { // Weapon is too large (or small) to be wielded and cannot // be thrown either. - return (true); + return true; } if (!item_type_known(item)) - return (false); + return false; if (you.undead_or_demonic() && is_holy_item(item)) { if (!temp && you.form == TRAN_LICH && you.species != SP_DEMONSPAWN) { - return (false); + return false; } - return (true); + return true; } - return (false); + return false; case OBJ_MISSILES: if ((you.has_spell(SPELL_STICKS_TO_SNAKES) @@ -2975,23 +2975,23 @@ bool is_useless_item(const item_def &item, bool temp) return (you.body_size(PSIZE_BODY, !temp) < SIZE_MEDIUM); } - return (false); + return false; case OBJ_ARMOUR: return (!can_wear_armour(item, false, true)); case OBJ_SCROLLS: if (!item_type_known(item)) - return (false); + return false; // A bad item is always useless. if (is_bad_item(item, temp)) - return (true); + return true; switch (item.sub_type) { case SCR_RANDOM_USELESSNESS: - return (true); + return true; case SCR_TELEPORTATION: return (crawl_state.game_is_sprint()); case SCR_AMNESIA: @@ -3006,11 +3006,11 @@ bool is_useless_item(const item_def &item, bool temp) case SCR_VORPALISE_WEAPON: return (you.species == SP_FELID); default: - return (false); + return false; } case OBJ_WANDS: if (you.species == SP_FELID) - return (true); + return true; return (item.plus2 == ZAPCOUNT_EMPTY) || item_ident(item, ISFLAG_KNOW_PLUSES) && !item.plus; @@ -3021,19 +3021,19 @@ bool is_useless_item(const item_def &item, bool temp) if (you.char_class == JOB_STALKER && !you.num_turns || you.has_spell(SPELL_EVAPORATE)) { - return (false); + return false; } // Apart from Evaporate, mummies can't use potions. if (you.species == SP_MUMMY) - return (true); + return true; if (!item_type_known(item)) - return (false); + return false; // A bad item is always useless. if (is_bad_item(item, temp)) - return (true); + return true; switch (item.sub_type) { @@ -3072,18 +3072,18 @@ bool is_useless_item(const item_def &item, bool temp) } - return (false); + return false; } case OBJ_JEWELLERY: if (!item_type_known(item)) - return (false); + return false; // Potentially useful. TODO: check the properties. if (is_artefact(item)) - return (false); + return false; if (is_bad_item(item, temp)) - return (true); + return true; switch (item.sub_type) { @@ -3146,60 +3146,60 @@ bool is_useless_item(const item_def &item, bool temp) return (you.permanent_levitation() || you.permanent_flight()); default: - return (false); + return false; } case OBJ_RODS: if (you.species == SP_FELID) - return (true); + return true; break; case OBJ_STAVES: if (you.species == SP_FELID) - return (true); + return true; if (you.religion == GOD_TROG) - return (true); + return true; if (!item_type_known(item)) - return (false); + return false; if (item.sub_type == STAFF_ENERGY && you.species == SP_MUMMY) - return (true); + return true; if (item.sub_type == STAFF_ENERGY && temp && (you.form == TRAN_LICH || you.species == SP_VAMPIRE && you.hunger_state == HS_STARVING)) { - return (true); + return true; } break; case OBJ_FOOD: if (!is_inedible(item)) - return (false); + return false; if (item.sub_type == FOOD_CHUNK && (you.has_spell(SPELL_SUBLIMATION_OF_BLOOD) || you.has_spell(SPELL_SIMULACRUM) || !temp && you.form == TRAN_LICH)) { - return (false); + return false; } if (is_fruit(item) && you.religion == GOD_FEDHAS) - return (false); + return false; - return (true); + return true; case OBJ_CORPSES: if (item.sub_type != CORPSE_SKELETON) - return (false); + return false; if (you.has_spell(SPELL_ANIMATE_DEAD) || you.has_spell(SPELL_ANIMATE_SKELETON) || you.religion == GOD_YREDELEMNUL && !you.penance[GOD_YREDELEMNUL] && you.piety >= piety_breakpoint(0)) { - return (false); + return false; } - return (true); + return true; case OBJ_MISCELLANY: switch (item.sub_type) @@ -3215,22 +3215,22 @@ bool is_useless_item(const item_def &item, bool temp) case MISC_HORN_OF_GERYON: return item.plus2; default: - return (false); + return false; } case OBJ_BOOKS: if (item.sub_type != BOOK_MANUAL || !item_type_known(item)) - return (false); + return false; if (you.skills[item.plus] >= 27) - return (true); + return true; if (is_useless_skill((skill_type)item.plus)) - return (true); - return (false); + return true; + return false; default: - return (false); + return false; } - return (false); + return false; } static const std::string _item_prefix(const item_def &item, bool temp, @@ -3392,7 +3392,7 @@ std::string get_menu_colour_prefix_tags(const item_def &item, item_name = colour + item_name + colour_off; } - return (item_name); + return item_name; } typedef std::map<std::string, item_kind> item_names_map; @@ -3485,7 +3485,7 @@ item_kind item_kind_by_name(std::string name) item_kind err = {OBJ_UNASSIGNED, 0, 0, 0}; - return (err); + return err; } std::vector<std::string> item_name_list_for_glyph(unsigned glyph) diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index d2357fd801..6731779b31 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -986,10 +986,10 @@ bool set_item_ego_type(item_def &item, int item_type, int ego_type) if (item.base_type == item_type && !is_artefact(item)) { item.special = ego_type; - return (true); + return true; } - return (false); + return false; } brand_type get_weapon_brand(const item_def &item) @@ -998,7 +998,7 @@ brand_type get_weapon_brand(const item_def &item) // Staves "brands" handled specially if (item.base_type != OBJ_WEAPONS) - return (SPWPN_NORMAL); + return SPWPN_NORMAL; if (is_artefact(item)) return static_cast<brand_type>(artefact_wpn_property(item, ARTP_BRAND)); @@ -1010,7 +1010,7 @@ special_missile_type get_ammo_brand(const item_def &item) { // No artefact arrows yet. -- bwr if (item.base_type != OBJ_MISSILES || is_artefact(item)) - return (SPMSL_NORMAL); + return SPMSL_NORMAL; return (static_cast<special_missile_type>(item.special)); } @@ -1019,7 +1019,7 @@ special_armour_type get_armour_ego_type(const item_def &item) { // Armour ego types are "brands", so we do the randart lookup here. if (item.base_type != OBJ_ARMOUR) - return (SPARM_NORMAL); + return SPARM_NORMAL; if (is_artefact(item)) { @@ -1034,12 +1034,12 @@ special_armour_type get_armour_ego_type(const item_def &item) bool hide2armour(item_def &item) { if (item.base_type != OBJ_ARMOUR) - return (false); + return false; switch (item.sub_type) { default: - return (false); + return false; case ARM_FIRE_DRAGON_HIDE: item.sub_type = ARM_FIRE_DRAGON_ARMOUR; @@ -1078,7 +1078,7 @@ bool hide2armour(item_def &item) break; } - return (true); + return true; } // Return the enchantment limit of a piece of armour. @@ -1096,7 +1096,7 @@ int armour_max_enchant(const item_def &item) else if (eq_slot == EQ_SHIELD) max_plus = 3; - return (max_plus); + return max_plus; } // Doesn't include animal skin (only skins we can make and enchant). @@ -1115,7 +1115,7 @@ bool armour_is_hide(const item_def &item, bool inc_made) case ARM_GOLD_DRAGON_ARMOUR: case ARM_SWAMP_DRAGON_ARMOUR: case ARM_PEARL_DRAGON_ARMOUR: - return (inc_made); + return inc_made; case ARM_TROLL_HIDE: case ARM_FIRE_DRAGON_HIDE: @@ -1126,13 +1126,13 @@ bool armour_is_hide(const item_def &item, bool inc_made) case ARM_GOLD_DRAGON_HIDE: case ARM_SWAMP_DRAGON_HIDE: case ARM_PEARL_DRAGON_HIDE: - return (true); + return true; default: break; } - return (false); + return false; } equipment_type get_armour_slot(const item_def &item) @@ -1172,7 +1172,7 @@ int fit_armour_size(const item_def &item, size_type size) else if (size > max) return (max - size); // +'ve means levels too large - return (0); + return 0; } // Returns true if armour fits size (shape needs additional verification). @@ -1192,20 +1192,20 @@ bool item_is_rechargeable(const item_def &it, bool hide_charged, bool weapons) if (it.base_type == OBJ_WANDS) { if (!hide_charged) - return (true); + return true; // Don't offer wands already maximally charged. if (item_ident(it, ISFLAG_KNOW_PLUSES) && it.plus >= wand_max_charges(it.sub_type)) { - return (false); + return false; } - return (true); + return true; } else if (it.base_type == OBJ_RODS) { if (!hide_charged) - return (true); + return true; if (item_ident(it, ISFLAG_KNOW_PLUSES)) { @@ -1213,10 +1213,10 @@ bool item_is_rechargeable(const item_def &it, bool hide_charged, bool weapons) || it.plus < it.plus2 || it.special < MAX_WPN_ENCHANT); } - return (true); + return true; } - return (false); + return false; } int wand_charge_value(int type) @@ -1287,17 +1287,17 @@ bool is_offensive_wand(const item_def& item) bool is_enchantable_armour(const item_def &arm, bool uncurse, bool unknown) { if (arm.base_type != OBJ_ARMOUR) - return (false); + return false; // Melded armour cannot be enchanted. if (item_is_melded(arm)) - return (false); + return false; // If we don't know the plusses, assume enchanting is possible. if (unknown && !is_known_artefact(arm) && !item_ident(arm, ISFLAG_KNOW_PLUSES)) { - return (true); + return true; } // Artefacts or highly enchanted armour cannot be enchanted, only @@ -1305,7 +1305,7 @@ bool is_enchantable_armour(const item_def &arm, bool uncurse, bool unknown) if (is_artefact(arm) || arm.plus >= armour_max_enchant(arm)) return (uncurse && arm.cursed() && you.religion != GOD_ASHENZARI); - return (true); + return true; } // @@ -1320,11 +1320,11 @@ int weapon_rarity(int w_type) { case WPN_CLUB: case WPN_DAGGER: - return (10); + return 10; case WPN_HAND_AXE: case WPN_MACE: - return (9); + return 9; case WPN_BOW: case WPN_FLAIL: @@ -1334,45 +1334,45 @@ int weapon_rarity(int w_type) case WPN_SLING: case WPN_SPEAR: case WPN_QUARTERSTAFF: - return (8); + return 8; case WPN_FALCHION: case WPN_LONG_SWORD: case WPN_MORNINGSTAR: case WPN_WAR_AXE: - return (7); + return 7; case WPN_BATTLEAXE: case WPN_CROSSBOW: case WPN_GREAT_SWORD: case WPN_SCIMITAR: case WPN_TRIDENT: - return (6); + return 6; case WPN_GLAIVE: case WPN_HALBERD: case WPN_BLOWGUN: - return (5); + return 5; case WPN_BROAD_AXE: case WPN_SPIKED_FLAIL: case WPN_WHIP: case WPN_STAFF: - return (4); + return 4; case WPN_GREAT_MACE: - return (3); + return 3; case WPN_DIRE_FLAIL: case WPN_SCYTHE: case WPN_LONGBOW: case WPN_LAJATANG: - return (2); + return 2; case WPN_GIANT_CLUB: case WPN_GIANT_SPIKED_CLUB: case WPN_BARDICHE: - return (1); + return 1; case WPN_DOUBLE_SWORD: case WPN_EVENINGSTAR: @@ -1392,13 +1392,13 @@ int weapon_rarity(int w_type) case WPN_SACRED_SCOURGE: case WPN_TRISHULA: // Zero value weapons must be placed specially -- see make_item() {dlb} - return (0); + return 0; default: break; } - return (0); + return 0; } int get_vorpal_type(const item_def &item) @@ -1408,7 +1408,7 @@ int get_vorpal_type(const item_def &item) if (item.base_type == OBJ_WEAPONS) ret = (Weapon_prop[Weapon_index[item.sub_type]].dam_type & DAMV_MASK); - return (ret); + return ret; } int get_damage_type(const item_def &item) @@ -1420,7 +1420,7 @@ int get_damage_type(const item_def &item) if (item.base_type == OBJ_WEAPONS) ret = (Weapon_prop[Weapon_index[item.sub_type]].dam_type & DAM_MASK); - return (ret); + return ret; } static bool _does_damage_type(const item_def &item, int dam_type) @@ -1446,7 +1446,7 @@ int single_damage_type(const item_def &item) } } - return (ret); + return ret; } hands_reqd_type hands_reqd(object_class_type base_type, int sub_type, @@ -1568,14 +1568,14 @@ bool is_demonic(const item_def &item) case WPN_DEMON_BLADE: case WPN_DEMON_WHIP: case WPN_DEMON_TRIDENT: - return (true); + return true; default: break; } } - return (false); + return false; } bool is_blessed(const item_def &item) @@ -1593,14 +1593,14 @@ bool is_blessed(const item_def &item) case WPN_BLESSED_TRIPLE_SWORD: case WPN_SACRED_SCOURGE: case WPN_TRISHULA: - return (true); + return true; default: break; } } - return (false); + return false; } bool is_blessed_convertible(const item_def &item) @@ -1616,28 +1616,28 @@ bool is_blessed_convertible(const item_def &item) bool convert2good(item_def &item, bool allow_blessed) { if (item.base_type != OBJ_WEAPONS) - return (false); + return false; switch (item.sub_type) { default: - return (false); + return false; case WPN_FALCHION: if (!allow_blessed) - return (false); + return false; item.sub_type = WPN_BLESSED_FALCHION; break; case WPN_LONG_SWORD: if (!allow_blessed) - return (false); + return false; item.sub_type = WPN_BLESSED_LONG_SWORD; break; case WPN_SCIMITAR: if (!allow_blessed) - return (false); + return false; item.sub_type = WPN_BLESSED_SCIMITAR; break; @@ -1650,19 +1650,19 @@ bool convert2good(item_def &item, bool allow_blessed) case WPN_DOUBLE_SWORD: if (!allow_blessed) - return (false); + return false; item.sub_type = WPN_BLESSED_DOUBLE_SWORD; break; case WPN_GREAT_SWORD: if (!allow_blessed) - return (false); + return false; item.sub_type = WPN_BLESSED_GREAT_SWORD; break; case WPN_TRIPLE_SWORD: if (!allow_blessed) - return (false); + return false; item.sub_type = WPN_BLESSED_TRIPLE_SWORD; break; @@ -1684,18 +1684,18 @@ bool convert2good(item_def &item, bool allow_blessed) if (is_blessed(item)) item.flags &= ~ISFLAG_RACIAL_MASK; - return (true); + return true; } bool convert2bad(item_def &item) { if (item.base_type != OBJ_WEAPONS) - return (false); + return false; switch (item.sub_type) { default: - return (false); + return false; case WPN_BLESSED_FALCHION: item.sub_type = WPN_FALCHION; @@ -1734,7 +1734,7 @@ bool convert2bad(item_def &item) break; } - return (true); + return true; } int weapon_str_weight(const item_def &wpn) @@ -1756,12 +1756,12 @@ skill_type weapon_skill(const item_def &item) if (item.base_type == OBJ_WEAPONS && !is_range_weapon(item)) return (Weapon_prop[ Weapon_index[item.sub_type] ].skill); else if (item.base_type == OBJ_RODS) - return (SK_MACES_FLAILS); // Rods are short and stubby + return SK_MACES_FLAILS; // Rods are short and stubby else if (item.base_type == OBJ_STAVES) - return (SK_STAVES); + return SK_STAVES; // This is used to mark that only fighting applies. - return (SK_FIGHTING); + return SK_FIGHTING; } // Front function for the above when we don't have a physical item to check. @@ -1783,10 +1783,10 @@ skill_type range_skill(const item_def &item) else if (item.base_type == OBJ_MISSILES) { if (!has_launcher(item)) - return (SK_THROWING); + return SK_THROWING; } - return (SK_THROWING); + return SK_THROWING; } // Front function for the above when we don't have a physical item to check. @@ -1960,7 +1960,7 @@ bool check_weapon_wieldable_size(const item_def &item, size_type size) if (item.base_type == OBJ_STAVES || item.base_type == OBJ_RODS || weapon_skill(item) == SK_STAVES) { - return (true); + return true; } int fit = _fit_weapon_wieldable_size(item, size); @@ -1980,7 +1980,7 @@ bool check_weapon_wieldable_size(const item_def &item, size_type size) missile_type fires_ammo_type(const item_def &item) { if (item.base_type != OBJ_WEAPONS) - return (MI_NONE); + return MI_NONE; return (Weapon_prop[Weapon_index[item.sub_type]].ammo); } @@ -2027,21 +2027,21 @@ bool is_throwable(const actor *actor, const item_def &wpn, bool force) || !actor->can_throw_large_rocks()) && wpn.sub_type == MI_LARGE_ROCK) { - return (false); + return false; } if (bodysize < SIZE_MEDIUM && (wpn.sub_type == MI_JAVELIN || wpn.sub_type == MI_THROWING_NET)) { - return (false); + return false; } } return (Missile_prop[Missile_index[wpn.sub_type]].throwable); } - return (false); + return false; } // Decide if something is launched or thrown. @@ -2052,7 +2052,7 @@ launch_retval is_launched(const actor *actor, const item_def *launcher, && launcher && missile.launched_by(*launcher)) { - return (LRET_LAUNCHED); + return LRET_LAUNCHED; } return (is_throwable(actor, missile) ? LRET_THROWN : LRET_FUMBLED); @@ -2120,25 +2120,25 @@ int ring_has_pluses(const item_def &item) // not known -> no pluses if (!item_type_known(item)) - return (0); + return 0; switch (item.sub_type) { case RING_SLAYING: - return (2); + return 2; case RING_PROTECTION: case RING_EVASION: case RING_STRENGTH: case RING_INTELLIGENCE: case RING_DEXTERITY: - return (1); + return 1; default: break; } - return (0); + return 0; } // Returns true if having two rings of the same type on at the same @@ -2149,10 +2149,10 @@ bool ring_has_stackable_effect(const item_def &item) ASSERT(!jewellery_is_amulet(item)); if (!item_type_known(item)) - return (false); + return false; if (ring_has_pluses(item)) - return (true); + return true; switch (item.sub_type) { @@ -2163,13 +2163,13 @@ bool ring_has_stackable_effect(const item_def &item) case RING_WIZARDRY: case RING_FIRE: case RING_ICE: - return (true); + return true; default: break; } - return (false); + return false; } // @@ -2178,7 +2178,7 @@ bool ring_has_stackable_effect(const item_def &item) bool is_blood_potion(const item_def &item) { if (item.base_type != OBJ_POTIONS) - return (false); + return false; return (item.sub_type == POT_BLOOD || item.sub_type == POT_BLOOD_COAGULATED); @@ -2187,7 +2187,7 @@ bool is_blood_potion(const item_def &item) bool is_fizzing_potion(const item_def &item) { if (item.base_type != OBJ_POTIONS) - return (false); + return false; return (item.sub_type == POT_FIZZING); } @@ -2223,7 +2223,7 @@ bool can_cut_meat(const item_def &item) bool is_fruit(const item_def & item) { if (item.base_type != OBJ_FOOD) - return (false); + return false; return (Food_prop[Food_index[item.sub_type]].flags & FFL_FRUIT); } @@ -2278,7 +2278,7 @@ int get_armour_res_fire(const item_def &arm, bool check_artp) if (check_artp && is_artefact(arm)) res += artefact_wpn_property(arm, ARTP_FIRE); - return (res); + return res; } int get_armour_res_cold(const item_def &arm, bool check_artp) @@ -2314,7 +2314,7 @@ int get_armour_res_cold(const item_def &arm, bool check_artp) if (check_artp && is_artefact(arm)) res += artefact_wpn_property(arm, ARTP_COLD); - return (res); + return res; } int get_armour_res_poison(const item_def &arm, bool check_artp) @@ -2345,7 +2345,7 @@ int get_armour_res_poison(const item_def &arm, bool check_artp) if (check_artp && is_artefact(arm)) res += artefact_wpn_property(arm, ARTP_POISON); - return (res); + return res; } int get_armour_res_elec(const item_def &arm, bool check_artp) @@ -2368,7 +2368,7 @@ int get_armour_res_elec(const item_def &arm, bool check_artp) if (check_artp && is_artefact(arm)) res += artefact_wpn_property(arm, ARTP_ELECTRICITY); - return (res); + return res; } int get_armour_life_protection(const item_def &arm, bool check_artp) @@ -2388,7 +2388,7 @@ int get_armour_life_protection(const item_def &arm, bool check_artp) if (check_artp && is_artefact(arm)) res += artefact_wpn_property(arm, ARTP_NEGATIVE_ENERGY); - return (res); + return res; } int get_armour_res_magic(const item_def &arm, bool check_artp) @@ -2404,7 +2404,7 @@ int get_armour_res_magic(const item_def &arm, bool check_artp) if (check_artp && is_artefact(arm)) res += artefact_wpn_property(arm, ARTP_MAGIC); - return (res); + return res; } bool get_armour_see_invisible(const item_def &arm, bool check_artp) @@ -2413,12 +2413,12 @@ bool get_armour_see_invisible(const item_def &arm, bool check_artp) // check for ego resistance if (get_armour_ego_type(arm) == SPARM_POSITIVE_ENERGY) - return (true); + return true; if (check_artp && is_artefact(arm)) return artefact_wpn_property(arm, ARTP_EYESIGHT); - return (false); + return false; } int get_armour_res_sticky_flame(const item_def &arm) @@ -2459,7 +2459,7 @@ int get_jewellery_res_fire(const item_def &ring, bool check_artp) if (check_artp && is_artefact(ring)) res += artefact_wpn_property(ring, ARTP_FIRE); - return (res); + return res; } int get_jewellery_res_cold(const item_def &ring, bool check_artp) @@ -2485,7 +2485,7 @@ int get_jewellery_res_cold(const item_def &ring, bool check_artp) if (check_artp && is_artefact(ring)) res += artefact_wpn_property(ring, ARTP_COLD); - return (res); + return res; } int get_jewellery_res_poison(const item_def &ring, bool check_artp) @@ -2500,7 +2500,7 @@ int get_jewellery_res_poison(const item_def &ring, bool check_artp) if (check_artp && is_artefact(ring)) res += artefact_wpn_property(ring, ARTP_POISON); - return (res); + return res; } int get_jewellery_res_elec(const item_def &ring, bool check_artp) @@ -2512,7 +2512,7 @@ int get_jewellery_res_elec(const item_def &ring, bool check_artp) if (check_artp && is_artefact(ring)) res += artefact_wpn_property(ring, ARTP_ELECTRICITY); - return (res); + return res; } int get_jewellery_life_protection(const item_def &ring, bool check_artp) @@ -2528,7 +2528,7 @@ int get_jewellery_life_protection(const item_def &ring, bool check_artp) if (check_artp && is_artefact(ring)) res += artefact_wpn_property(ring, ARTP_NEGATIVE_ENERGY); - return (res); + return res; } int get_jewellery_res_magic(const item_def &ring, bool check_artp) @@ -2543,7 +2543,7 @@ int get_jewellery_res_magic(const item_def &ring, bool check_artp) if (check_artp && is_artefact(ring)) res += artefact_wpn_property(ring, ARTP_MAGIC); - return (res); + return res; } bool get_jewellery_see_invisible(const item_def &ring, bool check_artp) @@ -2551,12 +2551,12 @@ bool get_jewellery_see_invisible(const item_def &ring, bool check_artp) ASSERT(ring.base_type == OBJ_JEWELLERY); if (ring.sub_type == RING_SEE_INVISIBLE) - return (true); + return true; if (check_artp && is_artefact(ring)) return artefact_wpn_property(ring, ARTP_EYESIGHT); - return (false); + return false; } int property(const item_def &item, int prop_type) @@ -2616,14 +2616,14 @@ int property(const item_def &item, int prop_type) break; } - return (0); + return 0; } // Returns true if item is evokable. bool gives_ability(const item_def &item) { if (!item_type_known(item)) - return (false); + return false; switch (item.base_type) { @@ -2635,40 +2635,40 @@ bool gives_ability(const item_def &item) || item.sub_type == RING_INVISIBILITY || item.sub_type == AMU_RAGE) { - return (true); + return true; } break; case OBJ_ARMOUR: { const equipment_type eq = get_armour_slot(item); if (eq == EQ_NONE) - return (false); + return false; const special_armour_type ego = get_armour_ego_type(item); if (ego == SPARM_DARKNESS || ego == SPARM_LEVITATION) - return (true); + return true; break; } default: - return (false); + return false; } if (!is_artefact(item)) - return (false); + return false; // Check for evokable randart properties. for (int rap = ARTP_INVISIBLE; rap <= ARTP_BERSERK; rap++) if (artefact_wpn_property(item, static_cast<artefact_prop_type>(rap))) - return (true); + return true; - return (false); + return false; } // Returns true if the item confers an intrinsic that is shown on the % screen. bool gives_resistance(const item_def &item) { if (!item_type_known(item)) - return (false); + return false; switch (item.base_type) { @@ -2684,26 +2684,26 @@ bool gives_resistance(const item_def &item) && item.sub_type <= RING_TELEPORT_CONTROL || item.sub_type == RING_SUSTAIN_ABILITIES) { - return (true); + return true; } } else { if (item.sub_type != AMU_RAGE && item.sub_type != AMU_INACCURACY) - return (true); + return true; } break; case OBJ_ARMOUR: { const equipment_type eq = get_armour_slot(item); if (eq == EQ_NONE) - return (false); + return false; const int ego = get_armour_ego_type(item); if (ego >= SPARM_FIRE_RESISTANCE && ego <= SPARM_SEE_INVISIBLE || ego == SPARM_RESISTANCE || ego == SPARM_POSITIVE_ENERGY) { - return (true); + return true; } break; } @@ -2711,15 +2711,15 @@ bool gives_resistance(const item_def &item) if (item.sub_type >= STAFF_FIRE && item.sub_type <= STAFF_POISON || item.sub_type == STAFF_AIR) { - return (true); + return true; } - return (false); + return false; default: - return (false); + return false; } if (!is_artefact(item)) - return (false); + return false; // Check for randart resistances. for (int rap = ARTP_FIRE; rap <= ARTP_BERSERK; rap++) @@ -2728,10 +2728,10 @@ bool gives_resistance(const item_def &item) continue; if (artefact_wpn_property(item, static_cast<artefact_prop_type>(rap))) - return (true); + return true; } - return (false); + return false; } int item_mass(const item_def &item) @@ -2854,7 +2854,7 @@ equipment_type get_item_slot(object_class_type type, int sub_type) case OBJ_STAVES: case OBJ_RODS: case OBJ_MISCELLANY: - return (EQ_WEAPON); + return EQ_WEAPON; case OBJ_ARMOUR: return get_armour_slot(static_cast<armour_type>(sub_type)); @@ -2866,7 +2866,7 @@ equipment_type get_item_slot(object_class_type type, int sub_type) break; } - return (EQ_NONE); + return EQ_NONE; } bool is_shield(const item_def &item) @@ -2881,7 +2881,7 @@ bool is_shield_incompatible(const item_def &weapon, const item_def *shield) { // If there's no shield, there's no problem. if (!shield && !(shield = you.shield())) - return (false); + return false; hands_reqd_type hand = hands_reqd(weapon, you.body_size()); return (hand == HANDS_TWO && !is_range_weapon(weapon)); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 331d00ccad..a4848dff40 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -136,16 +136,16 @@ static bool _item_ok_to_clean(int item) { // Never clean food or Orbs. if (mitm[item].base_type == OBJ_FOOD || item_is_orb(mitm[item])) - return (false); + return false; // Never clean runes. if (mitm[item].base_type == OBJ_MISCELLANY && mitm[item].sub_type == MISC_RUNE_OF_ZOT) { - return (false); + return false; } - return (true); + return true; } static bool _item_preferred_to_clean(int item) @@ -154,14 +154,14 @@ static bool _item_preferred_to_clean(int item) if (mitm[item].base_type == OBJ_WEAPONS && mitm[item].plus <= 0 && mitm[item].plus2 <= 0 && !is_artefact(mitm[item])) - return (true); + return true; if (mitm[item].base_type == OBJ_MISSILES && mitm[item].plus <= 0 && mitm[item].plus2 <= 0 && !is_artefact(mitm[item])) - return (true); + return true; - return (false); + return false; } // Returns index number of first available space, or NON_ITEM for @@ -222,7 +222,7 @@ static int _cull_items(void) } } - return (first_cleaned); + return first_cleaned; } @@ -333,7 +333,7 @@ bool dec_inv_item_quantity(int obj, int amount, bool suppress_burden) if (!suppress_burden) burden_change(); - return (ret); + return ret; } // Reduce quantity of a monster/grid item, do cleanup if item goes away. @@ -352,12 +352,12 @@ bool dec_mitm_item_quantity(int obj, int amount) // the next stack. crawl_state.cancel_cmd_repeat(); crawl_state.cancel_cmd_again(); - return (true); + return true; } mitm[obj].quantity -= amount; - return (false); + return false; } void inc_inv_item_quantity(int obj, int amount, bool suppress_burden) @@ -409,20 +409,20 @@ int get_mitm_slot(int reserve) // If arena_cull_items() can't free up any space then // _cull_items() won't be able to either, so give up. if (item == NON_ITEM) - return (NON_ITEM); + return NON_ITEM; } else item = (reserve <= 10) ? _cull_items() : NON_ITEM; if (item == NON_ITEM) - return (NON_ITEM); + return NON_ITEM; } ASSERT(item != NON_ITEM); init_item(item); - return (item); + return item; } void unlink_item(int dest) @@ -679,7 +679,7 @@ bool item_is_branded(const item_def& item) case OBJ_MISSILES: return (get_ammo_brand(item) != SPMSL_NORMAL); default: - return (false); + return false; } } @@ -866,7 +866,7 @@ static std::string _menu_burden_invstatus(const Menu *menu, bool is_pickup = fal sw.c_str(), carrying_capacity(BS_UNENCUMBERED) * BURDEN_TO_AUM) : newstate; - return (burden); + return burden; } static std::string _pickup_menu_title(const Menu *menu, const std::string &oldt) @@ -1012,7 +1012,7 @@ static int _first_corpse_monnum(const coord_def& where) // (already done for unique monsters to get named zombies), but // personally, I rather like the way the player can't tell where an // item came from if he just finds it lying on the floor. (jpeg) - return (0); + return 0; } static std::string _milestone_rune(const item_def &item) @@ -1121,10 +1121,10 @@ bool origin_is_god_gift(const item_def& item, god_type *god) if (iorig > GOD_NO_GOD && iorig < NUM_GODS) { *god = static_cast<god_type>(iorig); - return (true); + return true; } - return (false); + return false; } bool origin_is_acquirement(const item_def& item, item_source_type *type) @@ -1139,10 +1139,10 @@ bool origin_is_acquirement(const item_def& item, item_source_type *type) || iorig == AQ_WIZMODE) { *type = static_cast<item_source_type>(iorig); - return (true); + return true; } - return (false); + return false; } std::string origin_desc(const item_def &item) @@ -1202,20 +1202,20 @@ std::string origin_desc(const item_def &item) desc += "You found " + _article_it(item) + " "; desc += _origin_place_desc(item); - return (desc); + return desc; } bool pickup_single_item(int link, int qty) { if (!player_can_reach_floor()) - return (false); + return false; item_def* item = &mitm[link]; if (item->base_type == OBJ_GOLD && !qty && !i_feel_safe() && !yesno("Are you sure you want to pick up this pile of gold now?", true, 'n')) { - return (false); + return false; } if (qty == 0 && item->quantity > 1 && item->base_type != OBJ_GOLD) { @@ -1230,7 +1230,7 @@ bool pickup_single_item(int link, int qty) else if (qty == 0) { canned_msg(MSG_OK); - return (false); + return false; } else if (qty < item->quantity) { @@ -1253,16 +1253,16 @@ bool pickup_single_item(int link, int qty) { mpr("You can't carry that many items."); learned_something_new(HINT_HEAVY_LOAD); - return (false); + return false; } else if (num == 0) { mpr("You can't carry that much weight."); learned_something_new(HINT_HEAVY_LOAD); - return (false); + return false; } - return (true); + return true; } bool player_on_single_stack() @@ -1380,7 +1380,7 @@ void pickup(bool partial_quantity) bool is_stackable_item(const item_def &item) { if (!item.defined()) - return (false); + return false; if (item.base_type == OBJ_MISSILES || item.base_type == OBJ_FOOD @@ -1388,20 +1388,20 @@ bool is_stackable_item(const item_def &item) || item.base_type == OBJ_POTIONS || item.base_type == OBJ_GOLD) { - return (true); + return true; } - return (false); + return false; } bool items_similar(const item_def &item1, const item_def &item2) { // Base and sub-types must always be the same to stack. if (item1.base_type != item2.base_type || item1.sub_type != item2.sub_type) - return (false); + return false; if (item1.base_type == OBJ_GOLD || item_is_rune(item1)) - return (true); + return true; // These classes also require pluses and special. if (item1.base_type == OBJ_WEAPONS // only throwing weapons @@ -1416,23 +1416,23 @@ bool items_similar(const item_def &item1, const item_def &item2) // Non-chunk item specials must match exactly. : item1.special != item2.special)) { - return (false); + return false; } } #define NO_MERGE_FLAGS (ISFLAG_MIMIC | ISFLAG_SUMMONED) if ((item1.flags & NO_MERGE_FLAGS) != (item2.flags & NO_MERGE_FLAGS)) - return (false); + return false; // The inscriptions can differ if one of them is blank, but if they // are differing non-blank inscriptions then don't stack. if (item1.inscription != item2.inscription && !item1.inscription.empty() && !item2.inscription.empty()) { - return (false); + return false; } - return (true); + return true; } bool items_stack(const item_def &item1, const item_def &item2, @@ -1445,7 +1445,7 @@ bool items_stack(const item_def &item1, const item_def &item2, { COMPILE_CHECK(sizeof(item1.quantity) == 2); // can be relaxed otherwise - return (false); + return false; } return items_similar(item1, item2); @@ -1469,7 +1469,7 @@ static int _userdef_find_free_slot(const item_def &i) if (!clua.callfn("c_assign_invletter", "u>d", &i, &slot)) return (-1); - return (slot); + return slot; #else return -1; #endif @@ -1523,7 +1523,7 @@ int find_free_slot(const item_def &i) if (slot + 1 < ENDOFPACK && you.inv[slot + 1].defined() && !disliked[slot]) { - return (slot); + return slot; } } } @@ -1542,7 +1542,7 @@ int find_free_slot(const item_def &i) return slot; // If the least preferred slot is the only choice, so be it. - return (badslot); + return badslot; #undef slotisfree } @@ -1595,7 +1595,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, mpr("You cannot pick up the net that holds you!"); // Fake a successful pickup (return 1), so we can continue to // pick up anything else that might be on this square. - return (1); + return 1; } if (mitm[obj].base_type == OBJ_ORBS && crawl_state.game_is_zotdef()) @@ -1603,7 +1603,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, if (runes_in_pack() < 15) { mpr("You must possess at least fifteen runes to touch the sacred Orb which you defend."); - return (1); + return 1; } } @@ -1616,7 +1616,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, dec_mitm_item_quantity(obj, quant_got); you.turn_is_over = true; - return (retval); + return retval; } // So do runes. if (item_is_rune(mitm[obj])) @@ -1663,7 +1663,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, gain_piety(10, 1); } - return (retval); + return retval; } const int unit_mass = item_mass(mitm[obj]); @@ -1685,7 +1685,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, int part = (carrying_capacity() - you.burden) / unit_mass; if (part < 1) - return (0); + return 0; // only pickup 'part' items quant_got = part; @@ -1746,7 +1746,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, you.turn_is_over = true; you.last_pickup[m] = quant_got; - return (retval); + return retval; } } } @@ -1851,7 +1851,7 @@ int move_item_to_player(int obj, int quant_got, bool quiet, item_skills(item, you.start_train); - return (retval); + return retval; } void mark_items_non_pickup_at(const coord_def &pos) @@ -1880,7 +1880,7 @@ bool move_item_to_grid(int *const obj, const coord_def& p, bool silent) int& ob(*obj); // Must be a valid reference to a valid object. if (ob == NON_ITEM || !mitm[ob].defined()) - return (false); + return false; item_def& item(mitm[ob]); @@ -1890,7 +1890,7 @@ bool move_item_to_grid(int *const obj, const coord_def& p, bool silent) destroy_item(ob); ob = NON_ITEM; - return (true); + return true; } if (you.see_cell(p)) @@ -1904,7 +1904,7 @@ bool move_item_to_grid(int *const obj, const coord_def& p, bool silent) { // Check if item already linked here -- don't want to unlink it. if (ob == si->index()) - return (false); + return false; if (items_stack(item, *si)) { @@ -1914,7 +1914,7 @@ bool move_item_to_grid(int *const obj, const coord_def& p, bool silent) merge_item_stacks(item, *si); destroy_item(ob); ob = si->index(); - return (true); + return true; } } } @@ -1949,7 +1949,7 @@ bool move_item_to_grid(int *const obj, const coord_def& p, bool silent) if (item_is_orb(item)) env.orb_pos = p; - return (true); + return true; } void move_item_stack_to_grid(const coord_def& from, const coord_def& to) @@ -1982,7 +1982,7 @@ bool copy_item_to_grid(const item_def &item, const coord_def& p, ASSERT(in_bounds(p)); if (quant_drop == 0) - return (false); + return false; if (feat_destroys_item(grd(p), item, !silenced(p) && !silent)) { @@ -1991,7 +1991,7 @@ bool copy_item_to_grid(const item_def &item, const coord_def& p, item_was_destroyed(item, NON_MONSTER); - return (true); + return true; } // default quant_drop == -1 => drop all @@ -2019,7 +2019,7 @@ bool copy_item_to_grid(const item_def &item, const coord_def& p, si->flags |= ISFLAG_DROPPED; si->flags &= ~ISFLAG_THROWN; } - return (true); + return true; } } } @@ -2027,7 +2027,7 @@ bool copy_item_to_grid(const item_def &item, const coord_def& p, // Item not found in current stack, add new item to top. int new_item_idx = get_mitm_slot(10); if (new_item_idx == NON_ITEM) - return (false); + return false; item_def& new_item = mitm[new_item_idx]; // Copy item. @@ -2055,7 +2055,7 @@ bool copy_item_to_grid(const item_def &item, const coord_def& p, remove_newest_blood_potion(new_item); } - return (true); + return true; } coord_def item_pos(const item_def &item) @@ -2081,7 +2081,7 @@ bool move_top_item(const coord_def &pos, const coord_def &dest) { int item = igrd(pos); if (item == NON_ITEM) - return (false); + return false; dungeon_events.fire_position_event( dgn_event(DET_ITEM_MOVED, pos, 0, item, -1, dest), pos); @@ -2089,7 +2089,7 @@ bool move_top_item(const coord_def &pos, const coord_def &dest) // Now move the item to its new possition... move_item_to_grid(&item, dest); - return (true); + return true; } const item_def* top_item_at(const coord_def& where) @@ -2112,13 +2112,13 @@ item_def *corpse_at(coord_def pos, int *num_corpses) { corpse = &*si; if (!num_corpses) - return (corpse); + return corpse; } if (num_corpses) ++*num_corpses; } } - return (corpse); + return corpse; } bool multiple_items_at(const coord_def& where) @@ -2151,19 +2151,19 @@ bool drop_item(int item_dropped, int quant_drop) if (!Options.easy_unequip) { mpr("You will have to take that off first."); - return (false); + return false; } if (remove_ring(item_dropped, true)) start_delay(DELAY_DROP_ITEM, 1, item_dropped, 1); - return (false); + return false; } if (you.inv[item_dropped].base_type == OBJ_ORBS) { mpr("You don't feel like leaving the orb behind!"); - return (false); + return false; } if (item_dropped == you.equip[EQ_WEAPON] @@ -2171,7 +2171,7 @@ bool drop_item(int item_dropped, int quant_drop) && you.inv[item_dropped].cursed()) { mprf("%s is stuck to you!", you.inv[item_dropped].name(DESC_THE).c_str()); - return (false); + return false; } for (int i = EQ_MIN_ARMOUR; i <= EQ_MAX_ARMOUR; i++) @@ -2191,7 +2191,7 @@ bool drop_item(int item_dropped, int quant_drop) // Regardless, we want to return here because either we're // aborting the drop, or the drop is delayed until after // the armour is removed. -- bwr - return (false); + return false; } } @@ -2207,7 +2207,7 @@ bool drop_item(int item_dropped, int quant_drop) { int old_time = you.time_taken; if (!wield_weapon(true, SLOT_BARE_HANDS)) - return (false); + return false; // Dropping a wielded item isn't any faster. you.time_taken = old_time; } @@ -2218,7 +2218,7 @@ bool drop_item(int item_dropped, int quant_drop) you.pos(), quant_drop, true, true)) { mpr("Too many items on this level, not dropping the item."); - return (false); + return false; } mprf("You drop %s.", @@ -2250,7 +2250,7 @@ bool drop_item(int item_dropped, int quant_drop) you.last_pickup.erase(item_dropped); - return (true); + return true; } void drop_last() @@ -2280,7 +2280,7 @@ static std::string _drop_menu_title(const Menu *menu, const std::string &oldt) if (menu->is_set(MF_SINGLESELECT)) res = "[Single drop] " + res; - return (res); + return res; } int get_equip_slot(const item_def *item) @@ -2358,9 +2358,9 @@ static bool _drop_item_order(const SelItem &first, const SelItem &second) if (slot1 != -1 && slot2 != -1) return (slot1 < slot2); else if (slot1 != -1 && slot2 == -1) - return (false); + return false; else if (slot2 != -1 && slot1 == -1) - return (true); + return true; return (first.slot < second.slot); } @@ -2540,7 +2540,7 @@ static bool _known_subtype(const item_def &item) case OBJ_RODS: return (item_type_known(item)); default: - return (true); + return true; } } @@ -2572,7 +2572,7 @@ static bool _is_option_autopickup(const item_def &item, std::string &iname) clua.error.c_str()); if (res) - return (true); + return true; res = clua.callbooleanfn(false, "ch_deny_autopickup", "is", &item, iname.c_str()); @@ -2581,7 +2581,7 @@ static bool _is_option_autopickup(const item_def &item, std::string &iname) clua.error.c_str()); if (res) - return (false); + return false; #endif return (Options.autopickups & (1L << item.base_type)); @@ -2590,19 +2590,19 @@ static bool _is_option_autopickup(const item_def &item, std::string &iname) bool item_needs_autopickup(const item_def &item) { if (item_is_stationary(item)) - return (false); + return false; if (item.inscription.find("=g") != std::string::npos) - return (true); + return true; if ((item.flags & ISFLAG_THROWN) && Options.pickup_thrown) - return (true); + return true; if (item.flags & ISFLAG_DROPPED) - return (false); + return false; if (item.props.exists("needs_autopickup")) - return (true); + return true; std::string itemname; return _is_option_autopickup(item, itemname); @@ -2614,15 +2614,15 @@ bool can_autopickup() // autopickup is still possible with inscriptions and // pickup_thrown. if (Options.autopickup_on <= 0) - return (false); + return false; if (you.flight_mode() == FL_LEVITATE) - return (false); + return false; if (!i_feel_safe()) - return (false); + return false; - return (true); + return true; } typedef bool (*item_comparer)(const item_def& pickup_item, @@ -2647,20 +2647,20 @@ static bool _similar_equip(const item_def& pickup_item, const equipment_type inv_slot = get_item_slot(inv_item); if (inv_slot == EQ_NONE) - return (false); + return false; // If it's an unequipped cursed item the player might be looking // for a replacement. if (item_known_cursed(inv_item) && !item_is_equipped(inv_item)) - return (false); + return false; if (get_item_slot(pickup_item) != inv_slot) - return (false); + return false; // Just filling the same slot is enough for armour to be considered // similar. if (pickup_item.base_type == OBJ_ARMOUR) - return (true); + return true; // Launchers of the same type are similar. if ((pickup_item.sub_type >= WPN_BLOWGUN @@ -2678,10 +2678,10 @@ static bool _similar_wands(const item_def& pickup_item, const item_def& inv_item) { if (inv_item.base_type != OBJ_WANDS) - return (false); + return false; if (pickup_item.sub_type != inv_item.sub_type) - return (false); + return false; // Not similar if wand in inventory is known to be empty. return (inv_item.plus2 != ZAPCOUNT_EMPTY @@ -2693,10 +2693,10 @@ static bool _similar_jewellery(const item_def& pickup_item, const item_def& inv_item) { if (inv_item.base_type != OBJ_JEWELLERY) - return (false); + return false; if (pickup_item.sub_type != inv_item.sub_type) - return (false); + return false; // For jewellery of the same sub-type, unidentified jewellery is // always considered similar, as is identified jewellery whose @@ -2717,16 +2717,16 @@ static bool _item_different_than_inv(const item_def& pickup_item, continue; if ((*comparer)(pickup_item, inv_item)) - return (false); + return false; } - return (true); + return true; } static bool _interesting_explore_pickup(const item_def& item) { if (!(Options.explore_stop & ES_GREEDY_PICKUP_MASK)) - return (false); + return false; if (item.base_type == OBJ_GOLD) return (Options.explore_stop & ES_GREEDY_PICKUP_GOLD); @@ -2734,7 +2734,7 @@ static bool _interesting_explore_pickup(const item_def& item) if ((Options.explore_stop & ES_GREEDY_PICKUP_THROWN) && (item.flags & ISFLAG_THROWN)) { - return (true); + return true; } std::vector<text_pattern> &ignore = Options.explore_stop_pickup_ignore; @@ -2744,24 +2744,24 @@ static bool _interesting_explore_pickup(const item_def& item) for (unsigned int i = 0; i < ignore.size(); i++) if (ignore[i].matches(name)) - return (false); + return false; } if (!(Options.explore_stop & ES_GREEDY_PICKUP_SMART)) - return (true); + return true; // "Smart" code follows. // If ES_GREEDY_PICKUP_THROWN isn't set, then smart greedy pickup // will ignore thrown items. if (item.flags & ISFLAG_THROWN) - return (false); + return false; if (is_artefact(item)) - return (true); + return true; // Possbible ego items. if (!item_type_known(item) & (item.flags & ISFLAG_COSMETIC_MASK)) - return (true); + return true; switch (item.base_type) { @@ -2770,7 +2770,7 @@ static bool _interesting_explore_pickup(const item_def& item) case OBJ_ARMOUR: // Ego items. if (item.special != 0) - return (true); + return true; break; default: @@ -2791,10 +2791,10 @@ static bool _interesting_explore_pickup(const item_def& item) case OBJ_FOOD: if (you.religion == GOD_FEDHAS && is_fruit(item)) - return (true); + return true; if (is_inedible(item)) - return (false); + return false; // Interesting if we don't have any other edible food. return _item_different_than_inv(item, _edible_food); @@ -2802,17 +2802,17 @@ static bool _interesting_explore_pickup(const item_def& item) case OBJ_RODS: // Rods are always interesting, even if you already have one of // the same type, since each rod has its own mana. - return (true); + return true; // Intentional fall-through. case OBJ_MISCELLANY: // Runes are always interesting. if (item_is_rune(item)) - return (true); + return true; // Decks always start out unidentified. if (is_deck(item)) - return (true); + return true; // Intentional fall-through. case OBJ_SCROLLS: @@ -2823,17 +2823,17 @@ static bool _interesting_explore_pickup(const item_def& item) case OBJ_BOOKS: // Books always start out unidentified. - return (true); + return true; case OBJ_ORBS: // Orb is always interesting. - return (true); + return true; default: break; } - return (false); + return false; } static void _do_autopickup() @@ -2975,7 +2975,7 @@ item_def *find_floor_item(object_class_type cls, int sub_type) return (& (*si)); } - return (NULL); + return NULL; } int item_on_floor(const item_def &item, const coord_def& where) @@ -2983,9 +2983,9 @@ int item_on_floor(const item_def &item, const coord_def& where) // Check if the item is on the floor and reachable. for (int link = igrd(where); link != NON_ITEM; link = mitm[link].link) if (&mitm[link] == &item) - return (link); + return link; - return (NON_ITEM); + return NON_ITEM; } int get_max_subtype(object_class_type base_type) @@ -3018,13 +3018,13 @@ int get_max_subtype(object_class_type base_type) equipment_type item_equip_slot(const item_def& item) { if (!in_inventory(item)) - return (EQ_NONE); + return EQ_NONE; for (int i = 0; i < NUM_EQUIP; i++) if (item.link == you.equip[i]) return (static_cast<equipment_type>(i)); - return (EQ_NONE); + return EQ_NONE; } // Includes melded items. @@ -3071,7 +3071,7 @@ bool item_def::cursed() const bool item_def::launched_by(const item_def &launcher) const { if (base_type != OBJ_MISSILES) - return (false); + return false; const missile_type mt = fires_ammo_type(launcher); return (sub_type == mt || (mt == MI_STONE && sub_type == MI_SLING_BULLET)); } @@ -3079,7 +3079,7 @@ bool item_def::launched_by(const item_def &launcher) const zap_type item_def::zap() const { if (base_type != OBJ_WANDS) - return (ZAP_DEBUGGING_RAY); + return ZAP_DEBUGGING_RAY; zap_type result = ZAP_DEBUGGING_RAY; switch (static_cast<wand_type>(sub_type)) @@ -3113,7 +3113,7 @@ zap_type item_def::zap() const case NUM_WANDS: break; } - return (result); + return result; } int item_def::index() const @@ -3124,7 +3124,7 @@ int item_def::index() const int item_def::armour_rating() const { if (!this->defined() || base_type != OBJ_ARMOUR) - return (0); + return 0; return (property(*this, PARM_AC) + plus); } @@ -3132,10 +3132,10 @@ int item_def::armour_rating() const monster* item_def::holding_monster() const { if (!pos.equals(-2, -2)) - return (NULL); + return NULL; const int midx = link - NON_ITEM - 1; if (invalid_monster_index(midx)) - return (NULL); + return NULL; return (&menv[midx]); } @@ -3168,23 +3168,23 @@ bool item_def::defined() const bool item_def::is_valid() const { if (!defined()) - return (false); + return false; const int max_sub = get_max_subtype(base_type); if (max_sub != -1 && sub_type >= max_sub) - return (false); + return false; if (colour == 0) - return (false); // No black items. - return (true); + return false; // No black items. + return true; } // The Orb of Zot and unique runes are considered critical. bool item_def::is_critical() const { if (!defined()) - return (false); + return false; if (base_type == OBJ_ORBS) - return (true); + return true; return (base_type == OBJ_MISCELLANY && sub_type == MISC_RUNE_OF_ZOT @@ -3201,20 +3201,20 @@ bool item_def::is_mundane() const if (sub_type == WPN_CLUB || is_giant_club_type(sub_type)) { - return (true); + return true; } break; case OBJ_ARMOUR: if (sub_type == ARM_ANIMAL_SKIN) - return (true); + return true; break; default: break; } - return (false); + return false; } static void _rune_from_specs(const char* _specs, item_def &item) @@ -3434,17 +3434,17 @@ static bool _book_from_spell(const char* specs, item_def &item) spell_type type = spell_by_name(specs, true); if (type == SPELL_NO_SPELL) - return (false); + return false; for (int i = 0; i < NUM_FIXED_BOOKS; ++i) for (int j = 0; j < 8; ++j) if (which_spell_in_book(i, j) == type) { item.sub_type = i; - return (true); + return true; } - return (false); + return false; } bool get_item_by_name(item_def *item, char* specs, @@ -3474,7 +3474,7 @@ bool get_item_by_name(item_def *item, char* specs, if (item->base_type == OBJ_UNASSIGNED) { // Rune or deck creation canceled, clean up item-> - return (false); + return false; } } @@ -3504,7 +3504,7 @@ bool get_item_by_name(item_def *item, char* specs, { item->sub_type = type_wanted; if (!create_for_real) - return (true); + return true; } else { @@ -3556,7 +3556,7 @@ bool get_item_by_name(item_def *item, char* specs, // Since zero is atoi's copout, the wizard // must enter (subtype + 1). if (!(type_wanted = atoi(specs))) - return (false); + return false; type_wanted--; @@ -3565,7 +3565,7 @@ bool get_item_by_name(item_def *item, char* specs, } if (!create_for_real) - return (true); + return true; switch (item->base_type) { @@ -3700,7 +3700,7 @@ bool get_item_by_name(item_def *item, char* specs, item_set_appearance(*item); - return (true); + return true; } // Returns the position of the Orb on the floor, or diff --git a/crawl-ref/source/jobs.cc b/crawl-ref/source/jobs.cc index b0483581e0..c93d612957 100644 --- a/crawl-ref/source/jobs.cc +++ b/crawl-ref/source/jobs.cc @@ -82,7 +82,7 @@ job_type get_job_by_name(const char *name) } } - return (cl); + return cl; } bool is_valid_job(job_type job) diff --git a/crawl-ref/source/kills.cc b/crawl-ref/source/kills.cc index 02beb9a7e0..3f283606f9 100644 --- a/crawl-ref/source/kills.cc +++ b/crawl-ref/source/kills.cc @@ -57,15 +57,15 @@ const char *KillMaster::category_name(kill_category kc) const { if (kc >= KC_YOU && kc < KC_NCATEGORIES) return (kill_category_names[kc]); - return (NULL); + return NULL; } bool KillMaster::empty() const { for (int i = 0; i < KC_NCATEGORIES; ++i) if (!categorized_kills[i].empty()) - return (false); - return (true); + return false; + return true; } void KillMaster::save(writer& outf) const @@ -117,7 +117,7 @@ int KillMaster::total_kills() const int count = categorized_kills[i].get_kills(kills); grandtotal += count; } - return (grandtotal); + return grandtotal; } std::string KillMaster::kill_info() const @@ -338,7 +338,7 @@ int Kills::get_kills(std::vector<kill_exp> &all_kills) const count += ghosts.size(); std::sort(all_kills.begin(), all_kills.end()); - return (count); + return count; } void Kills::save(writer& outf) const diff --git a/crawl-ref/source/l_crawl.cc b/crawl-ref/source/l_crawl.cc index 8c502b443e..1a276997f0 100644 --- a/crawl-ref/source/l_crawl.cc +++ b/crawl-ref/source/l_crawl.cc @@ -54,11 +54,11 @@ function mpr(message, channel) */ static int crawl_mpr(lua_State *ls) { if (!crawl_state.io_inited) - return (0); + return 0; const char *message = luaL_checkstring(ls, 1); if (!message) - return (0); + return 0; int ch = MSGCH_PLAIN; if (lua_isnumber(ls, 2)) @@ -74,7 +74,7 @@ static int crawl_mpr(lua_State *ls) ch = MSGCH_PLAIN; mpr(message, static_cast<msg_channel_type>(ch)); - return (0); + return 0; } /* @@ -83,11 +83,11 @@ function formatted_mpr(message, channel) */ static int crawl_formatted_mpr(lua_State *ls) { if (!crawl_state.io_inited) - return (0); + return 0; const char *message = luaL_checkstring(ls, 1); if (!message) - return (0); + return 0; int ch = MSGCH_PLAIN; if (lua_isnumber(ls, 2)) @@ -104,7 +104,7 @@ static int crawl_formatted_mpr(lua_State *ls) formatted_mpr(formatted_string::parse_string(message), static_cast<msg_channel_type>(ch)); - return (0); + return 0; } /* @@ -114,7 +114,7 @@ LUAFN(crawl_stderr) { const char *text = luaL_checkstring(ls, 1); fprintf(stderr, "%s\n", text); - return (0); + return 0; } /* @@ -127,7 +127,7 @@ LUAFN(crawl_dpr) if (crawl_state.io_inited) dprf("%s", text); #endif - return (0); + return 0; } /* @@ -159,11 +159,11 @@ static int crawl_set_more_autoclear(lua_State *ls) if (lua_isnone(ls, 1)) { luaL_argerror(ls, 1, "needs a boolean argument"); - return (0); + return 0; } set_more_autoclear(lua_toboolean(ls, 1)); - return (0); + return 0; } /* @@ -174,11 +174,11 @@ static int crawl_enable_more(lua_State *ls) if (lua_isnone(ls, 1)) { luaL_argerror(ls, 1, "needs a boolean argument"); - return (0); + return 0; } crawl_state.show_more_prompt = lua_toboolean(ls, 1); - return (0); + return 0; } /* @@ -196,7 +196,7 @@ static int crawl_c_input_line(lua_State *ls) lua_pushstring(ls, linebuf); else lua_pushnil(ls); - return (1); + return 1; } /* @@ -243,7 +243,7 @@ static int crawl_yesno(lua_State *ls) lua_pushboolean(ls, yesno(prompt, safe, safeanswer, clear_after, interrupt_delays, noprompt)); - return (1); + return 1; } /* @@ -266,7 +266,7 @@ static int crawl_yesnoquit(lua_State *ls) lua_pushnumber(ls, yesnoquit(prompt, safe, safeanswer, allow_all, clear_after)); - return (1); + return 1; } static void crawl_sendkeys_proc(lua_State *ls, int argi) @@ -308,7 +308,7 @@ static int crawl_sendkeys(lua_State *ls) int top = lua_gettop(ls); for (int i = 1; i <= top; ++i) crawl_sendkeys_proc(ls, i); - return (0); + return 0; } /* @@ -330,7 +330,7 @@ static int crawl_process_command(lua_State *ls) } lua_pushboolean(ls, will_process); - return (1); + return 1; } /* @@ -343,13 +343,13 @@ static int crawl_process_keys(lua_State *ls) { luaL_error(ls, "Cannot currently process new keys (%s delay active)", delay_name(current_delay)); - return (0); + return 0; } if (you.turn_is_over) { luaL_error(ls, "Cannot currently process new keys (turn is over)"); - return (0); + return 0; } const char* keys = luaL_checkstring(ls, 1); @@ -357,7 +357,7 @@ static int crawl_process_keys(lua_State *ls) if (strlen(keys) == 0) { luaL_argerror(ls, 1, "Must have at least one key to process."); - return (0); + return 0; } command_type cmd = key_to_command(keys[0], KMC_DEFAULT); @@ -365,7 +365,7 @@ static int crawl_process_keys(lua_State *ls) if (cmd == CMD_NO_CMD) { luaL_argerror(ls, 1, "First key is invalid command"); - return (0); + return 0; } flush_input_buffer(FLUSH_BEFORE_COMMAND); @@ -374,7 +374,7 @@ static int crawl_process_keys(lua_State *ls) process_command(cmd); - return (0); + return 0; } /* @@ -385,9 +385,9 @@ static int crawl_playsound(lua_State *ls) { const char *sf = luaL_checkstring(ls, 1); if (!sf) - return (0); + return 0; play_sound(sf); - return (0); + return 0; } /* @@ -398,9 +398,9 @@ static int crawl_runmacro(lua_State *ls) { const char *macroname = luaL_checkstring(ls, 1); if (!macroname) - return (0); + return 0; run_macro(macroname); - return (0); + return 0; } /* @@ -410,7 +410,7 @@ function setopt(s) */ static int crawl_setopt(lua_State *ls) { if (!lua_isstring(ls, 1)) - return (0); + return 0; const char *s = lua_tostring(ls, 1); if (s) @@ -419,7 +419,7 @@ static int crawl_setopt(lua_State *ls) read_options(s, true); } - return (0); + return 0; } /* @@ -429,11 +429,11 @@ function read_options(filename) */ static int crawl_read_options(lua_State *ls) { if (!lua_isstring(ls, 1)) - return (0); + return 0; const char* filename = lua_tostring(ls, 1); Options.include(filename, true, true); - return (0); + return 0; } static int crawl_bindkey(lua_State *ls) @@ -443,7 +443,7 @@ static int crawl_bindkey(lua_State *ls) s = lua_tostring(ls, 1); if (!s || !lua_isfunction(ls, 2) || lua_gettop(ls) != 2) - return (0); + return 0; lua_pushvalue(ls, 2); std::string name = clua.setuniqregistry(); @@ -453,20 +453,20 @@ static int crawl_bindkey(lua_State *ls) lua_settop(ls, 2); } macro_userfn(s, name.c_str()); - return (0); + return 0; } static int crawl_msgch_num(lua_State *ls) { const char *s = luaL_checkstring(ls, 1); if (!s) - return (0); + return 0; int ch = str_to_channel(s); if (ch == -1) - return (0); + return 0; lua_pushnumber(ls, ch); - return (1); + return 1; } static int crawl_msgch_name(lua_State *ls) @@ -474,21 +474,21 @@ static int crawl_msgch_name(lua_State *ls) int num = luaL_checkint(ls, 1); std::string name = channel_to_str(num); lua_pushstring(ls, name.c_str()); - return (1); + return 1; } static int crawl_take_note(lua_State *ls) { const char* msg = luaL_checkstring(ls, 1); take_note(Note(NOTE_MESSAGE, 0, 0, msg)); - return (0); + return 0; } static int crawl_messages(lua_State *ls) { const int count = luaL_checkint(ls, 1); lua_pushstring(ls, get_last_messages(count).c_str()); - return (1); + return 1; } #define REGEX_METATABLE "crawl.regex" @@ -498,7 +498,7 @@ static int crawl_regex(lua_State *ls) { const char *s = luaL_checkstring(ls, 1); if (!s) - return (0); + return 0; text_pattern **tpudata = @@ -506,9 +506,9 @@ static int crawl_regex(lua_State *ls) if (tpudata) { *tpudata = new text_pattern(s); - return (1); + return 1; } - return (0); + return 0; } static int crawl_regex_find(lua_State *ls) @@ -516,14 +516,14 @@ static int crawl_regex_find(lua_State *ls) text_pattern **pattern = clua_get_userdata< text_pattern* >(ls, REGEX_METATABLE); if (!pattern) - return (0); + return 0; const char *text = luaL_checkstring(ls, -1); if (!text) - return (0); + return 0; lua_pushboolean(ls, (*pattern)->matches(text)); - return (1); + return 1; } static const luaL_reg crawl_regex_ops[] = @@ -536,7 +536,7 @@ static int crawl_message_filter(lua_State *ls) { const char *pattern = luaL_checkstring(ls, 1); if (!pattern) - return (0); + return 0; int num = lua_isnumber(ls, 2)? luaL_checkint(ls, 2) : -1; message_filter **mf = @@ -544,9 +544,9 @@ static int crawl_message_filter(lua_State *ls) if (mf) { *mf = new message_filter(num, pattern); - return (1); + return 1; } - return (0); + return 0; } static int crawl_messf_matches(lua_State *ls) @@ -554,7 +554,7 @@ static int crawl_messf_matches(lua_State *ls) message_filter **mf = clua_get_userdata< message_filter* >(ls, MESSF_METATABLE); if (!mf) - return (0); + return 0; const char *pattern = luaL_checkstring(ls, 2); int ch = luaL_checkint(ls, 3); @@ -562,9 +562,9 @@ static int crawl_messf_matches(lua_State *ls) { bool filt = (*mf)->is_filtered(ch, pattern); lua_pushboolean(ls, filt); - return (1); + return 1; } - return (0); + return 0; } static const luaL_reg crawl_messf_ops[] = @@ -577,11 +577,11 @@ static int crawl_trim(lua_State *ls) { const char *s = luaL_checkstring(ls, 1); if (!s) - return (0); + return 0; std::string text = s; trim_string(text); lua_pushstring(ls, text.c_str()); - return (1); + return 1; } static int crawl_split(lua_State *ls) @@ -589,7 +589,7 @@ static int crawl_split(lua_State *ls) const char *s = luaL_checkstring(ls, 1), *token = luaL_checkstring(ls, 2); if (!s || !token) - return (0); + return 0; std::vector<std::string> segs = split_string(token, s); lua_newtable(ls); @@ -598,7 +598,7 @@ static int crawl_split(lua_State *ls) lua_pushstring(ls, segs[i].c_str()); lua_rawseti(ls, -2, i + 1); } - return (1); + return 1; } static int _crawl_grammar(lua_State *ls) @@ -621,7 +621,7 @@ static int crawl_article_a(lua_State *ls) lua_pushstring(ls, article_a(s, lowercase).c_str()); - return (1); + return 1; } LUARET1(crawl_game_started, boolean, crawl_state.need_save) @@ -647,7 +647,7 @@ static int crawl_is_tiles(lua_State *ls) { lua_pushboolean(ls, is_tiles()); - return (1); + return 1; } static int crawl_is_webtiles(lua_State *ls) @@ -658,7 +658,7 @@ static int crawl_is_webtiles(lua_State *ls) lua_pushboolean(ls, false); #endif - return (1); + return 1; } static int crawl_get_command(lua_State *ls) @@ -666,7 +666,7 @@ static int crawl_get_command(lua_State *ls) if (lua_gettop(ls) == 0) { lua_pushnil(ls); - return (1); + return 1; } const command_type cmd = name_to_command(luaL_checkstring(ls, 1)); @@ -676,7 +676,7 @@ static int crawl_get_command(lua_State *ls) cmd_name = "<<"; lua_pushstring(ls, cmd_name.c_str()); - return (1); + return 1; } LUAWRAP(crawl_endgame, screen_end_game(luaL_checkstring(ls, 1))) @@ -786,7 +786,7 @@ static int crawl_call_dlua(lua_State *ls) const char* code = luaL_checkstring(ls, 1); if (!code) - return (0); + return 0; luaL_loadbuffer(dlua, code, strlen(code), "call_dlua"); int status = lua_pcall(dlua, 0, LUA_MULTRET, 0); @@ -916,13 +916,13 @@ LUAFN(_crawl_milestone) mark_milestone(luaL_checkstring(ls, 1), luaL_checkstring(ls, 2), lua_toboolean(ls, 3)); - return (0); + return 0; } LUAFN(_crawl_redraw_view) { viewwindow(); - return (0); + return 0; } LUAFN(_crawl_redraw_stats) @@ -939,7 +939,7 @@ LUAFN(_crawl_redraw_stats) you.redraw_status_flags = 0xFFFFFFFF; print_stats(); - return (0); + return 0; } @@ -954,7 +954,7 @@ LUAFN(_crawl_millis) strerror(error)).c_str()); lua_pushnumber(ls, tv.tv_sec * 1000 + tv.tv_usec / 1000); - return (1); + return 1; } #endif @@ -984,7 +984,7 @@ LUARET1(crawl_make_name, string, _crawl_make_name(ls).c_str()) static int _crawl_god_speaks(lua_State *ls) { if (!crawl_state.io_inited) - return (0); + return 0; const char *god_name = luaL_checkstring(ls, 1); if (!god_name) @@ -1002,10 +1002,10 @@ static int _crawl_god_speaks(lua_State *ls) const char *message = luaL_checkstring(ls, 2); if (!message) - return (0); + return 0; god_speaks(god, message); - return (0); + return 0; } LUAFN(_crawl_set_max_runes) @@ -1015,7 +1015,7 @@ LUAFN(_crawl_set_max_runes) luaL_error(ls, make_stringf("Bad number of max runes: %d", max_runes).c_str()); else you.obtainable_runes = max_runes; - return (0); + return 0; } LUAWRAP(_crawl_mark_game_won, crawl_state.mark_last_game_won()) diff --git a/crawl-ref/source/l_debug.cc b/crawl-ref/source/l_debug.cc index 01bf3d81d9..c764727cac 100644 --- a/crawl-ref/source/l_debug.cc +++ b/crawl-ref/source/l_debug.cc @@ -57,7 +57,7 @@ LUAFN(debug_goto_place) { luaL_error(ls, err.c_str()); } - return (0); + return 0; } LUAFN(debug_enter_dungeon) @@ -68,7 +68,7 @@ LUAFN(debug_enter_dungeon) you.depth = 1; load_level(DNGN_STONE_STAIRS_DOWN_I, LOAD_START_GAME, level_id()); - return (0); + return 0; } LUAWRAP(debug_down_stairs, down_stairs(DNGN_STONE_STAIRS_DOWN_I)) @@ -78,7 +78,7 @@ LUAFN(debug_flush_map_memory) { dgn_flush_map_memory(); init_level_connectivity(); - return (0); + return 0; } LUAFN(debug_generate_level) @@ -90,7 +90,7 @@ LUAFN(debug_generate_level) tile_clear_flavour(); tile_new_level(true); builder(lua_isboolean(ls, 1)? lua_toboolean(ls, 1) : true); - return (0); + return 0; } LUAFN(debug_reveal_mimics) @@ -98,13 +98,13 @@ LUAFN(debug_reveal_mimics) for (rectangle_iterator ri(1); ri; ++ri) if (mimic_at(*ri)) discover_mimic(*ri, false); - return (0); + return 0; } LUAFN(debug_los_changed) { los_changed(); - return (0); + return 0; } LUAFN(debug_dump_map) @@ -112,7 +112,7 @@ LUAFN(debug_dump_map) const int pos = lua_isuserdata(ls, 1) ? 2 : 1; if (lua_isstring(ls, pos)) dump_map(lua_tostring(ls, pos), true); - return (0); + return 0; } LUAFN(_debug_test_explore) @@ -120,7 +120,7 @@ LUAFN(_debug_test_explore) #ifdef WIZARD debug_test_explore(); #endif - return (0); + return 0; } LUAFN(debug_bouncy_beam) @@ -156,7 +156,7 @@ LUAFN(debug_bouncy_beam) beam.fire(); - return (0); + return 0; } // If menv[] is full, dismiss all monsters not near the player. @@ -166,7 +166,7 @@ LUAFN(debug_cull_monsters) { if (menv[il].type == MONS_NO_MONSTER) // At least one empty space in menv - return (0); + return 0; } mpr("menv[] is full, dismissing non-near monsters", @@ -182,7 +182,7 @@ LUAFN(debug_cull_monsters) monster_die(*mi, KILL_DISMISSED, NON_MONSTER); } - return (0); + return 0; } LUAFN(debug_dismiss_adjacent) @@ -198,7 +198,7 @@ LUAFN(debug_dismiss_adjacent) } } - return (0); + return 0; } LUAFN(debug_dismiss_monsters) @@ -212,7 +212,7 @@ LUAFN(debug_dismiss_monsters) } } - return (0); + return 0; } LUAFN(debug_god_wrath) @@ -234,17 +234,17 @@ LUAFN(debug_god_wrath) bool no_bonus = lua_toboolean(ls, 2); divine_retribution(god, no_bonus); - return (0); + return 0; } LUAFN(debug_handle_monster_move) { MonsterWrap *mw = clua_get_userdata< MonsterWrap >(ls, MONS_METATABLE); if (!mw || !mw->mons) - return (0); + return 0; handle_monster_move(mw->mons); - return (0); + return 0; } static FixedVector<bool, NUM_MONSTERS> saved_uniques; @@ -252,13 +252,13 @@ static FixedVector<bool, NUM_MONSTERS> saved_uniques; LUAFN(debug_save_uniques) { saved_uniques = you.unique_creatures; - return (0); + return 0; } LUAFN(debug_reset_uniques) { you.unique_creatures.init(false); - return (0); + return 0; } LUAFN(debug_randomize_uniques) @@ -270,7 +270,7 @@ LUAFN(debug_randomize_uniques) continue; you.unique_creatures[mt] = coinflip(); } - return (0); + return 0; } // Compare list of uniques on current level with @@ -304,25 +304,25 @@ static bool _check_uniques() ret = false; } } - return (ret); + return ret; } LUAFN(debug_check_uniques) { lua_pushboolean(ls, _check_uniques()); - return (1); + return 1; } LUAFN(debug_viewwindow) { viewwindow(lua_toboolean(ls, 1)); - return (0); + return 0; } LUAFN(debug_seen_monsters_react) { seen_monsters_react(); - return (0); + return 0; } static const char* disablements[] = @@ -349,12 +349,12 @@ LUAFN(debug_disable) if (lua_isboolean(ls, 2)) onoff = lua_toboolean(ls, 2); crawl_state.disables.set(dis, onoff); - return (0); + return 0; } luaL_argerror(ls, 1, make_stringf("unknown thing to disable: %s", what).c_str()); - return (0); + return 0; } const struct luaL_reg debug_dlib[] = diff --git a/crawl-ref/source/l_dgn.cc b/crawl-ref/source/l_dgn.cc index 28eec1a6a2..d347329bbc 100644 --- a/crawl-ref/source/l_dgn.cc +++ b/crawl-ref/source/l_dgn.cc @@ -50,7 +50,7 @@ std::string dgn_set_default_depth(const std::string &s) } catch (const std::string &error) { - return (error); + return error; } return (""); } @@ -79,12 +79,12 @@ static int dgn_depth_proc(lua_State *ls, depth_ranges &dr, int s) if (lua_isnil(ls, s)) { dr.clear(); - return (0); + return 0; } dr.clear(); dgn_add_depths(dr, ls, s, lua_gettop(ls)); - return (0); + return 0; } static int dgn_default_depth(lua_State *ls) @@ -185,7 +185,7 @@ static int dgn_lflags(lua_State *ls) luaL_argerror(ls, 2, error.c_str()); } - return (0); + return 0; } static int dgn_change_level_flags(lua_State *ls) @@ -201,7 +201,7 @@ static int dgn_change_level_flags(lua_State *ls) { luaL_argerror(ls, 2, error.c_str()); lua_pushboolean(ls, false); - return (1); + return 1; } bool silent = lua_toboolean(ls, 2); @@ -211,7 +211,7 @@ static int dgn_change_level_flags(lua_State *ls) lua_pushboolean(ls, changed1 || changed2); - return (1); + return 1; } static void _chance_magnitude_check(lua_State *ls, int which_par, int chance) @@ -256,7 +256,7 @@ static int dgn_depth_chance(lua_State *ls) { luaL_error(ls, error.c_str()); } - return (0); + return 0; } #define WEIGHT(ls, n, weight) \ @@ -331,7 +331,7 @@ int dgn_map_add_transform(lua_State *ls, } } - return (0); + return 0; } static int dgn_shuffle(lua_State *ls) @@ -358,7 +358,7 @@ static int dgn_normalise(lua_State *ls) { MAP(ls, 1, map); map->map.normalise(); - return (0); + return 0; } static int dgn_map(lua_State *ls) @@ -370,7 +370,7 @@ static int dgn_map(lua_State *ls) if (lua_isnil(ls, 2)) { map->map.clear(); - return (0); + return 0; } // map(<map>, x, y) = glyph at (x,y), subject to map being @@ -382,13 +382,13 @@ static int dgn_map(lua_State *ls) char buf[2] = ""; buf[0] = gly; lua_pushstring(ls, buf); - return (1); + return 1; } if (lua_isstring(ls, 2)) { map->map.add_line(luaL_checkstring(ls, 2)); - return (0); + return 0; } std::vector<std::string> &lines = map->map.get_lines(); @@ -415,7 +415,7 @@ static int dgn_map(lua_State *ls) lines.erase(lines.begin() + which_line); PLUARET(boolean, true); } - return (0); + return 0; } const std::string newline = luaL_checkstring(ls, 3); @@ -426,25 +426,25 @@ static int dgn_map(lua_State *ls) if (which_line < (int) lines.size()) { lines[which_line] = newline; - return (0); + return 0; } lines.reserve(which_line + 1); lines.resize(which_line + 1, ""); lines[which_line] = newline; - return (0); + return 0; } static int dgn_mons(lua_State *ls) { MAP(ls, 1, map); if (lua_gettop(ls) == 1) - return (0); + return 0; if (lua_isnil(ls, 2)) { map->mons.clear(); - return (0); + return 0; } if (lua_isstring(ls, 2)) @@ -452,26 +452,26 @@ static int dgn_mons(lua_State *ls) std::string err = map->mons.add_mons(luaL_checkstring(ls, 2)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } const int index = luaL_checkint(ls, 2); std::string err = map->mons.set_mons(index, luaL_checkstring(ls, 3)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_item(lua_State *ls) { MAP(ls, 1, map); if (lua_gettop(ls) == 1) - return (0); + return 0; if (lua_isnil(ls, 2)) { map->items.clear(); - return (0); + return 0; } if (lua_isstring(ls, 2)) @@ -479,14 +479,14 @@ static int dgn_item(lua_State *ls) std::string err = map->items.add_item(luaL_checkstring(ls, 2)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } const int index = luaL_checkint(ls, 2); std::string err = map->items.set_item(index, luaL_checkstring(ls, 3)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_lua_marker(lua_State *ls) @@ -506,18 +506,18 @@ static int dgn_lua_marker(lua_State *ls) if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_marker(lua_State *ls) { MAP(ls, 1, map); if (lua_gettop(ls) == 1) - return (0); + return 0; if (lua_isnil(ls, 2)) { map->map.clear_markers(); - return (0); + return 0; } if (lua_isstring(ls, 2)) @@ -526,7 +526,7 @@ static int dgn_marker(lua_State *ls) if (!err.empty()) luaL_error(ls, err.c_str()); } - return (0); + return 0; } static int dgn_kfeat(lua_State *ls) @@ -535,7 +535,7 @@ static int dgn_kfeat(lua_State *ls) std::string err = map->map.add_key_feat(luaL_checkstring(ls, 2)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_kmons(lua_State *ls) @@ -544,7 +544,7 @@ static int dgn_kmons(lua_State *ls) std::string err = map->map.add_key_mons(luaL_checkstring(ls, 2)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_kitem(lua_State *ls) @@ -553,7 +553,7 @@ static int dgn_kitem(lua_State *ls) std::string err = map->map.add_key_item(luaL_checkstring(ls, 2)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_kmask(lua_State *ls) @@ -562,7 +562,7 @@ static int dgn_kmask(lua_State *ls) std::string err = map->map.add_key_mask(luaL_checkstring(ls, 2)); if (!err.empty()) luaL_error(ls, err.c_str()); - return (0); + return 0; } static int dgn_kprop(lua_State *ls) @@ -580,7 +580,7 @@ static int dgn_map_size(lua_State *ls) MAP(ls, 1, map); lua_pushnumber(ls, map->map.width()); lua_pushnumber(ls, map->map.height()); - return (2); + return 2; } static int dgn_subvault(lua_State *ls) @@ -601,7 +601,7 @@ static int dgn_subvault(lua_State *ls) } } - return (0); + return 0; } static int dgn_name(lua_State *ls) @@ -668,9 +668,9 @@ static int dgn_gly_point(lua_State *ls) if (c.x != -1 && c.y != -1) { dlua_push_coordinates(ls, c); - return (2); + return 2; } - return (0); + return 0; } static int dgn_gly_points(lua_State *ls) @@ -690,7 +690,7 @@ static int dgn_original_map(lua_State *ls) clua_push_map(ls, map->original); else lua_pushnil(ls); - return (1); + return 1; } static int dgn_load_des_file(lua_State *ls) @@ -698,7 +698,7 @@ static int dgn_load_des_file(lua_State *ls) const std::string &file = luaL_checkstring(ls, 1); if (!file.empty()) read_map(file); - return (0); + return 0; } static int dgn_lfloorcol(lua_State *ls) @@ -725,7 +725,7 @@ static int dgn_lfloorcol(lua_State *ls) luaL_argerror(ls, 2, error.c_str()); - return (0); + return 0; } map->floor_colour = colour; } @@ -756,7 +756,7 @@ static int dgn_lrockcol(lua_State *ls) luaL_argerror(ls, 2, error.c_str()); - return (0); + return 0; } map->rock_colour = colour; @@ -792,7 +792,7 @@ static int _lua_colour(lua_State *ls, int ndx, error = std::string("Unknown colour: '") + s + "'"; return luaL_argerror(ls, 1, error.c_str()); } - return (colour); + return colour; } return luaL_argerror(ls, ndx, "Expected colour name or number"); } @@ -806,7 +806,7 @@ static int dgn_change_floor_colour(lua_State *ls) if (crawl_state.need_save && update_now) viewwindow(); - return (0); + return 0; } static int dgn_change_rock_colour(lua_State *ls) @@ -818,7 +818,7 @@ static int dgn_change_rock_colour(lua_State *ls) if (crawl_state.need_save && update_now) viewwindow(); - return (0); + return 0; } static int dgn_colour_at(lua_State *ls) @@ -843,7 +843,7 @@ static int dgn_register_listener(lua_State *ls) } dungeon_events.register_listener(mask, listener, pos); - return (0); + return 0; } static int dgn_remove_listener(lua_State *ls) @@ -858,14 +858,14 @@ static int dgn_remove_listener(lua_State *ls) pos.y = luaL_checkint(ls, 3); } dungeon_events.remove_listener(listener, pos); - return (0); + return 0; } static int dgn_remove_marker(lua_State *ls) { MAPMARKER(ls, 1, mark); env.markers.remove(mark); - return (0); + return 0; } static int dgn_num_matching_markers(lua_State *ls) @@ -901,7 +901,7 @@ static int dgn_terrain_changed(lua_State *ls) luaL_checkint(ls, 2)), type, affect_player, preserve_features, preserve_items); - return (0); + return 0; } static int dgn_fprop_changed(lua_State *ls) @@ -933,7 +933,7 @@ static int dgn_fprop_changed(lua_State *ls) else lua_pushboolean(ls, false); - return (1); + return 1; } static int dgn_fprop_at(lua_State *ls) @@ -952,7 +952,7 @@ static int dgn_fprop_at(lua_State *ls) else lua_pushboolean(ls, false); - return (1); + return 1; } static int dgn_cloud_at(lua_State *ls) @@ -960,7 +960,7 @@ static int dgn_cloud_at(lua_State *ls) COORDS(c, 1, 2); if (!in_bounds(c)) - return (0); + return 0; int cloudno = env.cgrid(c); @@ -969,7 +969,7 @@ static int dgn_cloud_at(lua_State *ls) else lua_pushstring(ls, cloud_name_at_index(cloudno).c_str()); - return (1); + return 1; } @@ -978,7 +978,7 @@ static int lua_dgn_set_branch_epilogue(lua_State *ls) const char *branch_name = luaL_checkstring(ls, 1); if (!branch_name) - return (0); + return 0; branch_type br = str_to_branch(branch_name); if (br == NUM_BRANCHES) @@ -990,11 +990,11 @@ static int lua_dgn_set_branch_epilogue(lua_State *ls) const char *func_name = luaL_checkstring(ls, 2); if (!func_name || !*func_name) - return (0); + return 0; dgn_set_branch_epilogue(br, func_name); - return (0); + return 0; } // XXX: Currently, this is hacked so that map_def->border_fill_type is marshalled @@ -1022,7 +1022,7 @@ static int lua_dgn_set_border_fill_type(lua_State *ls) luaL_error(ls, ("set_border_fill_type cannot be the feature '" + fill_string +"'.").c_str()); - return (0); + return 0; } static int lua_dgn_set_feature_name(lua_State *ls) @@ -1042,7 +1042,7 @@ static int lua_dgn_set_feature_name(lua_State *ls) map->feat_renames[feat_type] = luaL_checkstring(ls, 3); - return (0); + return 0; } static int dgn_floor_halo(lua_State *ls) @@ -1096,7 +1096,7 @@ static int dgn_floor_halo(lua_State *ls) unsigned int tile = get_tile_idx(ls, 3); if (!tile) - return (0); + return 0; if (tile_dngn_count(tile) != 9) { error += "'"; @@ -1105,12 +1105,12 @@ static int dgn_floor_halo(lua_State *ls) error += tile_dngn_count(tile); error += " variations, but needs exactly 9."; luaL_argerror(ls, 3, error.c_str()); - return (0); + return 0; } tile_floor_halo(target, tile); - return (0); + return 0; } #define SQRT_2 1.41421356237309504880 @@ -1131,12 +1131,12 @@ static int dgn_random_walk(lua_State *ls) char buf[80]; sprintf(buf, "Point (%d,%d) isn't in bounds.", x, y); luaL_argerror(ls, 1, buf); - return (0); + return 0; } if (dist < 1) { luaL_argerror(ls, 3, "Distance must be positive."); - return (0); + return 0; } float dist_left = dist; @@ -1176,7 +1176,7 @@ static int dgn_random_walk(lua_State *ls) dlua_push_coordinates(ls, pos); - return (2); + return 2; } static cloud_type dgn_cloud_name_to_type(std::string name) @@ -1184,15 +1184,15 @@ static cloud_type dgn_cloud_name_to_type(std::string name) lowercase(name); if (name == "random") - return (CLOUD_RANDOM); + return CLOUD_RANDOM; else if (name == "debugging") - return (CLOUD_DEBUGGING); + return CLOUD_DEBUGGING; for (int i = CLOUD_NONE; i < CLOUD_RANDOM; i++) if (cloud_type_name(static_cast<cloud_type>(i)) == name) return static_cast<cloud_type>(i); - return (CLOUD_NONE); + return CLOUD_NONE; } static kill_category dgn_kill_name_to_category(std::string name) @@ -1255,37 +1255,37 @@ static int dgn_apply_area_cloud(lua_State *ls) char buf[80]; sprintf(buf, "Point (%d,%d) isn't in bounds.", x, y); luaL_argerror(ls, 1, buf); - return (0); + return 0; } if (lua_cloud_pow_min < 0) { luaL_argerror(ls, 4, "pow_min must be non-negative"); - return (0); + return 0; } if (lua_cloud_pow_max < lua_cloud_pow_min) { luaL_argerror(ls, 5, "pow_max must not be less than pow_min"); - return (0); + return 0; } if (lua_cloud_pow_max == 0) { luaL_argerror(ls, 5, "pow_max must be positive"); - return (0); + return 0; } if (lua_cloud_pow_rolls <= 0) { luaL_argerror(ls, 6, "pow_rolls must be positive"); - return (0); + return 0; } if (size < 1) { luaL_argerror(ls, 4, "size must be positive."); - return (0); + return 0; } if (ctype == CLOUD_NONE) @@ -1294,7 +1294,7 @@ static int dgn_apply_area_cloud(lua_State *ls) error += luaL_checkstring(ls, 7); error += "'"; luaL_argerror(ls, 7, error.c_str()); - return (0); + return 0; } if (kc == KC_NCATEGORIES || kc != KC_OTHER) @@ -1303,21 +1303,21 @@ static int dgn_apply_area_cloud(lua_State *ls) error += kname; error += "'"; luaL_argerror(ls, 8, error.c_str()); - return (0); + return 0; } if (spread_rate < -1 || spread_rate > 100) { luaL_argerror(ls, 9, "spread_rate must be between -1 and 100," "inclusive"); - return (0); + return 0; } apply_area_cloud(make_a_lua_cloud, coord_def(x, y), 0, size, ctype, 0, spread_rate, colour, name, tile, excl_rad); - return (0); + return 0; } static int dgn_delete_cloud(lua_State *ls) @@ -1327,7 +1327,7 @@ static int dgn_delete_cloud(lua_State *ls) if (in_bounds(c) && env.cgrid(c) != EMPTY_CLOUD) delete_cloud(env.cgrid(c)); - return (0); + return 0; } static int dgn_place_cloud(lua_State *ls) @@ -1352,7 +1352,7 @@ static int dgn_place_cloud(lua_State *ls) char buf[80]; sprintf(buf, "Point (%d,%d) isn't in bounds.", x, y); luaL_argerror(ls, 1, buf); - return (0); + return 0; } if (ctype == CLOUD_NONE) @@ -1361,7 +1361,7 @@ static int dgn_place_cloud(lua_State *ls) error += luaL_checkstring(ls, 3); error += "'"; luaL_argerror(ls, 3, error.c_str()); - return (0); + return 0; } if (kc == KC_NCATEGORIES || kc != KC_OTHER) @@ -1370,19 +1370,19 @@ static int dgn_place_cloud(lua_State *ls) error += kname; error += "'"; luaL_argerror(ls, 5, error.c_str()); - return (0); + return 0; } if (spread_rate < -1 || spread_rate > 100) { luaL_argerror(ls, 6, "spread_rate must be between -1 and 100," "inclusive"); - return (0); + return 0; } place_cloud(ctype, coord_def(x, y), cl_range, 0, spread_rate, colour, name, tile, excl_rad); - return (0); + return 0; } @@ -1395,14 +1395,14 @@ LUAFN(dgn_noisy) noisy(loudness, pos); - return (0); + return 0; } static int _dgn_is_passable(lua_State *ls) { COORDS(c, 1, 2); lua_pushboolean(ls, dgn_square_travel_ok(c)); - return (1); + return 1; } static int dgn_register_feature_marker(lua_State *ls) @@ -1410,13 +1410,13 @@ static int dgn_register_feature_marker(lua_State *ls) COORDS(c, 1, 2); FEAT(feat, 3); env.markers.add(new map_feature_marker(c, feat)); - return (0); + return 0; } static int _dgn_map_register_flag(lua_State *ls) { map_register_flag(luaL_checkstring(ls, 1)); - return (0); + return 0; } static int dgn_register_lua_marker(lua_State *ls) @@ -1429,7 +1429,7 @@ static int dgn_register_lua_marker(lua_State *ls) map_marker *marker = new map_lua_marker(table); marker->pos = c; env.markers.add(marker); - return (0); + return 0; } static std::auto_ptr<lua_datum> _dgn_map_safe_bounds_fn; @@ -1459,7 +1459,7 @@ static bool _lua_map_place_valid(const map_def &map, if (err) { mprf(MSGCH_ERROR, "Lua error: %s", lua_tostring(ls, -1)); - return (true); + return true; } return (lua_toboolean(ls, -1)); @@ -1494,7 +1494,7 @@ LUAFN(dgn_with_map_bounds_fn) if (err) lua_error(ls); - return (1); + return 1; } // Accepts any number of point coordinates and a function, binds the @@ -1525,7 +1525,7 @@ LUAFN(dgn_with_map_anchors) } if (err) lua_error(ls); - return (1); + return 1; } static int _lua_push_map(lua_State *ls, const map_def *map) @@ -1534,7 +1534,7 @@ static int _lua_push_map(lua_State *ls, const map_def *map) clua_push_map(ls, const_cast<map_def*>(map)); else lua_pushnil(ls); - return (1); + return 1; } LUAFN(dgn_map_by_tag) @@ -1544,7 +1544,7 @@ LUAFN(dgn_map_by_tag) const bool check_depth = _lua_boolean(ls, 3, true); return _lua_push_map(ls, random_map_for_tag(tag, check_depth)); } - return (0); + return 0; } LUAFN(dgn_map_by_name) @@ -1552,7 +1552,7 @@ LUAFN(dgn_map_by_name) if (const char *name = luaL_checkstring(ls, 1)) return _lua_push_map(ls, find_map_by_name(name)); - return (0); + return 0; } LUAFN(dgn_map_in_depth) @@ -1590,7 +1590,7 @@ LUAFN(_dgn_place_map) { lua_pushnil(ls); } - return (1); + return 1; } LUAFN(_dgn_in_vault) @@ -1598,7 +1598,7 @@ LUAFN(_dgn_in_vault) GETCOORD(c, 1, 2, map_bounds); const int mask = lua_isnone(ls, 3) ? MMT_VAULT : lua_tointeger(ls, 3); lua_pushboolean(ls, env.level_map_mask(c) & mask); - return (1); + return 1; } LUAFN(_dgn_map_parameters) @@ -1641,7 +1641,7 @@ LUAFN(_dgn_find_marker_position_by_prop) lua_pushnil(ls); lua_pushnil(ls); } - return (2); + return 2; } LUAFN(_dgn_find_marker_positions_by_prop) @@ -1653,13 +1653,13 @@ LUAFN(_dgn_find_marker_positions_by_prop) const std::vector<coord_def> places = find_marker_positions_by_prop(prop, value, limit); clua_gentable(ls, places, clua_pushpoint); - return (1); + return 1; } static int _push_mapmarker(lua_State *ls, map_marker *marker) { dlua_push_userdata(ls, marker, MAPMARK_METATABLE); - return (1); + return 1; } LUAFN(_dgn_find_markers_by_prop) @@ -1671,7 +1671,7 @@ LUAFN(_dgn_find_markers_by_prop) const std::vector<map_marker*> places = find_markers_by_prop(prop, value, limit); clua_gentable(ls, places, _push_mapmarker); - return (1); + return 1; } LUAFN(_dgn_marker_at_pos) @@ -1688,14 +1688,14 @@ LUAFN(_dgn_marker_at_pos) else _push_mapmarker(ls, marker); - return (1); + return 1; } LUAFN(dgn_is_validating) { MAP(ls, 1, map); lua_pushboolean(ls, map->is_validating()); - return (1); + return 1; } LUAFN(_dgn_resolve_map) @@ -1703,7 +1703,7 @@ LUAFN(_dgn_resolve_map) if (lua_isnil(ls, 1)) { lua_pushnil(ls); - return (1); + return 1; } MAP(ls, 1, map); @@ -1725,7 +1725,7 @@ LUAFN(_dgn_resolve_map) lua_pushnil(ls); lua_pushnil(ls); } - return (2); + return 2; } LUAFN(_dgn_reuse_map) @@ -1761,7 +1761,7 @@ LUAFN(_dgn_reuse_map) if (register_place) dgn_register_place(vp, register_vault); - return (0); + return 0; } LUAWRAP(_dgn_reset_level, dgn_reset_level()) @@ -1788,13 +1788,13 @@ LUAFN(dgn_fill_grd_area) for (int x = x1; x <= x2; x++) grd[x][y] = feat; - return (0); + return 0; } LUAFN(dgn_apply_tide) { shoals_apply_tides(0, true, true); - return (0); + return 0; } const struct luaL_reg dgn_dlib[] = diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc index cbe56270d9..ae70244a80 100644 --- a/crawl-ref/source/l_dgnbld.cc +++ b/crawl-ref/source/l_dgnbld.cc @@ -35,7 +35,7 @@ static int _table_int(lua_State *ls, int idx, const char *name, int defval) luaL_error(ls, "'%s' in table, but not an int.", name); int ret = (!nil && valid ? luaL_checkint(ls, idx) : defval); lua_pop(ls, 1); - return (ret); + return ret; } // Return the character stored in the table (on the stack) with the key name. @@ -61,7 +61,7 @@ static char _table_char(lua_State *ls, int idx, const char *name, char defval) luaL_error(ls, "'%s' has more than one character.", name); } lua_pop(ls, 1); - return (ret); + return ret; } // Return the string stored in the table (on the stack) with the key name. @@ -78,7 +78,7 @@ static const char* _table_str(lua_State *ls, int idx, const char *name, const ch luaL_error(ls, "'%s' in table, but not a string.", name); const char *ret = (!nil && valid ? lua_tostring(ls, idx) : defval); lua_pop(ls, 1); - return (ret); + return ret; } // Return the boolean stored in the table (on the stack) with the key name. @@ -95,7 +95,7 @@ static bool _table_bool(lua_State *ls, int idx, const char *name, bool defval) luaL_error(ls, "'%s' in table, but not a bool.", name); bool ret = (!nil && valid ? lua_toboolean(ls, idx) : defval); lua_pop(ls, 1); - return (ret); + return ret; } // These macros all assume the table is on the top of the lua stack. @@ -154,7 +154,7 @@ static int _fill_area(lua_State *ls, map_lines &lines, int x1, int y1, int x2, i for (int x = x1; x <= x2; ++x) lines(x, y) = fill; - return (0); + return 0; } static void _border_area(map_lines &lines, int x1, int y1, int x2, int y2, char border) @@ -190,7 +190,7 @@ static std::vector<coord_def> _box_side(int x1, int y1, int x2, int y2, int side for (x = start_x+1; x < stop_x; x++) line.push_back(coord_def(x, y)); - return (line); + return line; } // Does what count_passable_neighbors does, but in C++ form. @@ -207,7 +207,7 @@ static int _count_passable_neighbors(lua_State *ls, map_lines &lines, int x, count++; } - return (count); + return count; } static int _count_passable_neighbors(lua_State *ls, map_lines &lines, coord_def point, @@ -223,7 +223,7 @@ LUAFN(dgn_count_feature_in_box) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_STR(ls, feat, ""); @@ -239,7 +239,7 @@ LUAFN(dgn_count_antifeature_in_box) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_STR(ls, feat, ""); @@ -259,7 +259,7 @@ LUAFN(dgn_count_neighbors) TABLE_INT(ls, y, -1); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; coord_def tl(x-1, y-1); coord_def br(x+1, y+1); @@ -278,11 +278,11 @@ LUAFN(dgn_count_passable_neighbors) if (!_valid_coord(ls, lines, x, y)) { lua_pushnumber(ls, 0); - return (1); + return 1; } lua_pushnumber(ls, _count_passable_neighbors(ls, lines, x, y, passable)); - return (1); + return 1; } @@ -296,17 +296,17 @@ LUAFN(dgn_is_valid_coord) if (x < 0 || x >= lines.width()) { lua_pushboolean(ls, false); - return (1); + return 1; } if (y < 0 || y >= lines.height()) { lua_pushboolean(ls, false); - return (1); + return 1; } lua_pushboolean(ls, true); - return (1); + return 1; } LUAFN(dgn_extend_map) @@ -319,7 +319,7 @@ LUAFN(dgn_extend_map) lines.extend(width, height, fill); - return (0); + return 0; } LUAFN(dgn_fill_area) @@ -328,7 +328,7 @@ LUAFN(dgn_fill_area) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, fill, 'x'); TABLE_CHAR(ls, border, fill); @@ -337,7 +337,7 @@ LUAFN(dgn_fill_area) if (border != fill) _border_area(lines, x1, y1, x2, y2, border); - return (0); + return 0; } LUAFN(dgn_fill_disconnected) @@ -346,7 +346,7 @@ LUAFN(dgn_fill_disconnected) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, fill, 'x'); TABLE_STR(ls, passable, traversable_glyphs); @@ -378,7 +378,7 @@ LUAFN(dgn_fill_disconnected) } } - return (0); + return 0; } LUAFN(dgn_is_passable_coord) @@ -390,14 +390,14 @@ LUAFN(dgn_is_passable_coord) TABLE_STR(ls, passable, traversable_glyphs); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; if (strchr(passable, lines(x, y))) lua_pushboolean(ls, true); else lua_pushboolean(ls, false); - return (1); + return 1; } LUAFN(dgn_find_in_area) @@ -410,7 +410,7 @@ LUAFN(dgn_find_in_area) TABLE_INT(ls, y2, -1); if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, find, 'x'); @@ -421,11 +421,11 @@ LUAFN(dgn_find_in_area) if (lines(x, y) == find) { lua_pushboolean(ls, true); - return (1); + return 1; } lua_pushboolean(ls, false); - return (1); + return 1; } LUAFN(dgn_height) @@ -446,15 +446,15 @@ LUAFN(dgn_join_the_dots) TABLE_CHAR(ls, fill, '.'); if (!_valid_coord(ls, lines, x1, y1)) - return (0); + return 0; if (!_valid_coord(ls, lines, x2, y2)) - return (0); + return 0; coord_def from(x1, y1); coord_def to(x2, y2); if (from == to) - return (0); + return 0; coord_def at = from; do @@ -493,7 +493,7 @@ LUAFN(dgn_join_the_dots) } while (true); - return (0); + return 0; } LUAFN(dgn_make_circle) @@ -506,14 +506,14 @@ LUAFN(dgn_make_circle) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) if (rx * rx + ry * ry < radius * radius) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_diamond) @@ -526,14 +526,14 @@ LUAFN(dgn_make_diamond) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) if (std::abs(rx) + std::abs(ry) <= radius) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_rounded_square) @@ -546,14 +546,14 @@ LUAFN(dgn_make_rounded_square) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) if (std::abs(rx) != radius || std::abs(ry) != radius) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_square) @@ -566,13 +566,13 @@ LUAFN(dgn_make_square) TABLE_CHAR(ls, fill, 'x'); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; for (int ry = -radius; ry <= radius; ++ry) for (int rx = -radius; rx <= radius; ++rx) lines(x + rx, y + ry) = fill; - return (0); + return 0; } LUAFN(dgn_make_box) @@ -581,7 +581,7 @@ LUAFN(dgn_make_box) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_CHAR(ls, floor, '.'); TABLE_CHAR(ls, wall, 'x'); @@ -590,7 +590,7 @@ LUAFN(dgn_make_box) _fill_area(ls, lines, x1, y1, x2, y2, wall); _fill_area(ls, lines, x1+width, y1+width, x2-width, y2-width, floor); - return (0); + return 0; } LUAFN(dgn_make_box_doors) @@ -599,7 +599,7 @@ LUAFN(dgn_make_box_doors) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; TABLE_INT(ls, number, 1); @@ -641,7 +641,7 @@ LUAFN(dgn_make_box_doors) } lua_pushnumber(ls, door_count); - return (1); + return 1; } // Return a metatable for a point on the map_lines grid. @@ -652,7 +652,7 @@ LUAFN(dgn_mapgrd_table) map_def **mapref = clua_new_userdata<map_def *>(ls, MAPGRD_METATABLE); *mapref = map; - return (1); + return 1; } LUAFN(dgn_octa_room) @@ -667,7 +667,7 @@ LUAFN(dgn_octa_room) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; coord_def tl(x1, y1); coord_def br(x2, y2); @@ -687,7 +687,7 @@ LUAFN(dgn_octa_room) lines(mc) = is_inside ? inside : outside; } - return (0); + return 0; } LUAFN(dgn_replace_area) @@ -699,14 +699,14 @@ LUAFN(dgn_replace_area) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; for (int y = y1; y <= y2; ++y) for (int x = x1; x <= x2; ++x) if (strchr(find, lines(x, y))) lines(x, y) = replace; - return (0); + return 0; } LUAFN(dgn_replace_first) @@ -722,7 +722,7 @@ LUAFN(dgn_replace_first) TABLE_BOOL(ls, required, false); if (!_valid_coord(ls, lines, x, y)) - return (0); + return 0; if (xdir < -1 || xdir > 1) return (luaL_error(ls, "Invalid xdir: %d", xdir)); @@ -735,7 +735,7 @@ LUAFN(dgn_replace_first) if (lines(x, y) == find) { lines(x, y) = replace; - return (0); + return 0; } x += xdir; @@ -745,7 +745,7 @@ LUAFN(dgn_replace_first) if (required) return (luaL_error(ls, "Could not find feature '%c' to replace", find)); - return (0); + return 0; } LUAFN(dgn_replace_random) @@ -758,14 +758,14 @@ LUAFN(dgn_replace_random) int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2)) - return (0); + return 0; int count = (x2 - x1) * (y2 - y1); if (!count) { if (required) luaL_error(ls, "%s", "No elements to replace"); - return (0); + return 0; } std::vector<coord_def> loc; @@ -785,7 +785,7 @@ LUAFN(dgn_replace_random) int idx = random2(loc.size()); lines(loc[idx]) = replace; - return (0); + return 0; } LUAFN(dgn_smear_map) @@ -800,7 +800,7 @@ LUAFN(dgn_smear_map) const int border = 1; int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2, border)) - return (0); + return 0; const int max_test_per_iteration = 10; int sanity = 0; @@ -816,7 +816,7 @@ LUAFN(dgn_smear_map) do { if (sanity++ > max_sanity) - return (0); + return 0; mc.x = random_range(x1+border, y2-border); mc.y = random_range(y1+border, y2-border); @@ -840,7 +840,7 @@ LUAFN(dgn_smear_map) lines(mc) = smear; } - return (0); + return 0; } LUAFN(dgn_spotty_map) @@ -855,7 +855,7 @@ LUAFN(dgn_spotty_map) const int border = 4; int x1, y1, x2, y2; if (!_coords(ls, lines, x1, y1, x2, y2, border)) - return (0); + return 0; const int max_test_per_iteration = 10; int sanity = 0; @@ -867,7 +867,7 @@ LUAFN(dgn_spotty_map) do { if (sanity++ > max_sanity) - return (0); + return 0; x = random_range(x1 + border, x2 - border); y = random_range(y1 + border, y2 - border); @@ -890,7 +890,7 @@ LUAFN(dgn_spotty_map) } } - return (0); + return 0; } static int dgn_width(lua_State *ls) @@ -916,7 +916,7 @@ LUAFN(dgn_delve) ARG_INT(ls, 6, top, 125); delve(&lines, ngb_min, ngb_max, connchance, cellnum, top); - return (0); + return 0; } LUAFN(dgn_farthest_from) @@ -948,7 +948,7 @@ LUAFN(dgn_farthest_from) // Not a single beacon, nowhere to go. lua_pushnil(ls); lua_pushnil(ls); - return (2); + return 2; } for (unsigned int dc = 0; dc < queue.size(); dc++) @@ -974,7 +974,7 @@ LUAFN(dgn_farthest_from) coord_def loc = queue[dc_prev + random2(dc_next - dc_prev)]; lua_pushnumber(ls, loc.x); lua_pushnumber(ls, loc.y); - return (2); + return 2; } /* Wrappers for C++ layouts, to facilitate choosing of layouts by weight and diff --git a/crawl-ref/source/l_dgnevt.cc b/crawl-ref/source/l_dgnevt.cc index 8fc155c6f5..f280a4362a 100644 --- a/crawl-ref/source/l_dgnevt.cc +++ b/crawl-ref/source/l_dgnevt.cc @@ -20,7 +20,7 @@ static int dgnevent_place(lua_State *ls) DEVENT(ls, 1, dev); lua_pushnumber(ls, dev->place.x); lua_pushnumber(ls, dev->place.y); - return (2); + return 2; } static int dgnevent_dest(lua_State *ls) @@ -28,7 +28,7 @@ static int dgnevent_dest(lua_State *ls) DEVENT(ls, 1, dev); lua_pushnumber(ls, dev->dest.x); lua_pushnumber(ls, dev->dest.y); - return (2); + return 2; } static int dgnevent_ticks(lua_State *ls) @@ -83,7 +83,7 @@ static dgn_event_type dgn_event_type_by_name(const std::string &name) for (unsigned i = 0; i < ARRAYSZ(dgn_event_type_names); ++i) if (dgn_event_type_names[i] == name) return static_cast<dgn_event_type>(i? 1 << (i - 1) : 0); - return (DET_NONE); + return DET_NONE; } static const char *dgn_event_type_name(unsigned evmask) @@ -117,7 +117,7 @@ static int dgn_dgn_event(lua_State *ls) dgn_push_event_type(ls, i); retvals++; } - return (retvals); + return retvals; } static dgn_event_type dgn_param_to_event_type(lua_State *ls, int n) @@ -127,19 +127,19 @@ static dgn_event_type dgn_param_to_event_type(lua_State *ls, int n) else if (lua_isstring(ls, n)) return dgn_event_type_by_name(lua_tostring(ls, n)); else - return (DET_NONE); + return DET_NONE; } static int dgn_dgn_event_is_global(lua_State *ls) { lua_pushboolean(ls, dgn_param_to_event_type(ls, 1) & DET_GLOBAL_MASK); - return (1); + return 1; } static int dgn_dgn_event_is_position(lua_State *ls) { lua_pushboolean(ls, dgn_param_to_event_type(ls, 1) & DET_POSITION_MASK); - return (1); + return 1; } const struct luaL_reg dgn_event_dlib[] = diff --git a/crawl-ref/source/l_dgngrd.cc b/crawl-ref/source/l_dgngrd.cc index f2b52f98e9..ef3cc86f34 100644 --- a/crawl-ref/source/l_dgngrd.cc +++ b/crawl-ref/source/l_dgngrd.cc @@ -47,7 +47,7 @@ dungeon_feature_type check_lua_feature(lua_State *ls, int idx) const dungeon_feature_type f = _get_lua_feature(ls, idx); if (!f) luaL_argerror(ls, idx, "Invalid dungeon feature"); - return (f); + return f; } #define FEAT(f, pos) \ @@ -65,7 +65,7 @@ static int dgn_feature_desc(lua_State *ls) const std::string s = feature_description(feat, NUM_TRAPS, "", dtype, need_stop); lua_pushstring(ls, s.c_str()); - return (1); + return 1; } static int dgn_feature_desc_at(lua_State *ls) @@ -80,14 +80,14 @@ static int dgn_feature_desc_at(lua_State *ls) luaL_checkint(ls, 2)), false, dtype, need_stop); lua_pushstring(ls, s.c_str()); - return (1); + return 1; } static int dgn_max_bounds(lua_State *ls) { lua_pushnumber(ls, GXM); lua_pushnumber(ls, GYM); - return (2); + return 2; } static int dgn_in_bounds(lua_State *ls) @@ -96,7 +96,7 @@ static int dgn_in_bounds(lua_State *ls) int y = luaL_checkint(ls, 2); lua_pushboolean(ls, in_bounds(x, y)); - return (1); + return 1; } static int dgn_grid(lua_State *ls) @@ -117,7 +117,7 @@ LUAFN(dgn_distance) COORDS(p1, 1, 2); COORDS(p2, 3, 4); lua_pushnumber(ls, distance(p1, p2)); - return (1); + return 1; } LUAFN(dgn_seen_replace_feat) @@ -126,7 +126,7 @@ LUAFN(dgn_seen_replace_feat) dungeon_feature_type f2 = _get_lua_feature(ls, 2); lua_pushboolean(ls, seen_replace_feat(f1, f2)); - return (1); + return 1; } const struct luaL_reg dgn_grid_dlib[] = diff --git a/crawl-ref/source/l_dgnit.cc b/crawl-ref/source/l_dgnit.cc index 68f490104a..7e2bdbc2ac 100644 --- a/crawl-ref/source/l_dgnit.cc +++ b/crawl-ref/source/l_dgnit.cc @@ -29,7 +29,7 @@ static item_list _lua_get_ilist(lua_State *ls, int ndx) if (!err.empty()) luaL_error(ls, err.c_str()); - return (ilist); + return ilist; } else { @@ -60,21 +60,21 @@ static int dgn_item_from_index(lua_State *ls) else lua_pushnil(ls); - return (1); + return 1; } static int dgn_items_at(lua_State *ls) { COORDS(c, 1, 2); lua_push_floor_items(ls, env.igrid(c)); - return (1); + return 1; } static int _dgn_item_spec(lua_State *ls) { const item_list ilist = _lua_get_ilist(ls, 1); dlua_push_object_type<item_list>(ls, ITEMLIST_METATABLE, ilist); - return (1); + return 1; } static int dgn_create_item(lua_State *ls) @@ -87,14 +87,14 @@ static int dgn_create_item(lua_State *ls) dgn_place_multiple_items(ilist, c, level); link_items(); - return (0); + return 0; } static int dgn_item_property_remove(lua_State *ls) { if (item_def *item = clua_get_item(ls, 1)) item->props.erase(luaL_checkstring(ls, 2)); - return (0); + return 0; } static int dgn_item_property_set(lua_State *ls) @@ -136,7 +136,7 @@ static int dgn_item_property_set(lua_State *ls) break; } } - return (0); + return 0; } static int dgn_item_property(lua_State *ls) @@ -152,7 +152,7 @@ static int dgn_item_property(lua_State *ls) if (!item->props.exists(key)) { lua_pushnil(ls); - return (1); + return 1; } switch (type[0]) @@ -180,14 +180,14 @@ static int dgn_item_property(lua_State *ls) const coord_def p(item->props[key].get_coord()); lua_pushnumber(ls, p.x); lua_pushnumber(ls, p.y); - return (2); + return 2; } default: luaL_error(ls, "Unknown type: '%s'", type.c_str()); break; } } - return (1); + return 1; } // Returns two arrays: one of floor items, one of shop items. @@ -242,7 +242,7 @@ static int dgn_stash_items(lua_State *ls) lua_rawseti(ls, -2, ++index); } - return (2); + return 2; } const struct luaL_reg dgn_item_dlib[] = diff --git a/crawl-ref/source/l_dgnlvl.cc b/crawl-ref/source/l_dgnlvl.cc index 79bdd4805e..7d1fb4fd7f 100644 --- a/crawl-ref/source/l_dgnlvl.cc +++ b/crawl-ref/source/l_dgnlvl.cc @@ -72,14 +72,14 @@ LUAFN(dgn_level_id) _push_level_id(ls, level_id::current()); else if (nargs == 1) _push_level_id(ls, dlua_level_id(ls, 1)); - return (1); + return 1; } LUAFN(dgn_level_name) { const level_id lid(dlua_level_id(ls, 1)); lua_pushstring(ls, lid.describe().c_str()); - return (1); + return 1; } const struct luaL_reg dgn_level_dlib[] = diff --git a/crawl-ref/source/l_dgnmon.cc b/crawl-ref/source/l_dgnmon.cc index ed4f652f87..3267fa0b71 100644 --- a/crawl-ref/source/l_dgnmon.cc +++ b/crawl-ref/source/l_dgnmon.cc @@ -28,7 +28,7 @@ static mons_list _lua_get_mlist(lua_State *ls, int ndx) const std::string err = mlist.add_mons(spec); if (!err.empty()) luaL_error(ls, err.c_str()); - return (mlist); + return mlist; } else { @@ -56,12 +56,12 @@ static int dgn_set_random_mon_list(lua_State *ls) if (nargs > 2) { luaL_error(ls, "Too many arguments."); - return (0); + return 0; } else if (nargs == 0) { luaL_error(ls, "Too few arguments."); - return (0); + return 0; } else if (nargs == 2) { @@ -76,13 +76,13 @@ static int dgn_set_random_mon_list(lua_State *ls) if (mlist.empty()) { luaL_argerror(ls, list_pos, "Mon list is empty."); - return (0); + return 0; } if (mlist.size() > 1) { luaL_argerror(ls, list_pos, "Mon list must contain only one slot."); - return (0); + return 0; } const int num_mons = mlist.slot_size(0); @@ -90,7 +90,7 @@ static int dgn_set_random_mon_list(lua_State *ls) if (num_mons == 0) { luaL_argerror(ls, list_pos, "Mon list is empty."); - return (0); + return 0; } std::vector<mons_spec> mons; @@ -162,7 +162,7 @@ static int dgn_set_random_mon_list(lua_State *ls) { luaL_argerror(ls, list_pos, "Mon list contains only pandemonium lords."); - return (0); + return 0; } if (map) @@ -170,7 +170,7 @@ static int dgn_set_random_mon_list(lua_State *ls) else set_vault_mon_list(mons); - return (0); + return 0; } static int dgn_mons_from_mid(lua_State *ls) @@ -184,7 +184,7 @@ static int dgn_mons_from_mid(lua_State *ls) else lua_pushnil(ls); - return (1); + return 1; } static int dgn_mons_at(lua_State *ls) @@ -196,7 +196,7 @@ static int dgn_mons_at(lua_State *ls) push_monster(ls, mon); else lua_pushnil(ls); - return (1); + return 1; } @@ -211,18 +211,18 @@ static int dgn_create_monster(lua_State *ls) if (monster *mon = dgn_place_monster(mspec, -1, c, false, false, false)) { push_monster(ls, mon); - return (1); + return 1; } } lua_pushnil(ls); - return (1); + return 1; } static int _dgn_monster_spec(lua_State *ls) { const mons_list mlist = _lua_get_mlist(ls, 1); dlua_push_object_type<mons_list>(ls, MONSLIST_METATABLE, mlist); - return (1); + return 1; } LUARET1(_dgn_max_monsters, number, MAX_MONSTERS) diff --git a/crawl-ref/source/l_dgntil.cc b/crawl-ref/source/l_dgntil.cc index b5ce593406..5be03bd5f6 100644 --- a/crawl-ref/source/l_dgntil.cc +++ b/crawl-ref/source/l_dgntil.cc @@ -142,7 +142,7 @@ LUAFN(dgn_tile_feat_changed) { env.tile_flv(c).feat = 0; env.tile_flv(c).feat_idx = 0; - return (0); + return 0; } std::string tilename = luaL_checkstring(ls, 3); @@ -160,7 +160,7 @@ LUAFN(dgn_tile_feat_changed) env.tile_flv(c).feat_idx = store_tilename_get_index(tilename); - return (0); + return 0; } LUAFN(dgn_tile_floor_changed) @@ -171,7 +171,7 @@ LUAFN(dgn_tile_floor_changed) { env.tile_flv(c).floor = 0; env.tile_flv(c).floor_idx = 0; - return (0); + return 0; } std::string tilename = luaL_checkstring(ls, 3); @@ -189,7 +189,7 @@ LUAFN(dgn_tile_floor_changed) env.tile_flv(c).floor_idx = store_tilename_get_index(tilename); - return (0); + return 0; } const struct luaL_reg dgn_tile_dlib[] = diff --git a/crawl-ref/source/l_feat.cc b/crawl-ref/source/l_feat.cc index 0e3ea7c481..0376efba6a 100644 --- a/crawl-ref/source/l_feat.cc +++ b/crawl-ref/source/l_feat.cc @@ -28,7 +28,7 @@ else if (lua_isstring(ls, 1)) \ lua_pushboolean(ls, val(dungeon_feature_by_name(\ luaL_checkstring(ls, 1))));\ - return (1); \ + return 1; \ } FEATF(_feat_is_wall, feat_is_wall) diff --git a/crawl-ref/source/l_file.cc b/crawl-ref/source/l_file.cc index dbb73b7ab8..4fb339c8b3 100644 --- a/crawl-ref/source/l_file.cc +++ b/crawl-ref/source/l_file.cc @@ -38,7 +38,7 @@ static int file_marshall(lua_State *ls) marshallByte(th, lua_toboolean(ls, 2)); else if (lua_isstring(ls, 2)) marshallString(th, lua_tostring(ls, 2)); - return (0); + return 0; } static int file_minor_version(lua_State *ls) @@ -47,13 +47,13 @@ static int file_minor_version(lua_State *ls) luaL_error(ls, "Need reader as one argument"); reader &th(*static_cast<reader*>(lua_touserdata(ls, 1))); lua_pushnumber(ls, th.getMinorVersion()); - return (1); + return 1; } static int file_major_version(lua_State *ls) { lua_pushnumber(ls, TAG_MAJOR_VERSION); - return (1); + return 1; } static int file_unmarshall_boolean(lua_State *ls) @@ -62,7 +62,7 @@ static int file_unmarshall_boolean(lua_State *ls) luaL_error(ls, "Need reader as one argument"); reader &th(*static_cast<reader*>(lua_touserdata(ls, 1))); lua_pushboolean(ls, unmarshallByte(th)); - return (1); + return 1; } static int file_unmarshall_number(lua_State *ls) @@ -71,7 +71,7 @@ static int file_unmarshall_number(lua_State *ls) luaL_error(ls, "Need reader as one argument"); reader &th(*static_cast<reader*>(lua_touserdata(ls, 1))); lua_pushnumber(ls, unmarshallInt(th)); - return (1); + return 1; } static int file_unmarshall_string(lua_State *ls) @@ -80,7 +80,7 @@ static int file_unmarshall_string(lua_State *ls) luaL_error(ls, "Need reader as one argument"); reader &th(*static_cast<reader*>(lua_touserdata(ls, 1))); lua_pushstring(ls, unmarshallString(th).c_str()); - return (1); + return 1; } enum lua_persist_type @@ -117,7 +117,7 @@ static int file_marshall_meta(lua_State *ls) marshallByte(th, ptype); if (ptype != LPT_NIL) file_marshall(ls); - return (0); + return 0; } static int file_unmarshall_meta(lua_State *ls) @@ -135,12 +135,12 @@ static int file_unmarshall_meta(lua_State *ls) return file_unmarshall_string(ls); case LPT_NIL: lua_pushnil(ls); - return (1); + return 1; default: luaL_error(ls, "Unexpected type signature."); } // Never get here. - return (0); + return 0; } // Returns a Lua table of filenames in the named directory. The file names @@ -200,7 +200,7 @@ LUAFN(_file_writefile) { lua_pushboolean(ls, false); } - return (1); + return 1; } static const struct luaL_reg file_dlib[] = diff --git a/crawl-ref/source/l_food.cc b/crawl-ref/source/l_food.cc index 7dc0e7ed6e..0b04b46961 100644 --- a/crawl-ref/source/l_food.cc +++ b/crawl-ref/source/l_food.cc @@ -18,7 +18,7 @@ static int food_do_eat(lua_State *ls) if (!you.turn_is_over) eaten = eat_food(-1); lua_pushboolean(ls, eaten); - return (1); + return 1; } static int food_prompt_eat_chunks(lua_State *ls) @@ -28,7 +28,7 @@ static int food_prompt_eat_chunks(lua_State *ls) eaten = prompt_eat_chunks(); lua_pushboolean(ls, (eaten != 0)); - return (1); + return 1; } static int food_prompt_floor(lua_State *ls) @@ -41,7 +41,7 @@ static int food_prompt_floor(lua_State *ls) burden_change(); } lua_pushboolean(ls, (eaten != 0)); - return (1); + return 1; } static int food_prompt_inventory(lua_State *ls) @@ -50,7 +50,7 @@ static int food_prompt_inventory(lua_State *ls) if (!you.turn_is_over) eaten = eat_from_inventory(); lua_pushboolean(ls, eaten); - return (1); + return 1; } static int food_prompt_inventory_menu(lua_State *ls) @@ -59,7 +59,7 @@ static int food_prompt_inventory_menu(lua_State *ls) if (!you.turn_is_over) eaten = prompt_eat_inventory_item(); lua_pushboolean(ls, eaten); - return (1); + return 1; } static int food_can_eat(lua_State *ls) @@ -72,7 +72,7 @@ static int food_can_eat(lua_State *ls) bool edible = item && can_ingest(*item, true, hungercheck); lua_pushboolean(ls, edible); - return (1); + return 1; } static bool eat_item(const item_def &item) @@ -86,7 +86,7 @@ static bool eat_item(const item_def &item) if (in_inventory(item)) { eat_inventory_item(item.link); - return (true); + return true; } else { @@ -95,9 +95,9 @@ static bool eat_item(const item_def &item) if (ilink != NON_ITEM) { eat_floor_item(ilink); - return (true); + return true; } - return (false); + return false; } } @@ -112,7 +112,7 @@ static int food_eat(lua_State *ls) eaten = eat_item(*item); } lua_pushboolean(ls, eaten); - return (1); + return 1; } static int food_rotting(lua_State *ls) @@ -124,7 +124,7 @@ static int food_rotting(lua_State *ls) rotting = food_is_rotten(*item); lua_pushboolean(ls, rotting); - return (1); + return 1; } static int food_dangerous(lua_State *ls) @@ -138,7 +138,7 @@ static int food_dangerous(lua_State *ls) || causes_rot(*item) || is_forbidden_food(*item)); } lua_pushboolean(ls, dangerous); - return (1); + return 1; } static int food_ischunk(lua_State *ls) @@ -147,14 +147,14 @@ static int food_ischunk(lua_State *ls) lua_pushboolean(ls, item && item->base_type == OBJ_FOOD && item->sub_type == FOOD_CHUNK); - return (1); + return 1; } static int food_isfruit(lua_State *ls) { LUA_ITEM(ls, item, 1); lua_pushboolean(ls, is_fruit(*item)); - return (1); + return 1; } static const struct luaL_reg food_lib[] = diff --git a/crawl-ref/source/l_global.cc b/crawl-ref/source/l_global.cc index f33c2537c8..ff50a9d49b 100644 --- a/crawl-ref/source/l_global.cc +++ b/crawl-ref/source/l_global.cc @@ -28,11 +28,11 @@ static int lua_pmatch(lua_State *ls) { const char *pattern = luaL_checkstring(ls, 1); if (!pattern) - return (0); + return 0; const char *text = luaL_checkstring(ls, 2); if (!text) - return (0); + return 0; bool checkcase = true; if (lua_isboolean(ls, 3)) @@ -40,7 +40,7 @@ static int lua_pmatch(lua_State *ls) text_pattern &tp = get_text_pattern(pattern, checkcase); lua_pushboolean(ls, tp.matches(text)); - return (1); + return 1; } void cluaopen_globals(lua_State *ls) diff --git a/crawl-ref/source/l_item.cc b/crawl-ref/source/l_item.cc index 2fa0d66eff..e2a3951fed 100644 --- a/crawl-ref/source/l_item.cc +++ b/crawl-ref/source/l_item.cc @@ -106,7 +106,7 @@ static void _lua_push_inv_items(lua_State *ls = NULL) { \ clua_push_item(ls, item); \ lua_pushcclosure(ls, l_item_##closure, 1); \ - return (1); \ + return 1; \ } #define ITEM(name, ndx) \ @@ -117,7 +117,7 @@ static void _lua_push_inv_items(lua_State *ls = NULL) static int l_item_do_wield(lua_State *ls) { if (you.turn_is_over) - return (0); + return 0; UDATA_ITEM(item); @@ -126,7 +126,7 @@ static int l_item_do_wield(lua_State *ls) slot = item->link; bool res = wield_weapon(true, slot); lua_pushboolean(ls, res); - return (1); + return 1; } IDEFN(wield, do_wield) @@ -134,16 +134,16 @@ IDEFN(wield, do_wield) static int l_item_do_wear(lua_State *ls) { if (you.turn_is_over) - return (0); + return 0; UDATA_ITEM(item); if (!item || !in_inventory(*item)) - return (0); + return 0; bool success = do_wear_armour(item->link, false); lua_pushboolean(ls, success); - return (1); + return 1; } IDEFN(wear, do_wear) @@ -151,15 +151,15 @@ IDEFN(wear, do_wear) static int l_item_do_puton(lua_State *ls) { if (you.turn_is_over) - return (0); + return 0; UDATA_ITEM(item); if (!item || !in_inventory(*item)) - return (0); + return 0; lua_pushboolean(ls, puton_ring(item->link)); - return (1); + return 1; } IDEFN(puton, do_puton) @@ -169,7 +169,7 @@ static int l_item_do_remove(lua_State *ls) if (you.turn_is_over) { mpr("Turn is over"); - return (0); + return 0; } UDATA_ITEM(item); @@ -177,14 +177,14 @@ static int l_item_do_remove(lua_State *ls) if (!item || !in_inventory(*item)) { mpr("Bad item"); - return (0); + return 0; } int eq = get_equip_slot(item); if (eq < 0 || eq >= NUM_EQUIP) { mpr("Item is not equipped"); - return (0); + return 0; } bool result = false; @@ -195,7 +195,7 @@ static int l_item_do_remove(lua_State *ls) else result = takeoff_armour(item->link); lua_pushboolean(ls, result); - return (1); + return 1; } IDEFN(remove, do_remove) @@ -203,19 +203,19 @@ IDEFN(remove, do_remove) static int l_item_do_drop(lua_State *ls) { if (you.turn_is_over) - return (0); + return 0; UDATA_ITEM(item); if (!item || !in_inventory(*item)) - return (0); + return 0; int eq = get_equip_slot(item); if (eq >= 0 && eq < NUM_EQUIP) { lua_pushboolean(ls, false); lua_pushstring(ls, "Can't drop worn items"); - return (2); + return 2; } int qty = item->quantity; @@ -226,7 +226,7 @@ static int l_item_do_drop(lua_State *ls) qty = q; } lua_pushboolean(ls, drop_item(item->link, qty)); - return (1); + return 1; } IDEFN(drop, do_drop) @@ -242,7 +242,7 @@ IDEF(equipped) else lua_pushboolean(ls, true); - return (1); + return 1; } static int l_item_do_class(lua_State *ls) @@ -260,7 +260,7 @@ static int l_item_do_class(lua_State *ls) } else lua_pushnil(ls); - return (1); + return 1; } IDEFN(class, do_class) @@ -356,11 +356,11 @@ static int l_item_do_subtype(lua_State *ls) else lua_pushnil(ls); - return (1); + return 1; } lua_pushnil(ls); - return (1); + return 1; } IDEFN(subtype, do_subtype); @@ -370,14 +370,14 @@ IDEF(cursed) bool cursed = item && item_ident(*item, ISFLAG_KNOW_CURSE) && item->cursed(); lua_pushboolean(ls, cursed); - return (1); + return 1; } IDEF(tried) { bool tried = item && item_type_tried(*item); lua_pushboolean(ls, tried); - return (1); + return 1; } IDEF(worn) @@ -391,7 +391,7 @@ IDEF(worn) lua_pushstring(ls, equip_slot_to_name(worn)); else lua_pushnil(ls); - return (2); + return 2; } static std::string _item_name(lua_State *ls, item_def* item) @@ -413,7 +413,7 @@ static int l_item_do_name(lua_State *ls) lua_pushstring(ls, _item_name(ls, item).c_str()); else lua_pushnil(ls); - return (1); + return 1; } IDEFN(name, do_name) @@ -436,7 +436,7 @@ static int l_item_do_name_coloured(lua_State *ls) } else lua_pushnil(ls); - return (1); + return 1; } IDEFN(name_coloured, do_name_coloured) @@ -456,7 +456,7 @@ IDEF(slot) } else lua_pushnil(ls); - return (1); + return 1; } IDEF(ininventory) @@ -467,7 +467,7 @@ IDEF(ininventory) IDEF(equip_type) { if (!item || !item->defined()) - return (0); + return 0; equipment_type eq = EQ_NONE; @@ -488,134 +488,134 @@ IDEF(equip_type) lua_pushnil(ls); lua_pushnil(ls); } - return (2); + return 2; } IDEF(weap_skill) { if (!item || !item->defined()) - return (0); + return 0; skill_type skill = range_skill(*item); if (skill == SK_THROWING) skill = weapon_skill(*item); if (skill == SK_FIGHTING) - return (0); + return 0; lua_pushstring(ls, skill_name(skill)); lua_pushnumber(ls, skill); - return (2); + return 2; } IDEF(reach_range) { if (!item || !item->defined()) - return (0); + return 0; reach_type rt = weapon_reach(*item); lua_pushnumber(ls, rt); - return (1); + return 1; } IDEF(is_ranged) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, is_range_weapon(*item)); - return (1); + return 1; } IDEF(is_throwable) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, is_throwable(&you, *item)); - return (1); + return 1; } IDEF(dropped) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, item->flags & ISFLAG_DROPPED); - return (1); + return 1; } IDEF(is_melded) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, item_is_melded(*item)); - return (1); + return 1; } IDEF(can_cut_meat) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, can_cut_meat(*item)); - return (1); + return 1; } IDEF(is_bad_food) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, is_bad_food(*item)); - return (1); + return 1; } IDEF(is_useless) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, is_useless_item(*item)); - return (1); + return 1; } IDEF(artefact) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, is_artefact(*item)); - return (1); + return 1; } IDEF(branded) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, item_is_branded(*item) || item->flags & ISFLAG_COSMETIC_MASK && !item_type_known(*item)); - return (1); + return 1; } IDEF(snakable) { if (!item || !item->defined()) - return (0); + return 0; lua_pushboolean(ls, item_is_snakable(*item)); - return (1); + return 1; } // DLUA-only functions @@ -628,14 +628,14 @@ static int l_item_do_pluses(lua_State *ls) if (!item || !item->defined() || !item_ident(*item, ISFLAG_KNOW_PLUSES)) { lua_pushboolean(ls, false); - return (1); + return 1; } lua_pushnumber(ls, item->plus); // XXX: May cause issues on items that don't use plus2, ie ammunition. lua_pushnumber(ls, item->plus2); - return (2); + return 2; } IDEFN(pluses, do_pluses) @@ -649,14 +649,14 @@ static int l_item_do_destroy(lua_State *ls) if (!item || !item->defined()) { lua_pushboolean(ls, false); - return (0); + return 0; } item_was_destroyed(*item); destroy_item(item->index()); lua_pushboolean(ls, true); - return (1); + return 1; } IDEFN(destroy, do_destroy) @@ -670,7 +670,7 @@ static int l_item_do_dec_quantity(lua_State *ls) if (!item || !item->defined()) { lua_pushboolean(ls, false); - return (1); + return 1; } // The quantity to reduce by. @@ -684,7 +684,7 @@ static int l_item_do_dec_quantity(lua_State *ls) destroyed = dec_mitm_item_quantity(item->index(), quantity); lua_pushboolean(ls, destroyed); - return (1); + return 1; } IDEFN(dec_quantity, do_dec_quantity) @@ -698,7 +698,7 @@ static int l_item_do_inc_quantity(lua_State *ls) if (!item || !item->defined()) { lua_pushboolean(ls, false); - return (1); + return 1; } // The quantity to increase by. @@ -709,7 +709,7 @@ static int l_item_do_inc_quantity(lua_State *ls) else inc_mitm_item_quantity(item->index(), quantity); - return (0); + return 0; } IDEFN(inc_quantity, do_inc_quantity) @@ -729,7 +729,7 @@ static iflags_t _str_to_item_status_flags(std::string flag) if (flag == "any") flags = ISFLAG_IDENT_MASK; - return (flags); + return flags; } static int l_item_do_identified(lua_State *ls) @@ -741,7 +741,7 @@ static int l_item_do_identified(lua_State *ls) if (!item || !item->defined()) { lua_pushnil(ls); - return (1); + return 1; } bool known_status = false; @@ -765,7 +765,7 @@ static int l_item_do_identified(lua_State *ls) } lua_pushboolean(ls, known_status); - return (1); + return 1; } IDEFN(identified, do_identified) @@ -776,7 +776,7 @@ IDEF(base_type) ASSERT_DLUA; lua_pushstring(ls, base_type_string(*item).c_str()); - return (1); + return 1; } IDEF(sub_type) @@ -784,7 +784,7 @@ IDEF(sub_type) ASSERT_DLUA; lua_pushstring(ls, sub_type_string(*item).c_str()); - return (1); + return 1; } IDEF(ego_type) @@ -792,11 +792,11 @@ IDEF(ego_type) if (CLua::get_vm(ls).managed_vm && !item_ident(*item, ISFLAG_KNOW_TYPE)) { lua_pushstring(ls, "unknown"); - return (1); + return 1; } lua_pushstring(ls, ego_type_string(*item).c_str()); - return (1); + return 1; } IDEF(artefact_name) @@ -808,7 +808,7 @@ IDEF(artefact_name) else lua_pushnil(ls); - return (1); + return 1; } IDEF(is_cursed) @@ -818,14 +818,14 @@ IDEF(is_cursed) bool cursed = item->cursed(); lua_pushboolean(ls, cursed); - return (1); + return 1; } // Library functions below static int l_item_inventory(lua_State *ls) { _lua_push_inv_items(ls); - return (1); + return 1; } static int l_item_index_to_letter(lua_State *ls) @@ -835,16 +835,16 @@ static int l_item_index_to_letter(lua_State *ls) if (index >= 0 && index <= ENDOFPACK) *sletter = index_to_letter(index); lua_pushstring(ls, sletter); - return (1); + return 1; } static int l_item_letter_to_index(lua_State *ls) { const char *s = luaL_checkstring(ls, 1); if (!s || !*s || s[1]) - return (0); + return 0; lua_pushnumber(ls, isaalpha(*s) ? letter_to_index(*s) : -1); - return (1); + return 1; } static int l_item_swap_slots(lua_State *ls) @@ -856,12 +856,12 @@ static int l_item_swap_slots(lua_State *ls) || slot2 < 0 || slot2 >= ENDOFPACK || slot1 == slot2 || !you.inv[slot1].defined()) { - return (0); + return 0; } swap_inv_slots(slot1, slot2, verbose); - return (0); + return 0; } static item_def *dmx_get_item(lua_State *ls, int ndx, int subndx) @@ -871,7 +871,7 @@ static item_def *dmx_get_item(lua_State *ls, int ndx, int subndx) lua_rawgeti(ls, ndx, subndx); ITEM(item, -1); lua_pop(ls, 1); - return (item); + return item; } ITEM(item, ndx); return item; @@ -889,17 +889,17 @@ static int dmx_get_qty(lua_State *ls, int ndx, int subndx) } else if (lua_isnumber(ls, ndx)) qty = luaL_checkint(ls, ndx); - return (qty); + return qty; } static bool l_item_pickup2(item_def *item, int qty) { if (!item || in_inventory(*item)) - return (false); + return false; int floor_link = item_on_floor(*item, you.pos()); if (floor_link == NON_ITEM) - return (false); + return false; return pickup_single_item(floor_link, qty); } @@ -907,7 +907,7 @@ static bool l_item_pickup2(item_def *item, int qty) static int l_item_pickup(lua_State *ls) { if (you.turn_is_over) - return (0); + return 0; if (lua_isuserdata(ls, 1)) { @@ -920,7 +920,7 @@ static int l_item_pickup(lua_State *ls) lua_pushnumber(ls, 1); else lua_pushnil(ls); - return (1); + return 1; } else if (lua_istable(ls, 1)) { @@ -944,9 +944,9 @@ static int l_item_pickup(lua_State *ls) lua_pushnumber(ls, dropped); else lua_pushnil(ls); - return (1); + return 1; } - return (0); + return 0; } // Returns item equipped in a slot defined in an argument. @@ -959,19 +959,19 @@ static int l_item_equipped_at(lua_State *ls) { const char *eqname = lua_tostring(ls, 1); if (!eqname) - return (0); + return 0; eq = equip_name_to_slot(eqname); } if (eq < 0 || eq >= NUM_EQUIP) - return (0); + return 0; if (you.equip[eq] != -1) clua_push_item(ls, &you.inv[you.equip[eq]]); else lua_pushnil(ls); - return (1); + return 1; } static int l_item_fired_item(lua_State *ls) @@ -979,14 +979,14 @@ static int l_item_fired_item(lua_State *ls) int q = you.m_quiver->get_fire_item(); if (q < 0 || q >= ENDOFPACK) - return (0); + return 0; if (q != -1 && !fire_warn_if_impossible(true)) clua_push_item(ls, &you.inv[q]); else lua_pushnil(ls); - return (1); + return 1; } static int l_item_inslot(lua_State *ls) @@ -996,7 +996,7 @@ static int l_item_inslot(lua_State *ls) clua_push_item(ls, &you.inv[index]); else lua_pushnil(ls); - return (1); + return 1; } static int l_item_get_items_at(lua_State *ls) @@ -1023,7 +1023,7 @@ static int l_item_get_items_at(lua_State *ls) lua_rawseti(ls, -2, ++index); } - return (1); + return 1; } struct ItemAccessor @@ -1079,17 +1079,17 @@ static int item_get(lua_State *ls) { ITEM(iw, 1); if (!iw) - return (0); + return 0; const char *attr = luaL_checkstring(ls, 2); if (!attr) - return (0); + return 0; for (unsigned i = 0; i < ARRAYSZ(item_attrs); ++i) if (!strcmp(attr, item_attrs[i].attribute)) return (item_attrs[i].accessor(ls, iw, attr)); - return (0); + return 0; } static const struct luaL_reg item_lib[] = @@ -1111,7 +1111,7 @@ static int _delete_wrapped_item(lua_State *ls) item_wrapper *iw = static_cast<item_wrapper*>(lua_touserdata(ls, 1)); if (iw && iw->temp) delete iw->item; - return (0); + return 0; } void cluaopen_item(lua_State *ls) diff --git a/crawl-ref/source/l_los.cc b/crawl-ref/source/l_los.cc index 8bb7e8f256..795e73f6c4 100644 --- a/crawl-ref/source/l_los.cc +++ b/crawl-ref/source/l_los.cc @@ -32,10 +32,10 @@ LUAFN(los_find_ray) if (find_ray(a, b, *ray, opc_no_trans)) { _lua_push_ray(ls, ray); - return (1); + return 1; } delete ray; - return (0); + return 0; } #define VECT(v, p1, p2) \ @@ -49,7 +49,7 @@ LUAFN(los_make_ray) VECT(d, 3, 4); ray_def *ray = new ray_def(geom::ray(s.x, s.y, d.x, d.y)); _lua_push_ray(ls, ray); - return (1); + return 1; } LUAFN(los_cell_see_cell) @@ -75,7 +75,7 @@ LUAFN(ray_start) RAY(ls, 1, ray); lua_pushnumber(ls, ray->r.start.x); lua_pushnumber(ls, ray->r.start.y); - return (2); + return 2; } LUAFN(ray_dir) @@ -83,14 +83,14 @@ LUAFN(ray_dir) RAY(ls, 1, ray); lua_pushnumber(ls, ray->r.dir.x); lua_pushnumber(ls, ray->r.dir.y); - return (2); + return 2; } LUAFN(ray_advance) { RAY(ls, 1, ray); ray->advance(); - return (0); + return 0; } LUAFN(ray_pos) @@ -99,7 +99,7 @@ LUAFN(ray_pos) coord_def p = ray->pos(); lua_pushnumber(ls, p.x); lua_pushnumber(ls, p.y); - return (2); + return 2; } static const struct luaL_reg ray_dlib[] = diff --git a/crawl-ref/source/l_mapgrd.cc b/crawl-ref/source/l_mapgrd.cc index acf7239543..7d6fea3d6b 100644 --- a/crawl-ref/source/l_mapgrd.cc +++ b/crawl-ref/source/l_mapgrd.cc @@ -25,7 +25,7 @@ static int mapgrd_get(lua_State *ls) mapref->map = map; mapref->col = column; - return (1); + return 1; } static int mapgrd_set(lua_State *ls) @@ -41,7 +41,7 @@ static char* mapgrd_glyph(lua_State *ls, int &col, int &row) map_lines &lines = mapc->map->map; if (row < 0 || col < 0 || col >= lines.width() || row >= lines.height()) - return (NULL); + return NULL; coord_def mc(col, row); return (&lines(mc)); @@ -60,7 +60,7 @@ static int mapgrd_col_get(lua_State *ls) lua_pushstring(ls, buf); - return (1); + return 1; } static int mapgrd_col_set(lua_State *ls) @@ -76,7 +76,7 @@ static int mapgrd_col_set(lua_State *ls) (*gly) = str[0]; - return (0); + return 0; } void dluaopen_mapgrd(lua_State *ls) diff --git a/crawl-ref/source/l_mapmrk.cc b/crawl-ref/source/l_mapmrk.cc index 155568d5b7..8d6e69ad2e 100644 --- a/crawl-ref/source/l_mapmrk.cc +++ b/crawl-ref/source/l_mapmrk.cc @@ -11,7 +11,7 @@ static int mapmarker_pos(lua_State *ls) MAPMARKER(ls, 1, mark); lua_pushnumber(ls, mark->pos.x); lua_pushnumber(ls, mark->pos.y); - return (2); + return 2; } static int mapmarker_move(lua_State *ls) @@ -19,14 +19,14 @@ static int mapmarker_move(lua_State *ls) MAPMARKER(ls, 1, mark); const coord_def dest(luaL_checkint(ls, 2), luaL_checkint(ls, 3)); env.markers.move_marker(mark, dest); - return (0); + return 0; } static int mapmarker_remove(lua_State *ls) { MAPMARKER(ls, 1, mark); env.markers.remove(mark); - return (0); + return 0; } const struct luaL_reg mapmarker_dlib[] = diff --git a/crawl-ref/source/l_moninf.cc b/crawl-ref/source/l_moninf.cc index 584b7211e1..4e94c52f82 100644 --- a/crawl-ref/source/l_moninf.cc +++ b/crawl-ref/source/l_moninf.cc @@ -35,7 +35,7 @@ void lua_push_moninf(lua_State *ls, monster_info *mi) { \ MONINF(ls, 1, mi); \ lua_push##type(ls, mi->cfield); \ - return (1); \ + return 1; \ } #define MIREG(field) { #field, moninf_get_##field } @@ -91,7 +91,7 @@ LUAFN(moninf_get_is) return 0; } lua_pushboolean(ls, mi->is(num)); - return (1); + return 1; } static bool cant_see_you(const monster_info *mi) @@ -125,21 +125,21 @@ LUAFN(moninf_get_stabbability) else lua_pushnumber(ls, 0); - return (1); + return 1; } LUAFN(moninf_get_is_constricted) { MONINF(ls, 1, mi); lua_pushboolean(ls, !mi->constrictor_name.empty()); - return (1); + return 1; } LUAFN(moninf_get_is_constricting) { MONINF(ls, 1, mi); lua_pushboolean(ls, !mi->constricting_name.empty()); - return (1); + return 1; } LUAFN(moninf_get_is_constricting_you) @@ -148,14 +148,14 @@ LUAFN(moninf_get_is_constricting_you) if (!you.is_constricted()) { lua_pushboolean(ls, false); - return (1); + return 1; } // yay the interface lua_pushboolean(ls, (std::find(mi->constricting_name.begin(), mi->constricting_name.end(), "you") != mi->constricting_name.end())); - return (1); + return 1; } LUAFN(moninf_get_can_be_constricted) @@ -177,7 +177,7 @@ LUAFN(moninf_get_can_be_constricted) dummy.base_monster = mi->base_type; lua_pushboolean(ls, dummy.res_constrict() < 3); } - return (1); + return 1; } LUAFN(moninf_get_reach_range) @@ -185,7 +185,7 @@ LUAFN(moninf_get_reach_range) MONINF(ls, 1, mi); lua_pushnumber(ls, mi->reach_range()); - return (1); + return 1; } LUAFN(moninf_get_is_unique) @@ -196,7 +196,7 @@ LUAFN(moninf_get_is_unique) lua_pushboolean(ls, true); else lua_pushboolean(ls, mons_is_unique(mi->type)); - return (1); + return 1; } @@ -205,7 +205,7 @@ LUAFN(moninf_get_damage_desc) MONINF(ls, 1, mi); std::string s = mi->damage_desc(); lua_pushstring(ls, s.c_str()); - return (1); + return 1; } LUAFN(moninf_get_desc) @@ -215,7 +215,7 @@ LUAFN(moninf_get_desc) int col; mi->to_string(1, desc, col); lua_pushstring(ls, desc.c_str()); - return (1); + return 1; } LUAFN(moninf_get_name) @@ -223,7 +223,7 @@ LUAFN(moninf_get_name) MONINF(ls, 1, mi); std::string s = mi->full_name(); lua_pushstring(ls, s.c_str()); - return (1); + return 1; } static const struct luaL_reg moninf_lib[] = @@ -266,15 +266,15 @@ LUAFN(mi_get_monster_at) COORDSHOW(s, 1, 2) coord_def p = player2grid(s); if (!you.see_cell(p)) - return (0); + return 0; if (env.mgrid(p) == NON_MONSTER) - return (0); + return 0; monster* m = &env.mons[env.mgrid(p)]; if (!m->visible_to(&you)) - return (0); + return 0; monster_info mi(m); lua_push_moninf(ls, &mi); - return (1); + return 1; } static const struct luaL_reg mon_lib[] = diff --git a/crawl-ref/source/l_mons.cc b/crawl-ref/source/l_mons.cc index cbb089eec8..e47c4c8180 100644 --- a/crawl-ref/source/l_mons.cc +++ b/crawl-ref/source/l_mons.cc @@ -40,7 +40,7 @@ void push_monster(lua_State *ls, monster* mons) { \ lua_pushlightuserdata(ls, mons); \ lua_pushcclosure(ls, l_mons_##closure, 1); \ - return (1); \ + return 1; \ } MDEF(name) @@ -83,7 +83,7 @@ MDEF(entry_name) else lua_pushnil(ls); - return (1); + return 1; } MDEF(x) @@ -118,7 +118,7 @@ LUAFN(l_mons_add_energy) ASSERT_DLUA; monster* mons = clua_get_lightuserdata<monster>(ls, lua_upvalueindex(1)); mons->speed_increment += luaL_checkint(ls, 1); - return (0); + return 0; } MDEFN(add_energy, add_energy) @@ -163,7 +163,7 @@ MDEF(shapeshifter) lua_pushstring(ls, "shapeshifter"); else lua_pushnil(ls); - return (1); + return 1; } MDEF(dancing_weapon) @@ -175,14 +175,14 @@ MDEF(dancing_weapon) else lua_pushnil(ls); - return (1); + return 1; } MDEF(wont_attack) { ASSERT_DLUA; lua_pushboolean(ls, mons->wont_attack()); - return (1); + return 1; } static const char *_monuse_names[] = @@ -200,7 +200,7 @@ MDEF(muse) { if (const monsterentry *me = mons->find_monsterentry()) PLUARET(string, _monuse_to_str(me->gmon_use)); - return (0); + return 0; } static const char *_moneat_names[] = @@ -218,7 +218,7 @@ MDEF(meat) { if (const monsterentry *me = mons->find_monsterentry()) PLUARET(string, _moneat_to_str(me->gmon_eat)); - return (0); + return 0; } static int l_mons_do_dismiss(lua_State *ls) @@ -233,7 +233,7 @@ static int l_mons_do_dismiss(lua_State *ls) mons->flags |= MF_HARD_RESET; monster_die(mons, KILL_DISMISSED, NON_MONSTER); } - return (0); + return 0; } MDEFN(dismiss, do_dismiss) @@ -282,7 +282,7 @@ static int l_mons_do_run_ai(lua_State *ls) monster* mons = clua_get_lightuserdata<monster>(ls, lua_upvalueindex(1)); if (mons->alive()) handle_monster_move(mons); - return (0); + return 0; } MDEFN(run_ai, do_run_ai) @@ -292,7 +292,7 @@ static int l_mons_do_handle_behaviour(lua_State *ls) monster* mons = clua_get_lightuserdata<monster>(ls, lua_upvalueindex(1)); if (mons->alive()) handle_behaviour(mons); - return (0); + return 0; } MDEFN(handle_behaviour, do_handle_behaviour) @@ -306,7 +306,7 @@ static int l_mons_do_random_teleport(lua_State *ls) if (mons->alive()) mons->teleport(true); - return (0); + return 0; } MDEFN(random_teleport, do_random_teleport) @@ -350,7 +350,7 @@ static int l_mons_do_set_prop(lua_State *ls) luaL_argerror(ls, 2, err.c_str()); } - return (0); + return 0; } MDEFN(set_prop, do_set_prop) @@ -373,7 +373,7 @@ static int l_mons_do_get_prop(lua_State *ls) luaL_argerror(ls, 2, err.c_str()); } - return (0); + return 0; } CrawlStoreValue prop = mons->props[prop_name]; @@ -399,7 +399,7 @@ static int l_mons_do_get_prop(lua_State *ls) break; } - return (num_pushed); + return num_pushed; } MDEFN(get_prop, do_get_prop) @@ -415,7 +415,7 @@ static int l_mons_do_has_prop(lua_State *ls) const char *prop_name = luaL_checkstring(ls, 1); lua_pushboolean(ls, mons->props.exists(prop_name)); - return (1); + return 1; } MDEFN(has_prop, do_has_prop) @@ -529,13 +529,13 @@ static int monster_get(lua_State *ls) const char *attr = luaL_checkstring(ls, 2); if (!attr) - return (0); + return 0; for (unsigned i = 0; i < ARRAYSZ(mons_attrs); ++i) if (!strcmp(attr, mons_attrs[i].attribute)) return (mons_attrs[i].accessor(ls, mons, attr)); - return (0); + return 0; } static const char *_monster_behaviour_names[] = { @@ -576,11 +576,11 @@ static int monster_set(lua_State *ls) MonsterWrap *mw = clua_get_userdata< MonsterWrap >(ls, MONS_METATABLE); if (!mw || !mw->mons) - return (0); + return 0; const char *attr = luaL_checkstring(ls, 2); if (!attr) - return (0); + return 0; if (!strcmp(attr, "beh")) { @@ -597,18 +597,18 @@ static int monster_set(lua_State *ls) else if (!strcmp(attr, "targety")) mw->mons->target.y = luaL_checkint(ls, 3); - return (0); + return 0; } static int mons_behaviour(lua_State *ls) { if (lua_gettop(ls) < 1) - return (0); + return 0; if (lua_isnumber(ls, 1)) { lua_pushvalue(ls, 1); - return (1); + return 1; } else if (lua_isstring(ls, 1)) { @@ -616,10 +616,10 @@ static int mons_behaviour(lua_State *ls) if (beh != NUM_BEHAVIOURS) { lua_pushnumber(ls, beh); - return (1); + return 1; } } - return (0); + return 0; } static const struct luaL_reg mons_lib[] = diff --git a/crawl-ref/source/l_option.cc b/crawl-ref/source/l_option.cc index aa4a8e049c..9af66a9914 100644 --- a/crawl-ref/source/l_option.cc +++ b/crawl-ref/source/l_option.cc @@ -22,13 +22,13 @@ static int option_hboolean(lua_State *ls, const char *name, void *data, if (get) { lua_pushboolean(ls, *static_cast<bool*>(data)); - return (1); + return 1; } else { if (lua_isboolean(ls, 3)) *static_cast<bool*>(data) = lua_toboolean(ls, 3); - return (0); + return 0; } } @@ -36,7 +36,7 @@ static int option_autopick(lua_State *ls, const char *name, void *data, bool get) { lua_pushboolean(ls, Options.autopickup_on>0); - return (1); + return 1; } static option_handler handlers[] = @@ -74,14 +74,14 @@ static const option_handler *get_handler(const char *optname) return &handlers[i]; } } - return (NULL); + return NULL; } static int option_get(lua_State *ls) { const char *opt = luaL_checkstring(ls, 2); if (!opt) - return (0); + return 0; // Is this a Lua named option? game_options::opt_map::iterator i = Options.named_options.find(opt); @@ -89,7 +89,7 @@ static int option_get(lua_State *ls) { const std::string &ov = i->second; lua_pushstring(ls, ov.c_str()); - return (1); + return 1; } const option_handler *oh = get_handler(opt); @@ -100,20 +100,20 @@ static int option_get(lua_State *ls) return (oh->handler(ls, opt, oh->data, true)); #endif - return (0); + return 0; } static int option_set(lua_State *ls) { const char *opt = luaL_checkstring(ls, 2); if (!opt) - return (0); + return 0; const option_handler *oh = get_handler(opt); if (oh) oh->handler(ls, opt, oh->data, false); - return (0); + return 0; } #define OPT_METATABLE "clua_metatable_optaccess" diff --git a/crawl-ref/source/l_subvault.cc b/crawl-ref/source/l_subvault.cc index d986b470b2..ce29f0e65e 100644 --- a/crawl-ref/source/l_subvault.cc +++ b/crawl-ref/source/l_subvault.cc @@ -14,7 +14,7 @@ static int dgn_is_subvault(lua_State *ls) MAP(ls, 1, map); lua_pushboolean(ls, map->is_subvault()); - return (1); + return 1; } static int dgn_default_subvault_glyphs(lua_State *ls) @@ -22,7 +22,7 @@ static int dgn_default_subvault_glyphs(lua_State *ls) MAP(ls, 1, map); map->apply_subvault_mask(); - return (0); + return 0; } static int dgn_subvault_cell_valid(lua_State *ls) @@ -33,7 +33,7 @@ static int dgn_subvault_cell_valid(lua_State *ls) c.y = luaL_checkint(ls, 3); lua_pushboolean(ls, map->subvault_cell_valid(c)); - return (1); + return 1; } static int dgn_subvault_size(lua_State *ls) @@ -42,7 +42,7 @@ static int dgn_subvault_size(lua_State *ls) lua_pushnumber(ls, map->subvault_width()); lua_pushnumber(ls, map->subvault_height()); - return (2); + return 2; } const struct luaL_reg dgn_subvault_dlib[] = diff --git a/crawl-ref/source/l_travel.cc b/crawl-ref/source/l_travel.cc index cbb7325440..b6c0d2c271 100644 --- a/crawl-ref/source/l_travel.cc +++ b/crawl-ref/source/l_travel.cc @@ -22,12 +22,12 @@ LUAFN(l_set_exclude) s.y = luaL_checkint(ls, 2); const coord_def p = player2grid(s); if (!in_bounds(p)) - return (0); + return 0; int r = LOS_RADIUS; if (lua_gettop(ls) > 2) r = luaL_checkint(ls, 3); set_exclude(p, r); - return (0); + return 0; } LUAFN(l_del_exclude) @@ -37,9 +37,9 @@ LUAFN(l_del_exclude) s.y = luaL_checkint(ls, 2); const coord_def p = player2grid(s); if (!in_bounds(p)) - return (0); + return 0; del_exclude(p); - return (0); + return 0; } LUAFN(l_feature_is_traversable) diff --git a/crawl-ref/source/l_view.cc b/crawl-ref/source/l_view.cc index 259b74b58a..b6565a3c6c 100644 --- a/crawl-ref/source/l_view.cc +++ b/crawl-ref/source/l_view.cc @@ -23,11 +23,11 @@ LUAFN(view_feature_at) COORDSHOW(s, 1, 2) const coord_def p = player2grid(s); if (!map_bounds(p)) - return (1); + return 1; dungeon_feature_type f = env.map_knowledge(p).feat(); if (f != DNGN_UNSEEN) lua_pushstring(ls, dungeon_feature_name(f)); - return (1); + return 1; } LUAFN(view_is_safe_square) @@ -35,12 +35,12 @@ LUAFN(view_is_safe_square) COORDSHOW(s, 1, 2) const coord_def p = player2grid(s); if (!map_bounds(p)) - return (1); + return 1; cloud_type c = env.map_knowledge(p).cloud(); if (c != CLOUD_NONE && is_damaging_cloud(c, true)) { PLUARET(boolean, false); - return (1); + return 1; } trap_type t = env.map_knowledge(p).trap(); if (t != TRAP_UNASSIGNED) @@ -49,16 +49,16 @@ LUAFN(view_is_safe_square) trap.type = t; trap.ammo_qty = 1; PLUARET(boolean, trap.is_safe()); - return (1); + return 1; } dungeon_feature_type f = env.map_knowledge(p).feat(); if (f != DNGN_UNSEEN && !feat_is_traversable_now(f)) { PLUARET(boolean, false); - return (1); + return 1; } PLUARET(boolean, true); - return (1); + return 1; } LUAFN(view_can_reach) @@ -69,12 +69,12 @@ LUAFN(view_can_reach) if (x_distance > 2 || y_distance > 2) { PLUARET(boolean, false); - return (1); + return 1; } if (x_distance < 2 && y_distance < 2) { PLUARET(boolean, true); - return (1); + return 1; } const coord_def first_middle(s.x/2,s.y/2); const coord_def second_middle(s.x - s.x/2, s.y - s.y/2); @@ -82,10 +82,10 @@ LUAFN(view_can_reach) && !feat_is_reachable_past(grd(player2grid(second_middle)))) { PLUARET(boolean, false); - return (1); + return 1; } PLUARET(boolean, true); - return (1); + return 1; } static const struct luaL_reg view_lib[] = diff --git a/crawl-ref/source/l_you.cc b/crawl-ref/source/l_you.cc index df010d51b6..fa01b474b0 100644 --- a/crawl-ref/source/l_you.cc +++ b/crawl-ref/source/l_you.cc @@ -179,13 +179,13 @@ static int l_you_genus(lua_State *ls) if (plural) genus = pluralise(genus); lua_pushstring(ls, genus.c_str()); - return (1); + return 1; } static int you_floor_items(lua_State *ls) { lua_push_floor_items(ls, env.igrid(you.pos())); - return (1); + return 1; } static int l_you_spells(lua_State *ls) @@ -201,7 +201,7 @@ static int l_you_spells(lua_State *ls) lua_pushstring(ls, spell_title(spell)); lua_rawseti(ls, -2, ++index); } - return (1); + return 1; } static int l_you_spell_letters(lua_State *ls) @@ -222,7 +222,7 @@ static int l_you_spell_letters(lua_State *ls) lua_pushstring(ls, buf); lua_rawseti(ls, -2, ++index); } - return (1); + return 1; } static int l_you_abils(lua_State *ls) @@ -235,7 +235,7 @@ static int l_you_abils(lua_State *ls) lua_pushstring(ls, abils[i]); lua_rawseti(ls, -2, i + 1); } - return (1); + return 1; } static int l_you_abil_letters(lua_State *ls) @@ -252,7 +252,7 @@ static int l_you_abil_letters(lua_State *ls) lua_pushstring(ls, buf); lua_rawseti(ls, -2, i + 1); } - return (1); + return 1; } static int you_can_consume_corpses(lua_State *ls) @@ -261,7 +261,7 @@ static int you_can_consume_corpses(lua_State *ls) can_ingest(OBJ_FOOD, FOOD_CHUNK, true, false) || can_ingest(OBJ_CORPSES, CORPSE_BODY, true, false) ); - return (1); + return 1; } LUAFN(you_caught) @@ -271,7 +271,7 @@ LUAFN(you_caught) else lua_pushnil(ls); - return (1); + return 1; } LUAFN(you_mutation) @@ -450,7 +450,7 @@ LUAFN(you_stop_running) { stop_running(); - return (0); + return 0; } LUAFN(you_moveto) @@ -458,7 +458,7 @@ LUAFN(you_moveto) const coord_def place(luaL_checkint(ls, 1), luaL_checkint(ls, 2)); ASSERT(map_bounds(place)); you.moveto(place); - return (0); + return 0; } LUAFN(you_teleport_to) @@ -470,13 +470,13 @@ LUAFN(you_teleport_to) lua_pushboolean(ls, you_teleport_to(place, move_monsters)); - return (1); + return 1; } LUAFN(you_random_teleport) { you_teleport_now(false, false); - return (0); + return 0; } static int _you_uniques(lua_State *ls) @@ -487,7 +487,7 @@ static int _you_uniques(lua_State *ls) unique_found = you.unique_creatures[get_monster_by_name(lua_tostring(ls, 1))]; lua_pushboolean(ls, unique_found); - return (1); + return 1; } LUARET1(you_num_runes, number, runes_in_pack()) @@ -508,7 +508,7 @@ static int _you_have_rune(lua_State *ls) if (which_rune >= 0 && which_rune < NUM_RUNE_TYPES) have_rune = you.runes[which_rune]; lua_pushboolean(ls, have_rune); - return (1); + return 1; } static int _you_gold(lua_State *ls) diff --git a/crawl-ref/source/libgui.cc b/crawl-ref/source/libgui.cc index 396efb4fec..d00db41aeb 100644 --- a/crawl-ref/source/libgui.cc +++ b/crawl-ref/source/libgui.cc @@ -108,9 +108,9 @@ void set_cursor_enabled(bool enabled) bool is_cursor_enabled() { if (TextRegion::cursor_flag) - return (true); + return true; - return (false); + return false; } bool is_smart_cursor_enabled() diff --git a/crawl-ref/source/libunix.cc b/crawl-ref/source/libunix.cc index 909547a990..20fa1fa618 100644 --- a/crawl-ref/source/libunix.cc +++ b/crawl-ref/source/libunix.cc @@ -75,13 +75,13 @@ static unsigned int convert_to_curses_attr(int chattr) { switch (chattr & CHATTR_ATTRMASK) { - case CHATTR_STANDOUT: return (A_STANDOUT); - case CHATTR_BOLD: return (A_BOLD); - case CHATTR_BLINK: return (A_BLINK); - case CHATTR_UNDERLINE: return (A_UNDERLINE); - case CHATTR_REVERSE: return (A_REVERSE); - case CHATTR_DIM: return (A_DIM); - default: return (A_NORMAL); + case CHATTR_STANDOUT: return A_STANDOUT; + case CHATTR_BOLD: return A_BOLD; + case CHATTR_BLINK: return A_BLINK; + case CHATTR_UNDERLINE: return A_UNDERLINE; + case CHATTR_REVERSE: return A_REVERSE; + case CHATTR_DIM: return A_DIM; + default: return A_NORMAL; } } @@ -185,7 +185,7 @@ static int proc_mouse_event(int c, const MEVENT *me) crawl_view.mousep.y = me->y + 1; if (!crawl_state.mouse_enabled) - return (CK_MOUSE_MOVE); + return CK_MOUSE_MOVE; c_mouse_event cme(crawl_view.mousep); if (me->bstate & BUTTON1_CLICKED) @@ -208,10 +208,10 @@ static int proc_mouse_event(int c, const MEVENT *me) if (cme) { new_mouse_event(cme); - return (CK_MOUSE_CLICK); + return CK_MOUSE_CLICK; } - return (CK_MOUSE_MOVE); + return CK_MOUSE_MOVE; } #endif @@ -279,7 +279,7 @@ int m_getch() ((c == CK_MOUSE_MOVE || c == CK_MOUSE_CLICK) && !crawl_state.mouse_enabled)); - return (c); + return c; } int getch_ck() @@ -540,12 +540,12 @@ void clear_to_end_of_line(void) int get_number_of_lines(void) { - return (LINES); + return LINES; } int get_number_of_cols(void) { - return (COLS); + return COLS; } int num_to_lines(int num) @@ -575,7 +575,7 @@ void set_cursor_enabled(bool enabled) bool is_cursor_enabled() { - return (cursor_is_enabled); + return cursor_is_enabled; } bool is_smart_cursor_enabled() @@ -744,7 +744,7 @@ static inline char_info character_at(int y, int x) cchar_t c; // (void) is to hush an incorrect clang warning. (void)mvin_wch(y, x, &c); - return (c); + return c; } static inline bool valid_char(const cchar_t &c) diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index 671c8b9379..0791ed9a78 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -110,7 +110,7 @@ std::string apply_description(description_level_type desc, return ("your " + name); case DESC_PLAIN: default: - return (name); + return name; } } @@ -154,7 +154,7 @@ std::string vmake_stringf(const char* s, va_list args) size_t len = vsnprintf(buf1, sizeof buf1, s, orig_args); va_end(orig_args); if (len < sizeof buf1) - return (buf1); + return buf1; char *buf2 = (char*)malloc(len + 1); va_copy(orig_args, args); @@ -163,7 +163,7 @@ std::string vmake_stringf(const char* s, va_list args) std::string ret(buf2); free(buf2); - return (ret); + return ret; } std::string make_stringf(const char *s, ...) @@ -180,9 +180,9 @@ bool key_is_escape(int key) switch (key) { CASE_ESCAPE - return (true); + return true; default: - return (false); + return false; } } @@ -191,13 +191,13 @@ std::string &uppercase(std::string &s) for (unsigned i = 0, sz = s.size(); i < sz; ++i) s[i] = toupper(s[i]); - return (s); + return s; } std::string &lowercase(std::string &s) { s = lowercase_string(s); - return (s); + return s; } std::string lowercase_string(std::string s) @@ -207,7 +207,7 @@ std::string lowercase_string(std::string s) char buf[4]; for (const char *tp = s.c_str(); int len = utf8towc(&c, tp); tp += len) res.append(buf, wctoutf8(buf, towlower(c))); - return (res); + return res; } // Warning: this (and uppercase_first()) relies on no libc (glibc, BSD libc, @@ -227,7 +227,7 @@ std::string lowercase_first(std::string s) utf8towc(&c, &s[0]); wctoutf8(&s[0], towlower(c)); } - return (s); + return s; } std::string uppercase_first(std::string s) @@ -241,19 +241,19 @@ std::string uppercase_first(std::string s) utf8towc(&c, &s[0]); wctoutf8(&s[0], towupper(c)); } - return (s); + return s; } int ends_with(const std::string &s, const char *suffixes[]) { if (!suffixes) - return (0); + return 0; for (int i = 0; suffixes[i]; ++i) if (ends_with(s, suffixes[i])) return (1 + i); - return (0); + return 0; } bool strip_suffix(std::string &s, const std::string &suffix) @@ -262,7 +262,7 @@ bool strip_suffix(std::string &s, const std::string &suffix) { s.erase(s.length() - suffix.length(), suffix.length()); trim_string(s); - return (true); + return true; } return false; } @@ -273,7 +273,7 @@ bool strip_tag(std::string &s, const std::string &tag, bool skip_padding) if (s == tag) { s.clear(); - return (true); + return true; } std::string::size_type pos; @@ -284,9 +284,9 @@ bool strip_tag(std::string &s, const std::string &tag, bool skip_padding) { s.erase(pos, tag.length()); trim_string(s); - return (true); + return true; } - return (false); + return false; } if ((pos = s.find(" " + tag + " ")) != std::string::npos) @@ -294,7 +294,7 @@ bool strip_tag(std::string &s, const std::string &tag, bool skip_padding) // Leave one space intact. s.erase(pos, tag.length() + 1); trim_string(s); - return (true); + return true; } if ((pos = s.find(tag + " ")) == 0 @@ -303,10 +303,10 @@ bool strip_tag(std::string &s, const std::string &tag, bool skip_padding) { s.erase(pos, tag.length() + 1); trim_string(s); - return (true); + return true; } - return (false); + return false; } std::vector<std::string> strip_multiple_tag_prefix(std::string &s, const std::string &tagprefix) @@ -345,7 +345,7 @@ std::string strip_tag_prefix(std::string &s, const std::string &tagprefix) s.erase(pos, ns - pos + 1); trim_string(s); - return (argument); + return argument; } int strip_number_tag(std::string &s, const std::string &tagprefix) @@ -518,7 +518,7 @@ std::string pluralise(const std::string &name, std::string apostrophise(const std::string &name) { if (name.empty()) - return (name); + return name; if (name == "you" || name == "You") return (name + "r"); @@ -533,7 +533,7 @@ std::string apostrophise(const std::string &name) std::string apostrophise_fixup(const std::string &msg) { if (msg.empty()) - return (msg); + return msg; // XXX: This is rather hackish. return (replace_all(msg, "s's", "s'")); @@ -622,7 +622,7 @@ std::string replace_all(std::string s, start = found + repl.length(); } - return (s); + return s; } // Replaces all occurrences of any of the characters in tofind with the @@ -641,7 +641,7 @@ std::string replace_all_of(std::string s, start = found + replacement.length(); } - return (s); + return s; } int count_occurrences(const std::string &text, const std::string &s) @@ -656,13 +656,13 @@ int count_occurrences(const std::string &text, const std::string &s) pos += s.length(); } - return (nfound); + return nfound; } std::string trimmed_string(std::string s) { trim_string(s); - return (s); + return s; } // also used with macros @@ -671,13 +671,13 @@ std::string &trim_string(std::string &str) str.erase(0, str.find_first_not_of(" \t\n\r")); str.erase(str.find_last_not_of(" \t\n\r") + 1); - return (str); + return str; } std::string &trim_string_right(std::string &str) { str.erase(str.find_last_not_of(" \t\n\r") + 1); - return (str); + return str; } static void add_segment(std::vector<std::string> &segs, @@ -977,7 +977,7 @@ void cgotoxy(int x, int y, GotoRegion region) GotoRegion get_cursor_region() { - return (_current_region); + return _current_region; } #endif // USE_TILE_LOCAL diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h index 3e455d5fdf..a98ffb9218 100644 --- a/crawl-ref/source/libutil.h +++ b/crawl-ref/source/libutil.h @@ -174,7 +174,7 @@ std::string comma_separated_line(Z start, Z end, text += *i; } - return (text); + return text; } std::string unwrap_desc(std::string desc); diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc index 69829dcc71..6d12315942 100644 --- a/crawl-ref/source/libw32c.cc +++ b/crawl-ref/source/libw32c.cc @@ -187,7 +187,7 @@ void enable_smart_cursor(bool cursor) bool is_smart_cursor_enabled() { - return (w32_smart_cursor); + return w32_smart_cursor; } void bFlush(void) @@ -446,7 +446,7 @@ void set_cursor_enabled(bool enabled) bool is_cursor_enabled() { - return (cursor_is_enabled); + return cursor_is_enabled; } static void _setcursortype_internal(bool curstype) @@ -726,11 +726,11 @@ static int w32_proc_mouse_event(const MOUSE_EVENT_RECORD &mer) crawl_view.mousep = pos; if (!crawl_state.mouse_enabled) - return (0); + return 0; c_mouse_event cme(pos); if (mer.dwEventFlags & MOUSE_MOVED) - return (CK_MOUSE_MOVE); + return CK_MOUSE_MOVE; if (mer.dwButtonState & FROM_LEFT_1ST_BUTTON_PRESSED) cme.bstate |= c_mouse_event::BUTTON1; @@ -748,10 +748,10 @@ static int w32_proc_mouse_event(const MOUSE_EVENT_RECORD &mer) if (cme) { new_mouse_event(cme); - return (CK_MOUSE_CLICK); + return CK_MOUSE_CLICK; } - return (0); + return 0; } int getch_ck(void) diff --git a/crawl-ref/source/los.cc b/crawl-ref/source/los.cc index bbb707f671..d2e9386e24 100644 --- a/crawl-ref/source/los.cc +++ b/crawl-ref/source/los.cc @@ -259,9 +259,9 @@ static bool _is_better(const cellray& a, const cellray& b) // calc_params() has been called. ASSERT(a.imbalance >= 0 && b.imbalance >= 0); if (a.imbalance < b.imbalance) - return (true); + return true; else if (a.imbalance > b.imbalance) - return (false); + return false; else return (a.first_diag && !b.first_diag); } @@ -595,12 +595,12 @@ static bool _find_ray_se(const coord_def& target, ray_def& ray, blocked += opc(c[j]); } if (blocked >= OPC_OPAQUE) - return (false); + return false; ray = c.ray; ray.cycle_idx = index; - return (true); + return true; } // Coordinate transformation so we can find_ray quadrant-by-quadrant. @@ -650,7 +650,7 @@ bool find_ray(const coord_def& source, const coord_def& target, opacity_trans opc_trans = opacity_trans(opc, source, signx, signy); if (!_find_ray_se(abs, ray, opc_trans, bds, cycle)) - return (false); + return false; if (signx < 0) ray.r.start.x = 1.0 - ray.r.start.x; @@ -662,7 +662,7 @@ bool find_ray(const coord_def& source, const coord_def& target, ray.r.start.x += source.x; ray.r.start.y += source.y; - return (true); + return true; } bool exists_ray(const coord_def& source, const coord_def& target, @@ -681,7 +681,7 @@ dungeon_feature_type ray_blocker(const coord_def& source, if (!find_ray(source, target, ray, opc_default)) { ASSERT(you.xray_vision); - return (NUM_FEATURES); + return NUM_FEATURES; } ray.advance(); @@ -694,7 +694,7 @@ dungeon_feature_type ray_blocker(const coord_def& source, ray.advance(); } ASSERT(false); - return (NUM_FEATURES); + return NUM_FEATURES; } // Returns a straight ray from source to target. @@ -726,7 +726,7 @@ int num_feats_between(const coord_def& source, const coord_def& target, ASSERT(map_bounds(source) && map_bounds(target)); if (source == target) - return (0); // XXX: might want to count the cell. + return 0; // XXX: might want to count the cell. // We don't need to find the shortest beam, any beam will suffice. fallback_ray(source, target, ray); @@ -752,7 +752,7 @@ int num_feats_between(const coord_def& source, const coord_def& target, count++; if (just_check) // Only needs to be > 0. - return (count); + return count; } if (reached_target) @@ -761,7 +761,7 @@ int num_feats_between(const coord_def& source, const coord_def& target, ray.advance(); } - return (count); + return count; } // Is p2 visible from p1, disregarding half-opaque objects? diff --git a/crawl-ref/source/los_def.cc b/crawl-ref/source/los_def.cc index 7c1515a0e3..eecb36d3f0 100644 --- a/crawl-ref/source/los_def.cc +++ b/crawl-ref/source/los_def.cc @@ -102,7 +102,7 @@ bool los_def::see_cell(const coord_def& p) const coord_def los_glob::get_center() const { - return (center); + return center; } circle_def los_glob::get_bounds() const diff --git a/crawl-ref/source/losglobal.cc b/crawl-ref/source/losglobal.cc index 80e2d334e0..aefb8828b6 100644 --- a/crawl-ref/source/losglobal.cc +++ b/crawl-ref/source/losglobal.cc @@ -22,10 +22,10 @@ static losfield_t* _lookup_globallos(const coord_def& p, const coord_def& q) COMPILE_CHECK(LOS_KNOWN * 2 <= sizeof(losfield_t) * 8); if (!map_bounds(p) || !map_bounds(q)) - return (NULL); + return NULL; coord_def diff = q - p; if (diff.abs() > LOS_RADIUS_SQ) - return (NULL); + return NULL; // p < q iff p.x < q.x || p.x == q.x && p.y < q.y if (diff < coord_def(0, 0)) return (&globallos[q.x][q.y][-diff.x + o_half_x][-diff.y + o_half_y]); @@ -108,12 +108,12 @@ static void _update_globallos_at(const coord_def& p, los_type l) bool cell_see_cell(const coord_def& p, const coord_def& q, los_type l) { if (l == LOS_ARENA) - return (true); + return true; losfield_t* flags = _lookup_globallos(p, q); if (!flags) - return (false); // outside range + return false; // outside range if (!(*flags & (l << LOS_KNOWN))) _update_globallos_at(p, l); diff --git a/crawl-ref/source/losparam.cc b/crawl-ref/source/losparam.cc index 8f9830d877..9a8c98d516 100644 --- a/crawl-ref/source/losparam.cc +++ b/crawl-ref/source/losparam.cc @@ -66,7 +66,7 @@ static bool mons_block_immob(const monster* mons) // In Zotdef, plants don't block movement as critters // will attack them if (crawl_state.game_is_zotdef()) - return (false); + return false; switch (mons->type) { @@ -118,15 +118,15 @@ opacity_type opacity_monmove::operator()(const coord_def& p) const { dungeon_feature_type feat = env.grid(p); if (feat < DNGN_MINMOVE || !mon.can_pass_through_feat(feat)) - return (OPC_OPAQUE); + return OPC_OPAQUE; else - return (OPC_CLEAR); + return OPC_CLEAR; } opacity_type opacity_no_actor::operator()(const coord_def& p) const { if (feat_is_solid(env.grid(p)) || actor_at(p)) - return (OPC_OPAQUE); + return OPC_OPAQUE; else - return (OPC_CLEAR); + return OPC_CLEAR; } diff --git a/crawl-ref/source/luaterp.cc b/crawl-ref/source/luaterp.cc index 8aef3dc531..bb5af468d4 100644 --- a/crawl-ref/source/luaterp.cc +++ b/crawl-ref/source/luaterp.cc @@ -46,7 +46,7 @@ static int _pushline(lua_State *ls, int firstline) size_t l; std::string prompt = firstline ? "> " : ". "; if (msgwin_get_line_autohist(prompt, buffer, sizeof(buffer))) - return (0); + return 0; l = strlen(b); // XXX: get line doesn't return newline? @@ -57,7 +57,7 @@ static int _pushline(lua_State *ls, int firstline) lua_pushfstring(ls, "return %s", b+1); // change it to `return' else lua_pushstring(ls, b); - return (1); + return 1; } static int _loadline(lua_State *ls) @@ -90,7 +90,7 @@ static int _docall(lua_State *ls) { int status; status = lua_pcall(ls, 0, LUA_MULTRET, 0); - return (status); + return status; } static int _report(lua_State *ls, int status) @@ -137,7 +137,7 @@ static void _run_dlua_interpreter(lua_State *ls) bool luaterp_running() { - return (_luaterp_running); + return _luaterp_running; } static bool _loaded_terp_files = false; diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index 8dd80dfc23..d52f39737b 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -146,9 +146,9 @@ static bool userfunc_referenced(int index, const macromap &mm) for (macromap::const_iterator i = mm.begin(); i != mm.end(); ++i) { if (userfunc_index(i->second) == index) - return (true); + return true; } - return (false); + return false; } static bool userfunc_referenced(int index) @@ -157,9 +157,9 @@ static bool userfunc_referenced(int index) { macromap *m = all_maps[i]; if (userfunc_referenced(index, *m)) - return (true); + return true; } - return (false); + return false; } // Expensive function to discard unused function names @@ -183,7 +183,7 @@ static int userfunc_getindex(const std::string &fname) for (int i = 0, count = userfunctions.size(); i < count; ++i) { if (userfunctions[i] == fname) - return (i); + return i; } // Pass 2 to hunt for gaps. @@ -192,7 +192,7 @@ static int userfunc_getindex(const std::string &fname) if (userfunctions[i].empty()) { userfunctions[i] = fname; - return (i); + return i; } } @@ -253,7 +253,7 @@ static void buf2keyseq(const char *buff, keyseq &k) static int read_key_code(std::string s) { if (s.empty()) - return (0); + return 0; int base = 10; if (s[0] == 'x') @@ -289,7 +289,7 @@ static keyseq parse_keyseq(std::string s) if (s.find("===") == 0) { buf2keyseq(s.c_str(), v); - return (v); + return v; } bool more_reset = false; @@ -342,7 +342,7 @@ static keyseq parse_keyseq(std::string s) } } - return (v); + return v; } /* @@ -642,7 +642,7 @@ int macro_buf_get() for (int i = 0, size_i = recorders.size(); i < size_i; i++) recorders[i]->add_key(key); - return (key); + return key; } static void write_map(FILE *f, const macromap &mp, const char *key) @@ -722,7 +722,7 @@ static keyseq _getch_mul(int (*rgetch)() = NULL) while (kbhit() || a == 0) keys.push_back(a = rgetch()); - return (keys); + return keys; } /* @@ -740,7 +740,7 @@ int getchm(KeymapContext mc, int (*rgetch)()) // Got data from buffer. if ((a = macro_buf_get()) != -1) - return (a); + return a; // Read some keys... keyseq keys = _getch_mul(rgetch); @@ -1085,9 +1085,9 @@ bool is_synthetic_key(int key) #ifdef USE_TILE case CK_MOUSE_CMD: #endif - return (true); + return true; default: - return (false); + return false; } } @@ -1207,7 +1207,7 @@ command_type name_to_command(std::string name) name_to_cmd_map::iterator it = _names_to_cmds.find(name); if (it == _names_to_cmds.end()) - return (CMD_NO_CMD); + return CMD_NO_CMD; return static_cast<command_type>(it->second); } @@ -1230,7 +1230,7 @@ command_type key_to_command(int key, KeymapContext context) KeymapContext cmd_context = _context_for_command(cmd); if (cmd == CMD_NO_CMD) - return (CMD_NO_CMD); + return CMD_NO_CMD; if (cmd_context != context) { @@ -1248,10 +1248,10 @@ command_type key_to_command(int key, KeymapContext context) } flush_input_buffer(FLUSH_BEFORE_COMMAND); - return (CMD_NO_CMD); + return CMD_NO_CMD; } - return (cmd); + return cmd; } key_to_cmd_map &key_map = _keys_to_cmds[context]; @@ -1377,7 +1377,7 @@ static std::string _special_keys_to_string(int key) case CK_PGDN: cmd += "PgDn"; break; } - return (cmd); + return cmd; } std::string command_to_string(command_type cmd, bool tutorial) @@ -1386,7 +1386,7 @@ std::string command_to_string(command_type cmd, bool tutorial) const std::string desc = _special_keys_to_string(key); if (!desc.empty()) - return (desc); + return desc; if (key >= 32 && key < 256) { @@ -1410,7 +1410,7 @@ std::string command_to_string(command_type cmd, bool tutorial) } std::string result = info; - return (result); + return result; } void insert_commands(std::string &desc, std::vector<command_type> cmds, diff --git a/crawl-ref/source/main.cc b/crawl-ref/source/main.cc index 78f02f93ca..1db00118e8 100644 --- a/crawl-ref/source/main.cc +++ b/crawl-ref/source/main.cc @@ -916,7 +916,7 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false) case CMD_READ_MESSAGES: case CMD_SEARCH_STASHES: mpr("You can't repeat informational commands."); - return (false); + return false; // Multi-turn commands case CMD_PICKUP: @@ -933,7 +933,7 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false) case CMD_EXPLORE: case CMD_INTERLEVEL_TRAVEL: mpr("You can't repeat multi-turn commands."); - return (false); + return false; // Miscellaneous non-repeatable commands. case CMD_TOGGLE_AUTOPICKUP: @@ -958,20 +958,20 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false) case CMD_EDIT_PLAYER_TILE: #endif mpr("You can't repeat that command."); - return (false); + return false; case CMD_DISPLAY_MAP: mpr("You can't repeat map commands."); - return (false); + return false; case CMD_MOUSE_MOVE: case CMD_MOUSE_CLICK: mpr("You can't repeat mouse clicks or movements."); - return (false); + return false; case CMD_REPEAT_CMD: mpr("You can't repeat the repeat command!"); - return (false); + return false; case CMD_RUN_LEFT: case CMD_RUN_DOWN: @@ -982,14 +982,14 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false) case CMD_RUN_UP_RIGHT: case CMD_RUN_DOWN_RIGHT: mpr("Why would you want to repeat a run command?"); - return (false); + return false; case CMD_PREV_CMD_AGAIN: ASSERT(!is_again); if (crawl_state.prev_cmd == CMD_NO_CMD) { mpr("No previous command to repeat."); - return (false); + return false; } return _cmd_is_repeatable(crawl_state.prev_cmd, true); @@ -1013,18 +1013,18 @@ static bool _cmd_is_repeatable(command_type cmd, bool is_again = false) "are nearby?", false, 'n'); } - return (true); + return true; case CMD_NO_CMD: case CMD_NO_CMD_DEFAULT: mpr("Unknown command, not repeating."); - return (false); + return false; default: - return (true); + return true; } - return (false); + return false; } // Used to determine whether to apply the berserk penalty at end of round. @@ -1331,10 +1331,10 @@ static bool _stairs_check_mesmerised() const monster* beholder = you.get_any_beholder(); mprf("You cannot move away from %s!", beholder->name(DESC_THE, true).c_str()); - return (true); + return true; } - return (false); + return false; } static bool _marker_vetoes_stair() @@ -1359,7 +1359,7 @@ static bool _prompt_dangerous_portal(dungeon_feature_type ftype) "self.", false, 'n'); default: - return (true); + return true; } } @@ -2172,7 +2172,7 @@ static bool _decrement_a_duration(duration_type dur, int delay, msg_channel_type chan = MSGCH_DURATION) { if (you.duration[dur] < 1) - return (false); + return false; const int midpoint = get_expiration_threshold(dur); @@ -3346,7 +3346,7 @@ static command_type _get_next_cmd() if (is_userfunction(keyin)) { run_macro(get_userfunction(keyin).c_str()); - return (CMD_NEXT_CMD); + return CMD_NEXT_CMD; } return _keycode_to_command(keyin); @@ -3383,7 +3383,7 @@ static keycode_type _get_next_keycode() if (!is_synthetic_key(keyin)) mesclr(); - return (keyin); + return keyin; } // Check squares adjacent to player for given feature and return how @@ -3450,7 +3450,7 @@ static bool _untrap_target(const coord_def move, bool check_confused) if (yesno(prompt.c_str(), true, 'n')) { remove_net_from(mon); - return (true); + return true; } } @@ -3460,7 +3460,7 @@ static bool _untrap_target(const coord_def move, bool check_confused) if (you.berserk_penalty != NO_BERSERK_PENALTY) you.berserk_penalty = 0; - return (true); + return true; } if (find_trap(target) && grd(target) != DNGN_UNDISCOVERED_TRAP) @@ -3470,24 +3470,24 @@ static bool _untrap_target(const coord_def move, bool check_confused) if (!form_can_wield()) { mpr("You can't disarm traps in your present form."); - return (true); + return true; } if (!player_can_reach_floor()) - return (true); + return true; const int cloud = env.cgrid(target); if (cloud != EMPTY_CLOUD && is_damaging_cloud(env.cloud[ cloud ].type, true)) { mpr("You can't get to that trap right now."); - return (true); + return true; } } // If you're confused, you may attempt it and stumble into the trap. disarm_trap(target); - return (true); + return true; } const dungeon_feature_type feat = grd(target); @@ -3497,7 +3497,7 @@ static bool _untrap_target(const coord_def move, bool check_confused) { case DNGN_OPEN_DOOR: _close_door(move); // for convenience - return (true); + return true; default: { bool do_msg = true; @@ -3518,13 +3518,13 @@ static bool _untrap_target(const coord_def move, bool check_confused) mpr("You swing at nothing."); make_hungry(3, true); you.turn_is_over = true; - return (true); + return true; } } } // Else it's a closed door and needs further handling. - return (false); + return false; } // Opens doors and may also handle untrapping/attacking, etc. @@ -4464,7 +4464,7 @@ static command_type _find_command(const keyseq& keys) if (is_userfunction(keyin)) cmd = CMD_NEXT_CMD; flush_input_buffer(FLUSH_REPEAT_SETUP_DONE); - return (cmd); + return cmd; } static void _check_cmd_repeat(int last_turn) diff --git a/crawl-ref/source/makeitem.cc b/crawl-ref/source/makeitem.cc index 32a9889b3b..9376836641 100644 --- a/crawl-ref/source/makeitem.cc +++ b/crawl-ref/source/makeitem.cc @@ -44,7 +44,7 @@ int create_item_named(std::string name, coord_def p, { if (error) *error = err; - return (NON_ITEM); + return NON_ITEM; } item_spec ispec = ilist.get_item(0); @@ -54,7 +54,7 @@ int create_item_named(std::string name, coord_def p, else if (error) *error = "Failed to create item '" + name + "'"; - return (item); + return item; } bool got_curare_roll(const int item_level) @@ -144,7 +144,7 @@ static int _weapon_colour(const item_def &item) } } - return (item_colour); + return item_colour; } static int _missile_colour(const item_def &item) @@ -178,7 +178,7 @@ static int _missile_colour(const item_def &item) default: die("invalid missile type"); } - return (item_colour); + return item_colour; } static int _armour_colour(const item_def &item) @@ -231,7 +231,7 @@ static int _armour_colour(const item_def &item) break; } - return (item_colour); + return item_colour; } void item_colour(item_def &item) @@ -727,7 +727,7 @@ static bool _is_boring_item(int type, int sub_type) case SCR_REMOVE_CURSE: case SCR_IDENTIFY: case SCR_MAGIC_MAPPING: - return (true); + return true; default: break; } @@ -738,7 +738,7 @@ static bool _is_boring_item(int type, int sub_type) default: break; } - return (false); + return false; } static weapon_type _determine_weapon_subtype(int item_level) @@ -793,15 +793,15 @@ static weapon_type _determine_weapon_subtype(int item_level) static bool _try_make_item_unrand(item_def& item, int force_type) { if (player_in_branch(BRANCH_PANDEMONIUM)) - return (false); + return false; int idx = find_okay_unrandart(item.base_type, force_type, player_in_branch(BRANCH_ABYSS)); if (idx != -1 && make_item_unrandart(item, idx)) - return (true); + return true; - return (false); + return false; } // Return whether we made an artefact. @@ -818,7 +818,7 @@ static bool _try_make_weapon_artefact(item_def& item, int force_type, && !force_randart) { if (_try_make_item_unrand(item, force_type)) - return (true); + return true; } // Small clubs are never randarts. @@ -856,10 +856,10 @@ static bool _try_make_weapon_artefact(item_def& item, int force_type, if (get_weapon_brand(item) == SPWPN_HOLY_WRATH) item.flags &= (~ISFLAG_CURSED); - return (true); + return true; } - return (false); + return false; } static item_status_flag_type _determine_weapon_race(const item_def& item, @@ -1454,7 +1454,7 @@ static brand_type _determine_weapon_brand(const item_def& item, int item_level) } ASSERT(is_weapon_brand_ok(item.sub_type, rc, true)); - return (rc); + return rc; } // Reject brands which are outright bad for the item. Unorthodox combinations @@ -1466,21 +1466,21 @@ bool is_weapon_brand_ok(int type, int brand, bool strict) item.sub_type = type; if (brand <= SPWPN_NORMAL) - return (true); + return true; if (type == WPN_QUICK_BLADE && brand == SPWPN_SPEED) - return (false); + return false; if (weapon_skill(OBJ_WEAPONS, type) != SK_POLEARMS && brand == SPWPN_DRAGON_SLAYING) { - return (false); + return false; } if (weapon_skill(OBJ_WEAPONS, type) == SK_POLEARMS && brand == SPWPN_REACHING) { - return (false); + return false; } if (type == WPN_BLOWGUN) @@ -1525,7 +1525,7 @@ bool is_weapon_brand_ok(int type, int brand, bool strict) case SPWPN_ANTIMAGIC: case SPWPN_REAPING: if (is_range_weapon(item)) - return (false); + return false; break; // Ranged-only brands. @@ -1534,7 +1534,7 @@ bool is_weapon_brand_ok(int type, int brand, bool strict) case SPWPN_PENETRATION: case SPWPN_EVASION: if (!is_range_weapon(item)) - return (false); + return false; break; case SPWPN_ACID: @@ -1548,9 +1548,9 @@ bool is_weapon_brand_ok(int type, int brand, bool strict) } if (brand == SPWPN_RETURNING && !is_throwable(&you, item, true)) - return (false); + return false; - return (true); + return true; } static void _generate_weapon_item(item_def& item, bool allow_uniques, @@ -1827,7 +1827,7 @@ bool is_missile_brand_ok(int type, int brand, bool strict) if ((type == MI_STONE || type == MI_LARGE_ROCK) && brand != SPMSL_NORMAL && strict) { - return (false); + return false; } // In contrast, needles should always be branded. @@ -1836,7 +1836,7 @@ bool is_missile_brand_ok(int type, int brand, bool strict) { case SPMSL_POISONED: if (type == MI_NEEDLE) - return (true); + return true; break; case SPMSL_CURARE: @@ -1850,20 +1850,20 @@ bool is_missile_brand_ok(int type, int brand, bool strict) default: if (type == MI_NEEDLE) - return (false); + return false; } // Everything else doesn't matter. if (brand == SPMSL_NORMAL) - return (true); + return true; // In non-strict mode, everything other than needles is mostly ok. if (!strict) - return (true); + return true; // Not a missile? if (type == 0) - return (true); + return true; // Specifics switch (brand) @@ -1898,7 +1898,7 @@ bool is_missile_brand_ok(int type, int brand, bool strict) } // Assume yes, if we've gotten this far. - return (false); + return false; } static void _generate_missile_item(item_def& item, int force_type, @@ -1979,7 +1979,7 @@ static bool _try_make_armour_artefact(item_def& item, int force_type, && !force_randart) { if (_try_make_item_unrand(item, force_type)) - return (true); + return true; } // The rest are normal randarts. @@ -2018,10 +2018,10 @@ static bool _try_make_armour_artefact(item_def& item, int force_type, do_curse_item(item); } - return (true); + return true; } - return (false); + return false; } static item_status_flag_type _determine_armour_race(const item_def& item, @@ -2126,7 +2126,7 @@ static item_status_flag_type _determine_armour_race(const item_def& item, } } - return (rc); + return rc; } static special_armour_type _determine_armour_ego(const item_def& item, @@ -2239,7 +2239,7 @@ static special_armour_type _determine_armour_ego(const item_def& item, } ASSERT(is_armour_brand_ok(item.sub_type, rc, true)); - return (rc); + return rc; } bool is_armour_brand_ok(int type, int brand, bool strict) @@ -2253,11 +2253,11 @@ bool is_armour_brand_ok(int type, int brand, bool strict) { case SPARM_FORBID_EGO: case SPARM_NORMAL: - return (true); + return true; case SPARM_LEVITATION: if (slot == EQ_BODY_ARMOUR) - return (true); + return true; // deliberate fall-through case SPARM_RUNNING: case SPARM_STEALTH: @@ -2268,11 +2268,11 @@ bool is_armour_brand_ok(int type, int brand, bool strict) : (slot == EQ_BODY_ARMOUR)); case SPARM_PONDEROUSNESS: - return (true); + return true; case SPARM_PRESERVATION: if (type == ARM_PLATE_ARMOUR && !strict) - return (true); + return true; // deliberate fall-through case SPARM_DARKNESS: return (slot == EQ_CLOAK); @@ -2300,18 +2300,18 @@ bool is_armour_brand_ok(int type, int brand, bool strict) || type == ARM_ICE_DRAGON_ARMOUR || type == ARM_GOLD_DRAGON_ARMOUR) { - return (false); // contradictory or redundant + return false; // contradictory or redundant } - return (true); // in portal vaults, these can happen on every slot + return true; // in portal vaults, these can happen on every slot case SPARM_MAGIC_RESISTANCE: if (type == ARM_WIZARD_HAT) - return (true); + return true; // deliberate fall-through case SPARM_POISON_RESISTANCE: case SPARM_POSITIVE_ENERGY: if (type == ARM_PEARL_DRAGON_ARMOUR && brand == SPARM_POSITIVE_ENERGY) - return (false); // contradictory or redundant + return false; // contradictory or redundant return (slot == EQ_BODY_ARMOUR || slot == EQ_SHIELD || slot == EQ_CLOAK || !strict); @@ -2323,7 +2323,7 @@ bool is_armour_brand_ok(int type, int brand, bool strict) die("invalid armour brand"); } - return (true); + return true; } static void _generate_armour_item(item_def& item, bool allow_uniques, @@ -2470,7 +2470,7 @@ static monster_type _choose_random_monster_corpse() return spc; } - return (MONS_RAT); // if you can't find anything else... + return MONS_RAT; // if you can't find anything else... } static int _random_wand_subtype() @@ -2877,10 +2877,10 @@ static bool _try_make_jewellery_unrandart(item_def& item, int force_type, && x_chance_in_y(101 + item_level * 3, 2000)) { if (_try_make_item_unrand(item, force_type)) - return (true); + return true; } - return (false); + return false; } static int _determine_ring_plus(int subtype) @@ -3053,7 +3053,7 @@ int items(bool allow_uniques, // Find an empty slot for the item (with culling if required). int p = get_mitm_slot(10); if (p == NON_ITEM) - return (NON_ITEM); + return NON_ITEM; item_def& item(mitm[p]); @@ -3124,7 +3124,7 @@ int items(bool allow_uniques, { make_item_unrandart(mitm[p], force_ego); ASSERT(mitm[p].is_valid()); - return (p); + return p; } // the base item otherwise item.special = SPWPN_NORMAL; @@ -3245,14 +3245,14 @@ int items(bool allow_uniques, { // Couldn't find a single good spot! destroy_item(p); - return (NON_ITEM); + return NON_ITEM; } move_item_to_grid(&p, itempos); } // Note that item might be invalidated now, since p could have changed. ASSERT(mitm[p].is_valid()); - return (p); + return p; } void reroll_brand(item_def &item, int item_level) @@ -3325,18 +3325,18 @@ static bool _weapon_is_visibly_special(const item_def &item) const bool visibly_branded = (brand != SPWPN_NORMAL); if (get_equip_desc(item) != ISFLAG_NO_DESC) - return (false); + return false; if (visibly_branded || is_artefact(item)) - return (true); + return true; if (item.is_mundane()) - return (false); + return false; if (item.flags & ISFLAG_CURSED && one_chance_in(3)) - return (true); + return true; - return (false); + return false; } static bool _armour_is_visibly_special(const item_def &item) @@ -3345,18 +3345,18 @@ static bool _armour_is_visibly_special(const item_def &item) const bool visibly_branded = (brand != SPARM_NORMAL); if (get_equip_desc(item) != ISFLAG_NO_DESC) - return (false); + return false; if (visibly_branded || is_artefact(item)) - return (true); + return true; if (item.is_mundane()) - return (false); + return false; if (item.flags & ISFLAG_CURSED && !one_chance_in(3)) - return (true); + return true; - return (false); + return false; } jewellery_type get_random_amulet_type() @@ -3389,7 +3389,7 @@ jewellery_type get_random_ring_type() return (_get_raw_random_ring_type()); } - return (j); + return j; } // FIXME: Need to clean up this mess. diff --git a/crawl-ref/source/map_knowledge.cc b/crawl-ref/source/map_knowledge.cc index 04dcbd2663..2681f341b5 100644 --- a/crawl-ref/source/map_knowledge.cc +++ b/crawl-ref/source/map_knowledge.cc @@ -62,7 +62,7 @@ int count_detected_mons() count++; } - return (count); + return count; } void clear_map(bool clear_items, bool clear_mons) diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 472e81446c..7507dbf5ad 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -228,7 +228,7 @@ level_range::operator raw_range () const r.shallowest = shallowest; r.deepest = deepest; r.deny = deny; - return (r); + return r; } void level_range::set(const std::string &br, int s, int d) @@ -276,7 +276,7 @@ level_range level_range::parse(std::string s) throw (std::string) lr.set(br, lr.shallowest, lr.deepest); } - return (lr); + return lr; } void level_range::parse_partial(level_range &lr, const std::string &s) @@ -502,7 +502,7 @@ std::string map_lines::add_feature_marker(const std::string &s) int sep = 0; std::string err = mapdef_split_key_item(s, &key, &sep, &arg, -1); if (!err.empty()) - return (err); + return err; map_marker_spec spec(key, arg); spec.apply_transform(*this); @@ -628,12 +628,12 @@ void map_lines::apply_overlays(const coord_def &c) const std::vector<std::string> &map_lines::get_lines() const { - return (lines); + return lines; } std::vector<std::string> &map_lines::get_lines() { - return (lines); + return lines; } void map_lines::add_line(const std::string &s) @@ -740,10 +740,10 @@ bool map_colour_list::parse(const std::string &col, int weight) { const int colour = col == "none" ? BLACK : str_to_colour(col, -1); if (colour == -1) - return (false); + return false; push_back(map_weighted_colour(colour, weight)); - return (true); + return true; } std::string map_lines::add_colour(const std::string &sub) @@ -759,12 +759,12 @@ std::string map_lines::add_colour(const std::string &sub) std::string err = mapdef_split_key_item(sub, &key, &sep, &substitute, -1); if (!err.empty()) - return (err); + return err; map_colour_list colours; err = _parse_weighted_str<map_colour_list>(substitute, colours); if (!err.empty()) - return (err); + return err; colour_spec spec(key, sep == ':', colours); overlay_colours(spec); @@ -779,7 +779,7 @@ bool map_fprop_list::parse(const std::string &fp, int weight) if (fp == "nothing") fprop = FPROP_NONE; else if (fp.empty()) - return (false); + return false; else if (str_to_fprop(fp) == FPROP_NONE) return false; else @@ -793,9 +793,9 @@ bool map_featheight_list::parse(const std::string &fp, int weight) { const int thisheight = strict_aton(fp.c_str(), INVALID_HEIGHT); if (thisheight == INVALID_HEIGHT) - return (false); + return false; push_back(map_weighted_fheight(thisheight, weight)); - return (true); + return true; } std::string map_lines::add_fproperty(const std::string &sub) @@ -811,12 +811,12 @@ std::string map_lines::add_fproperty(const std::string &sub) std::string err = mapdef_split_key_item(sub, &key, &sep, &substitute, -1); if (!err.empty()) - return (err); + return err; map_fprop_list fprops; err = _parse_weighted_str<map_fprop_list>(substitute, fprops); if (!err.empty()) - return (err); + return err; fprop_spec spec(key, sep == ':', fprops); overlay_fprops(spec); @@ -836,12 +836,12 @@ std::string map_lines::add_fheight(const std::string &sub) std::string err = mapdef_split_key_item(sub, &key, &sep, &substitute, -1); if (!err.empty()) - return (err); + return err; map_featheight_list fheights; err = _parse_weighted_str(substitute, fheights); if (!err.empty()) - return (err); + return err; fheight_spec spec(key, sep == ':', fheights); overlay_fheights(spec); @@ -868,12 +868,12 @@ std::string map_lines::add_subst(const std::string &sub) std::string err = mapdef_split_key_item(sub, &key, &sep, &substitute, -1); if (!err.empty()) - return (err); + return err; glyph_replacements_t repl; err = parse_glyph_replacements(substitute, repl); if (!err.empty()) - return (err); + return err; subst_spec spec(key, sep == ':', repl); subst(spec); @@ -900,7 +900,7 @@ std::string map_lines::parse_nsubst_spec(const std::string &s, glyph_replacements_t repl; err = parse_glyph_replacements(arg, repl); if (!err.empty()) - return (err); + return err; spec = subst_spec(count, sep == ':', repl); return (""); @@ -915,7 +915,7 @@ std::string map_lines::add_nsubst(const std::string &s) std::string err = mapdef_split_key_item(s, &key, &sep, &arg, -1); if (!err.empty()) - return (err); + return err; std::vector<std::string> segs = split_string("/", arg); for (int i = 0, vsize = segs.size(); i < vsize; ++i) @@ -951,7 +951,7 @@ std::string map_lines::add_shuffle(const std::string &raws) if (err.empty()) resolve_shuffle(s); - return (err); + return err; } int map_lines::width() const @@ -1068,7 +1068,7 @@ bool map_lines::solid_borders(map_section_type border) case MAP_NORTHWEST: return solid_north && solid_west; case MAP_SOUTHEAST: return solid_south && solid_east; case MAP_SOUTHWEST: return solid_south && solid_west; - default: return (false); + default: return false; } } @@ -1389,7 +1389,7 @@ int map_lines::apply_nsubst(std::vector<coord_def> &pos, lines[c.y][c.x] = val; ++substituted; } - return (substituted); + return substituted; } std::string map_lines::block_shuffle(const std::string &s) @@ -1414,7 +1414,7 @@ std::string map_lines::shuffle(std::string s) s.erase(c, 1); } - return (result); + return result; } void map_lines::resolve_shuffle(const std::string &shufflage) @@ -1646,13 +1646,13 @@ std::string map_lines::add_key_field( std::string err = mapdef_split_key_item(s, &key, &separator, &arg, -1); if (!err.empty()) - return (err); + return err; keyed_mapspec &kmbase = keyspecs[key[0]]; kmbase.key_glyph = key[0]; err = ((kmbase.*set_field)(arg, separator == ':')); if (!err.empty()) - return (err); + return err; size_t len = key.length(); for (size_t i = 1; i < len; i++) @@ -1662,7 +1662,7 @@ std::string map_lines::add_key_field( ((km.*copy_field)(kmbase)); } - return (err); + return err; } std::string map_lines::add_key_item(const std::string &s) @@ -1701,7 +1701,7 @@ std::vector<coord_def> map_lines::find_glyph(int gly) const points.push_back(c); } } - return (points); + return points; } std::vector<coord_def> map_lines::find_glyph(const std::string &glyphs) const @@ -1716,7 +1716,7 @@ std::vector<coord_def> map_lines::find_glyph(const std::string &glyphs) const points.push_back(c); } } - return (points); + return points; } coord_def map_lines::find_first_glyph(int gly) const @@ -1839,7 +1839,7 @@ bool map_lines::fill_zone(travel_distance_grid_t &tpd, const coord_def &start, points[cur].clear(); cur = !cur; } - return (ret); + return ret; } int map_lines::count_feature_in_box(const coord_def &tl, const coord_def &br, @@ -1852,17 +1852,17 @@ int map_lines::count_feature_in_box(const coord_def &tl, const coord_def &br, result++; } - return (result); + return result; } bool map_tile_list::parse(const std::string &s, int weight) { tileidx_t idx = 0; if (s != "none" && !tile_dngn_index(s.c_str(), &idx)) - return (false); + return false; push_back(map_weighted_tile(s, weight)); - return (true); + return true; } std::string map_lines::add_tile(const std::string &sub, bool is_floor, bool is_feat) @@ -1881,12 +1881,12 @@ std::string map_lines::add_tile(const std::string &sub, bool is_floor, bool is_f std::string err = mapdef_split_key_item(s, &key, &sep, &substitute, -1); if (!err.empty()) - return (err); + return err; map_tile_list list; err = _parse_weighted_str<map_tile_list>(substitute, list); if (!err.empty()) - return (err); + return err; tile_spec spec(key, sep == ':', no_random, last_tile, is_floor, is_feat, list); overlay_tiles(spec); @@ -1928,7 +1928,7 @@ std::string tile_spec::get_tile() chose_fixed = true; fixed_tile = chosen; } - return (chosen); + return chosen; } ////////////////////////////////////////////////////////////////////////// @@ -1967,7 +1967,7 @@ map_lines::iterator::operator bool() const coord_def map_lines::iterator::operator *() const { - return (p); + return p; } coord_def map_lines::iterator::operator ++ () @@ -1981,7 +1981,7 @@ coord_def map_lines::iterator::operator ++ (int) { coord_def here(**this); ++*this; - return (here); + return here; } /////////////////////////////////////////////// @@ -2071,11 +2071,11 @@ bool depth_ranges::is_usable_in(const level_id &lid) const if (lr.matches(lid)) { if (lr.deny) - return (false); + return false; any_matched = true; } } - return (any_matched); + return any_matched; } void depth_ranges::add_depths(const depth_ranges &other_depths) @@ -2476,9 +2476,9 @@ bool map_def::run_hook(const std::string &hook_name, bool die_on_lua_error) mprf(MSGCH_ERROR, "Lua error running hook '%s' on map '%s': %s", hook_name.c_str(), name.c_str(), rewrite_chunk_errors(dlua.error).c_str()); - return (false); + return false; } - return (true); + return true; } bool map_def::run_postplace_hook(bool die_on_lua_error) @@ -2494,14 +2494,14 @@ bool map_def::test_lua_boolchunk(dlua_chunk &chunk, bool defval, int err = chunk.load(dlua); if (err == E_CHUNK_LOAD_FAILURE) - return (result); + return result; else if (err) { if (die_on_lua_error) end(1, false, "Lua error: %s", chunk.orig_error().c_str()); else mprf(MSGCH_ERROR, "Lua error: %s", chunk.orig_error().c_str()); - return (result); + return result; } if (dlua.callfn("dgn_run_map", 1, 1)) dlua.fnreturns(">b", &result); @@ -2514,7 +2514,7 @@ bool map_def::test_lua_boolchunk(dlua_chunk &chunk, bool defval, mprf(MSGCH_ERROR, "Lua error: %s", rewrite_chunk_errors(dlua.error).c_str()); } - return (result); + return result; } bool map_def::test_lua_validate(bool croak) @@ -2541,17 +2541,17 @@ std::string map_def::rewrite_chunk_errors(const std::string &s) const { std::string res = s; if (prelude.rewrite_chunk_errors(res)) - return (res); + return res; if (mapchunk.rewrite_chunk_errors(res)) - return (res); + return res; if (main.rewrite_chunk_errors(res)) - return (res); + return res; if (validate.rewrite_chunk_errors(res)) - return (res); + return res; if (veto.rewrite_chunk_errors(res)) - return (res); + return res; epilogue.rewrite_chunk_errors(res); - return (res); + return res; } std::string map_def::validate_temple_map() @@ -2661,7 +2661,7 @@ std::string map_def::validate_map_def(const depth_ranges &default_depths) std::string err = run_lua(true); if (!err.empty()) - return (err); + return err; fixup(); resolve(); @@ -2867,7 +2867,7 @@ bool map_def::can_dock(map_section_type norient) const case MAP_EAST: case MAP_WEST: return map.height() > GYM * 2 / 3; default: - return (true); + return true; } } @@ -2895,7 +2895,7 @@ point_vector map_def::anchor_points() const for (int x = 0, cwidth = map.width(); x < cwidth; ++x) if (map.glyph(x, y) == '@') points.push_back(coord_def(x, y)); - return (points); + return points; } coord_def map_def::float_aligned_place() const @@ -2908,21 +2908,21 @@ coord_def map_def::float_aligned_place() const // Mismatch in the number of points we have to align, bail. if (our_anchors.size() != map_anchor_points.size()) - return (fail); + return fail; // Align first point of both vectors, then check that the others match. const coord_def pos = map_anchor_points[0] - our_anchors[0]; for (int i = 1, psize = map_anchor_points.size(); i < psize; ++i) if (pos + our_anchors[i] != map_anchor_points[i]) - return (fail); + return fail; // Looking good, check bounds. if (!map_bounds(pos) || !map_bounds(pos + size() - 1)) - return (fail); + return fail; // Go us! - return (pos); + return pos; } coord_def map_def::float_place() @@ -2942,7 +2942,7 @@ coord_def map_def::float_place() pos = float_random_place(); } - return (pos); + return pos; } void map_def::hmirror() @@ -3091,7 +3091,7 @@ std::string map_def::subvault_from_tagstring(const std::string &sub) std::string err = mapdef_split_key_item(sub, &key, &sep, &substitute, -1); if (!err.empty()) - return (err); + return err; // Randomly picking a different vault per-glyph is not supported. if (sep != ':') @@ -3100,7 +3100,7 @@ std::string map_def::subvault_from_tagstring(const std::string &sub) map_string_list vlist; err = _parse_weighted_str<map_string_list>(substitute, vlist); if (!err.empty()) - return (err); + return err; bool fix = false; string_spec spec(key, fix, vlist); @@ -3112,7 +3112,7 @@ std::string map_def::subvault_from_tagstring(const std::string &sub) err = apply_subvault(spec); if (!err.empty()) - return (err); + return err; return (""); } @@ -3238,7 +3238,7 @@ int map_def::subvault_mismatch_count(const coord_def &offset) const { int count = 0; if (!is_subvault()) - return (count); + return count; for (rectangle_iterator ri(map.get_iter()); ri; ++ri) { @@ -3254,7 +3254,7 @@ int map_def::subvault_mismatch_count(const coord_def &offset) const count++; } - return (count); + return count; } /////////////////////////////////////////////////////////////////// @@ -3268,7 +3268,7 @@ mons_list::mons_list() : mons() int mons_list::fix_demon(int demon) const { if (demon >= -1) - return (demon); + return demon; demon = -100 - demon; @@ -3303,7 +3303,7 @@ mons_spec mons_list::pick_monster(mons_spec_slot &slot) slot.fix_slot = false; } - return (pick); + return pick; } mons_spec mons_list::get_monster(int index) @@ -3447,7 +3447,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { parse_mons_spells(mspec, spells); if (!error.empty()) - return (slot); + return slot; } std::vector<std::string> parts = split_string(";", s); @@ -3457,7 +3457,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { error = make_stringf("Too many semi-colons for '%s' spec.", mon_str.c_str()); - return (slot); + return slot; } else if (parts.size() == 2) { @@ -3473,14 +3473,14 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { error = make_stringf("More items than monster item slots " "for '%s'.", mon_str.c_str()); - return (slot); + return slot; } for (int j = 0, isize = segs.size(); j < isize; ++j) { error = mspec.items.add_item(segs[j], false); if (!error.empty()) - return (slot); + return slot; } } @@ -3555,7 +3555,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) catch (const std::string &err) { error = err; - return (slot); + return slot; } } @@ -3599,12 +3599,12 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { error = make_stringf("bad monster summon type: \"%s\"", s_type.c_str()); - return (slot); + return slot; } if (mspec.abjuration_duration == 0) { error = "marked summon with no duration"; - return (slot); + return slot; } } @@ -3618,7 +3618,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) if (mspec.abjuration_duration == 0) { error = "marked summon with no duration"; - return (slot); + return slot; } } @@ -3635,7 +3635,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { error = make_stringf("bad monster colour \"%s\" in \"%s\"", colour.c_str(), specs[i].c_str()); - return (slot); + return slot; } } } @@ -3651,7 +3651,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { error = make_stringf("bad monster god: \"%s\"", god_name.c_str()); - return (slot); + return slot; } if (strip_tag(mon_str, "god_gift")) @@ -3665,7 +3665,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) if (!tile_player_index(tile.c_str(), &index)) { error = make_stringf("bad tile name: \"%s\".", tile.c_str()); - return (slot); + return slot; } // Store name along with the tile. mspec.props["monster_tile_name"].get_string() = tile; @@ -3747,13 +3747,13 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { mspec.ench.push_back(parse_ench(ench_str, false)); if (!error.empty()) - return (slot); + return slot; } while (!(ench_str = strip_tag_prefix(mon_str, "perm_ench:")).empty()) { mspec.ench.push_back(parse_ench(ench_str, true)); if (!error.empty()) - return (slot); + return slot; } trim_string(mon_str); @@ -3786,7 +3786,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) { error = make_stringf("unknown monster: \"%s\"", mon_str.c_str()); - return (slot); + return slot; } mspec.type = nspec.type; @@ -3809,7 +3809,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) if (type >= NUM_MONSTERS) { error = "Can't give spec items to a random monster."; - return (slot); + return slot; } else if (mons_class_itemuse(type) < MONUSE_STARTING_EQUIPMENT) { @@ -3822,7 +3822,7 @@ mons_list::mons_spec_slot mons_list::parse_mons_spec(std::string spec) slot.mlist.push_back(mspec); } - return (slot); + return slot; } std::string mons_list::add_mons(const std::string &s, bool fix) @@ -3831,7 +3831,7 @@ std::string mons_list::add_mons(const std::string &s, bool fix) mons_spec_slot slotmons = parse_mons_spec(s); if (!error.empty()) - return (error); + return error; if (fix) { @@ -3841,7 +3841,7 @@ std::string mons_list::add_mons(const std::string &s, bool fix) mons.push_back(slotmons); - return (error); + return error; } std::string mons_list::set_mons(int index, const std::string &s) @@ -3853,7 +3853,7 @@ std::string mons_list::set_mons(int index, const std::string &s) mons_spec_slot slotmons = parse_mons_spec(s); if (!error.empty()) - return (error); + return error; if (index >= (int) mons.size()) { @@ -3861,7 +3861,7 @@ std::string mons_list::set_mons(int index, const std::string &s) mons.resize(index + 1, mons_spec_slot()); } mons[index] = slotmons; - return (error); + return error; } void mons_list::get_zombie_type(std::string s, mons_spec &spec) const @@ -4003,7 +4003,7 @@ mons_spec mons_list::drac_monspec(std::string name) const // Check if it's a simple drac name, we're done. if (spec.type != MONS_PROGRAM_BUG) - return (spec); + return spec; spec.type = RANDOM_DRACONIAN; @@ -4015,7 +4015,7 @@ mons_spec mons_list::drac_monspec(std::string name) const if (starts_with(name, "base ")) { // Base dracs need no further work. - return (RANDOM_BASE_DRACONIAN); + return RANDOM_BASE_DRACONIAN; } else if (starts_with(name, "nonbase ")) { @@ -4027,24 +4027,24 @@ mons_spec mons_list::drac_monspec(std::string name) const // Match "any draconian" if (name == "draconian") - return (spec); + return spec; // Check for recognition again to match any (nonbase) <colour> draconian. const monster_type colour = get_monster_by_name(name, true); if (colour != MONS_PROGRAM_BUG) { spec.monbase = colour; - return (spec); + return spec; } // Only legal possibility left is <colour> boss drac. std::string::size_type wordend = name.find(' '); if (wordend == std::string::npos) - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; std::string scolour = name.substr(0, wordend); if ((spec.monbase = draconian_colour_by_name(scolour)) == MONS_PROGRAM_BUG) - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; name = trimmed_string(name.substr(wordend + 1)); spec.type = get_monster_by_name(name, true); @@ -4056,10 +4056,10 @@ mons_spec mons_list::drac_monspec(std::string name) const || (spec.type >= MONS_BLACK_DRACONIAN && spec.type <= MONS_PALE_DRACONIAN)) { - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; } - return (spec); + return spec; } mons_spec mons_list::mons_by_name(std::string name) const @@ -4074,10 +4074,10 @@ mons_spec mons_list::mons_by_name(std::string name) const // Special casery: if (name == "pandemonium lord") - return (MONS_PANDEMONIUM_LORD); + return MONS_PANDEMONIUM_LORD; if (name == "any" || name == "any monster") - return (RANDOM_MONSTER); + return RANDOM_MONSTER; if (name == "any demon") return (-100 - DEMON_RANDOM); @@ -4092,27 +4092,27 @@ mons_spec mons_list::mons_by_name(std::string name) const return (-100 - DEMON_GREATER); if (name == "small zombie") - return (MONS_ZOMBIE_SMALL); + return MONS_ZOMBIE_SMALL; if (name == "large zombie") - return (MONS_ZOMBIE_LARGE); + return MONS_ZOMBIE_LARGE; if (name == "small skeleton") - return (MONS_SKELETON_SMALL); + return MONS_SKELETON_SMALL; if (name == "large skeleton") - return (MONS_SKELETON_LARGE); + return MONS_SKELETON_LARGE; if (name == "spectral thing") - return (MONS_SPECTRAL_THING); + return MONS_SPECTRAL_THING; if (name == "small simulacrum") - return (MONS_SIMULACRUM_SMALL); + return MONS_SIMULACRUM_SMALL; if (name == "large simulacrum") - return (MONS_SIMULACRUM_LARGE); + return MONS_SIMULACRUM_LARGE; if (name == "small abomination") - return (MONS_ABOMINATION_SMALL); + return MONS_ABOMINATION_SMALL; if (name == "large abomination") - return (MONS_ABOMINATION_LARGE); + return MONS_ABOMINATION_LARGE; if (ends_with(name, "-headed hydra") && !starts_with(name, "spectral ")) return (get_hydra_spec(name)); @@ -4130,7 +4130,7 @@ mons_spec mons_list::mons_by_name(std::string name) const { mons_spec spec = mons_by_name(name.substr(wordend + 1)); spec.colour = colour; - return (spec); + return spec; } } if (name.find(" laboratory rat") != std::string::npos) @@ -4143,14 +4143,14 @@ mons_spec mons_list::mons_by_name(std::string name) const { mons_spec spec = mons_by_name(name.substr(wordend+1)); spec.colour = colour; - return (spec); + return spec; } } mons_spec spec; get_zombie_type(name, spec); if (spec.type != MONS_PROGRAM_BUG) - return (spec); + return spec; if (name.find("draconian") != std::string::npos) return drac_monspec(name); @@ -4236,7 +4236,7 @@ item_spec item_list::random_item() if (items.size() <= 0) { const item_spec none; - return (none); + return none; } return (get_item(random2(size()))); @@ -4259,7 +4259,7 @@ item_spec item_list::random_item_weighted() if (rn_item) return (*rn_item); - return (none); + return none; } item_spec item_list::pick_item(item_spec_slot &slot) @@ -4281,7 +4281,7 @@ item_spec item_list::pick_item(item_spec_slot &slot) slot.fix_slot = false; } - return (spec); + return spec; } item_spec item_list::get_item(int index) @@ -4289,7 +4289,7 @@ item_spec item_list::get_item(int index) if (index < 0 || index >= (int) items.size()) { const item_spec none; - return (none); + return none; } return (pick_item(items[index])); @@ -4311,7 +4311,7 @@ std::string item_list::add_item(const std::string &spec, bool fix) items.push_back(sp); } - return (error); + return error; } std::string item_list::set_item(int index, const std::string &spec) @@ -4331,7 +4331,7 @@ std::string item_list::set_item(int index, const std::string &spec) items.push_back(sp); } - return (error); + return error; } void item_list::set_from_slot(const item_list &list, int slot_index) @@ -4484,7 +4484,7 @@ int item_list::parse_acquirement_source(const std::string &source) const god_type god(str_to_god(god_name)); if (god == GOD_NO_GOD) error = make_stringf("unknown god name: '%s'", god_name.c_str()); - return (god); + return god; } bool item_list::monster_corpse_is_valid(monster_type *mons, @@ -4496,12 +4496,12 @@ bool item_list::monster_corpse_is_valid(monster_type *mons, if (*mons == RANDOM_NONBASE_DRACONIAN) { error = "Can't use non-base draconian for corpse/chunk items"; - return (false); + return false; } // Accept randomised types without further checks: if (*mons >= NUM_MONSTERS) - return (true); + return true; // Convert to the monster species: *mons = mons_species(*mons); @@ -4509,17 +4509,17 @@ bool item_list::monster_corpse_is_valid(monster_type *mons, if (!mons_class_can_leave_corpse(*mons)) { error = make_stringf("'%s' cannot leave corpses", name.c_str()); - return (false); + return false; } if (skeleton && !mons_skeleton(*mons)) { error = make_stringf("'%s' has no skeleton", name.c_str()); - return (false); + return false; } // We're ok. - return (true); + return true; } item_spec item_list::parse_corpse_spec(item_spec &result, std::string s) @@ -4545,7 +4545,7 @@ item_spec item_list::parse_corpse_spec(item_spec &result, std::string s) if (!mons_parse_err.empty()) { error = mons_parse_err; - return (result); + return result; } // Get the actual monster spec: @@ -4555,12 +4555,12 @@ item_spec item_list::parse_corpse_spec(item_spec &result, std::string s) { error = make_stringf("Requested corpse '%s' is invalid", s.c_str()); - return (result); + return result; } // Ok, looking good, the caller can have their requested toy. result.set_corpse_monster_spec(spec); - return (result); + return result; } // Strips the first word from s and returns it. @@ -4691,7 +4691,7 @@ item_spec item_list::parse_single_spec(std::string s) { error = make_stringf("Bad item generation weight: '%d'", result.genweight); - return (result); + return result; } } @@ -4718,7 +4718,7 @@ item_spec item_list::parse_single_spec(std::string s) catch (const std::string &err) { error = err; - return (result); + return result; } } @@ -4735,7 +4735,7 @@ item_spec item_list::parse_single_spec(std::string s) result.base_type = OBJ_RANDOM; else parse_random_by_class(s, result); - return (result); + return result; } std::string ego_str = strip_tag_prefix(s, "ego:"); @@ -4754,7 +4754,7 @@ item_spec item_list::parse_single_spec(std::string s) else if (!race_str.empty()) { error = make_stringf("Bad race: %s", race_str.c_str()); - return (result); + return result; } std::string id_str = strip_tag_prefix(s, "ident:"); @@ -4779,7 +4779,7 @@ item_spec item_list::parse_single_spec(std::string s) else { error = make_stringf("Bad identify status: %s", id_str.c_str()); - return (result); + return result; } } result.props["ident"].get_int() = id; @@ -4798,7 +4798,7 @@ item_spec item_list::parse_single_spec(std::string s) && number != ISPEC_DAMAGED && number != ISPEC_BAD) { error = make_stringf("Bad item level: %d", number); - return (result); + return result; } result.level = number; @@ -4856,7 +4856,7 @@ item_spec item_list::parse_single_spec(std::string s) if (uniq <= 0) { error = make_stringf("Bad uniq level: %d", uniq); - return (result); + return result; } result.allow_uniques = uniq; } @@ -4882,7 +4882,7 @@ item_spec item_list::parse_single_spec(std::string s) if (disc1 == SPTYP_NONE) { error = make_stringf("Bad spell school: %s", st_disc1.c_str()); - return (result); + return result; } } @@ -4893,7 +4893,7 @@ item_spec item_list::parse_single_spec(std::string s) if (disc2 == SPTYP_NONE) { error = make_stringf("Bad spell school: %s", st_disc2.c_str()); - return (result); + return result; } } @@ -4903,7 +4903,7 @@ item_spec item_list::parse_single_spec(std::string s) { error = make_stringf("Bad combination of spell schools: %s & %s.", st_disc1.c_str(), st_disc2.c_str()); - return (result); + return result; } } @@ -4921,7 +4921,7 @@ item_spec item_list::parse_single_spec(std::string s) else if (num_spells <= 0 || num_spells > SPELLBOOK_SIZE) { error = make_stringf("Bad spellbook size: %d", num_spells); - return (result); + return result; } short slevels = strip_number_tag(s, "slevels:"); @@ -4930,7 +4930,7 @@ item_spec item_list::parse_single_spec(std::string s) else if (slevels == 0) { error = make_stringf("Bad slevels: %d.", slevels); - return (result); + return result; } const std::string title = replace_all_of(strip_tag_prefix(s, "title:"), @@ -4949,7 +4949,7 @@ item_spec item_list::parse_single_spec(std::string s) if (spell == SPELL_NO_SPELL) { error = make_stringf("Bad spell: %s", spell_list[i].c_str()); - return (result); + return result; } incl_spells.push_back(spell); } @@ -4968,13 +4968,13 @@ item_spec item_list::parse_single_spec(std::string s) result.sub_type = BOOK_MINOR_MAGIC; result.plus = -1; - return (result); + return result; } if (s.find("deck") != std::string::npos) { build_deck_spec(s, &result); - return (result); + return result; } // Clean up after any tag brain damage. @@ -4985,17 +4985,17 @@ item_spec item_list::parse_single_spec(std::string s) // Completely random? if (s == "random" || s == "any" || s == "%") - return (result); + return result; if (s == "*" || s == "star_item") { result.level = ISPEC_GOOD; - return (result); + return result; } else if (s == "|" || s == "superb_item") { result.level = ISPEC_SUPERB; - return (result); + return result; } else if (s == "$" || s == "gold") { @@ -5004,14 +5004,14 @@ item_spec item_list::parse_single_spec(std::string s) result.base_type = OBJ_GOLD; result.sub_type = OBJ_RANDOM; - return (result); + return result; } if (s == "nothing") { error.clear(); result.base_type = OBJ_UNASSIGNED; - return (result); + return result; } error.clear(); @@ -5033,7 +5033,7 @@ item_spec item_list::parse_single_spec(std::string s) parse_raw_name(s, result); if (!error.empty()) - return (result); + return result; if (!unrand_str.empty()) { @@ -5048,7 +5048,7 @@ item_spec item_list::parse_single_spec(std::string s) } if (ego_str.empty()) - return (result); + return result; if (result.base_type != OBJ_WEAPONS && result.base_type != OBJ_MISSILES @@ -5056,13 +5056,13 @@ item_spec item_list::parse_single_spec(std::string s) { error = "An ego can only be applied to a weapon, missile or " "armour."; - return (result); + return result; } if (ego_str == "none") { result.ego = -1; - return (result); + return result; } const int ego = str_to_ego(result, ego_str); @@ -5070,13 +5070,13 @@ item_spec item_list::parse_single_spec(std::string s) if (ego == 0) { error = make_stringf("No such ego as: %s", ego_str.c_str()); - return (result); + return result; } else if (ego == -1) { error = make_stringf("Ego '%s' is invalid for item '%s'.", ego_str.c_str(), s.c_str()); - return (result); + return result; } else if (result.sub_type == OBJ_RANDOM) { @@ -5091,11 +5091,11 @@ item_spec item_list::parse_single_spec(std::string s) { error = make_stringf("Ego '%s' is incompatible with item '%s'.", ego_str.c_str(), s.c_str()); - return (result); + return result; } result.ego = ego; - return (result); + return result; } void item_list::parse_random_by_class(std::string c, item_spec &spec) @@ -5176,7 +5176,7 @@ item_list::item_spec_slot item_list::parse_item_spec(std::string spec) for (unsigned i = 0; i < specifiers.size() && error.empty(); ++i) list.ilist.push_back(parse_single_spec(specifiers[i])); - return (list); + return list; } ///////////////////////////////////////////////////////////////////////// @@ -5195,7 +5195,7 @@ subst_spec::subst_spec(int _count, bool dofix, const glyph_replacements_t &g) int subst_spec::value() { if (frozen_value) - return (frozen_value); + return frozen_value; int cumulative = 0; int chosen = 0; @@ -5206,7 +5206,7 @@ int subst_spec::value() if (fix) frozen_value = chosen; - return (chosen); + return chosen; } ////////////////////////////////////////////////////////////////////////// @@ -5223,7 +5223,7 @@ nsubst_spec::nsubst_spec(std::string _key, const std::vector<subst_spec> &_specs int colour_spec::get_colour() { if (fixed_colour != BLACK) - return (fixed_colour); + return fixed_colour; int chosen = BLACK; int cweight = 0; @@ -5232,7 +5232,7 @@ int colour_spec::get_colour() chosen = colours[i].first; if (fix) fixed_colour = chosen; - return (chosen); + return chosen; } ////////////////////////////////////////////////////////////////////////// @@ -5241,7 +5241,7 @@ int colour_spec::get_colour() feature_property_type fprop_spec::get_property() { if (fixed_prop != FPROP_NONE) - return (fixed_prop); + return fixed_prop; feature_property_type chosen = FPROP_NONE; int cweight = 0; @@ -5250,7 +5250,7 @@ feature_property_type fprop_spec::get_property() chosen = fprops[i].first; if (fix) fixed_prop = chosen; - return (chosen); + return chosen; } ////////////////////////////////////////////////////////////////////////// @@ -5259,7 +5259,7 @@ feature_property_type fprop_spec::get_property() int fheight_spec::get_height() { if (fixed_height != INVALID_HEIGHT) - return (fixed_height); + return fixed_height; int chosen = INVALID_HEIGHT; int cweight = 0; @@ -5268,7 +5268,7 @@ int fheight_spec::get_height() chosen = fheights[i].first; if (fix) fixed_height = chosen; - return (chosen); + return chosen; } ////////////////////////////////////////////////////////////////////////// @@ -5286,7 +5286,7 @@ std::string string_spec::get_property() chosen = strlist[i].first; if (fix) fixed_str = chosen; - return (chosen); + return chosen; } ////////////////////////////////////////////////////////////////////////// @@ -5313,7 +5313,7 @@ std::string map_marker_spec::apply_transform(map_lines &map) } catch (const std::string &err) { - return (err); + return err; } } return (""); @@ -5393,7 +5393,7 @@ std::string keyed_mapspec::set_feat(const std::string &s, bool fix) if (fix) get_feat(); - return (err); + return err; } void keyed_mapspec::copy_feat(const keyed_mapspec &spec) @@ -5443,7 +5443,7 @@ feature_spec keyed_mapspec::parse_trap(std::string s, int weight) feature_spec fspec(known ? 1 : -1, weight); fspec.trap.reset(new trap_spec(static_cast<trap_type>(trap))); - return (fspec); + return fspec; } /** @@ -5509,7 +5509,7 @@ feature_spec keyed_mapspec::parse_shop(std::string s, int weight) shop_type_name, shop_suffix_name, greed, num_items, use_all)); fspec.shop->items = items; - return (fspec); + return fspec; } feature_spec_list keyed_mapspec::parse_feature(const std::string &str) @@ -5532,20 +5532,20 @@ feature_spec_list keyed_mapspec::parse_feature(const std::string &str) feature_spec fsp(-1, weight, mimic, no_mimic); fsp.glyph = s[0]; list.push_back(fsp); - return (list); + return list; } if (s.find("trap") != std::string::npos || s == "web") { list.push_back(parse_trap(s, weight)); - return (list); + return list; } if (s.find("shop") != std::string::npos && s != "abandoned_shop" || s.find("store") != std::string::npos) { list.push_back(parse_shop(s, weight)); - return (list); + return list; } const dungeon_feature_type ftype = dungeon_feature_by_name(s); @@ -5555,7 +5555,7 @@ feature_spec_list keyed_mapspec::parse_feature(const std::string &str) else list.push_back(feature_spec(ftype, weight, mimic, no_mimic)); - return (list); + return list; } std::string keyed_mapspec::set_mons(const std::string &s, bool fix) @@ -5568,7 +5568,7 @@ std::string keyed_mapspec::set_mons(const std::string &s, bool fix) { const std::string error = mons.add_mons(segments[i], fix); if (!error.empty()) - return (error); + return error; } return (""); @@ -5585,10 +5585,10 @@ std::string keyed_mapspec::set_item(const std::string &s, bool fix) { err = item.add_item(segs[i], fix); if (!err.empty()) - return (err); + return err; } - return (err); + return err; } std::string keyed_mapspec::set_mask(const std::string &s, bool garbage) @@ -5608,10 +5608,10 @@ std::string keyed_mapspec::set_mask(const std::string &s, bool garbage) catch (const std::string &error) { err = error; - return (err); + return err; } - return (err); + return err; } void keyed_mapspec::copy_mons(const keyed_mapspec &spec) @@ -5636,17 +5636,17 @@ feature_spec keyed_mapspec::get_feat() mons_list &keyed_mapspec::get_monsters() { - return (mons); + return mons; } item_list &keyed_mapspec::get_items() { - return (item); + return item; } map_flags &keyed_mapspec::get_mask() { - return (map_mask); + return map_mask; } bool keyed_mapspec::replaces_glyph() @@ -5737,5 +5737,5 @@ feature_spec feature_slot::get_feat(int def_glyph) feats.clear(); feats.push_back(chosen_feat); } - return (chosen_feat); + return chosen_feat; } diff --git a/crawl-ref/source/mapdef.h b/crawl-ref/source/mapdef.h index c57ff16d3c..c136b98629 100644 --- a/crawl-ref/source/mapdef.h +++ b/crawl-ref/source/mapdef.h @@ -1192,7 +1192,7 @@ public: std::string validate_map_def(const depth_ranges &); std::string validate_temple_map(); // Returns true if this map is in the middle of validation. - bool is_validating() const { return (validating_map_flag); } + bool is_validating() const { return validating_map_flag; } void add_prelude_line(int line, const std::string &s); void add_main_line(int line, const std::string &s); diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc index cade0020db..c142ec0803 100644 --- a/crawl-ref/source/mapmark.cc +++ b/crawl-ref/source/mapmark.cc @@ -91,10 +91,10 @@ map_marker *map_marker::parse_marker( if (parsers[i]) { if (map_marker *m = parsers[i](s, ctx)) - return (m); + return m; } } - return (NULL); + return NULL; } //////////////////////////////////////////////////////////////////////////// @@ -134,14 +134,14 @@ map_marker *map_feature_marker::read(reader &inf, map_marker_type) { map_marker *mapf = new map_feature_marker(); mapf->read(inf); - return (mapf); + return mapf; } map_marker *map_feature_marker::parse( const std::string &s, const std::string &) throw (std::string) { if (s.find("feat:") != 0) - return (NULL); + return NULL; std::string raw = s; strip_tag(raw, "feat:", true); @@ -233,7 +233,7 @@ bool map_lua_marker::get_table() const } else { - return (false); + return false; } } @@ -300,7 +300,7 @@ map_marker *map_lua_marker::read(reader &inf, map_marker_type) { map_marker *marker = new map_lua_marker; marker->read(inf); - return (marker); + return marker; } void map_lua_marker::push_fn_args(const char *fn) const @@ -321,7 +321,7 @@ bool map_lua_marker::callfn(const char *fn, bool warn_err, int args) const const bool res = dlua.callfn("dlua_marker_method", args, 1); if (!res && warn_err) mprf(MSGCH_ERROR, "mlua error: %s", dlua.error.c_str()); - return (res); + return res; } void map_lua_marker::activate(bool verbose) @@ -343,7 +343,7 @@ bool map_lua_marker::notify_dgn_event(const dgn_event &e) dlua.error.c_str()); // Lua error prevents veto if the event is vetoable. - return (true); + return true; } bool accepted = true; @@ -352,7 +352,7 @@ bool map_lua_marker::notify_dgn_event(const dgn_event &e) if (lua_isboolean(dlua, -1)) accepted = lua_toboolean(dlua, -1); - return (accepted); + return accepted; } std::string map_lua_marker::call_str_fn(const char *fn) const @@ -364,7 +364,7 @@ std::string map_lua_marker::call_str_fn(const char *fn) const std::string result; if (lua_isstring(dlua, -1)) result = lua_tostring(dlua, -1); - return (result); + return result; } std::string map_lua_marker::debug_describe() const @@ -387,7 +387,7 @@ std::string map_lua_marker::property(const std::string &pname) const std::string result; if (lua_isstring(dlua, -1)) result = lua_tostring(dlua, -1); - return (result); + return result; } std::string map_lua_marker::debug_to_string() const @@ -406,7 +406,7 @@ std::string map_lua_marker::debug_to_string() const result = lua_tostring(dlua, -1); else result = "table_to_string() returned nothing"; - return (result); + return result; } map_marker *map_lua_marker::parse( @@ -423,7 +423,7 @@ map_marker *map_lua_marker::parse( mapdef_marker = false; } else - return (NULL); + return NULL; map_lua_marker *mark = new map_lua_marker(raw, ctx, mapdef_marker); if (!mark->initialised) @@ -432,7 +432,7 @@ map_marker *map_lua_marker::parse( throw make_stringf("Unable to initialise Lua marker from '%s'", raw.c_str()); } - return (mark); + return mark; } ////////////////////////////////////////////////////////////////////////// @@ -460,13 +460,13 @@ map_marker *map_corruption_marker::read(reader &in, map_marker_type) { map_corruption_marker *mc = new map_corruption_marker(); mc->read(in); - return (mc); + return mc; } map_marker *map_corruption_marker::clone() const { map_corruption_marker *mark = new map_corruption_marker(pos, duration); - return (mark); + return mark; } std::string map_corruption_marker::debug_describe() const @@ -534,7 +534,7 @@ std::string map_wiz_props_marker::set_property(const std::string &key, { std::string old_val = properties[key]; properties[key] = val; - return (old_val); + return old_val; } map_marker *map_wiz_props_marker::clone() const @@ -546,7 +546,7 @@ map_marker *map_wiz_props_marker::read(reader &inf, map_marker_type) { map_marker *mapf = new map_wiz_props_marker(); mapf->read(inf); - return (mapf); + return mapf; } map_marker *map_wiz_props_marker::parse( @@ -589,14 +589,14 @@ map_marker *map_tomb_marker::read(reader &in, map_marker_type) { map_tomb_marker *mc = new map_tomb_marker(); mc->read(in); - return (mc); + return mc; } map_marker *map_tomb_marker::clone() const { map_tomb_marker *mark = new map_tomb_marker(pos, duration, source, target); - return (mark); + return mark; } std::string map_tomb_marker::debug_describe() const @@ -646,14 +646,14 @@ map_marker *map_malign_gateway_marker::read(reader &in, map_marker_type) { map_malign_gateway_marker *mc = new map_malign_gateway_marker(); mc->read(in); - return (mc); + return mc; } map_marker *map_malign_gateway_marker::clone() const { map_malign_gateway_marker *mark = new map_malign_gateway_marker(pos, duration, is_player, summoner_string, behaviour, god, power); - return (mark); + return mark; } std::string map_malign_gateway_marker::debug_describe() const @@ -700,14 +700,14 @@ map_marker *map_phoenix_marker::read(reader &in, map_marker_type) { map_phoenix_marker *mc = new map_phoenix_marker(); mc->read(in); - return (mc); + return mc; } map_marker *map_phoenix_marker::clone() const { map_phoenix_marker *mark = new map_phoenix_marker(pos, duration, mon_num, behaviour, attitude, god, corpse_pos); - return (mark); + return mark; } std::string map_phoenix_marker::debug_describe() const @@ -752,7 +752,7 @@ map_marker *map_position_marker::read(reader &inf, map_marker_type) { map_marker *mapf = new map_position_marker(); mapf->read(inf); - return (mapf); + return mapf; } std::string map_position_marker::debug_describe() const @@ -898,7 +898,7 @@ map_marker *map_markers::find(const coord_def &c, map_marker_type type) for (dgn_marker_map::const_iterator i = els.first; i != els.second; ++i) if (type == MAT_ANY || i->second->get_type() == type) return (i->second); - return (NULL); + return NULL; } map_marker *map_markers::find(map_marker_type type) @@ -909,7 +909,7 @@ map_marker *map_markers::find(map_marker_type type) if (type == MAT_ANY || i->second->get_type() == type) return (i->second); } - return (NULL); + return NULL; } void map_markers::move(const coord_def &from, const coord_def &to) @@ -951,7 +951,7 @@ std::vector<map_marker*> map_markers::get_all(map_marker_type mat) if (mat == MAT_ANY || i->second->get_type() == mat) rmarkers.push_back(i->second); } - return (rmarkers); + return rmarkers; } std::vector<map_marker*> map_markers::get_all(const std::string &key, @@ -969,7 +969,7 @@ std::vector<map_marker*> map_markers::get_all(const std::string &key, rmarkers.push_back(marker); } - return (rmarkers); + return rmarkers; } std::vector<map_marker*> map_markers::get_markers_at(const coord_def &c) @@ -979,7 +979,7 @@ std::vector<map_marker*> map_markers::get_markers_at(const coord_def &c) std::vector<map_marker*> rmarkers; for (dgn_marker_map::const_iterator i = els.first; i != els.second; ++i) rmarkers.push_back(i->second); - return (rmarkers); + return rmarkers; } std::string map_markers::property_at(const coord_def &c, map_marker_type type, @@ -991,7 +991,7 @@ std::string map_markers::property_at(const coord_def &c, map_marker_type type, { const std::string prop = i->second->property(key); if (!prop.empty()) - return (prop); + return prop; } return (""); } @@ -1064,10 +1064,10 @@ bool feature_marker_at(const coord_def &pos, dungeon_feature_type feat) if (mark->get_type() == MAT_FEATURE && dynamic_cast<map_feature_marker*>(mark)->feat == feat) { - return (true); + return true; } } - return (false); + return false; } coord_def find_marker_position_by_prop(const std::string &prop, @@ -1078,7 +1078,7 @@ coord_def find_marker_position_by_prop(const std::string &prop, if (markers.empty()) { const coord_def nowhere(-1, -1); - return (nowhere); + return nowhere; } return markers[0]; } @@ -1097,10 +1097,10 @@ std::vector<coord_def> find_marker_positions_by_prop( { marker_positions.push_back(*i); if (maxresults && marker_positions.size() >= maxresults) - return (marker_positions); + return marker_positions; } } - return (marker_positions); + return marker_positions; } std::vector<map_marker*> find_markers_by_prop( @@ -1120,11 +1120,11 @@ std::vector<map_marker*> find_markers_by_prop( { markers.push_back(markers_here[i]); if (maxresults && markers.size() >= maxresults) - return (markers); + return markers; } } } - return (markers); + return markers; } /////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/maps.cc b/crawl-ref/source/maps.cc index ecc3e311ff..9085885d43 100644 --- a/crawl-ref/source/maps.cc +++ b/crawl-ref/source/maps.cc @@ -131,7 +131,7 @@ static map_section_type _write_vault(map_def &mdef, if (place.orient != MAP_NONE) return (place.orient); } - return (MAP_NONE); + return MAP_NONE; } static void _dgn_flush_map_environments() @@ -158,7 +158,7 @@ static bool _resolve_map_lua(map_def &map) mapgen_report_error(map, err); #endif mprf(MSGCH_ERROR, "Lua error: %s", err.c_str()); - return (false); + return false; } map.fixup(); @@ -166,25 +166,25 @@ static bool _resolve_map_lua(map_def &map) if (!err.empty()) { mprf(MSGCH_ERROR, "Error: %s", err.c_str()); - return (false); + return false; } if (!map.test_lua_validate(false)) - return (false); + return false; - return (true); + return true; } // Mirror the map if appropriate, resolve substitutable symbols (?), static bool _resolve_map(map_def &map) { if (!_resolve_map_lua(map)) - return (false); + return false; // Don't bother flipping or rotating 1x1 subvaults. // This just cuts down on level generation message spam. if (map.map.width() == map.map.height() && map.map.width() == 1) - return (true); + return true; // Mirroring is possible for any map that does not explicitly forbid it. // Note that mirroring also flips the orientation. @@ -198,7 +198,7 @@ static bool _resolve_map(map_def &map) if (coinflip()) map.rotate(coinflip()); - return (true); + return true; } bool resolve_subvault(map_def &map) @@ -208,7 +208,7 @@ bool resolve_subvault(map_def &map) return false; if (map.test_lua_veto()) - return (false); + return false; if (!_resolve_map_lua(map)) return false; @@ -245,13 +245,13 @@ bool resolve_subvault(map_def &map) // The map may have refused to have been rotated, so verify dimensions. bool valid = (map.map.width() <= width && map.map.height() <= height); - return (valid); + return valid; } // Don't bother flipping or rotating 1x1 subvaults. // This just cuts down on level generation message spam. if (exact_fit && width == height && width == 1) - return (true); + return true; // Count original mismatches. If mirroring the map causes more cells to // not be written, then don't mirror. This allows oddly shaped subvaults @@ -297,7 +297,7 @@ bool resolve_subvault(map_def &map) ASSERT(map.subvault_mismatch_count(svplace) == min_mismatch); // We already know this is an exact fit, so this is a success. - return (true); + return true; } // Given a rectangular region, slides it to fit into the map. size must be @@ -329,18 +329,18 @@ static bool _may_overwrite_feature(const coord_def p, // If there's a mask specifying where vaults can be placed, don't // allow stepping outside it. if (Vault_Placement_Mask && !(*Vault_Placement_Mask)(p)) - return (false); + return false; // If in the abyss, the placement mask is the only check necessary // for terrain. if (Vault_Placement_Mask && player_in_branch(BRANCH_ABYSS)) - return (true); + return true; const dungeon_feature_type grid = grd(p); // Deep water grids may be overwritten if water_ok == true. if (grid == DNGN_DEEP_WATER) - return (water_ok); + return water_ok; // Handle all other non-LOS blocking grids here. if (!feat_is_opaque(grid) @@ -350,14 +350,14 @@ static bool _may_overwrite_feature(const coord_def p, && grid != DNGN_SECRET_DOOR && !feat_is_closed_door(grid)) { - return (false); + return false; } if (feat_is_wall(grid) || feat_is_tree(grid)) - return (wall_ok); + return wall_ok; // Otherwise, feel free to clobber this feature. - return (true); + return true; } static bool _map_safe_vault_place(const map_def &map, @@ -365,7 +365,7 @@ static bool _map_safe_vault_place(const map_def &map, const coord_def &size) { if (size.zero()) - return (true); + return true; const bool water_ok = map.has_tag("water_ok") || player_in_branch(BRANCH_SWAMP); @@ -386,28 +386,28 @@ static bool _map_safe_vault_place(const map_def &map, for (adjacent_iterator ai(cp); ai; ++ai) { if (map_bounds(*ai) && (env.level_map_mask(*ai) & MMT_VAULT)) - return (false); + return false; } } // Don't overwrite features other than floor, rock wall, doors, // nor water, if !water_ok. if (!_may_overwrite_feature(cp, water_ok)) - return (false); + return false; // Don't overwrite monsters or items, either! if (monster_at(cp) || igrd(cp) != NON_ITEM) - return (false); + return false; } - return (true); + return true; } static bool _connected_minivault_place(const coord_def &c, const vault_placement &place) { if (place.size.zero()) - return (true); + return true; // Must not be completely isolated. const bool water_ok = place.map.has_tag("water_ok"); @@ -421,10 +421,10 @@ static bool _connected_minivault_place(const coord_def &c, continue; if (_may_overwrite_feature(ci, water_ok, false)) - return (true); + return true; } - return (false); + return false; } static coord_def _find_minivault_place( @@ -460,7 +460,7 @@ static coord_def _find_minivault_place( #endif continue; } - return (v1); + return v1; } return (coord_def(-1, -1)); } @@ -522,20 +522,20 @@ static bool _apply_vault_grid(map_def &def, } if (!map_bounds(start)) - return (false); + return false; if (check_place && !map_place_valid(def, start, size)) { dprf("Bad vault place: (%d,%d) dim (%d,%d)", start.x, start.y, size.x, size.y); - return (false); + return false; } place.pos = start; place.size = size; - return (true); + return true; } static map_section_type _apply_vault_definition( @@ -544,7 +544,7 @@ static map_section_type _apply_vault_definition( bool check_place) { if (!_apply_vault_grid(def, place, check_place)) - return (MAP_NONE); + return MAP_NONE; const map_section_type orient = def.orient; return (orient == MAP_NONE? MAP_NORTH : orient); @@ -582,7 +582,7 @@ const map_def *find_map_by_name(const std::string &name) if (vdefs[i].name == name) return (&vdefs[i]); - return (NULL); + return NULL; } // Discards Lua code loaded by all maps to reduce memory use. If any stripped @@ -600,7 +600,7 @@ std::vector<std::string> find_map_matches(const std::string &name) for (unsigned i = 0, size = vdefs.size(); i < size; ++i) if (vdefs[i].name.find(name) != std::string::npos) matches.push_back(vdefs[i].name); - return (matches); + return matches; } mapref_vector find_maps_for_tag(const std::string tag, @@ -622,7 +622,7 @@ mapref_vector find_maps_for_tag(const std::string tag, maps.push_back(&mapdef); } } - return (maps); + return maps; } struct map_selector @@ -669,7 +669,7 @@ public: map_selector msel = map_selector(map_selector::TAG, _place, _tag, false, _check_depth); msel.ignore_chance = !_check_chance; - return (msel); + return msel; } private: @@ -724,7 +724,7 @@ bool map_selector::accept(const map_def &mapdef) const && (!crawl_state.game_is_tutorial() || !mapdef.has_tag(crawl_state.map))) { - return (false); + return false; } return (mapdef.is_minivault() == mini && mapdef.place.is_usable_in(place) @@ -760,7 +760,7 @@ bool map_selector::accept(const map_def &mapdef) const && !mapdef.map_already_used()); default: - return (false); + return false; } } @@ -818,7 +818,7 @@ static vault_indices _eligible_maps_for_selector(const map_selector &sel) eligible.push_back(i); } - return (eligible); + return eligible; } static const map_def *_random_map_by_selector(const map_selector &sel); @@ -840,10 +840,10 @@ static bool _vault_chance_new(const map_def &map, { if (!tag.empty()) chance_tags.insert(tag); - return (true); + return true; } } - return (false); + return false; } class vault_chance_roll_iterator @@ -871,7 +871,7 @@ public: { vault_chance_roll_iterator copy(*this); operator ++ (); - return (copy); + return copy; } private: @@ -902,7 +902,7 @@ static const map_def *_resolve_chance_vault(const map_selector &sel, sel.place); return _random_map_by_selector(msel); } - return (map); + return map; } static mapref_vector @@ -933,7 +933,7 @@ _random_chance_maps_in_list(const map_selector &sel, sel.announce(chosen); } - return (chosen_chances); + return chosen_chances; } static const map_def * @@ -999,7 +999,7 @@ _random_map_in_list(const map_selector &sel, } sel.announce(chosen_map); - return (chosen_map); + return chosen_map; } static const map_def *_random_map_by_selector(const map_selector &sel) @@ -1110,7 +1110,7 @@ static bool verify_file_version(const std::string &file, time_t mtime) { FILE *fp = fopen_u(file.c_str(), "rb"); if (!fp) - return (false); + return false; try { reader inf(fp); @@ -1125,7 +1125,7 @@ static bool verify_file_version(const std::string &file, time_t mtime) catch (short_read_exception &E) { fclose(fp); - return (false); + return false; } } @@ -1186,7 +1186,7 @@ static bool _load_map_index(const std::string& cache, const std::string &base, } fclose(fp); - return (true); + return true; } static bool _load_map_cache(const std::string &filename, const std::string &cachename) @@ -1204,7 +1204,7 @@ static bool _load_map_cache(const std::string &filename, const std::string &cach if (!_verify_map_index(descache_base, mtime) || !_verify_map_full(descache_base, mtime)) { - return (false); + return false; } return _load_map_index(cachename, descache_base, mtime); @@ -1418,7 +1418,7 @@ static weighted_map_names mg_find_random_vaults( weighted_map_names wms; if (!place.is_valid()) - return (wms); + return wms; typedef std::map<std::string, int> map_count_t; @@ -1445,7 +1445,7 @@ static weighted_map_names mg_find_random_vaults( wms.push_back(*i); } - return (wms); + return wms; } static bool _weighted_map_more_likely( diff --git a/crawl-ref/source/melee_attack.cc b/crawl-ref/source/melee_attack.cc index 81e6665963..14e792d489 100644 --- a/crawl-ref/source/melee_attack.cc +++ b/crawl-ref/source/melee_attack.cc @@ -177,7 +177,7 @@ bool melee_attack::handle_phase_attempted() { --effective_attack_number; - return (false); + return false; } if (attacker->is_player() && defender->is_monster()) @@ -205,7 +205,7 @@ bool melee_attack::handle_phase_attempted() else { cancel_attack = true; - return (false); + return false; } } else @@ -224,7 +224,7 @@ bool melee_attack::handle_phase_attempted() if (stop_attack_prompt(hitfunc, verb)) { cancel_attack = true; - return (false); + return false; } } } @@ -232,7 +232,7 @@ bool melee_attack::handle_phase_attempted() attacker->pos())) { cancel_attack = true; - return (false); + return false; } else if (cell_is_solid(defender->pos()) && mons_wall_shielded(defender->as_monster()) @@ -246,7 +246,7 @@ bool melee_attack::handle_phase_attempted() raw_feature_description(defender->pos()).c_str(), defender->name(DESC_THE).c_str()); cancel_attack = true; - return (false); + return false; } } // Set delay now that we know the attack won't be cancelled. @@ -283,7 +283,7 @@ bool melee_attack::handle_phase_attempted() // Statues and other special monsters which have AT_NONE need to lose // energy, but otherwise should exit the melee attack now. if (attk_type == AT_NONE) - return (false); + return false; } if (attacker != defender) @@ -307,7 +307,7 @@ bool melee_attack::handle_phase_attempted() if (damage_brand == SPWPN_CHAOS) chaos_affects_attacker(); - return (false); + return false; } // Non-fumbled self-attacks due to confusion are still pretty funny, though. else if (attacker == defender && attacker->confused()) @@ -355,7 +355,7 @@ bool melee_attack::handle_phase_attempted() if (damage_brand == SPWPN_CHAOS) chaos_affects_attacker(); - return (false); + return false; } attack_occurred = true; @@ -364,13 +364,13 @@ bool melee_attack::handle_phase_attempted() if (one_chance_in(3) && defender->is_player()) practise(EX_MONSTER_MAY_HIT); - return (true); + return true; } bool melee_attack::handle_phase_blocked() { damage_done = 0; - return (true); + return true; } bool melee_attack::handle_phase_dodged() @@ -428,10 +428,10 @@ bool melee_attack::handle_phase_dodged() // Retaliations can kill! if (!attacker->alive()) - return (false); + return false; } - return (true); + return true; } /* An attack has been determined to have hit something @@ -475,7 +475,7 @@ bool melee_attack::handle_phase_hit() slimify_monster(defender->as_monster()); you.duration[DUR_SLIMIFY] = 0; - return (false); + return false; } // This does more than just calculate the damage, it also sets up @@ -490,12 +490,12 @@ bool melee_attack::handle_phase_hit() // check_unrand_effects is safe to call with a dead defender, so always // call it, even if the hit effects said to stop. if (check_unrand_effects() || stop_hit) - return (false); + return false; if (damage_done > 0 || attk_flavour == AF_CRUSH) { if (!handle_phase_damaged()) - return (false); + return false; // TODO: Remove this, (placed here to remove player_attack) if (attacker->is_player() && hit_woke_orc) @@ -531,7 +531,7 @@ bool melee_attack::handle_phase_hit() // [ds] Monster may disappear after behaviour event. if (!defender->alive()) - return (true); + return true; } else if (defender->is_player()) { @@ -542,7 +542,7 @@ bool melee_attack::handle_phase_hit() emit_foul_stench(); } - return (true); + return true; } bool melee_attack::handle_phase_damaged() @@ -671,7 +671,7 @@ bool melee_attack::handle_phase_damaged() chaos_affects_attacker(); do_miscast(); - return (false); + return false; } if (!defender->alive()) @@ -680,7 +680,7 @@ bool melee_attack::handle_phase_damaged() chaos_affects_attacker(); do_miscast(); - return (true); + return true; } // Yredelemnul's injury mirroring can kill the attacker. @@ -691,7 +691,7 @@ bool melee_attack::handle_phase_damaged() { if (miscast_target == defender) do_miscast(); - return (false); + return false; } if (!defender->alive()) @@ -700,7 +700,7 @@ bool melee_attack::handle_phase_damaged() chaos_affects_attacker(); do_miscast(); - return (true); + return true; } if (chaos_attack && attacker->alive()) @@ -711,20 +711,20 @@ bool melee_attack::handle_phase_damaged() // Yredelemnul's injury mirroring can kill the attacker. if (!attacker->alive()) - return (false); + return false; if (miscast_target == attacker) do_miscast(); // Miscast might have killed the attacker. if (!attacker->alive()) - return (false); + return false; } if (shroud_broken) mpr("Your shroud falls apart!", MSGCH_WARN); - return (true); + return true; } bool melee_attack::handle_phase_killed() @@ -740,7 +740,7 @@ bool melee_attack::handle_phase_killed() } _defender_die(); - return (true); + return true; } bool melee_attack::handle_phase_end() @@ -764,7 +764,7 @@ bool melee_attack::handle_phase_end() // This may invalidate both the attacker and defender. fire_final_effects(); - return (true); + return true; } /* Initiate the processing of the attack @@ -782,7 +782,7 @@ bool melee_attack::handle_phase_end() bool melee_attack::attack() { if (!handle_phase_attempted()) - return (false); + return false; if (attacker != defender && attacker->self_destructs()) return (did_hit = perceived_attack = true); @@ -812,7 +812,7 @@ bool melee_attack::attack() simple_god_message(" blocks your attack.", GOD_ELYVILON); dec_penance(GOD_ELYVILON, 1); - return (false); + return false; } // Check for stab (and set stab_attempt and stab_bonus) player_stab_check(); @@ -835,7 +835,7 @@ bool melee_attack::attack() // Spines can kill! if (!attacker->alive()) - return (false); + return false; } if (ev_margin >= 0) @@ -843,7 +843,7 @@ bool melee_attack::attack() if (attacker != defender && attack_warded_off()) { perceived_attack = true; - return (false); + return false; } bool cont = handle_phase_hit(); @@ -851,7 +851,7 @@ bool melee_attack::attack() attacker_sustain_passive_damage(); if (!cont) - return (false); + return false; } else handle_phase_dodged(); @@ -918,7 +918,7 @@ bool melee_attack::attack() for (int i = 0; i <= 1; ++i) if (is_melee_weapon(&you.inv[i])) if (wield_weapon(true, i)) - return (false); + return false; } you.pet_target = attacker->mindex(); @@ -931,7 +931,7 @@ bool melee_attack::attack() enable_attack_conducts(conducts); - return (attack_occurred); + return attack_occurred; } /* Initializes the noise_factor @@ -1049,7 +1049,7 @@ void melee_attack::check_autoberserk() bool melee_attack::check_unrand_effects() { if (attacker->suppressed()) - return (false); + return false; // If bashing the defender with a wielded unrandart launcher, don't use // unrand_entry->fight_func, since that's the function used for @@ -1063,7 +1063,7 @@ bool melee_attack::check_unrand_effects() return (!defender->alive()); } - return (false); + return false; } /* Setup all unarmed (non attack_type) variables @@ -1236,7 +1236,7 @@ unarmed_attack_type melee_attack::player_aux_choose_uc_attack() if (_tran_forbid_aux_attack(uc_attack)) uc_attack = UNAT_NO_ATTACK; - return (uc_attack); + return uc_attack; } bool melee_attack::player_aux_test_hit() @@ -1253,13 +1253,13 @@ bool melee_attack::player_aux_test_hit() { simple_god_message(" blocks your attack.", GOD_ELYVILON); dec_penance(GOD_ELYVILON, 1); - return (false); + return false; } bool auto_hit = one_chance_in(30); if (to_hit >= evasion || auto_hit) - return (true); + return true; const int phaseless_evasion = defender->melee_evasion(attacker, EV_IGNORE_PHASESHIFT); @@ -1277,7 +1277,7 @@ bool melee_attack::player_aux_test_hit() defender->name(DESC_THE).c_str()); } - return (false); + return false; } /* Controls the looping on available unarmed attacks @@ -1336,23 +1336,23 @@ bool melee_attack::player_aux_unarmed() // of the kraken still gets a chance to act and submerge // tentacles before we get here. if (!defender->alive()) - return (true); + return true; if (player_aux_test_hit()) { // Upset the monster. behaviour_event(defender->as_monster(), ME_WHACK, attacker); if (!defender->alive()) - return (true); + return true; if (attack_shield_blocked(true)) continue; if (player_aux_apply(atk)) - return (true); + return true; } } - return (false); + return false; } bool melee_attack::player_aux_apply(unarmed_attack_type atk) @@ -1458,10 +1458,10 @@ bool melee_attack::player_aux_apply(unarmed_attack_type atk) if (defender->as_monster()->hit_points < 1) { _defender_die(); - return (true); + return true; } - return (false); + return false; } void melee_attack::player_announce_aux_hit() @@ -1528,7 +1528,7 @@ int melee_attack::player_stat_modify_damage(int damage) damage *= dammod; damage /= 78; - return (damage); + return damage; } int melee_attack::player_aux_stat_modify_damage(int damage) @@ -1545,7 +1545,7 @@ int melee_attack::player_aux_stat_modify_damage(int damage) damage *= dammod; damage /= 20; - return (damage); + return damage; } int melee_attack::player_apply_weapon_skill(int damage) @@ -1556,7 +1556,7 @@ int melee_attack::player_apply_weapon_skill(int damage) damage /= 2500; } - return (damage); + return damage; } int melee_attack::player_apply_fighting_skill(int damage, bool aux) @@ -1566,7 +1566,7 @@ int melee_attack::player_apply_fighting_skill(int damage, bool aux) damage *= base * 100 + (random2(you.skill(SK_FIGHTING, 100) + 1)); damage /= base * 100; - return (damage); + return damage; } int melee_attack::player_apply_misc_modifiers(int damage) @@ -1582,7 +1582,7 @@ int melee_attack::player_apply_misc_modifiers(int damage) if (you.form == TRAN_STATUE) damage = div_rand_round(damage * 3, 2); - return (damage); + return damage; } int melee_attack::player_apply_weapon_bonuses(int damage) @@ -1638,7 +1638,7 @@ int melee_attack::player_apply_weapon_bonuses(int damage) damage = div_rand_round(damage * 9, 10); } - return (damage); + return damage; } int melee_attack::player_stab_weapon_bonus(int damage) @@ -1678,7 +1678,7 @@ int melee_attack::player_stab_weapon_bonus(int damage) break; } - return (damage); + return damage; } int melee_attack::player_stab(int damage) @@ -1707,7 +1707,7 @@ int melee_attack::player_stab(int damage) damage = player_stab_weapon_bonus(damage); } - return (damage); + return damage; } void melee_attack::set_attack_verb() @@ -2015,7 +2015,7 @@ bool melee_attack::player_monattk_hit_effects() } if (!defender->alive()) - return (false); + return false; // These effects apply only to monsters that are still alive: @@ -2032,7 +2032,7 @@ bool melee_attack::player_monattk_hit_effects() apply_staff_damage(); if (!defender->alive()) - return (false); + return false; if (special_damage || special_damage_flavour) { @@ -2058,7 +2058,7 @@ bool melee_attack::player_monattk_hit_effects() } } - return (true); + return true; } void melee_attack::_defender_die() @@ -2077,7 +2077,7 @@ int melee_attack::fire_res_apply_cerebov_downgrade(int res) if (weapon && weapon->special == UNRAND_CEREBOV) --res; - return (res); + return res; } void melee_attack::drain_defender() @@ -2141,7 +2141,7 @@ bool melee_attack::distortion_affects_defender() defender->heal(1 + random2avg(7, 2), true); // heh heh } - return (false); + return false; } if (one_chance_in(3)) @@ -2150,7 +2150,7 @@ bool melee_attack::distortion_affects_defender() make_stringf("Space bends around %s.", def_name(DESC_THE).c_str()); special_damage += 1 + random2avg(7, 2); - return (false); + return false; } if (one_chance_in(3)) @@ -2159,11 +2159,11 @@ bool melee_attack::distortion_affects_defender() make_stringf("Space warps horribly around %s!", def_name(DESC_THE).c_str()); special_damage += 3 + random2avg(24, 2); - return (false); + return false; } if (simu) - return (false); + return false; if (one_chance_in(3)) { @@ -2171,7 +2171,7 @@ bool melee_attack::distortion_affects_defender() obvious_effect = true; if (!defender->no_tele(true, false)) add_final_effect(FINEFF_BLINK, 0, defender); - return (false); + return false; } // Used to be coinflip() || coinflip() for players, just coinflip() @@ -2191,7 +2191,7 @@ bool melee_attack::distortion_affects_defender() add_final_effect(FINEFF_DISTORTION_TELEPORT, 0, defender); else defender->teleport(); - return (false); + return false; } if (!player_in_branch(BRANCH_ABYSS) && coinflip()) @@ -2213,10 +2213,10 @@ bool melee_attack::distortion_affects_defender() obvious_effect = true; defender->banish(attacker, attacker->name(DESC_PLAIN, true)); - return (true); + return true; } - return (false); + return false; } void melee_attack::antimagic_affects_defender() @@ -2802,7 +2802,7 @@ brand_type melee_attack::random_chaos_brand() if (brand != SPWPN_CHAOS) take_note(Note(NOTE_MESSAGE, 0, 0, brand_name.c_str()), true); #endif - return (brand); + return brand; } attack_flavour melee_attack::random_chaos_attack_flavour() @@ -3122,7 +3122,7 @@ bool melee_attack::apply_damage_brand() set_ident_flags(*weapon, ISFLAG_KNOW_TYPE); } - return (ret); + return ret; } @@ -3178,7 +3178,7 @@ bool melee_attack::chop_hydra_head(int dam, // Monster attackers have only a 25% chance of making the // chop-check to prevent runaway head inflation. if (attacker->is_monster() && !one_chance_in(4)) - return (false); + return false; // Only cutting implements. if (dam_type != DVORP_SLICING && dam_type != DVORP_CHOPPING @@ -3227,7 +3227,7 @@ bool melee_attack::chop_hydra_head(int dam, defender->hurt(attacker, INSTANT_DEATH); - return (true); + return true; } else { @@ -3251,7 +3251,7 @@ bool melee_attack::chop_hydra_head(int dam, { if (defender_visible) mpr("The flame cauterises the wound!"); - return (true); + return true; } else if (defender->as_monster()->number < limit - 1) { @@ -3263,7 +3263,7 @@ bool melee_attack::chop_hydra_head(int dam, } } - return (false); + return false; } bool melee_attack::decapitate_hydra(int dam, int damage_type) @@ -3278,7 +3278,7 @@ bool melee_attack::decapitate_hydra(int dam, int damage_type) return chop_hydra_head(dam, dam_type, wpn_brand); } - return (false); + return false; } void melee_attack::attacker_sustain_passive_damage() @@ -3628,7 +3628,7 @@ int melee_attack::calc_to_hit(bool random) // If no defender, we're calculating to-hit for debug-display // purposes, so don't drop down to defender code below if (defender == NULL) - return (mhit); + return mhit; if (!defender->visible_to(attacker)) if (attacker->is_player()) @@ -3656,7 +3656,7 @@ int melee_attack::calc_to_hit(bool random) attacker->name(DESC_PLAIN).c_str(), base_hit, mhit); - return (mhit); + return mhit; } /* @@ -3722,7 +3722,7 @@ int melee_attack::calc_attack_delay(bool random, bool scaled) return random ? div_rand_round(10 + delay, 2) : (10 + delay) / 2; } - return (0); + return 0; } /* Check for stab and prepare combat for stab-values @@ -3818,7 +3818,7 @@ random_var melee_attack::player_weapon_speed() } } - return (attack_delay); + return attack_delay; } random_var melee_attack::player_unarmed_speed() @@ -3834,7 +3834,7 @@ random_var melee_attack::player_unarmed_speed() // Bats are faster (for what good it does them). if (player_in_bat_form()) unarmed_delay = div_rand_round(constant(3)*unarmed_delay, 5); - return (unarmed_delay); + return unarmed_delay; } bool melee_attack::attack_warded_off() @@ -3860,10 +3860,10 @@ bool melee_attack::attack_warded_off() ASSERT(amu); wear_id_type(*amu); } - return (true); + return true; } - return (false); + return false; } /* Determine whether a block occurred @@ -3878,10 +3878,10 @@ bool melee_attack::attack_warded_off() bool melee_attack::attack_shield_blocked(bool verbose) { if (!defender_shield && !defender->is_player()) - return (false); + return false; if (defender->incapacitated()) - return (false); + return false; const int con_block = random2(attacker->shield_bypass_ability(to_hit) + defender->shield_block_penalty()); @@ -3907,10 +3907,10 @@ bool melee_attack::attack_shield_blocked(bool verbose) defender->shield_block_succeeded(attacker); - return (true); + return true; } - return (false); + return false; } /* Select the attack verb for attacker @@ -4802,7 +4802,7 @@ bool melee_attack::_tran_forbid_aux_attack(unarmed_attack_type atk) return (!form_keeps_mutations()); default: - return (false); + return false; } } @@ -4810,7 +4810,7 @@ bool melee_attack::_extra_aux_attack(unarmed_attack_type atk, bool is_uc) { // No extra unarmed attacks for disabled mutations. if (_tran_forbid_aux_attack(atk)) - return (false); + return false; if (atk == UNAT_CONSTRICT) return (is_uc @@ -4818,7 +4818,7 @@ bool melee_attack::_extra_aux_attack(unarmed_attack_type atk, bool is_uc) || you.species == SP_OCTOPODE && you.has_usable_tentacle()); if (you.strength() + you.dex() <= random2(50)) - return (false); + return false; switch (atk) { @@ -4859,7 +4859,7 @@ bool melee_attack::_extra_aux_attack(unarmed_attack_type atk, bool is_uc) return (is_uc && !one_chance_in(3)); default: - return (false); + return false; } } @@ -4926,7 +4926,7 @@ int melee_attack::test_hit(int to_land, int ev, bool randomise_ev) if (randomise_ev) ev = random2avg(2*ev, 2); if (to_land >= AUTOMATIC_HIT) - return (true); + return true; else if (x_chance_in_y(MIN_HIT_MISS_PERCENTAGE, 100)) margin = (random2(2) ? 1 : -1) * AUTOMATIC_HIT; else @@ -4937,7 +4937,7 @@ int melee_attack::test_hit(int to_land, int ev, bool randomise_ev) to_hit, ev, (margin >= 0) ? "hit" : "miss", margin); #endif - return (margin); + return margin; } /* Returns base weapon damage for attacker @@ -4968,7 +4968,7 @@ int melee_attack::calc_base_weapon_damage() } } - return (damage); + return damage; } /* Returns attacker base unarmed damage @@ -5162,7 +5162,7 @@ int melee_attack::calc_damage() return damage_done; } - return (0); + return 0; } int melee_attack::apply_defender_ac(int damage, int damage_max) @@ -5220,7 +5220,7 @@ bool melee_attack::_player_vampire_draws_blood(const monster* mon, const int dam if (!_vamp_wants_blood_from_monster(mon) || (!adjacent(defender->pos(), attacker->pos()) && needs_bite_msg)) { - return (false); + return false; } const corpse_effect_type chunk_type = mons_corpse_effect(mon->type); @@ -5281,7 +5281,7 @@ bool melee_attack::_player_vampire_draws_blood(const monster* mon, const int dam did_god_conduct(DID_DRINK_BLOOD, 5 + random2(4)); - return (true); + return true; } // weighted average of strength and dex, between str and (str+dex)/2 @@ -5343,16 +5343,16 @@ void melee_attack::stab_message() bool melee_attack::_vamp_wants_blood_from_monster(const monster* mon) { if (you.species != SP_VAMPIRE) - return (false); + return false; if (you.hunger_state == HS_ENGORGED) - return (false); + return false; if (mon->is_summoned()) - return (false); + return false; if (!mons_has_blood(mon->type)) - return (false); + return false; const corpse_effect_type chunk_type = mons_corpse_effect(mon->type); diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 109a7b9941..40a96d0b18 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -286,7 +286,7 @@ std::vector<MenuEntry *> Menu::show(bool reuse_selections) tiles.pop_menu(); #endif - return (sel); + return sel; } void Menu::do_menu() @@ -313,7 +313,7 @@ int Menu::get_cursor() const if (items[next]->level != MEL_ITEM) next = (next + 1) % item_count(); - return (next); + return next; } bool Menu::is_set(int flag) const @@ -323,12 +323,12 @@ bool Menu::is_set(int flag) const int Menu::pre_process(int k) { - return (k); + return k; } int Menu::post_process(int k) { - return (k); + return k; } bool Menu::process_key(int keyin) @@ -336,7 +336,7 @@ bool Menu::process_key(int keyin) if (items.empty()) { lastch = keyin; - return (false); + return false; } else if (action_cycle == CYCLE_TOGGLE && (keyin == '!' || keyin == '?')) { @@ -348,14 +348,14 @@ bool Menu::process_key(int keyin) sel.clear(); update_title(); - return (true); + return true; } else if (action_cycle == CYCLE_CYCLE && (keyin == '!' || keyin == '?')) { menu_action = (action)((menu_action+1) % ACT_NUM); sel.clear(); update_title(); - return (true); + return true; } bool nav = false, repaint = false; @@ -368,13 +368,13 @@ bool Menu::process_key(int keyin) switch (keyin) { case 0: - return (true); + return true; case CK_MOUSE_B2: case CK_MOUSE_CMD: CASE_ESCAPE sel.clear(); lastch = keyin; - return (false); + return false; case ' ': case CK_PGDN: case '>': case CK_MOUSE_B1: case CK_MOUSE_CLICK: @@ -438,7 +438,7 @@ bool Menu::process_key(int keyin) { // Return the first item found. get_selected(&sel); - return (false); + return false; } } } @@ -528,7 +528,7 @@ bool Menu::process_key(int keyin) case CK_ENTER: if (!(flags & MF_PRESELECTED) || !sel.empty()) - return (false); + return false; // else fall through default: // Even if we do return early, lastch needs to be set first, @@ -538,7 +538,7 @@ bool Menu::process_key(int keyin) // If no selection at all is allowed, exit now. if (!(flags & (MF_SINGLESELECT | MF_MULTISELECT))) - return (false); + return false; if (!is_set(MF_NO_SELECT_QTY) && isadigit(keyin)) { @@ -551,7 +551,7 @@ bool Menu::process_key(int keyin) select_items(keyin, num); get_selected(&sel); if (sel.size() == 1 && (flags & MF_SINGLESELECT)) - return (false); + return false; draw_select_count(sel.size()); #ifdef USE_TILE_WEB @@ -561,7 +561,7 @@ bool Menu::process_key(int keyin) if (flags & MF_ANYPRINTABLE && (!isadigit(keyin) || is_set(MF_NO_SELECT_QTY))) { - return (false); + return false; } break; @@ -583,9 +583,9 @@ bool Menu::process_key(int keyin) draw_menu(); } else if (allow_easy_exit() && is_set(MF_EASY_EXIT)) - return (false); + return false; } - return (true); + return true; } // Easy exit should not kill the menu if there are selected items. @@ -597,7 +597,7 @@ bool Menu::allow_easy_exit() const bool Menu::draw_title_suffix(const std::string &s, bool titlefirst) { if (crawl_state.doing_prev_cmd_again) - return (true); + return true; int oldx = wherex(), oldy = wherey(); @@ -608,7 +608,7 @@ bool Menu::draw_title_suffix(const std::string &s, bool titlefirst) if (x > get_number_of_cols() || x < 1) { cgotoxy(oldx, oldy); - return (false); + return false; } // Note: 1 <= x <= get_number_of_cols(); we have no fear of overflow. @@ -617,13 +617,13 @@ bool Menu::draw_title_suffix(const std::string &s, bool titlefirst) cprintf("%s", towrite.c_str()); cgotoxy(oldx, oldy); - return (true); + return true; } bool Menu::draw_title_suffix(const formatted_string &fs, bool titlefirst) { if (crawl_state.doing_prev_cmd_again) - return (true); + return true; int oldx = wherex(), oldy = wherey(); @@ -634,7 +634,7 @@ bool Menu::draw_title_suffix(const formatted_string &fs, bool titlefirst) if (x > get_number_of_cols() || x < 1) { cgotoxy(oldx, oldy); - return (false); + return false; } // Note: 1 <= x <= get_number_of_cols(); we have no fear of overflow. @@ -657,7 +657,7 @@ bool Menu::draw_title_suffix(const formatted_string &fs, bool titlefirst) } cgotoxy(oldx, oldy); - return (true); + return true; } std::string Menu::get_select_count_string(int count) const @@ -688,7 +688,7 @@ std::vector<MenuEntry*> Menu::selected_entries() const { std::vector<MenuEntry*> selection; get_selected(&selection); - return (selection); + return selection; } void Menu::get_selected(std::vector<MenuEntry*> *selected) const @@ -839,12 +839,12 @@ PlayerMenuEntry::PlayerMenuEntry(const std::string &str) : bool MenuEntry::get_tiles(std::vector<tile_def>& tileset) const { if (!Options.tile_menu_icons || tiles.empty()) - return (false); + return false; for (unsigned int i = 0; i < tiles.size(); i++) tileset.push_back(tiles[i]); - return (true); + return true; } void MenuEntry::add_tile(tile_def tile) @@ -855,11 +855,11 @@ void MenuEntry::add_tile(tile_def tile) bool MonsterMenuEntry::get_tiles(std::vector<tile_def>& tileset) const { if (!Options.tile_menu_icons) - return (false); + return false; monster_info* m = (monster_info*)(data); if (!m) - return (false); + return false; MenuEntry::get_tiles(tileset); @@ -979,16 +979,16 @@ bool MonsterMenuEntry::get_tiles(std::vector<tile_def>& tileset) const else if (m->is(MB_DISTRACTED)) tileset.push_back(tile_def(TILEI_MAY_STAB_BRAND, TEX_ICONS)); - return (true); + return true; } bool FeatureMenuEntry::get_tiles(std::vector<tile_def>& tileset) const { if (!Options.tile_menu_icons) - return (false); + return false; if (feat == DNGN_UNSEEN) - return (false); + return false; MenuEntry::get_tiles(tileset); @@ -998,13 +998,13 @@ bool FeatureMenuEntry::get_tiles(std::vector<tile_def>& tileset) const if (in_bounds(pos) && is_unknown_stair(pos)) tileset.push_back(tile_def(TILEI_NEW_STAIR, TEX_ICONS)); - return (true); + return true; } bool PlayerMenuEntry::get_tiles(std::vector<tile_def>& tileset) const { if (!Options.tile_menu_icons) - return (false); + return false; MenuEntry::get_tiles(tileset); @@ -1079,21 +1079,21 @@ bool PlayerMenuEntry::get_tiles(std::vector<tile_def>& tileset) const tileset.push_back(tile_def(idx, TEX_PLAYER, ymax)); } - return (true); + return true; } #endif bool Menu::is_selectable(int item) const { if (select_filter.empty()) - return (true); + return true; std::string text = items[item]->get_filter_text(); for (int i = 0, count = select_filter.size(); i < count; ++i) if (select_filter[i].matches(text)) - return (true); + return true; - return (false); + return false; } void Menu::select_item_index(int idx, int qty, bool draw_cursor) @@ -1174,7 +1174,7 @@ int Menu::get_entry_index(const MenuEntry *e) const for (unsigned int i = first_entry; i < items.size(); i++) { if (items[i] == e) - return (index); + return index; if (items[i]->quantity != 0) index++; @@ -1306,9 +1306,9 @@ bool Menu::page_down() // first_entry = items.size() - pagesize; if (old_first != first_entry) - return (true); + return true; } - return (false); + return false; } bool Menu::page_up() @@ -1321,9 +1321,9 @@ bool Menu::page_up() first_entry = 0; if (old_first != first_entry) - return (true); + return true; } - return (false); + return false; } bool Menu::line_down() @@ -1331,9 +1331,9 @@ bool Menu::line_down() if (first_entry + pagesize < (int) items.size()) { ++first_entry; - return (true); + return true; } - return (false); + return false; } bool Menu::line_up() @@ -1341,9 +1341,9 @@ bool Menu::line_up() if (first_entry > 0) { --first_entry; - return (true); + return true; } - return (false); + return false; } #ifdef USE_TILE_WEB @@ -1655,7 +1655,7 @@ void column_composer::add_formatted(int ncol, std::vector<formatted_string> column_composer::formatted_lines() const { - return (flines); + return flines; } void column_composer::strip_blank_lines(std::vector<formatted_string> &fs) const @@ -1797,7 +1797,7 @@ std::string get_linebreak_string(const std::string& s, int maxcol) bool formatted_scroller::jump_to(int i) { if (i == first_entry + 1) - return (false); + return false; if (i == 0) first_entry = 0; @@ -1824,7 +1824,7 @@ bool formatted_scroller::jump_to(int i) webtiles_write_menu(true); #endif - return (true); + return true; } // Don't scroll past MEL_TITLE entries @@ -1833,7 +1833,7 @@ bool formatted_scroller::page_down() const int old_first = first_entry; if ((int) items.size() <= first_entry + pagesize) - return (false); + return false; // If, when scrolling forward, we encounter a MEL_TITLE // somewhere in the newly displayed page, stop scrolling @@ -1858,7 +1858,7 @@ bool formatted_scroller::page_up() // just before it becomes visible if (items[first_entry]->level == MEL_TITLE) - return (false); + return false; for (int i = 0; i < pagesize; ++i) { @@ -1877,9 +1877,9 @@ bool formatted_scroller::line_down() && items[first_entry + pagesize]->level != MEL_TITLE) { ++first_entry; - return (true); + return true; } - return (false); + return false; } bool formatted_scroller::line_up() @@ -1888,9 +1888,9 @@ bool formatted_scroller::line_up() && items[first_entry]->level != MEL_TITLE) { --first_entry; - return (true); + return true; } - return (false); + return false; } bool formatted_scroller::jump_to_hotkey(int keyin) @@ -1899,7 +1899,7 @@ bool formatted_scroller::jump_to_hotkey(int keyin) if (items[i]->is_hotkey(keyin)) return jump_to(i); - return (false); + return false; } std::vector<MenuEntry *> formatted_scroller::show(bool reuse_selections) @@ -1929,10 +1929,10 @@ bool formatted_scroller::process_key(int keyin) switch (keyin) { case 0: - return (true); + return true; case CK_MOUSE_CMD: CASE_ESCAPE - return (false); + return false; case ' ': case '+': case '=': case CK_PGDN: case '>': case '\'': case CK_MOUSE_B5: case CK_MOUSE_CLICK: @@ -1966,7 +1966,7 @@ bool formatted_scroller::process_key(int keyin) select_items(keyin); get_selected(&sel); if (sel.size() >= 1) - return (false); + return false; } else repaint = jump_to_hotkey(keyin); @@ -1977,9 +1977,9 @@ bool formatted_scroller::process_key(int keyin) if (repaint) draw_menu(); else if (!moved || is_set(MF_EASY_EXIT)) - return (false); + return false; - return (true); + return true; } int ToggleableMenu::pre_process(int key) diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 4fea91c2fb..d2a33ec36c 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -273,7 +273,7 @@ static glyph _prefix_glyph(prefix_type p) g.col = LIGHTGRAY; break; } - return (g); + return g; } static bool _pre_more(); @@ -635,7 +635,7 @@ public: bool have_prev() { - return (prev_msg); + return prev_msg; } void store_msg(const message_item& msg) @@ -728,7 +728,7 @@ msg_colour_type msg_colour(int col) static int colour_msg(msg_colour_type col) { if (col == MSGCOL_MUTED) - return (DARKGREY); + return DARKGREY; else return static_cast<int>(col); } @@ -737,7 +737,7 @@ static int colour_msg(msg_colour_type col) static msg_colour_type channel_to_msgcol(msg_channel_type channel, int param) { if (you.asleep()) - return (MSGCOL_DARKGREY); + return MSGCOL_DARKGREY; msg_colour_type ret; @@ -867,7 +867,7 @@ static msg_colour_type channel_to_msgcol(msg_channel_type channel, int param) break; } - return (ret); + return ret; } int channel_to_colour(msg_channel_type channel, int param) @@ -1277,9 +1277,9 @@ static bool channel_message_history(msg_channel_type channel) case MSGCH_PROMPT: case MSGCH_EQUIPMENT: case MSGCH_EXAMINE_FILTER: - return (false); + return false; default: - return (true); + return true; } } diff --git a/crawl-ref/source/misc.cc b/crawl-ref/source/misc.cc index 45d508ed63..be0bfd1580 100644 --- a/crawl-ref/source/misc.cc +++ b/crawl-ref/source/misc.cc @@ -555,7 +555,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) } if (!rot_count && !coag_count) - return (false); // Nothing to be done. + return false; // Nothing to be done. #ifdef DEBUG_BLOOD_POTIONS mprf(MSGCH_DIAGNOSTICS, "in maybe_coagulate_blood_potions_INV " @@ -597,7 +597,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) else _compare_blood_quantity(blood, timer.size()); - return (true); + return true; } // Coagulated blood cannot coagulate any further... @@ -775,7 +775,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) if (!knew_blood) mpr_nocap(blood.name(DESC_INVENTORY).c_str()); - return (true); + return true; } o = mitm[o].link; } @@ -784,7 +784,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) // Create a new stack of potions. o = get_mitm_slot(); if (o == NON_ITEM) - return (false); + return false; // These values are common to all: {dlb} mitm[o].base_type = OBJ_POTIONS; @@ -826,7 +826,7 @@ bool maybe_coagulate_blood_potions_inv(item_def &blood) if (!knew_blood) mpr_nocap(blood.name(DESC_INVENTORY).c_str()); } - return (true); + return true; } // Removes the oldest timer of a stack of blood potions. @@ -848,7 +848,7 @@ int remove_oldest_blood_potion(item_def &stack) timer.pop_back(); // The quantity will be decreased elsewhere. - return (val); + return val; } // Used whenever copies of blood potions have to be cleaned up. @@ -927,10 +927,10 @@ bool check_blood_corpses_on_ground() && !food_is_rotten(*si) && mons_has_blood(si->mon_type)) { - return (true); + return true; } } - return (false); + return false; } // Deliberately don't check for rottenness here, so this check @@ -941,14 +941,14 @@ bool can_bottle_blood_from_corpse(monster_type mons_class) if (you.species != SP_VAMPIRE || you.experience_level < 6 || !mons_has_blood(mons_class)) { - return (false); + return false; } int chunk_type = mons_corpse_effect(mons_class); if (chunk_type == CE_CLEAN || chunk_type == CE_CONTAMINATED) - return (true); + return true; - return (false); + return false; } int num_blood_potions_from_corpse(monster_type mons_class, int chunk_type) @@ -970,7 +970,7 @@ int num_blood_potions_from_corpse(monster_type mons_class, int chunk_type) if (pot_quantity < 1) pot_quantity = 1; - return (pot_quantity); + return pot_quantity; } // If autopickup is active, the potions are auto-picked up after creation. @@ -1020,30 +1020,30 @@ static bool allow_bleeding_on_square(const coord_def& where) // No bleeding onto sanctuary ground, please. // Also not necessary if already covered in blood. if (is_bloodcovered(where) || is_sanctuary(where)) - return (false); + return false; // No spattering into lava or water. if (grd(where) >= DNGN_LAVA && grd(where) < DNGN_FLOOR) - return (false); + return false; // No spattering into fountains (other than blood). if (grd(where) == DNGN_FOUNTAIN_BLUE || grd(where) == DNGN_FOUNTAIN_SPARKLING) { - return (false); + return false; } // The good gods like to keep their altars pristine. if (is_good_god(feat_altar_god(grd(where)))) - return (false); + return false; - return (true); + return true; } bool maybe_bloodify_square(const coord_def& where) { if (!allow_bleeding_on_square(where)) - return (false); + return false; env.pgrid(where) |= FPROP_BLOODY; return true; @@ -1404,7 +1404,7 @@ bool scramble(void) // Statues are too stiff and heavy to scramble out of the water. if (you.form == TRAN_STATUE || you.cannot_move()) - return (false); + return false; const int max_carry = carrying_capacity(); // When highly encumbered, scrambling out is hard to do. @@ -1416,7 +1416,7 @@ bool go_berserk(bool intentional, bool potion) ASSERT(!crawl_state.game_is_arena()); if (!you.can_go_berserk(intentional, potion)) - return (false); + return false; if (stasis_blocks_effect(true, true, @@ -1424,7 +1424,7 @@ bool go_berserk(bool intentional, bool potion) 3, "%s vibrates violently and saps your rage.")) { - return (false); + return false; } if (crawl_state.game_is_hints()) @@ -1479,7 +1479,7 @@ bool go_berserk(bool intentional, bool potion) you.redraw_quiver = true; // Account for no firing. - return (true); + return true; } // Returns true if the monster has a path to the player, or it has to be @@ -1492,20 +1492,20 @@ static bool _mons_has_path_to_player(const monster* mon, bool want_move = false) if (want_move) dist--; if (dist >= 2) - return (false); + return false; } // Short-cut if it's already adjacent. if (grid_distance(mon->pos(), you.pos()) <= 1) - return (true); + return true; // If the monster is awake and knows a path towards the player // (even though the player cannot know this) treat it as unsafe. if (mon->travel_target == MTRAV_PLAYER) - return (true); + return true; if (mon->travel_target == MTRAV_KNOWN_UNREACHABLE) - return (false); + return false; // Try to find a path from monster to player, using the map as it's // known to the player and assuming unknown terrain to be traversable. @@ -1516,12 +1516,12 @@ static bool _mons_has_path_to_player(const monster* mon, bool want_move = false) mp.set_range(range * 4); if (mp.init_pathfind(mon, you.pos(), true, false, true)) - return (true); + return true; // Now we know the monster cannot possibly reach the player. mon->travel_target = MTRAV_KNOWN_UNREACHABLE; - return (false); + return false; } bool mons_can_hurt_player(const monster* mon, const bool want_move) @@ -1531,17 +1531,17 @@ bool mons_can_hurt_player(const monster* mon, const bool want_move) // It also always returns true for sleeping monsters, but that's okay // for its current purposes. (Travel interruptions and tension.) if (_mons_has_path_to_player(mon, want_move)) - return (true); + return true; // Even if the monster can not actually reach the player it might // still use some ranged form of attack. if (you.see_cell_no_trans(mon->pos()) && mons_has_known_ranged_attack(mon)) { - return (true); + return true; } - return (false); + return false; } // Returns true if a monster can be considered safe regardless @@ -1597,7 +1597,7 @@ bool mons_is_safe(const monster* mon, const bool want_move, } #endif - return (is_safe); + return is_safe; } // Return all nearby monsters in range (default: LOS) that the player @@ -1650,8 +1650,8 @@ static bool _exposed_monsters_nearby(bool want_move) const int radius = want_move ? 2 : 1; for (radius_iterator ri(you.pos(), radius); ri; ++ri) if (env.map_knowledge(*ri).flags & MAP_INVISIBLE_MONSTER) - return (true); - return (false); + return true; + return false; } bool i_feel_safe(bool announce, bool want_move, bool just_monsters, @@ -1672,14 +1672,14 @@ bool i_feel_safe(bool announce, bool want_move, bool just_monsters, mprf(MSGCH_WARN, "You're standing in a cloud of %s!", cloud_name_at_index(cloudidx).c_str()); } - return (false); + return false; } } // No monster will attack you inside a sanctuary, // so presence of monsters won't matter -- until it starts shrinking... if (is_sanctuary(you.pos()) && env.sanctuary_time >= 5) - return (true); + return true; } // Monster check. @@ -1702,12 +1702,12 @@ bool i_feel_safe(bool announce, bool want_move, bool just_monsters, else if (_exposed_monsters_nearby(want_move)) msg = "There is a strange disturbance nearby!"; else - return (true); + return true; if (announce) mpr(msg, MSGCH_WARN); - return (false); + return false; } bool there_are_monsters_nearby(bool dangerous_only, bool require_visible, @@ -1736,12 +1736,12 @@ static const char *shop_types[] = { int str_to_shoptype(const std::string &s) { if (s == "random" || s == "any") - return (SHOP_RANDOM); + return SHOP_RANDOM; for (unsigned i = 0; i < ARRAYSZ(shop_types); ++i) { if (s == shop_types[i]) - return (i); + return i; } return (-1); } @@ -2276,7 +2276,7 @@ bool bad_attack(const monster *mon, std::string& adj, std::string& suffix) { ASSERT(!crawl_state.game_is_arena()); if (!you.can_see(mon)) - return (false); + return false; adj.clear(); suffix.clear(); @@ -2314,7 +2314,7 @@ bool stop_attack_prompt(const monster* mon, bool beam_attack, coord_def beam_target, bool autohit_first) { if (you.confused() || !you.can_see(mon)) - return (false); + return false; std::string adj, suffix; if (!bad_attack(mon, adj, suffix)) @@ -2337,7 +2337,7 @@ bool stop_attack_prompt(const monster* mon, bool beam_attack, || you.pos() > beam_target && beam_target > mon->pos()) { if (autohit_first) - return (false); + return false; verb += "in " + apostrophise(mon_name) + " direction"; mon_name = ""; @@ -2400,7 +2400,7 @@ bool stop_attack_prompt(targetter &hitfunc, std::string verb, bool is_orckind(const actor *act) { if (mons_genus(act->mons_species()) == MONS_ORC) - return (true); + return true; if (act->is_monster()) { @@ -2408,16 +2408,16 @@ bool is_orckind(const actor *act) if (mons_is_zombified(mon) && mons_genus(mon->base_monster) == MONS_ORC) { - return (true); + return true; } if (mons_is_ghost_demon(mon->type) && mon->ghost->species == SP_HILL_ORC) { - return (true); + return true; } } - return (false); + return false; } bool is_dragonkind(const actor *act) @@ -2425,7 +2425,7 @@ bool is_dragonkind(const actor *act) if (mons_genus(act->mons_species()) == MONS_DRAGON || mons_genus(act->mons_species()) == MONS_DRACONIAN) { - return (true); + return true; } if (act->is_player()) @@ -2435,22 +2435,22 @@ bool is_dragonkind(const actor *act) const monster* mon = act->as_monster(); if (mon->type == MONS_SERPENT_OF_HELL) - return (true); + return true; if (mons_is_zombified(mon) && (mons_genus(mon->base_monster) == MONS_DRAGON || mons_genus(mon->base_monster) == MONS_DRACONIAN)) { - return (true); + return true; } if (mons_is_ghost_demon(mon->type) && species_genus(mon->ghost->species) == GENPC_DRACONIAN) { - return (true); + return true; } - return (false); + return false; } // Make the player swap positions with a given monster. @@ -2793,7 +2793,7 @@ int counted_monster_list::count() int nmons = 0; for (counted_list::const_iterator i = list.begin(); i != list.end(); ++i) nmons += i->second; - return (nmons); + return nmons; } std::string counted_monster_list::describe(description_level_type desc) @@ -2824,18 +2824,18 @@ bool move_stairs(coord_def orig, coord_def dest) const dungeon_feature_type stair_feat = grd(orig); if (feat_stair_direction(stair_feat) == CMD_NO_CMD) - return (false); + return false; // The player can't use shops to escape, so don't bother. if (stair_feat == DNGN_ENTER_SHOP) - return (false); + return false; // Don't move around notable terrain the player is aware of if it's // out of sight. if (is_notable_terrain(stair_feat) && env.map_knowledge(orig).known() && !you.see_cell(orig)) { - return (false); + return false; } return slide_feature_over(orig, dest); diff --git a/crawl-ref/source/mislead.cc b/crawl-ref/source/mislead.cc index 7f10b066e5..147f1a74e5 100644 --- a/crawl-ref/source/mislead.cc +++ b/crawl-ref/source/mislead.cc @@ -49,7 +49,7 @@ static monster_type _get_misled_monster(monster* mons) mt = random_monster_at_grid(mons->pos()); if (_unsuitable_misled_monster(mt)) - return (MONS_BAT); + return MONS_BAT; return mt; } @@ -63,7 +63,7 @@ bool update_mislead_monster(monster* mons) || mons->type == MONS_ORB_OF_DESTRUCTION || mons->type == MONS_MARA_FAKE) { - return (false); + return false; } monster misled_as; @@ -73,9 +73,9 @@ bool update_mislead_monster(monster* mons) mons->props["mislead_as"] = misled_as; if (misled_as.type == MONS_BAT) - return (false); + return false; - return (true); + return true; } static int _update_mislead_monsters(monster* caster) diff --git a/crawl-ref/source/mon-abil.cc b/crawl-ref/source/mon-abil.cc index b1d6433723..0ea8f9a73b 100644 --- a/crawl-ref/source/mon-abil.cc +++ b/crawl-ref/source/mon-abil.cc @@ -272,10 +272,10 @@ bool ugly_thing_mutate(monster* ugly, bool proximity) ugly->uglything_mutate(mon_colour); - return (true); + return true; } - return (false); + return false; } // Inflict any enchantments the parent slime has on its offspring, @@ -526,7 +526,7 @@ static bool _do_merge_crawlies(monster* crawlie, monster* merge_to) // Now kill the other monster monster_die(crawlie, KILL_DISMISSED, NON_MONSTER, true); - return (true); + return true; } @@ -583,7 +583,7 @@ static bool _do_merge_slimes(monster* initial_slime, monster* merge_to) // Have to 'kill' the slime doing the merging. monster_die(initial_slime, KILL_DISMISSED, NON_MONSTER, true); - return (true); + return true; } // Slime creatures can split but not merge under these conditions. @@ -612,7 +612,7 @@ static bool _disabled_merge(monster* thing) static bool _slime_merge(monster* thing) { if (!thing || _disabled_merge(thing) || _unoccupied_slime(thing)) - return (false); + return false; int max_slime_merge = 5; int compass_idx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; @@ -667,7 +667,7 @@ static bool _slime_merge(monster* thing) return (_do_merge_slimes(thing, merge_target)); // No adjacent slime creatures we could merge with. - return (false); + return false; } static bool _crawlie_is_mergeable(monster *mons) @@ -691,7 +691,7 @@ static bool _crawlie_is_mergeable(monster *mons) static bool _crawling_corpse_merge(monster *crawlie) { if (!crawlie || _disabled_merge(crawlie)) - return (false); + return false; int compass_idx[8] = {0, 1, 2, 3, 4, 5, 6, 7}; std::random_shuffle(compass_idx, compass_idx + 8); @@ -713,7 +713,7 @@ static bool _crawling_corpse_merge(monster *crawlie) return (_do_merge_crawlies(crawlie, merge_target)); // No adjacent crawlies. - return (false); + return false; } @@ -791,11 +791,11 @@ static bool _slime_split_merge(monster* thing) || thing->is_shapeshifter() || thing->type != MONS_SLIME_CREATURE) { - return (false); + return false; } if (_slime_split(thing, false)) - return (true); + return true; return (_slime_merge(thing)); } @@ -880,7 +880,7 @@ static bool _siren_movement_effect(const monster* mons) mprf("Something prevents you from swapping places " "with %s.", mon->name(DESC_THE).c_str()); - return (do_resist); + return do_resist; } int swap_mon = mgrd(newpos); @@ -902,7 +902,7 @@ static bool _siren_movement_effect(const monster* mons) } } - return (do_resist); + return do_resist; } static bool _silver_statue_effects(monster* mons) @@ -916,7 +916,7 @@ static bool _silver_statue_effects(monster* mons) && crawl_state.game_is_zotdef()) { if (!one_chance_in(3)) - return (false); + return false; abjuration_duration = 1; } @@ -932,9 +932,9 @@ static bool _silver_statue_effects(monster* mons) : DEMON_LESSER)), SAME_ATTITUDE(mons), mons, abjuration_duration, 0, foe->pos(), mons->foe)); - return (true); + return true; } - return (false); + return false; } static bool _orange_statue_effects(monster* mons) @@ -951,7 +951,7 @@ static bool _orange_statue_effects(monster* mons) && crawl_state.game_is_zotdef()) { if (foe->check_res_magic(120) > 0) - return (false); + return false; pow /= 2; fail /= 2; } @@ -970,10 +970,10 @@ static bool _orange_statue_effects(monster* mons) MiscastEffect(foe, mons->mindex(), SPTYP_DIVINATION, pow, fail, "an orange crystal statue"); - return (true); + return true; } - return (false); + return false; } static void _orc_battle_cry(monster* chief) @@ -1165,7 +1165,7 @@ static void _cherub_hymn(monster* chief) static bool _make_monster_angry(const monster* mon, monster* targ) { if (mon->friendly() != targ->friendly()) - return (false); + return false; // targ is guaranteed to have a foe (needs_berserk checks this). // Now targ needs to be closer to *its* foe than mon is (otherwise @@ -1178,7 +1178,7 @@ static bool _make_monster_angry(const monster* mon, monster* targ) { const monster* vmons = &menv[targ->foe]; if (!vmons->alive()) - return (false); + return false; victim = vmons->pos(); } else @@ -1189,7 +1189,7 @@ static bool _make_monster_angry(const monster* mon, monster* targ) // If mon may be blocking targ from its victim, don't try. if (victim.distance_from(targ->pos()) > victim.distance_from(mon->pos())) - return (false); + return false; if (you.can_see(mon)) { @@ -1207,7 +1207,7 @@ static bool _make_monster_angry(const monster* mon, monster* targ) targ->go_berserk(false); - return (true); + return true; } static bool _moth_incite_monsters(const monster* mon) @@ -1230,7 +1230,7 @@ static bool _moth_incite_monsters(const monster* mon) continue; if (_make_monster_angry(mon, *mi) && !one_chance_in(3 * ++goaded)) - return (true); + return true; } return goaded != 0; @@ -1257,7 +1257,7 @@ static bool _queen_incite_worker(const monster* queen) continue; if (_make_monster_angry(queen, *mi) && !one_chance_in(3 * ++goaded)) - return (true); + return true; } return goaded != 0; @@ -1597,8 +1597,8 @@ struct target_monster { monster* temp = monster_at(pos); if (!temp || temp->mindex() != target_mindex) - return (false); - return (true); + return false; + return true; } }; @@ -1612,9 +1612,9 @@ struct multi_target for (unsigned i = 0; i < targets->size(); ++i) { if (pos == targets->at(i)) - return (true); + return true; } - return (false); + return false; } @@ -1675,7 +1675,7 @@ static bool _tentacle_pathfind(monster* tentacle, } - return (path_found); + return path_found; } static bool _try_tentacle_connect(const coord_def & new_pos, @@ -1693,7 +1693,7 @@ static bool _try_tentacle_connect(const coord_def & new_pos, menv[tentacle_idx].props["inwards"].get_int() = -1; else menv[tentacle_idx].props["inwards"].get_int() = base_idx; - return (true); + return true; } int start_level = 0; @@ -1726,11 +1726,11 @@ static bool _try_tentacle_connect(const coord_def & new_pos, visited, candidates); if (candidates.empty()) - return (false); + return false; _establish_connection(tentacle_idx, base_idx,candidates[0], connect_type); - return (true); + return true; } static void _collect_tentacles(int headnum, @@ -2249,7 +2249,7 @@ bool mon_special_ability(monster* mons, bolt & beem) && mons->type != MONS_SLIME_CREATURE && !_crawlie_is_mergeable(mons)) { - return (false); + return false; } const msg_channel_type spl = (mons->friendly() ? MSGCH_FRIEND_SPELL @@ -2273,14 +2273,14 @@ bool mon_special_ability(monster* mons, bolt & beem) // situation. used = _slime_split_merge(mons); if (!mons->alive()) - return (true); + return true; break; case MONS_CRAWLING_CORPSE: case MONS_MACABRE_MASS: used = _crawling_corpse_merge(mons); if (!mons->alive()) - return (true); + return true; break; case MONS_ORC_KNIGHT: @@ -2825,7 +2825,7 @@ bool mon_special_ability(monster* mons, bolt & beem) if (used && (mons_genus(mons->type) == MONS_DRAGON || mons_genus(mons->type) == MONS_DRACONIAN)) setup_breath_timeout(mons); - return (used); + return used; } // Combines code for eyeball-type monsters, etc. to reduce clutter. diff --git a/crawl-ref/source/mon-act.cc b/crawl-ref/source/mon-act.cc index 29ce017fa5..930603fbf0 100644 --- a/crawl-ref/source/mon-act.cc +++ b/crawl-ref/source/mon-act.cc @@ -77,7 +77,7 @@ static int _compass_idx(const coord_def& mov) { for (int i = 0; i < 8; i++) if (mon_compass[i] == mov) - return (i); + return i; return (-1); } @@ -137,7 +137,7 @@ static bool _swap_monsters(monster* mover, monster* moved) // with the main body. if (mons_is_stationary(moved) && moved->type != MONS_KRAKEN_TENTACLE) - return (false); + return false; // If the target monster is constricted it is stuck // and not eligible to be swapped with @@ -146,23 +146,23 @@ static bool _swap_monsters(monster* mover, monster* moved) dprf("%s fails to swap with %s, constricted.", mover->name(DESC_THE).c_str(), moved->name(DESC_THE).c_str()); - return (false); + return false; } // Swapping is a purposeful action. if (mover->confused()) - return (false); + return false; // Right now just happens in sanctuary. if (!is_sanctuary(mover->pos()) || !is_sanctuary(moved->pos())) - return (false); + return false; // A friendly or good-neutral monster moving past a fleeing hostile // or neutral monster, or vice versa. if (mover->wont_attack() == moved->wont_attack() || mons_is_retreating(mover) == mons_is_retreating(moved)) { - return (false); + return false; } // Don't swap places if the player explicitly ordered their pet to @@ -170,13 +170,13 @@ static bool _swap_monsters(monster* mover, monster* moved) if ((mover->friendly() || moved->friendly()) && you.pet_target != MHITYOU && you.pet_target != MHITNOT) { - return (false); + return false; } if (!mover->can_pass_through(moved->pos()) || !moved->can_pass_through(mover->pos())) { - return (false); + return false; } if (!monster_habitable_grid(mover, grd(moved->pos())) @@ -184,7 +184,7 @@ static bool _swap_monsters(monster* mover, monster* moved) || !monster_habitable_grid(moved, grd(mover->pos())) && !moved->can_cling_to(mover->pos())) { - return (false); + return false; } // Okay, we can do the swap. @@ -209,7 +209,7 @@ static bool _swap_monsters(monster* mover, monster* moved) moved->name(DESC_THE).c_str()); } - return (true); + return true; } static bool _do_mon_spell(monster* mons, bolt &beem) @@ -226,11 +226,11 @@ static bool _do_mon_spell(monster* mons, bolt &beem) mons->flags |= MF_SEEN_RANGED; mmov.reset(); - return (true); + return true; } } - return (false); + return false; } static void _swim_or_move_energy(monster* mon, bool diag = false) @@ -268,15 +268,15 @@ static bool _ranged_allied_monster_in_dir(monster* mon, coord_def p) if (mons_intel(mon) <= I_NORMAL && !mon->wont_attack() && mons_genus(mon->type) != mons_genus(ally->type)) { - return (false); + return false; } if (mons_has_ranged_attack(ally)) - return (true); + return true; } break; } - return (false); + return false; } // Check whether there's a monster of the same type and alignment adjacent @@ -311,10 +311,10 @@ static bool _allied_monster_at(monster* mon, coord_def a, coord_def b, } if (mons_aligned(mon, ally)) - return (true); + return true; } - return (false); + return false; } // Altars as well as branch entrances are considered interesting for @@ -323,7 +323,7 @@ static bool _mon_on_interesting_grid(monster* mon) { // Patrolling shouldn't happen all the time. if (one_chance_in(4)) - return (false); + return false; const dungeon_feature_type feat = grd(mon->pos()); @@ -332,7 +332,7 @@ static bool _mon_on_interesting_grid(monster* mon) // Holy beings will tend to patrol around altars to the good gods. case DNGN_ALTAR_ELYVILON: if (!one_chance_in(3)) - return (false); + return false; // else fall through case DNGN_ALTAR_ZIN: case DNGN_ALTAR_SHINING_ONE: @@ -364,7 +364,7 @@ static bool _mon_on_interesting_grid(monster* mon) return (mons_is_native_in_branch(mon, BRANCH_FOREST)); default: - return (false); + return false; } } @@ -474,10 +474,10 @@ bool mons_can_move_towards_target(const monster* mon) const int altdir = (dir + i + 8) % 8; const coord_def p = mon_compass[altdir] + coord_def(1, 1); if (good_move(p)) - return (true); + return true; } - return (false); + return false; } @@ -738,15 +738,15 @@ static bool _handle_potion(monster* mons, bolt & beem) || mons->inv[MSLOT_POTION] == NON_ITEM || !one_chance_in(3)) { - return (false); + return false; } if (mons_itemuse(mons) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; // Make sure the item actually is a potion. if (mitm[mons->inv[MSLOT_POTION]].base_type != OBJ_POTIONS) - return (false); + return false; bool rc = false; @@ -775,7 +775,7 @@ static bool _handle_potion(monster* mons, bolt & beem) rc = true; } - return (rc); + return rc; } static bool _handle_evoke_equipment(monster* mons, bolt & beem) @@ -785,15 +785,15 @@ static bool _handle_evoke_equipment(monster* mons, bolt & beem) || mons->inv[MSLOT_JEWELLERY] == NON_ITEM || !one_chance_in(3)) { - return (false); + return false; } if (mons_itemuse(mons) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; // Make sure the item actually is a ring or amulet. if (mitm[mons->inv[MSLOT_JEWELLERY]].base_type != OBJ_JEWELLERY) - return (false); + return false; bool rc = false; @@ -818,7 +818,7 @@ static bool _handle_evoke_equipment(monster* mons, bolt & beem) rc = true; } - return (rc); + return rc; } static bool _handle_reaching(monster* mons) @@ -828,18 +828,18 @@ static bool _handle_reaching(monster* mons) actor *foe = mons->get_foe(); if (!foe || range <= REACH_NONE) - return (false); + return false; if (mons->submerged()) - return (false); + return false; if (mons_aligned(mons, foe)) - return (false); + return false; // Greatly lowered chances if the monster is fleeing or pacified and // leaving the level. if ((mons_is_fleeing(mons) || mons->pacified()) && !one_chance_in(8)) - return (false); + return false; const coord_def foepos(foe->pos()); const coord_def delta(foepos - mons->pos()); @@ -878,7 +878,7 @@ static bool _handle_reaching(monster* mons) } } - return (ret); + return ret; } //--------------------------------------------------------------- @@ -898,18 +898,18 @@ static bool _handle_scroll(monster* mons) || mons->inv[MSLOT_SCROLL] == NON_ITEM || !one_chance_in(3)) { - return (false); + return false; } if (mons_itemuse(mons) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; if (silenced(mons->pos())) - return (false); + return false; // Make sure the item actually is a scroll. if (mitm[mons->inv[MSLOT_SCROLL]].base_type != OBJ_SCROLLS) - return (false); + return false; bool read = false; item_type_id_state_type ident = ID_UNKNOWN_TYPE; @@ -1070,7 +1070,7 @@ static bool _rod_fired_post(monster* mons, item_def &rod, int idx, bolt &beem, } mons->lose_energy(EUT_ITEM); - return (true); + return true; } static bool _get_rod_spell_and_cost(const item_def& rod, spell_type& spell, @@ -1095,7 +1095,7 @@ static bool _get_rod_spell_and_cost(const item_def& rod, spell_type& spell, break; } - return (success); + return success; } // handle_rod @@ -1123,7 +1123,7 @@ static bool _handle_rod(monster *mons, bolt &beem) int rate = 0; if (!_get_rod_spell_and_cost(rod, mzap, rate)) - return (false); + return false; // XXX: There should be a better way to do this than hardcoding // monster-castable rod spells! @@ -1144,13 +1144,13 @@ static bool _handle_rod(monster *mons, bolt &beem) case SPELL_STRIKING: case SPELL_FIREBALL: if (mons->foe_distance() < 2) - return (false); + return false; break; case SPELL_FREEZING_CLOUD: case SPELL_POISONOUS_CLOUD: if (mons->foe_distance() <= 2) - return (false); + return false; break; case SPELL_SMITING: @@ -1166,10 +1166,10 @@ static bool _handle_rod(monster *mons, bolt &beem) _rod_fired_pre(mons, nice_spell); mons_cast(mons, beem, mzap, false); _rod_fired_post(mons, rod, weapon, beem, rate, was_visible); - return (true); + return true; default: - return (false); + return false; } bool zap = false; @@ -1186,7 +1186,7 @@ static bool _handle_rod(monster *mons, bolt &beem) { beem.target = dgn_random_point_from(mons->pos(), LOS_RADIUS); if (beem.target.origin()) - return (false); + return false; zap = true; } else if (!nice_spell) @@ -1199,7 +1199,7 @@ static bool _handle_rod(monster *mons, bolt &beem) { actor* foe = mons->get_foe(); if (!foe) - return (false); + return false; _rod_fired_pre(mons, nice_spell); direct_effect(mons, mzap, beem, foe); return (_rod_fired_post(mons, rod, weapon, beem, rate, was_visible)); @@ -1212,7 +1212,7 @@ static bool _handle_rod(monster *mons, bolt &beem) return (_rod_fired_post(mons, rod, weapon, beem, rate, was_visible)); } - return (false); + return false; } //--------------------------------------------------------------- @@ -1233,11 +1233,11 @@ static bool _handle_wand(monster* mons, bolt &beem) || mons->has_ench(ENCH_SUBMERGED) || coinflip()) { - return (false); + return false; } if (mons_itemuse(mons) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; if (mons->inv[MSLOT_WEAPON] != NON_ITEM && mitm[mons->inv[MSLOT_WEAPON]].base_type == OBJ_RODS) @@ -1248,12 +1248,12 @@ static bool _handle_wand(monster* mons, bolt &beem) if (mons->inv[MSLOT_WAND] == NON_ITEM || mitm[mons->inv[MSLOT_WAND]].plus <= 0) { - return (false); + return false; } // Make sure the item actually is a wand. if (mitm[mons->inv[MSLOT_WAND]].base_type != OBJ_WANDS) - return (false); + return false; bool niceWand = false; bool zap = false; @@ -1264,7 +1264,7 @@ static bool _handle_wand(monster* mons, bolt &beem) // map wand type to monster spell type const spell_type mzap = _map_wand_to_mspell(wand.sub_type); if (mzap == SPELL_NO_SPELL) - return (false); + return false; // set up the beam int power = 30 + mons->hit_dice; @@ -1287,13 +1287,13 @@ static bool _handle_wand(monster* mons, bolt &beem) case WAND_DIGGING: case WAND_RANDOM_EFFECTS: // These have been deemed "too tricky" at this time {dlb}: - return (false); + return false; case WAND_POLYMORPH_OTHER: // Monsters can be very trigger happy with wands, reduce this // for polymorph. if (!one_chance_in(5)) - return (false); + return false; break; // These are wands that monsters will aim at themselves {dlb}: @@ -1304,7 +1304,7 @@ static bool _handle_wand(monster* mons, bolt &beem) niceWand = true; break; } - return (false); + return false; case WAND_HEAL_WOUNDS: if (mons->hit_points <= mons->max_hit_points / 2) @@ -1313,7 +1313,7 @@ static bool _handle_wand(monster* mons, bolt &beem) niceWand = true; break; } - return (false); + return false; case WAND_INVISIBILITY: if (!mons->has_ench(ENCH_INVIS) @@ -1325,7 +1325,7 @@ static bool _handle_wand(monster* mons, bolt &beem) niceWand = true; break; } - return (false); + return false; case WAND_TELEPORTATION: if (mons->hit_points <= mons->max_hit_points / 2 @@ -1341,14 +1341,14 @@ static bool _handle_wand(monster* mons, bolt &beem) // This break causes the wand to be tried on the player. break; } - return (false); + return false; } if (mons->confused()) { beem.target = dgn_random_point_from(mons->pos(), LOS_RADIUS); if (beem.target.origin()) - return (false); + return false; zap = true; } else if (!niceWand) @@ -1398,10 +1398,10 @@ static bool _handle_wand(monster* mons, bolt &beem) mons->lose_energy(EUT_ITEM); - return (true); + return true; } - return (false); + return false; } static bool _mons_has_launcher(const monster* mons) @@ -1411,10 +1411,10 @@ static bool _mons_has_launcher(const monster* mons) if (item_def *item = mons->mslot_item(static_cast<mon_inv_type>(i))) { if (is_range_weapon(*item)) - return (true); + return true; } } - return (false); + return false; } //--------------------------------------------------------------- @@ -1431,26 +1431,26 @@ static bool _handle_throw(monster* mons, bolt & beem) if (mons->incapacitated() || mons->submerged()) { - return (false); + return false; } if (mons_itemuse(mons) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; const bool archer = mons->is_archer(); // Highly-specialised archers are more likely to shoot than talk. (?) if (one_chance_in(archer ? 9 : 5)) - return (false); + return false; // Don't allow offscreen throwing for now. if (mons->foe == MHITYOU && !mons_near(mons)) - return (false); + return false; // Monsters won't shoot in melee range, largely for balance reasons. // Specialist archers are an exception to this rule. if (!archer && adjacent(beem.target, mons->pos())) - return (false); + return false; // If the monster is a spellcaster, don't bother throwing stuff. // Exception: Spellcasters that already start out with some kind @@ -1460,7 +1460,7 @@ static bool _handle_throw(monster* mons, bolt & beem) if (mons_has_ranged_spell(mons, true, false) && !_mons_has_launcher(mons)) { - return (false); + return false; } // Greatly lowered chances if the monster is fleeing or pacified and @@ -1468,7 +1468,7 @@ static bool _handle_throw(monster* mons, bolt & beem) if ((mons_is_fleeing(mons) || mons->pacified()) && !one_chance_in(8)) { - return (false); + return false; } item_def *launcher = NULL; @@ -1476,10 +1476,10 @@ static bool _handle_throw(monster* mons, bolt & beem) const int mon_item = mons_pick_best_missile(mons, &launcher); if (mon_item == NON_ITEM || !mitm[mon_item].defined()) - return (false); + return false; if (player_or_mon_in_sanct(mons)) - return (false); + return false; item_def *missile = &mitm[mon_item]; @@ -1491,11 +1491,11 @@ static bool _handle_throw(monster* mons, bolt & beem) // Throwing a net at a target that is already caught would be // completely useless, so bail out. if (act->caught()) - return (false); + return false; // Netting targets that are already permanently stuck in place // is similarly useless. if (mons_class_is_stationary(act->type)) - return (false); + return false; } // If the attack needs a launcher that we can't wield, bail out. @@ -1503,7 +1503,7 @@ static bool _handle_throw(monster* mons, bolt & beem) { weapon = mons->mslot_item(MSLOT_WEAPON); if (weapon && weapon != launcher && weapon->cursed()) - return (false); + return false; } // Ok, we'll try it. @@ -1534,7 +1534,7 @@ static bool _handle_throw(monster* mons, bolt & beem) return (mons_throw(mons, beem, mon_item)); } - return (false); + return false; } // Give the monster its action energy (aka speed_increment). @@ -2192,11 +2192,11 @@ void handle_monsters(bool with_noise) static bool _jelly_divide(monster* parent) { if (!mons_class_flag(parent->type, M_SPLITS)) - return (false); + return false; const int reqd = std::max(parent->hit_dice * 8, 50); if (parent->hit_points < reqd) - return (false); + return false; monster* child = NULL; coord_def child_spot; @@ -2209,12 +2209,12 @@ static bool _jelly_divide(monster* parent) child_spot = *ai; if (num_spots == 0) - return (false); + return false; // Now that we have a spot, find a monster slot {dlb}: child = get_free_monster(); if (!child) - return (false); + return false; // Handle impact of split on parent {dlb}: parent->max_hit_points /= 2; @@ -2243,22 +2243,22 @@ static bool _jelly_divide(monster* parent) if (crawl_state.game_is_arena()) arena_placed_monster(child); - return (true); + return true; } // XXX: This function assumes that only jellies eat items. static bool _monster_eat_item(monster* mons, bool nearby) { if (!mons_eats_items(mons)) - return (false); + return false; // Friendly jellies won't eat (unless worshipping Jiyva). if (mons->friendly() && you.religion != GOD_JIYVA) - return (false); + return false; // Off-limit squares are off-limit. if (testbits(env.pgrid(mons->pos()), FPROP_NO_JIYVA)) - return (false); + return false; int hps_changed = 0; // Zotdef jellies are toned down slightly @@ -2384,7 +2384,7 @@ static bool _monster_eat_single_corpse(monster* mons, item_def& item, bool do_heal, bool nearby) { if (item.base_type != OBJ_CORPSES || item.sub_type != CORPSE_BODY) - return (false); + return false; const monster_type mt = item.mon_type; if (do_heal) @@ -2406,13 +2406,13 @@ static bool _monster_eat_single_corpse(monster* mons, item_def& item, // Butcher the corpse without leaving chunks. butcher_corpse(item, B_MAYBE, false); - return (true); + return true; } static bool _monster_eat_corpse(monster* mons, bool do_heal, bool nearby) { if (!mons_eats_corpses(mons)) - return (false); + return false; int eaten = 0; @@ -2432,10 +2432,10 @@ static bool _monster_eat_corpse(monster* mons, bool do_heal, bool nearby) static bool _monster_eat_honey(monster* mons, bool nearby) { if (!mons_eats_honey(mons)) - return (false); + return false; if (mons_is_fleeing(mons)) - return (false); + return false; for (stack_iterator si(mons->pos()); si; ++si) { @@ -2468,19 +2468,19 @@ static bool _monster_eat_honey(monster* mons, bool nearby) old_name_the.c_str(), mons->name(DESC_A).c_str()); } - return (true); + return true; } - return (false); + return false; } static bool _monster_eat_food(monster* mons, bool nearby) { if (!mons_eats_food(mons)) - return (false); + return false; if (mons_is_fleeing(mons)) - return (false); + return false; int eaten = 0; @@ -2537,7 +2537,7 @@ static bool _monster_eat_food(monster* mons, bool nearby) static bool _handle_pickup(monster* mons) { if (mons->asleep() || mons->submerged()) - return (false); + return false; // Hack - Harpies fly over water, but we don't have a general // system for monster igrd yet. Flying intelligent monsters @@ -2545,7 +2545,7 @@ static bool _handle_pickup(monster* mons) dungeon_feature_type feat = grd(mons->pos()); if ((feat == DNGN_LAVA || feat == DNGN_DEEP_WATER) && !mons->flight_mode()) - return (false); + return false; const bool nearby = mons_near(mons); int count_pickup = 0; @@ -2555,7 +2555,7 @@ static bool _handle_pickup(monster* mons) if (mons_eats_items(mons)) { if (_monster_eat_item(mons, nearby)) - return (false); + return false; } else if (mons_eats_corpses(mons)) { @@ -2563,18 +2563,18 @@ static bool _handle_pickup(monster* mons) if (_monster_eat_corpse(mons, mons->holiness() == MH_UNDEAD, nearby)) { - return (false); + return false; } } else if (mons_eats_honey(mons)) { if (_monster_eat_honey(mons, nearby)) - return (false); + return false; } else if (mons_eats_food(mons)) { if (_monster_eat_food(mons, nearby)) - return (false); + return false; } } @@ -2612,7 +2612,7 @@ static int _estimated_trap_damage(trap_type trap) case TRAP_SPEAR: return (random2(10)); case TRAP_BOLT: return (random2(13)); case TRAP_GAS: return (random2(50)); - default: return (0); + default: return 0; } } @@ -2627,22 +2627,22 @@ static bool _is_trap_safe(const monster* mons, const coord_def& where, const trap_def *ptrap = find_trap(where); if (!ptrap) - return (true); + return true; const trap_def& trap = *ptrap; const bool player_knows_trap = (trap.is_known(&you)); // No friendly monsters will ever enter a Zot trap you know. if (player_knows_trap && mons->friendly() && trap.type == TRAP_ZOT) - return (false); + return false; // Dumb monsters don't care at all. if (intel == I_PLANT) - return (true); + return true; // Known shafts are safe. Unknown ones are unknown. if (trap.type == TRAP_SHAFT) - return (true); + return true; // Hostile monsters are not afraid of non-mechanical traps. // Allies will try to avoid teleportation and zot traps. @@ -2651,7 +2651,7 @@ static bool _is_trap_safe(const monster* mons, const coord_def& where, if (trap.is_known(mons)) { if (just_check) - return (false); // Square is blocked. + return false; // Square is blocked. else { // Test for corridor-like environment. @@ -2682,7 +2682,7 @@ static bool _is_trap_safe(const monster* mons, const coord_def& where, && (mon_can_move_to_pos(mons, coord_def(x,y-1), true) || mon_can_move_to_pos(mons, coord_def(x,y+1), true))) { - return (false); + return false; } } } @@ -2691,7 +2691,7 @@ static bool _is_trap_safe(const monster* mons, const coord_def& where, if (intelligent_ally(mons) && trap.type == TRAP_TELEPORT && player_knows_trap && mons_near(mons)) { - return (false); + return false; } // Healthy monsters don't mind a little pain. @@ -2699,12 +2699,12 @@ static bool _is_trap_safe(const monster* mons, const coord_def& where, && (intel == I_ANIMAL || mons->hit_points > _estimated_trap_damage(trap.type))) { - return (true); + return true; } // In Zotdef critters will risk death to get to the Orb if (crawl_state.game_is_zotdef() && mechanical) - return (true); + return true; // Friendly and good neutral monsters don't enjoy Zot trap perks; // handle accordingly. In the arena Zot traps affect all monsters. @@ -2781,28 +2781,28 @@ static bool _no_habitable_adjacent_grids(const monster* mon) { for (adjacent_iterator ai(mon->pos()); ai; ++ai) if (monster_habitable_grid(mon, grd(*ai))) - return (false); + return false; - return (true); + return true; } static bool _same_kraken_parts(const monster* mpusher, const monster* mpushee) { if (mons_base_type(mpusher) != MONS_KRAKEN) - return (false); + return false; if (mpushee->type == MONS_KRAKEN_TENTACLE && int(mpushee->number) == mpusher->mindex()) { - return (true); + return true; } if (mpushee->type == MONS_KRAKEN_TENTACLE_SEGMENT && int(menv[mpushee->number].number) == mpusher->mindex() && mpushee->props.exists("inwards") && mpushee->props["inwards"].get_int() == mpusher->mindex()) { - return (true); + return true; } return false; @@ -2812,17 +2812,17 @@ static bool _mons_can_displace(const monster* mpusher, const monster* mpushee) { if (invalid_monster(mpusher) || invalid_monster(mpushee)) - return (false); + return false; const int ipushee = mpushee->mindex(); if (invalid_monster_index(ipushee)) - return (false); + return false; if (immobile_monster[ipushee] && !_same_kraken_parts(mpusher, mpushee)) { - return (false); + return false; } // Confused monsters can't be pushed past, sleeping monsters @@ -2838,21 +2838,21 @@ static bool _mons_can_displace(const monster* mpusher, || mons_is_stationary(mpushee))) || mpusher->asleep() || mpushee->caught()) { - return (false); + return false; } // Batty monsters are unpushable. if (mons_is_batty(mpusher) || mons_is_batty(mpushee)) - return (false); + return false; if (!monster_shover(mpusher)) - return (false); + return false; // Fleeing monsters of the same type may push past higher ranking ones. if (!monster_senior(mpusher, mpushee, mons_is_retreating(mpusher))) - return (false); + return false; - return (true); + return true; } static int _count_adjacent_slime_walls(const coord_def &pos) @@ -2862,7 +2862,7 @@ static int _count_adjacent_slime_walls(const coord_def &pos) if (env.grid(*ai) == DNGN_SLIMY_WALL) count++; - return (count); + return count; } // Returns true if the monster should try to avoid that position @@ -2873,20 +2873,20 @@ static bool _check_slime_walls(const monster *mon, if (!player_in_branch(BRANCH_SLIME_PITS) || mons_is_slime(mon) || mon->res_acid() >= 3 || mons_intel(mon) <= I_INSECT) { - return (false); + return false; } const int target_count = _count_adjacent_slime_walls(targ); // Entirely safe. if (!target_count) - return (false); + return false; const int current_count = _count_adjacent_slime_walls(mon->pos()); if (target_count <= current_count) - return (false); + return false; // The monster needs to have a purpose to risk taking damage. if (!mons_is_seeking(mon)) - return (true); + return true; // With enough hit points monsters will consider moving // onto more dangerous squares. @@ -2902,11 +2902,11 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, // Bounds check: don't consider moving out of grid! if (!in_bounds(targ)) - return (false); + return false; // No monster may enter the open sea. if (grd(targ) == DNGN_OPEN_SEA || grd(targ) == DNGN_LAVA_SEA) - return (false); + return false; // Non-friendly and non-good neutral monsters won't enter // sanctuaries. @@ -2914,12 +2914,12 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, && is_sanctuary(targ) && !is_sanctuary(mons->pos())) { - return (false); + return false; } // Inside a sanctuary don't attack anything! if (is_sanctuary(mons->pos()) && actor_at(targ)) - return (false); + return false; const dungeon_feature_type target_grid = grd(targ); const habitat_type habitat = mons_primary_habitat(mons); @@ -2929,17 +2929,17 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, if (mons_base_type(mons) == MONS_KRAKEN && target_grid == DNGN_SHALLOW_WATER) { - return (false); + return false; } bool no_water = false; const int targ_cloud_num = env.cgrid(targ); if (mons_avoids_cloud(mons, targ_cloud_num)) - return (false); + return false; if (_check_slime_walls(mons, targ)) - return (false); + return false; const bool burrows = mons_class_flag(mons->type, M_BURROWS); const bool flattens_trees = mons_flattens_trees(mons); @@ -2949,10 +2949,10 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, { // Don't burrow out of bounds. if (!in_bounds(targ)) - return (false); + return false; } else if (no_water && feat_is_water(target_grid)) - return (false); + return false; else if (!mons_can_traverse(mons, targ, false) && !monster_habitable_grid(mons, target_grid)) { @@ -2961,10 +2961,10 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, if (grd(mons->pos()) == target_grid && mons->ground_level() && _no_habitable_adjacent_grids(mons)) { - return (true); + return true; } - return (false); + return false; } // Wandering mushrooms usually don't move while you are looking. @@ -2973,20 +2973,20 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, if (!mons->wont_attack() && is_sanctuary(mons->pos())) { - return (true); + return true; } if (!mons->friendly() && you.see_cell(targ) || mon_enemies_around(mons)) { - return (false); + return false; } } // Fire elementals avoid water and cold. if (mons->type == MONS_FIRE_ELEMENTAL && feat_is_watery(target_grid)) - return (false); + return false; // Submerged water creatures avoid the shallows where // they would be forced to surface. -- bwr @@ -2999,7 +2999,7 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, && grd(mons->pos()) == DNGN_DEEP_WATER && mons->hit_points < (mons->max_hit_points * 3) / 4) { - return (false); + return false; } // Smacking the player is always a good move if we're @@ -3014,15 +3014,15 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, if (just_check) { if (targ == mons->pos()) - return (true); + return true; - return (false); // blocks square + return false; // blocks square } // Cut down plants only when no alternative, or they're // our target. if (mons_is_firewood(targmonster) && mons->target != targ) - return (false); + return false; if (mons_aligned(mons, targmonster) && !_mons_can_displace(mons, targmonster)) @@ -3034,11 +3034,11 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, if (!mons_is_stationary(targmonster) || targmonster->attitude != ATT_HOSTILE) { - return (false); + return false; } } else - return (false); + return false; } } @@ -3049,16 +3049,16 @@ bool mon_can_move_to_pos(const monster* mons, const coord_def& delta, && (mons->foe != MHITNOT || mons->is_patrolling()) && targ == you.pos()) { - return (false); + return false; } // Wandering through a trap is OK if we're pretty healthy, // really stupid, or immune to the trap. if (!_is_trap_safe(mons, targ, just_check)) - return (false); + return false; // If we end up here the monster can safely move. - return (true); + return true; } // Uses, and updates the global variable mmov. @@ -3154,15 +3154,15 @@ static void _jelly_grows(monster* mons) static bool _monster_swaps_places(monster* mon, const coord_def& delta) { if (delta.origin()) - return (false); + return false; monster* const m2 = monster_at(mon->pos() + delta); if (!m2) - return (false); + return false; if (!_mons_can_displace(mon, m2)) - return (false); + return false; if (m2->asleep()) { @@ -3172,7 +3172,7 @@ static bool _monster_swaps_places(monster* mon, const coord_def& delta) m2->name(DESC_PLAIN).c_str(), m2->pos().x, m2->pos().y); behaviour_event(m2, ME_ALERT); } - return (false); + return false; } // Check that both monsters will be happy at their proposed new locations. @@ -3182,7 +3182,7 @@ static bool _monster_swaps_places(monster* mon, const coord_def& delta) if (!monster_habitable_grid(mon, grd(n)) && !mon->can_cling_to(n) || !monster_habitable_grid(m2, grd(c)) && !m2->can_cling_to(c)) { - return (false); + return false; } // Okay, do the swap! @@ -3220,7 +3220,7 @@ static bool _monster_swaps_places(monster* mon, const coord_def& delta) mon->seen_context = SC_NONE; m2->seen_context = SC_NONE; - return (false); + return false; } static bool _do_move_monster(monster* mons, const coord_def& delta) @@ -3228,19 +3228,19 @@ static bool _do_move_monster(monster* mons, const coord_def& delta) const coord_def f = mons->pos() + delta; if (!in_bounds(f)) - return (false); + return false; if (f == you.pos()) { fight_melee(mons, &you); - return (true); + return true; } // This includes the case where the monster attacks itself. if (monster* def = monster_at(f)) { fight_melee(mons, def); - return (true); + return true; } if (mons->is_constricted()) @@ -3258,7 +3258,7 @@ static bool _do_move_monster(monster* mons, const coord_def& delta) if (mons_can_open_door(mons, f)) { _mons_open_door(mons, f); - return (true); + return true; } else if (mons_can_eat_door(mons, f)) { @@ -3327,7 +3327,7 @@ static bool _do_move_monster(monster* mons, const coord_def& delta) mons->check_redraw(mons->pos() - delta); mons->apply_location_effects(mons->pos() - delta); - return (true); + return true; } // May mons attack targ if it's in its way, despite @@ -3368,7 +3368,7 @@ static bool _monster_move(monster* mons) if (mons->type == MONS_TRAPDOOR_SPIDER) { if (mons->submerged()) - return (false); + return false; // Trapdoor spiders hide if they can't see their foe. // (Note that friendly trapdoor spiders will thus hide even @@ -3383,7 +3383,7 @@ static bool _monster_move(monster* mons) { mons->add_ench(ENCH_SUBMERGED); mons->behaviour = BEH_LURK; - return (false); + return false; } } @@ -3424,7 +3424,7 @@ static bool _monster_move(monster* mons) return _do_move_monster(mons, mmov); } } - return (false); + return false; } // If a water monster is currently flopping around on land, it cannot @@ -3446,7 +3446,7 @@ static bool _monster_move(monster* mons) if (adj_move.empty()) { simple_monster_message(mons, " flops around on dry land!"); - return (false); + return false; } std::vector<coord_def> moves = adj_water; @@ -3464,7 +3464,7 @@ static bool _monster_move(monster* mons) || (mon2 && mons->wont_attack() == mon2->wont_attack())) { simple_monster_message(mons, " flops around on dry land!"); - return (false); + return false; } return _do_move_monster(mons, newpos - mons->pos()); @@ -3472,7 +3472,7 @@ static bool _monster_move(monster* mons) // Let's not even bother with this if mmov is zero. if (mmov.origin()) - return (false); + return false; for (int count_x = 0; count_x < 3; count_x++) for (int count_y = 0; count_y < 3; count_y++) @@ -3636,7 +3636,7 @@ static bool _monster_move(monster* mons) // The monster could die after a melee attack due to a mummy // death curse or something. if (!mons->alive()) - return (true); + return true; if (mons_genus(mons->type) == MONS_EFREET || mons->type == MONS_FIRE_ELEMENTAL) @@ -3693,7 +3693,7 @@ static bool _monster_move(monster* mons) mons->firing_pos.reset(); } - return (ret); + return ret; } static void _mons_in_cloud(monster* mons) diff --git a/crawl-ref/source/mon-behv.cc b/crawl-ref/source/mon-behv.cc index b0cd34dea2..dfab7cc379 100644 --- a/crawl-ref/source/mon-behv.cc +++ b/crawl-ref/source/mon-behv.cc @@ -812,14 +812,14 @@ static bool _mons_check_foe(monster* mon, const coord_def& p, bool friendly, bool neutral) { if (!in_bounds(p)) - return (false); + return false; if (p == you.pos()) { // The player: We don't return true here because // otherwise wandering monsters will always // attack the player. - return (false); + return false; } if (monster* foe = monster_at(p)) @@ -833,10 +833,10 @@ static bool _mons_check_foe(monster* mon, const coord_def& p, && (crawl_state.game_is_zotdef() || !mons_is_firewood(foe))) // Zotdef allies take out firewood { - return (true); + return true; } } - return (false); + return false; } // Choose random nearest monster as a foe. diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index 089c527e96..638159d719 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -90,7 +90,7 @@ void init_mons_spells() bool is_valid_mon_spell(spell_type spell) { if (spell < 0 || spell >= NUM_SPELLS) - return (false); + return false; return (_valid_mon_spells[spell]); } @@ -146,7 +146,7 @@ static spell_type _draco_type_to_breath(int drac_type) break; } - return (SPELL_DRACONIAN_BREATH); + return SPELL_DRACONIAN_BREATH; } static bool _flavour_benefits_monster(beam_type flavour, monster& monster) @@ -218,11 +218,11 @@ static bool _set_allied_target(monster* caster, bolt & pbolt) if (selected_target) { pbolt.target = selected_target->pos(); - return (true); + return true; } // Didn't find a target - return (false); + return false; } bolt mons_spells(monster* mons, spell_type spell_cast, int power, @@ -950,7 +950,7 @@ bolt mons_spells(monster* mons, spell_type spell_cast, int power, if (check_validity) { beam.flavour = NUM_BEAMS; - return (beam); + return beam; } if (!is_valid_spell(real_spell)) @@ -961,7 +961,7 @@ bolt mons_spells(monster* mons, spell_type spell_cast, int power, spell_title(real_spell), mons->name(DESC_PLAIN, true).c_str()); - return (beam); + return beam; } if (beam.is_enchantment()) @@ -997,7 +997,7 @@ bolt mons_spells(monster* mons, spell_type spell_cast, int power, } } - return (beam); + return beam; } static bool _los_free_spell(spell_type spell_cast) @@ -1052,7 +1052,7 @@ bool setup_mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, case SPELL_SACRIFICE: case SPELL_AIRSTRIKE: case SPELL_HOLY_FLAMES: - return (true); + return true; default: // Other spells get normal setup: break; @@ -1137,7 +1137,7 @@ bool setup_mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, case SPELL_DEATHS_DOOR: case SPELL_OZOCUBUS_ARMOUR: case SPELL_OZOCUBUS_REFRIGERATION: - return (true); + return true; default: if (check_validity) { @@ -1222,7 +1222,7 @@ bool setup_mons_cast(monster* mons, bolt &pbolt, spell_type spell_cast, } // else target remains as specified } - return (true); + return true; } // Returns a suitable breath weapon for the draconian; does not handle all @@ -1259,7 +1259,7 @@ static spell_type _get_draconian_breath_spell(monster* mons) draco_breath = SPELL_NO_SPELL; } - return (draco_breath); + return draco_breath; } static bool _is_emergency_spell(const monster_spells &msp, int spell) @@ -1268,7 +1268,7 @@ static bool _is_emergency_spell(const monster_spells &msp, int spell) // escape spell. for (int i = 0; i < 5; ++i) if (msp[i] == spell) - return (false); + return false; return (msp[5] == spell); } @@ -1281,18 +1281,18 @@ static bool _animate_dead_okay(spell_type spell) { // It's always okay in the arena. if (crawl_state.game_is_arena()) - return (true); + return true; if (is_butchering() || is_vampire_feeding()) - return (false); + return false; if (you.hunger_state < HS_SATIATED && you.mutation[MUT_HERBIVOROUS] < 3) - return (false); + return false; if (god_hates_spell(spell, you.religion)) - return (false); + return false; - return (true); + return true; } // Spells that work even if magic is off. Be careful to not add ones which @@ -1330,16 +1330,16 @@ static bool _foe_should_res_negative_energy(const actor* foe) && you.is_undead == US_SEMI_UNDEAD && you.hunger_state > HS_STARVING) { - return (false); + return false; } // Demonspawn do not appear immune. if (holiness == MH_DEMONIC) - return (false); + return false; // Nor do statues (they only have partial resistance). if (you.form == TRAN_STATUE) - return (false); + return false; } return (holiness != MH_NATURAL); @@ -1356,20 +1356,20 @@ static bool _ms_waste_of_time(const monster* mon, spell_type monspell) && (!foe || foe->is_player()) && spell_typematch(monspell, SPTYP_SUMMONING)) { - return (true); + return true; } if (!mon->wont_attack()) { if (spell_harms_area(monspell) && env.sanctuary_time > 0) - return (true); + return true; if (spell_harms_target(monspell) && is_sanctuary(mon->target)) - return (true); + return true; } if (mons_genus(mon->type) == MONS_DRAGON && mon->has_ench(ENCH_BREATH_WEAPON)) - return (true); + return true; // Eventually, we'll probably want to be able to have monsters // learn which of their elemental bolts were resisted and have those @@ -1602,7 +1602,7 @@ static bool _ms_waste_of_time(const monster* mon, spell_type monspell) break; } - return (ret); + return ret; } // Spells a monster may want to cast if fleeing from the player, and @@ -1611,7 +1611,7 @@ static bool _ms_useful_fleeing_out_of_sight(const monster* mon, spell_type monspell) { if (monspell == SPELL_NO_SPELL || _ms_waste_of_time(mon, monspell)) - return (false); + return false; switch (monspell) { @@ -1622,21 +1622,21 @@ static bool _ms_useful_fleeing_out_of_sight(const monster* mon, case SPELL_MAJOR_HEALING: case SPELL_ANIMATE_DEAD: case SPELL_TWISTED_RESURRECTION: - return (true); + return true; default: if (spell_typematch(monspell, SPTYP_SUMMONING) && one_chance_in(4)) - return (true); + return true; break; } - return (false); + return false; } static bool _ms_low_hitpoint_cast(const monster* mon, spell_type monspell) { if (_ms_waste_of_time(mon, monspell)) - return (false); + return false; bool targ_adj = false; bool targ_sanct = false; @@ -1723,12 +1723,12 @@ static bool _ms_quick_get_away(const monster* mon, spell_type monspell) case SPELL_TELEPORT_SELF: // Don't cast again if already about to teleport. if (mon->has_ench(ENCH_TP)) - return (false); + return false; // intentional fall-through case SPELL_BLINK: - return (true); + return true; default: - return (false); + return false; } } @@ -1778,7 +1778,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) && mons->has_spells()); if (is_sanctuary(mons->pos()) && !mons->wont_attack()) - return (false); + return false; // Yes, there is a logic to this ordering {dlb}: // .. berserk check is necessary for out-of-sequence actions like emergency @@ -1790,7 +1790,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) && !spellcasting_poly && draco_breath == SPELL_NO_SPELL)) { - return (false); + return false; } bool priest; @@ -1803,26 +1803,26 @@ bool handle_mon_spell(monster* mons, bolt &beem) && (priest || wizard || spellcasting_poly || mons_class_flag(mons->type, M_SPELL_NO_SILENT))) { - return (false); + return false; } // Shapeshifters don't get spells. if (mons->is_shapeshifter() && (priest || wizard)) - return (false); + return false; else if (mons_is_confused(mons, false)) - return (false); + return false; else if (mons_is_ghost_demon(mons->type) && !mons->ghost->spellcaster) { - return (false); + return false; } else if (random2(200) > mons->hit_dice + 50 || mons->type == MONS_BALL_LIGHTNING && coinflip()) { - return (false); + return false; } else if (spellcasting_poly && coinflip()) // 50% chance of not casting - return (false); + return false; else { spell_type spell_cast = SPELL_NO_SPELL; @@ -1867,7 +1867,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) } } else if (mons->foe == MHITYOU && !monsterNearby) - return (false); + return false; } // Monsters caught in a net try to get away. @@ -1925,7 +1925,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) if (mons->wont_attack() && !mon_enemies_around(mons) && !one_chance_in(10)) { - return (false); + return false; } // Remove healing/invis/haste if we don't need them. @@ -1949,7 +1949,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) if (num_no_spell == NUM_MONSTER_SPELL_SLOTS && draco_breath == SPELL_NO_SPELL) { - return (false); + return false; } const bolt orig_beem = beem; @@ -2152,12 +2152,12 @@ bool handle_mon_spell(monster* mons, bolt &beem) // Should the monster *still* not have a spell, well, too bad {dlb}: if (spell_cast == SPELL_NO_SPELL || spell_cast == SPELL_MELEE) - return (false); + return false; // Friendly monsters don't use polymorph other, for fear of harming // the player. if (spell_cast == SPELL_POLYMORPH_OTHER && mons->friendly()) - return (false); + return false; // Past this point, we're actually casting, instead of just pondering. @@ -2173,52 +2173,52 @@ bool handle_mon_spell(monster* mons, bolt &beem) // lose a turn like players do not, please make this just return. simple_monster_message(mons, " falters for a moment."); mons->lose_energy(EUT_SPELL); - return (true); + return true; } // Try to animate dead: if nothing rises, pretend we didn't cast it. else if (spell_cast == SPELL_ANIMATE_DEAD) { if (mons->friendly() && !_animate_dead_okay(spell_cast)) - return (false); + return false; if (!animate_dead(mons, 100, SAME_ATTITUDE(mons), mons->foe, mons, "", god, false)) { - return (false); + return false; } } // Try to raise crawling corpses: if nothing rises, pretend we didn't cast it. else if (spell_cast == SPELL_TWISTED_RESURRECTION) { if (mons->friendly() && !_animate_dead_okay(spell_cast)) - return (false); + return false; if (!twisted_resurrection(mons, 500, SAME_ATTITUDE(mons), mons->foe, god, false)) { - return (false); + return false; } } // Ditto for simulacrum. else if (spell_cast == SPELL_SIMULACRUM) { if (mons->friendly() && !_animate_dead_okay(spell_cast)) - return (false); + return false; if (!monster_simulacrum(mons, false)) - return (false); + return false; } // Try to cause fear: if nothing is scared, pretend we didn't cast it. else if (spell_cast == SPELL_CAUSE_FEAR) { if (_mons_cause_fear(mons, false) < 0) - return (false); + return false; } // Try to drain life: if nothing is drained, pretend we didn't cast it. else if (spell_cast == SPELL_DRAIN_LIFE) { if (!_mons_drain_life(mons, false)) - return (false); + return false; } // Try to use Ozocubu's Refrigeration; if nothing happened, // pretend we didn't cast it. @@ -2250,7 +2250,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) mons->lose_energy(EUT_SPELL); } else - return (false); + return false; } else if (spell_cast == SPELL_BLINK_RANGE) { @@ -2277,7 +2277,7 @@ bool handle_mon_spell(monster* mons, bolt &beem) } } // end "if (mons->can_use_spells())" - return (true); + return true; } static int _monster_abjure_square(const coord_def &pos, @@ -2286,18 +2286,18 @@ static int _monster_abjure_square(const coord_def &pos, { monster* target = monster_at(pos); if (target == NULL) - return (0); + return 0; if (!target->alive() || ((bool)wont_attack == target->wont_attack())) { - return (0); + return 0; } int duration; if (!target->is_summoned(&duration)) - return (0); + return 0; pow = std::max(20, fuzz_value(pow, 40, 25)); @@ -2340,10 +2340,10 @@ static int _monster_abjure_square(const coord_def &pos, { if (!shielded) simple_monster_message(target, " shudders."); - return (1); + return 1; } - return (0); + return 0; } static int _apply_radius_around_square(const coord_def &c, int radius, @@ -2370,7 +2370,7 @@ static int _apply_radius_around_square(const coord_def &c, int radius, if (in_bounds(c2)) res += fn(c2, pow, par1, par2); } - return (res); + return res; } static int _monster_abjuration(const monster* caster, bool actual) @@ -2403,7 +2403,7 @@ static int _monster_abjuration(const monster* caster, bool actual) pow /= 2; } - return (maffected); + return maffected; } @@ -2413,10 +2413,10 @@ static bool _mons_abjured(monster* mons, bool nearby) && coinflip()) { _monster_abjuration(mons, true); - return (true); + return true; } - return (false); + return false; } static monster_type _pick_swarmer() @@ -2584,9 +2584,9 @@ static bool _mons_vampiric_drain(monster *mons) { actor *target = mons->get_foe(); if (!target) - return (false); + return false; if (grid_distance(mons->pos(), target->pos()) > 1) - return (false); + return false; int fnum = 5; int fden = 5; @@ -2605,7 +2605,7 @@ static bool _mons_vampiric_drain(monster *mons) simple_monster_message(mons, " is infused with unholy energy, but nothing happens.", MSGCH_MONSTER_SPELL); - return (false); + return false; } dprf("vamp draining: %d damage, %d healing", hp_cost, hp_cost/2); @@ -2643,7 +2643,7 @@ static bool _mons_vampiric_drain(monster *mons) print_wounds(mtarget); } - return (true); + return true; } void setup_breath_timeout(monster* mons) @@ -2714,12 +2714,12 @@ static int _mons_mesmerise(monster* mons, bool actual) if (actual) canned_msg(MSG_YOU_RESIST); - return (0); + return 0; } you.add_beholder(mons); - return (1); + return 1; } // Check whether targets might be scared. @@ -2821,7 +2821,7 @@ static int _mons_cause_fear(monster* mons, bool actual) } } - return (retval); + return retval; } static bool _mons_drain_life(monster* mons, bool actual) @@ -2897,7 +2897,7 @@ static bool _mons_drain_life(monster* mons, bool actual) simple_monster_message(mons, " is healed."); } - return (success); + return success; } static bool _mons_ozocubus_refrigeration(monster* mons, bool actual) @@ -2967,7 +2967,7 @@ static bool _mons_ozocubus_refrigeration(monster* mons, bool actual) } } - return (success); + return success; } static bool _mon_spell_bail_out_early(monster* mons, spell_type spell_cast) @@ -2982,7 +2982,7 @@ static bool _mon_spell_bail_out_early(monster* mons, spell_type spell_cast) case SPELL_SIMULACRUM: // see special handling in mon-stuff::handle_spell() {dlb} if (mons->friendly() && !_animate_dead_okay(spell_cast)) - return (true); + return true; break; case SPELL_CHAIN_LIGHTNING: @@ -2993,7 +2993,7 @@ static bool _mon_spell_bail_out_early(monster* mons, spell_type spell_cast) // friendly holies don't care if you are friendly || (mons->friendly() && spell_cast != SPELL_HOLY_WORD)) { - return (true); + return true; } break; @@ -3001,7 +3001,7 @@ static bool _mon_spell_bail_out_early(monster* mons, spell_type spell_cast) break; } - return (false); + return false; } static void _clone_monster(monster* mons, monster_type clone_type, @@ -4328,7 +4328,7 @@ static std::string _noise_message(const std::vector<std::string>& key_list, break; } - return (msg); + return msg; } static void _noise_fill_target(std::string& targ_prep, std::string& target, diff --git a/crawl-ref/source/mon-clone.cc b/crawl-ref/source/mon-clone.cc index 142825e3c5..5ca4445a50 100644 --- a/crawl-ref/source/mon-clone.cc +++ b/crawl-ref/source/mon-clone.cc @@ -40,7 +40,7 @@ static std::string _monster_clone_id_for(monster* mons) static bool _monster_clone_exists(monster* mons) { if (!mons->props.exists(clone_master_key)) - return (false); + return false; const std::string clone_id = mons->props[clone_master_key].get_string(); for (monster_iterator mi; mi; ++mi) @@ -48,9 +48,9 @@ static bool _monster_clone_exists(monster* mons) monster* thing(*mi); if (thing->props.exists(clone_slave_key) && thing->props[clone_slave_key].get_string() == clone_id) - return (true); + return true; } - return (false); + return false; } static bool _mons_is_illusion(monster* mons) @@ -70,9 +70,9 @@ static bool _player_is_illusion_cloneable() for (monster_iterator mi; mi; ++mi) { if (mi->type == MONS_PLAYER_ILLUSION && mi->mname == you.your_name) - return (false); + return false; } - return (true); + return true; } bool actor_is_illusion_cloneable(actor *target) @@ -219,7 +219,7 @@ bool mons_clonable(const monster* mon, bool needs_adjacent) || mons_is_ghost_demon(mon->type) || mon->is_named()) { - return (false); + return false; } if (needs_adjacent) @@ -239,7 +239,7 @@ bool mons_clonable(const monster* mon, bool needs_adjacent) } } if (!square_found) - return (false); + return false; } // Is the monster carrying an artefact? @@ -251,10 +251,10 @@ bool mons_clonable(const monster* mon, bool needs_adjacent) continue; if (is_artefact(mitm[index])) - return (false); + return false; } - return (true); + return true; } monster* clone_mons(const monster* orig, bool quiet, bool* obvious, diff --git a/crawl-ref/source/mon-death.cc b/crawl-ref/source/mon-death.cc index 8a629a31d2..83e9cfc5e6 100644 --- a/crawl-ref/source/mon-death.cc +++ b/crawl-ref/source/mon-death.cc @@ -705,9 +705,9 @@ monster* get_shedu_pair(const monster* mons) { monster* pair = monster_by_mid(mons->number); if (pair) - return (pair); + return pair; - return (NULL); + return NULL; } /** @@ -721,9 +721,9 @@ monster* get_shedu_pair(const monster* mons) bool shedu_pair_alive(const monster* mons) { if (get_shedu_pair(mons) == NULL) - return (false); + return false; - return (true); + return true; } /** diff --git a/crawl-ref/source/mon-ench.cc b/crawl-ref/source/mon-ench.cc index 055ca46c34..39406814a8 100644 --- a/crawl-ref/source/mon-ench.cc +++ b/crawl-ref/source/mon-ench.cc @@ -66,9 +66,9 @@ bool monster::has_ench(enchant_type ench, enchant_type ench2) const for (int i = ench; i <= ench2; ++i) if (has_ench(static_cast<enchant_type>(i))) - return (true); + return true; - return (false); + return false; } mon_enchant monster::get_ench(enchant_type ench1, @@ -103,12 +103,12 @@ bool monster::add_ench(const mon_enchant &ench) { // silliness if (ench.ench == ENCH_NONE) - return (false); + return false; if (ench.ench == ENCH_FEAR && (holiness() == MH_NONLIVING || berserk())) { - return (false); + return false; } if (ench.ench == ENCH_LEVITATION && has_ench(ENCH_LIQUEFYING)) @@ -140,7 +140,7 @@ bool monster::add_ench(const mon_enchant &ench) if (new_enchantment) add_enchantment_effect(ench); - return (true); + return true; } void monster::add_enchantment_effect(const mon_enchant &ench, bool quiet) @@ -282,7 +282,7 @@ void monster::add_enchantment_effect(const mon_enchant &ench, bool quiet) static bool _prepare_del_ench(monster* mon, const mon_enchant &me) { if (me.ench != ENCH_SUBMERGED) - return (true); + return true; // Lurking monsters only unsubmerge when their foe is in sight if the foe // is right next to them. @@ -292,7 +292,7 @@ static bool _prepare_del_ench(monster* mon, const mon_enchant &me) if (foe != NULL && mon->can_see(foe) && !adjacent(mon->pos(), foe->pos())) { - return (false); + return false; } } @@ -302,7 +302,7 @@ static bool _prepare_del_ench(monster* mon, const mon_enchant &me) mgrd(mon->pos()) = midx; if (mon->pos() != you.pos() && midx == mgrd(mon->pos())) - return (true); + return true; if (midx != mgrd(mon->pos())) { @@ -320,7 +320,7 @@ static bool _prepare_del_ench(monster* mon, const mon_enchant &me) mon->name(DESC_PLAIN, true).c_str()); if (mon->pos() != you.pos()) - return (true); + return true; } else mprf(MSGCH_ERROR, "%s tried to unsubmerge while on same square as " @@ -348,7 +348,7 @@ static bool _prepare_del_ench(monster* mon, const mon_enchant &me) // No available adjacent squares from which the monster could also // have unsubmerged. Can it just stay submerged where it is? if (monster_can_submerge(mon, grd(mon->pos()))) - return (false); + return false; // The terrain changed and the monster can't remain submerged. // Try to move to an adjacent square where it would be happy. @@ -366,26 +366,26 @@ static bool _prepare_del_ench(monster* mon, const mon_enchant &me) if (okay_squares > 0) return (mon->move_to_pos(target_square)); - return (true); + return true; } bool monster::del_ench(enchant_type ench, bool quiet, bool effect) { mon_enchant_list::iterator i = enchantments.find(ench); if (i == enchantments.end()) - return (false); + return false; const mon_enchant me = i->second; const enchant_type et = i->first; if (!_prepare_del_ench(this, me)) - return (false); + return false; enchantments.erase(et); ench_cache.set(et, false); if (effect) remove_enchantment_effect(me, quiet); - return (true); + return true; } void monster::remove_enchantment_effect(const mon_enchant &me, bool quiet) @@ -775,40 +775,40 @@ void monster::remove_enchantment_effect(const mon_enchant &me, bool quiet) bool monster::lose_ench_levels(const mon_enchant &e, int lev) { if (!lev) - return (false); + return false; if (e.degree <= lev) { del_ench(e.ench); - return (true); + return true; } else { mon_enchant newe(e); newe.degree -= lev; update_ench(newe); - return (false); + return false; } } bool monster::lose_ench_duration(const mon_enchant &e, int dur) { if (!dur) - return (false); + return false; if (e.duration >= INFINITE_DURATION) return false; if (e.duration <= dur) { del_ench(e.ench); - return (true); + return true; } else { mon_enchant newe(e); newe.duration -= dur; update_ench(newe); - return (false); + return false; } } @@ -970,17 +970,17 @@ bool monster::decay_enchantment(const mon_enchant &me, bool decay_degree) 10; const int actdur = speed_to_duration(spd); if (lose_ench_duration(me, actdur)) - return (true); + return true; if (!decay_degree) - return (false); + return false; // Decay degree so that higher degrees decay faster than lower // degrees, and a degree of 1 does not decay (it expires when the // duration runs out). const int level = me.degree; if (level <= 1) - return (false); + return false; const int decay_factor = level * (level + 1) / 2; if (me.duration < me.maxduration * (decay_factor - 1) / decay_factor) @@ -992,12 +992,12 @@ bool monster::decay_enchantment(const mon_enchant &me, bool decay_degree) if (newme.degree <= 0) { del_ench(me.ench); - return (true); + return true; } else update_ench(newme); } - return (false); + return false; } void monster::apply_enchantment(const mon_enchant &me) @@ -1688,7 +1688,7 @@ bool monster::is_summoned(int* duration, int* summon_type) const if (summon_type != NULL) *summon_type = 0; - return (false); + return false; } if (duration != NULL) *duration = abj.duration; @@ -1699,13 +1699,13 @@ bool monster::is_summoned(int* duration, int* summon_type) const if (summon_type != NULL) *summon_type = 0; - return (true); + return true; } if (summon_type != NULL) *summon_type = summ.degree; if (mons_is_conjured(type)) - return (false); + return false; switch (summ.degree) { @@ -1726,10 +1726,10 @@ bool monster::is_summoned(int* duration, int* summon_type) const // Some object which was animated, and thus not really summoned. case MON_SUMM_ANIMATE: - return (false); + return false; } - return (true); + return true; } void monster::apply_enchantments() @@ -1868,7 +1868,7 @@ mon_enchant mon_enchant::operator + (const mon_enchant &other) const { mon_enchant tmp(*this); tmp += other; - return (tmp); + return tmp; } killer_type mon_enchant::killer() const @@ -1994,11 +1994,11 @@ int mon_enchant::calc_duration(const monster* mons, case ENCH_PORTAL_PACIFIED: // Must be set by spell. - return (0); + return 0; case ENCH_BREATH_WEAPON: // Must be set by creature. - return (0); + return 0; case ENCH_PORTAL_TIMER: cturn = 30 * 10 / _mod_speed(10, mons->speed); @@ -2051,7 +2051,7 @@ int mon_enchant::calc_duration(const monster* mons, dprf("cturn: %d, raw_duration: %d", cturn, raw_duration); - return (raw_duration); + return raw_duration; } // Calculate the effective duration (in terms of normal player time - 10 diff --git a/crawl-ref/source/mon-gear.cc b/crawl-ref/source/mon-gear.cc index 5dd4d6fc60..1e8722c555 100644 --- a/crawl-ref/source/mon-gear.cc +++ b/crawl-ref/source/mon-gear.cc @@ -266,7 +266,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, break; } else - return (item_race); + return item_race; break; case MONS_HOBGOBLIN: @@ -279,7 +279,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, item.sub_type = WPN_CLUB; } else - return (item_race); + return item_race; break; case MONS_GOBLIN: @@ -301,7 +301,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, item.sub_type = (coinflip() ? WPN_DAGGER : WPN_CLUB); } else - return (item_race); + return item_race; break; case MONS_WIGHT: @@ -494,7 +494,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, 0); } else - return (item_race); + return item_race; break; case MONS_TERENCE: @@ -1322,7 +1322,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, // Only happens if something in above switch doesn't set it. {dlb} if (item.base_type == OBJ_UNASSIGNED) - return (item_race); + return item_race; if (!force_item && mons_is_unique(mon->type)) { @@ -1343,7 +1343,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, level, item_race)); if (thing_created == NON_ITEM) - return (item_race); + return item_race; // Copy temporary item into the item array if were forcing it, since // items() won't have done it for us. @@ -1354,7 +1354,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, if (melee_only && (i.base_type != OBJ_WEAPONS || is_range_weapon(i))) { destroy_item(thing_created); - return (item_race); + return item_race; } if (force_item) @@ -1369,7 +1369,7 @@ static item_make_species_type _give_weapon(monster* mon, int level, _give_weapon(mon, level, true, false); } - return (item_race); + return item_race; } // Hands out ammunition fitting the monster's launcher (if any), or else any @@ -1585,16 +1585,16 @@ static bool make_item_for_monster( { const int bp = get_mitm_slot(); if (bp == NON_ITEM) - return (false); + return false; const int thing_created = items(allow_uniques, base, subtype, true, level, race); if (thing_created == NON_ITEM) - return (false); + return false; _give_monster_item(mons, thing_created); - return (true); + return true; } static void _give_shield(monster* mon, int level) diff --git a/crawl-ref/source/mon-grow.cc b/crawl-ref/source/mon-grow.cc index 220f16810e..4ef253793e 100644 --- a/crawl-ref/source/mon-grow.cc +++ b/crawl-ref/source/mon-grow.cc @@ -109,7 +109,7 @@ static const monster_level_up *_monster_level_up_target(monster_type type, } } } - return (NULL); + return NULL; } void monster::upgrade_type(monster_type after, bool adjust_hd, @@ -164,15 +164,15 @@ bool monster::level_up_change() if (const monster_level_up *lup = _monster_level_up_target(type, hit_dice)) { upgrade_type(lup->after, false, lup->adjust_hp); - return (true); + return true; } - return (false); + return false; } bool monster::level_up() { if (hit_dice >= MAX_MONS_HD) - return (false); + return false; ++hit_dice; @@ -196,7 +196,7 @@ bool monster::level_up() level_up_change(); - return (true); + return true; } void monster::init_experience() @@ -210,23 +210,23 @@ void monster::init_experience() bool monster::gain_exp(int exp, int max_levels_to_gain) { if (!alive()) - return (false); + return false; init_experience(); if (hit_dice >= MAX_MONS_HD) - return (false); + return false; // Only natural monsters can level-up. if (holiness() != MH_NATURAL) - return (false); + return false; // Only monsters that you can gain XP from can level-up. if (mons_class_flag(type, M_NO_EXP_GAIN)) - return (false); + return false; // Avoid wrap-around. if (experience + exp < experience) - return (false); + return false; experience += exp; diff --git a/crawl-ref/source/mon-info.cc b/crawl-ref/source/mon-info.cc index e0af7336c8..b22d2aec68 100644 --- a/crawl-ref/source/mon-info.cc +++ b/crawl-ref/source/mon-info.cc @@ -159,12 +159,12 @@ static bool _blocked_ray(const coord_def &where, if (exists_ray(you.pos(), where, opc_solid_see) || !exists_ray(you.pos(), where, opc_default)) { - return (false); + return false; } if (feat == NULL) - return (true); + return true; *feat = ray_blocker(you.pos(), where); - return (true); + return true; } static bool _is_public_key(std::string key) @@ -197,7 +197,7 @@ static bool _tentacle_pos_unknown(const monster *tentacle, { // We can see the segment, no guessing necessary. if (!tentacle->submerged()) - return (false); + return false; const coord_def t_pos = tentacle->pos(); @@ -223,12 +223,12 @@ static bool _tentacle_pos_unknown(const monster *tentacle, { // Could originate from the kraken. if (mon->type == MONS_KRAKEN) - return (true); + return true; // Otherwise, we know the segment can't be there. continue; } - return (true); + return true; } if (grd(*ai) == DNGN_SHALLOW_WATER) @@ -241,12 +241,12 @@ static bool _tentacle_pos_unknown(const monster *tentacle, // Disturbance in shallow water -> might be a tentacle. if (mon->type == MONS_KRAKEN || mon->submerged()) - return (true); + return true; } } // Using a directional tile leaks no information. - return (false); + return false; } static void _translate_tentacle_ref(monster_info& mi, const monster* m, @@ -948,7 +948,7 @@ std::string monster_info::common_name(description_level_type desc) const if (desc == DESC_ITS) s = apostrophise(s); - return (s); + return s; } dungeon_feature_type monster_info::get_mimic_feature() const @@ -1046,9 +1046,9 @@ bool monster_info::less_than(const monster_info& m1, const monster_info& m2, bool zombified, bool fullname) { if (m1.attitude < m2.attitude) - return (true); + return true; else if (m1.attitude > m2.attitude) - return (false); + return false; // Force plain but different coloured draconians to be treated like the // same sub-type. @@ -1057,30 +1057,30 @@ bool monster_info::less_than(const monster_info& m1, const monster_info& m2, && m2.type >= MONS_DRACONIAN && m2.type <= MONS_PALE_DRACONIAN) { - return (false); + return false; } int diff_delta = mons_avg_hp(m1.type) - mons_avg_hp(m2.type); // By descending difficulty if (diff_delta > 0) - return (true); + return true; else if (diff_delta < 0) - return (false); + return false; // Force mimics of different types to be treated like the same one. if (mons_is_mimic(m1.type) && mons_is_mimic(m2.type)) - return (false); + return false; if (m1.type < m2.type) - return (true); + return true; else if (m1.type > m2.type) - return (false); + return false; // Never distinguish between dancing weapons. // The above checks guarantee that *both* monsters are of this type. if (m1.type == MONS_DANCING_WEAPON) - return (false); + return false; if (m1.type == MONS_SLIME_CREATURE) return (m1.number > m2.number); @@ -1095,18 +1095,18 @@ bool monster_info::less_than(const monster_info& m1, const monster_info& m2, // Because of the type checks above, if one of the two is zombified, so // is the other, and of the same type. if (m1.base_type < m2.base_type) - return (true); + return true; else if (m1.base_type > m2.base_type) - return (false); + return false; } // Both monsters are hydras or hydra zombies, sort by number of heads. if (mons_genus(m1.type) == MONS_HYDRA || mons_genus(m1.base_type) == MONS_HYDRA) { if (m1.number > m2.number) - return (true); + return true; else if (m1.number < m2.number) - return (false); + return false; } } @@ -1116,12 +1116,12 @@ bool monster_info::less_than(const monster_info& m1, const monster_info& m2, #if 0 // for now, sort mb together. // By descending mb, so no mb sorts to the end if (m1.mb > m2.mb) - return (true); + return true; else if (m1.mb < m2.mb) - return (false); + return false; #endif - return (false); + return false; } static std::string _verbose_info0(const monster_info& mi) @@ -1441,14 +1441,14 @@ int monster_info::randarts(artefact_prop_type ra_prop) const ret += artefact_wpn_property(*ring, ra_prop); } - return (ret); + return ret; } int monster_info::res_magic() const { int mr = (get_monster_data(type))->resist_magic; if (mr == MAG_IMMUNE) - return (MAG_IMMUNE); + return MAG_IMMUNE; // Negative values get multiplied with monster hit dice. if (mr < 0) @@ -1482,7 +1482,7 @@ int monster_info::res_magic() const if (is(MB_VULN_MAGIC)) mr /= 2; - return (mr); + return mr; } bool monster_info::wields_two_weapons() const @@ -1540,7 +1540,7 @@ size_type monster_info::body_size() const ret = SIZE_MEDIUM; } - return (ret); + return ret; } bool monster_info::cannot_move() const diff --git a/crawl-ref/source/mon-info.h b/crawl-ref/source/mon-info.h index 31de3d6de6..4d2be1dffe 100644 --- a/crawl-ref/source/mon-info.h +++ b/crawl-ref/source/mon-info.h @@ -214,22 +214,22 @@ struct monster_info : public monster_info_base monster_type draco_subspecies() const { - return (draco_type); + return draco_type; } mon_intel_type intel() const { - return (mintel); + return mintel; } mon_resist_def resists() const { - return (mresists); + return mresists; } mon_itemuse_type itemuse() const { - return (mitemuse); + return mitemuse; } int randarts(artefact_prop_type ra_prop) const; @@ -237,7 +237,7 @@ struct monster_info : public monster_info_base int base_speed() const { - return (mbase_speed); + return mbase_speed; } bool wields_two_weapons() const; diff --git a/crawl-ref/source/mon-iter.cc b/crawl-ref/source/mon-iter.cc index 90b936e929..b44cf9ea49 100644 --- a/crawl-ref/source/mon-iter.cc +++ b/crawl-ref/source/mon-iter.cc @@ -56,14 +56,14 @@ monster_iterator monster_iterator::operator++(int) { monster_iterator copy = *this; ++(*this); - return (copy); + return copy; } bool monster_iterator::valid(int mid) const { monster* mon = &env.mons[mid]; if (!mon->alive()) - return (false); + return false; switch (restr) { case R_CIRC: @@ -73,7 +73,7 @@ bool monster_iterator::valid(int mid) const case R_ACT: return (act->can_see(mon)); default: - return (true); + return true; } } diff --git a/crawl-ref/source/mon-movetarget.cc b/crawl-ref/source/mon-movetarget.cc index 6cdc27632b..7d422190a7 100644 --- a/crawl-ref/source/mon-movetarget.cc +++ b/crawl-ref/source/mon-movetarget.cc @@ -170,7 +170,7 @@ bool try_pathfind(monster* mon) mon->travel_path.clear(); mon->travel_target = MTRAV_NONE; } - return (false); + return false; } // If the target is "unreachable" (the monster already tried, @@ -180,7 +180,7 @@ bool try_pathfind(monster* mon) if (target_is_unreachable(mon) && !one_chance_in(12) && !(mon->can_cling_to_walls() && one_chance_in(4))) { - return (false); + return false; } #ifdef DEBUG_PATHFIND @@ -205,13 +205,13 @@ bool try_pathfind(monster* mon) if (!mon->travel_path.empty()) { mon->target = mon->travel_path[0]; - return (true); + return true; } } else if (can_go_straight(mon, mon->pos(), mon->travel_path[0])) { mon->target = mon->travel_path[0]; - return (true); + return true; } } } @@ -232,7 +232,7 @@ bool try_pathfind(monster* mon) mprf("Distance too great, don't attempt pathfinding! (%s)", mon->name(DESC_PLAIN).c_str()); #endif - return (false); + return false; } #ifdef DEBUG_PATHFIND @@ -252,27 +252,27 @@ bool try_pathfind(monster* mon) // Okay then, we found a path. Let's use it! mon->target = mon->travel_path[0]; mon->travel_target = MTRAV_PLAYER; - return (true); + return true; } } // We didn't find a path. _set_no_path_found(mon); - return (false); + return false; } static bool _is_level_exit(const coord_def& pos) { // All types of stairs. if (feat_is_stair(grd(pos))) - return (true); + return true; // Teleportation and shaft traps. const trap_type tt = get_trap_type(pos); if (tt == TRAP_TELEPORT || tt == TRAP_SHAFT) - return (true); + return true; - return (false); + return false; } // Returns true if a monster left the level. @@ -288,10 +288,10 @@ bool pacified_leave_level(monster* mon, std::vector<level_exit> e, || distance(mon->pos(), you.pos()) >= dist_range(LOS_RADIUS * 4)) { make_mons_leave_level(mon); - return (true); + return true; } - return (false); + return false; } // Counts deep water twice. @@ -305,7 +305,7 @@ static int _count_water_neighbours(coord_def p) else if (grd(*ai) == DNGN_DEEP_WATER) water_count += 2; } - return (water_count); + return water_count; } // Pick the nearest water grid that is surrounded by the most @@ -316,11 +316,11 @@ bool find_siren_water_target(monster* mon) // Moving away could break the entrancement, so don't do this. if ((mon->pos() - you.pos()).rdist() >= 6) - return (false); + return false; // Already completely surrounded by deep water. if (_count_water_neighbours(mon->pos()) >= 16) - return (true); + return true; if (mon->travel_target == MTRAV_SIREN) { @@ -330,7 +330,7 @@ bool find_siren_water_target(monster* mon) targ_pos.x, targ_pos.y, (int) (mon->pos() - targ_pos).rdist()); #endif if ((mon->pos() - targ_pos).rdist() > 2) - return (true); + return true; } int best_water_count = 0; @@ -387,11 +387,11 @@ bool find_siren_water_target(monster* mon) } if (!best_water_count) - return (false); + return false; // We're already optimally placed. if (best_target == mon->pos()) - return (true); + return true; monster_pathfind mp; #ifdef WIZARD @@ -419,11 +419,11 @@ bool find_siren_water_target(monster* mon) // Okay then, we found a path. Let's use it! mon->target = mon->travel_path[0]; mon->travel_target = MTRAV_SIREN; - return (true); + return true; } } - return (false); + return false; } bool find_wall_target(monster* mon) @@ -445,7 +445,7 @@ bool find_wall_target(monster* mon) mon->name(DESC_PLAIN, true).c_str(), targ_pos.x, targ_pos.y, (int) (mon->pos() - targ_pos).rdist()); #endif - return (true); + return true; } mon->travel_path.clear(); @@ -485,7 +485,7 @@ bool find_wall_target(monster* mon) } if (best_dist == INT_MAX || !in_bounds(best_target)) - return (false); + return false; monster_pathfind mp; #ifdef WIZARD @@ -510,10 +510,10 @@ bool find_wall_target(monster* mon) // Okay then, we found a path. Let's use it! mon->target = mon->travel_path[0]; mon->travel_target = MTRAV_WALL; - return (true); + return true; } } - return (false); + return false; } // Returns true if further handling neeeded. @@ -537,7 +537,7 @@ static bool _handle_monster_travelling(monster* mon) mpr("We reached the end of our path: stop travelling."); #endif mon->travel_target = MTRAV_NONE; - return (true); + return true; } else { @@ -545,7 +545,7 @@ static bool _handle_monster_travelling(monster* mon) #ifdef DEBUG_PATHFIND mprf("Next waypoint: (%d, %d)", mon->target.x, mon->target.y); #endif - return (false); + return false; } } @@ -609,7 +609,7 @@ static bool _handle_monster_travelling(monster* mon) else { mon->travel_target = MTRAV_NONE; - return (true); + return true; } } else @@ -617,14 +617,14 @@ static bool _handle_monster_travelling(monster* mon) // Or just forget about the whole thing. mon->travel_path.clear(); mon->travel_target = MTRAV_NONE; - return (true); + return true; } } } // Else, we can see the next waypoint and are making good progress. // Carry on, then! - return (false); + return false; } static bool _choose_random_patrol_target_grid(monster* mon) @@ -637,11 +637,11 @@ static bool _choose_random_patrol_target_grid(monster* mon) // just remain there until next turn when this function is called // again. if (intel == I_PLANT && coinflip()) - return (true); + return true; // If there's no chance we'll find the patrol point, quit right away. if (distance(mon->pos(), mon->patrol_point) > dist_range(2 * LOS_RADIUS)) - return (false); + return false; // Can the monster see the patrol point from its current position? const bool patrol_seen = mon->see_cell(mon->patrol_point); @@ -650,7 +650,7 @@ static bool _choose_random_patrol_target_grid(monster* mon) { // Really stupid monsters won't even try to get back into the // patrol zone. - return (false); + return false; } // While the patrol point is in easy reach, monsters of insect/plant @@ -740,7 +740,7 @@ static bool _choose_random_patrol_target_grid(monster* mon) mon->target = *ri; } - return (count_grids); + return count_grids; }// Returns true if further handling neeeded. static bool _handle_monster_patrolling(monster* mon) { @@ -767,7 +767,7 @@ static bool _handle_monster_patrolling(monster* mon) // Stop patrolling. mon->patrol_point.reset(); mon->travel_target = MTRAV_NONE; - return (true); + return true; } } else @@ -805,7 +805,7 @@ static bool _handle_monster_patrolling(monster* mon) // Stop patrolling. mon->patrol_point.reset(); mon->travel_target = MTRAV_NONE; - return (true); + return true; } } } @@ -819,7 +819,7 @@ static bool _handle_monster_patrolling(monster* mon) #endif } - return (false); + return false; } void set_random_target(monster* mon) @@ -845,7 +845,7 @@ static monster * _active_band_leader(monster * mon) { // Not a band member if (!mon->props.exists("band_leader")) - return (NULL); + return NULL; // Try to find our fearless leader. unsigned leader_mid = mon->props["band_leader"].get_int(); @@ -860,7 +860,7 @@ static bool _band_wander_target(monster * mon) int dist_thresh = LOS_RADIUS + HERD_COMFORT_RANGE; monster * band_leader = _active_band_leader(mon); if (band_leader == NULL) - return (true); + return true; int leader_dist = grid_distance(mon->pos(), band_leader->pos()); if (leader_dist > dist_thresh) @@ -876,13 +876,13 @@ static bool _band_wander_target(monster * mon) // Okay then, we found a path. Let's use it! mon->target = mon->travel_path[0]; mon->travel_target = MTRAV_PATROL; - return (false); + return false; } else - return (true); + return true; } - return (true); + return true; } std::vector<coord_def> positions; @@ -898,12 +898,12 @@ static bool _band_wander_target(monster * mon) } if (positions.empty()) - return (true); + return true; mon->target = positions[random2(positions.size())]; ASSERT(in_bounds(mon->target)); - return (false); + return false; } // Returns true if a movement target still needs to be set @@ -927,7 +927,7 @@ static bool _herd_wander_target(monster * mon) } if (friends.empty()) - return (true); + return true; for (radius_iterator r_it(mon->get_los_no_trans(), true) ; r_it; ++r_it) { @@ -950,10 +950,10 @@ static bool _herd_wander_target(monster * mon) distance_positions.rbegin(); if (back == distance_positions.rend()) - return (true); + return true; mon->target = back->second[random2(back->second.size())]; - return (false); + return false; } static bool _herd_ok(monster * mon) @@ -993,7 +993,7 @@ static bool _band_ok(monster * mon) monster * leader = _active_band_leader(mon); if (!leader) - return (true); + return true; int g_dist = grid_distance(leader->pos(), mon->pos()); @@ -1002,10 +1002,10 @@ static bool _band_ok(monster * mon) if (g_dist < HERD_COMFORT_RANGE && mon->see_cell_no_trans(leader->pos()) || g_dist >= (LOS_RADIUS + HERD_COMFORT_RANGE)) { - return (true); + return true; } - return (false); + return false; } @@ -1094,7 +1094,7 @@ int mons_find_nearest_level_exit(const monster* mon, } } - return (retval); + return retval; } void set_random_slime_target(monster* mon) diff --git a/crawl-ref/source/mon-pathfind.cc b/crawl-ref/source/mon-pathfind.cc index b3c7ac6250..4216684cd0 100644 --- a/crawl-ref/source/mon-pathfind.cc +++ b/crawl-ref/source/mon-pathfind.cc @@ -66,7 +66,7 @@ int mons_tracking_range(const monster* mon) if (you.penance[GOD_ASHENZARI]) range *= 5; - return (range); + return range; } //#define DEBUG_PATHFIND @@ -111,7 +111,7 @@ bool monster_pathfind::init_pathfind(const monster* mon, coord_def dest, if (msg) mpr("The monster is already there!"); - return (true); + return true; } return start_pathfind(msg); @@ -127,7 +127,7 @@ bool monster_pathfind::init_pathfind(coord_def src, coord_def dest, bool diag, // Easy enough. :P if (start == target) - return (true); + return true; return start_pathfind(msg); } @@ -155,7 +155,7 @@ bool monster_pathfind::start_pathfind(bool msg) // and add them to the hash, if they haven't already been looked at. success = calc_path_to_neighbours(); if (success) - return (true); + return true; // Pull the position with shortest distance estimate to our target grid. success = get_best_position(); @@ -167,7 +167,7 @@ bool monster_pathfind::start_pathfind(bool msg) mprf("Couldn't find a path from (%d,%d) to (%d,%d).", target.x, target.y, start.x, start.y); } - return (false); + return false; } } while (true); @@ -279,11 +279,11 @@ bool monster_pathfind::calc_path_to_neighbours() #ifdef DEBUG_PATHFIND mpr("Arrived at target."); #endif - return (true); + return true; } } } - return (false); + return false; } // Starting at known min_length (minimum total estimated path distance), check @@ -309,7 +309,7 @@ bool monster_pathfind::get_best_position() pos.x, pos.y, min_length); #endif - return (true); + return true; } #ifdef DEBUG_PATHFIND mprf("No positions for path length %d.", i); @@ -317,7 +317,7 @@ bool monster_pathfind::get_best_position() } // Nothing found? Then there's no path! :( - return (false); + return false; } // Using the prev vector backtrack from start to target to find all steps to @@ -352,7 +352,7 @@ std::vector<coord_def> monster_pathfind::backtrack() while (pos != start); ASSERT(pos == start); - return (path); + return path; } // Reduces the path coordinates to only a couple of key waypoints needed @@ -396,20 +396,20 @@ std::vector<coord_def> monster_pathfind::calc_waypoints() if (pos != path[path.size() - 1]) waypoints.push_back(path[path.size() - 1]); - return (waypoints); + return waypoints; } bool monster_pathfind::traversable(const coord_def& p) { if (!traverse_unmapped && grd(p) == DNGN_UNSEEN) - return (false); + return false; // XXX: Hack to be somewhat consistent with uses of // opc_immob elsewhere in pathfinding. // All of this should eventually be replaced by // giving the monster a proper pathfinding LOS. if (opc_immob(p) == OPC_OPAQUE) - return (false); + return false; if (mons) return mons_traversable(p); @@ -443,7 +443,7 @@ int monster_pathfind::travel_cost(coord_def npos) if (mons) return mons_travel_cost(npos); - return (1); + return 1; #endif } @@ -457,7 +457,7 @@ int monster_pathfind::mons_travel_cost(coord_def npos) if (feat_is_closed_door(grd(npos)) || grd(npos) == DNGN_SECRET_DOOR && env.markers.property_at(npos, MAT_ANY, "door_restrict") != "veto") { - return (2); + return 2; } const monster_type mt = mons_base_type(mons); @@ -470,7 +470,7 @@ int monster_pathfind::mons_travel_cost(coord_def npos) // (The resulting path might not be optimal but it will lead to a path // a monster of such habits is likely to prefer.) if (mons->floundering_at(npos)) - return (2); + return 2; // Try to avoid (known) traps. const trap_def* ptrap = find_trap(npos); @@ -483,19 +483,19 @@ int monster_pathfind::mons_travel_cost(coord_def npos) // Your allies take extra precautions to avoid known alarm traps. // Zot traps are considered intraversable. if (knows_trap && mons->friendly()) - return (3); + return 3; // To hostile monsters, these traps are completely harmless. - return (1); + return 1; } // Mechanical traps can be avoided by flying, as can shafts, and // tele traps are never traversable anyway. if (knows_trap && ground_level) - return (2); + return 2; } - return (1); + return 1; } // The estimated cost to reach a grid is simply max(dx, dy). diff --git a/crawl-ref/source/mon-pick.cc b/crawl-ref/source/mon-pick.cc index 334d6ecee2..c65a494df5 100644 --- a/crawl-ref/source/mon-pick.cc +++ b/crawl-ref/source/mon-pick.cc @@ -383,9 +383,9 @@ int mons_pan_rare(monster_type mcls) case MONS_SHADOW_IMP: case MONS_SHADOW_DEMON: case MONS_LOROCYPROCA: - return (40); + return 40; default: - return (0); + return 0; } } diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index bbfb754069..3a665043bf 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -158,11 +158,11 @@ bool monster_habitable_grid(monster_type mt, { // No monster may be placed on open sea. if (actual_grid == DNGN_OPEN_SEA || actual_grid == DNGN_LAVA_SEA) - return (false); + return false; // Monsters can't use teleporters, and standing there would look just wrong. if (actual_grid == DNGN_TELEPORTER) - return (false); + return false; const dungeon_feature_type feat_preferred = habitat2grid(mons_class_primary_habitat(mt)); @@ -185,24 +185,24 @@ bool monster_habitable_grid(monster_type mt, // Special check for fire elementals since their habitat is floor which // is generally considered compatible with shallow water. if (mt == MONS_FIRE_ELEMENTAL && feat_is_watery(actual_grid)) - return (false); + return false; if (actual_grid == DNGN_MALIGN_GATEWAY) { if (mt == MONS_ELDRITCH_TENTACLE || mt == MONS_ELDRITCH_TENTACLE_SEGMENT) { - return (true); + return true; } else - return (false); + return false; } if (feat_compatible(feat_preferred, actual_grid) || (feat_nonpreferred != feat_preferred && feat_compatible(feat_nonpreferred, actual_grid))) { - return (true); + return true; } // [dshaligram] Flying creatures are all DNGN_FLOOR, so we @@ -211,19 +211,19 @@ bool monster_habitable_grid(monster_type mt, if (monster_is_airborne && (actual_grid == DNGN_LAVA || actual_grid == DNGN_DEEP_WATER)) { - return (true); + return true; } - return (false); + return false; } // Returns true if the monster can submerge in the given grid. bool monster_can_submerge(const monster* mon, dungeon_feature_type feat) { if (testbits(env.pgrid(mon->pos()), FPROP_NO_SUBMERGE)) - return (false); + return false; if (!mon->is_habitable_feat(feat)) - return (false); + return false; if (mons_class_flag(mon->type, M_SUBMERGES)) switch (mons_habitat(mon)) { @@ -236,10 +236,10 @@ bool monster_can_submerge(const monster* mon, dungeon_feature_type feat) // Currently, trapdoor spider and air elemental only. return (feat == DNGN_FLOOR); default: - return (false); + return false; } else - return (false); + return false; } static bool _is_spawn_scaled_area(const level_id &here) @@ -312,7 +312,7 @@ static int _fuzz_mons_level(int level) return level + fuzz; } - return (level); + return level; } static int _vestibule_spawn_rate() @@ -427,7 +427,7 @@ static std::vector<monster_type> _find_valid_monster_types(const level_id &place static level_id last_monster_type_place; if (last_monster_type_place == place) - return (valid_monster_types); + return valid_monster_types; valid_monster_types.clear(); for (monster_type i = MONS_0; i < NUM_MONSTERS; ++i) @@ -435,7 +435,7 @@ static std::vector<monster_type> _find_valid_monster_types(const level_id &place valid_monster_types.push_back(i); last_monster_type_place = place; - return (valid_monster_types); + return valid_monster_types; } static bool _is_random_monster(int mt) @@ -460,12 +460,12 @@ static monster_type _pick_random_monster(const level_id &place, int power, { monster_type type = arena_pick_random_monster(place, power, lev_mons); if (!_is_random_monster(type)) - return (type); + return type; } // Short-circuit it when we know it will fail. if (!branch_has_monsters(place.branch)) - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; monster_type mon_type = MONS_PROGRAM_BUG; @@ -550,7 +550,7 @@ static monster_type _pick_random_monster(const level_id &place, int power, } if (monster_pick_tries <= 0) - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; if (level > original_level + 5) *isood = true; @@ -562,7 +562,7 @@ static monster_type _pick_random_monster(const level_id &place, int power, "NONE" : get_monster_data(mon_type)->name, *isood? "YES" : "no"); - return (mon_type); + return mon_type; } // Caller must use !invalid_monster_type to check if the return value @@ -577,18 +577,18 @@ monster_type pick_random_monster(const level_id &place, bool can_place_on_trap(monster_type mon_type, trap_type trap) { if (trap == TRAP_TELEPORT) - return (false); + return false; if (trap == TRAP_SHAFT) { if (_is_random_monster(mon_type)) - return (false); + return false; return (mons_class_flies(mon_type) != FL_NONE || get_monster_data(mon_type)->size == SIZE_TINY); } - return (true); + return true; } bool drac_colour_incompatible(int drac, int colour) @@ -727,7 +727,7 @@ static monster_type _resolve_monster_type(monster_type mon_type, stair_type, lev_mons, chose_ood_monster); } - return (mon_type); + return mon_type; } } @@ -763,7 +763,7 @@ static monster_type _resolve_monster_type(monster_type mon_type, mon_type == RANDOM_MOBILE_MONSTER); } } - return (mon_type); + return mon_type; } monster_type pick_random_monster_for_place(const level_id &place, @@ -800,7 +800,7 @@ monster_type pick_random_monster_for_place(const level_id &place, if (!tries) chosen = MONS_NO_MONSTER; - return (chosen); + return chosen; } // A short function to check the results of near_stairs(). @@ -831,7 +831,7 @@ static int _is_near_stairs(coord_def &p) } } - return (result); + return result; } // Checks if the monster is ok to place at mg_pos. If force_location @@ -844,7 +844,7 @@ static bool _valid_monster_generation_location(const mgen_data &mg, if (!in_bounds(mg_pos) || monster_at(mg_pos) || you.pos() == mg_pos && !fedhas_passthrough_class(mg.cls)) - return (false); + return false; const monster_type montype = (mons_class_is_zombified(mg.cls) ? mg.base_type : mg.cls); @@ -853,7 +853,7 @@ static bool _valid_monster_generation_location(const mgen_data &mg, || (mg.behaviour != BEH_FRIENDLY && !mons_is_mimic(montype) && is_sanctuary(mg_pos))) { - return (false); + return false; } // Check player proximity to avoid band members being placed @@ -863,16 +863,16 @@ static bool _valid_monster_generation_location(const mgen_data &mg, if (mg.proximity == PROX_AWAY_FROM_PLAYER && distance(you.pos(), mg_pos) <= LOS_RADIUS_SQ) { - return (false); + return false; } // Don't generate monsters on top of teleport traps. // (How did they get there?) const trap_def* ptrap = find_trap(mg_pos); if (ptrap && !can_place_on_trap(mg.cls, ptrap->type)) - return (false); + return false; - return (true); + return true; } static bool _valid_monster_generation_location(mgen_data &mg) @@ -1235,7 +1235,7 @@ monster* get_free_monster() return (&env.mons[i]); } - return (NULL); + return NULL; } void mons_add_blame(monster* mon, const std::string &blame_string) @@ -1812,16 +1812,16 @@ static bool _good_zombie(monster_type base, monster_type cs, // Actually pick a monster that is happy where we want to put it. // Fish zombies on land are helpless and uncool. if (in_bounds(pos) && !monster_habitable_grid(base, grd(pos))) - return (false); + return false; if (cs == MONS_NO_MONSTER) - return (true); + return true; // If skeleton, monster must have a skeleton. if ((cs == MONS_SKELETON_SMALL || cs == MONS_SKELETON_LARGE) && !mons_skeleton(base)) { - return (false); + return false; } // Size must match, but you can make a spectral thing out of @@ -1829,10 +1829,10 @@ static bool _good_zombie(monster_type base, monster_type cs, if (cs != MONS_SPECTRAL_THING && mons_zombie_size(base) != zombie_class_size(cs)) { - return (false); + return false; } - return (true); + return true; } monster_type pick_local_zombifiable_monster(int power, bool hack_hd, @@ -1882,7 +1882,7 @@ monster_type pick_local_zombifiable_monster(int power, bool hack_hd, // Hack -- non-dungeon zombies are always made out of nastier // monsters. if (hack_hd && !player_in_connected_branch() && mons_power(base) > 8) - return (base); + return base; // Check for rarity.. and OOD - identical to mons_place() int level, diff, chance; @@ -1896,7 +1896,7 @@ monster_type pick_local_zombifiable_monster(int power, bool hack_hd, if (power > level - relax && power < level + relax && random2avg(100, 2) <= chance) { - return (base); + return base; } // Every so often, we'll relax the OOD restrictions. Avoids @@ -2038,7 +2038,7 @@ bool downgrade_zombie_to_skeleton(monster* mon) if ((mon->type != MONS_ZOMBIE_SMALL && mon->type != MONS_ZOMBIE_LARGE) || !mons_skeleton(mon->base_monster)) { - return (false); + return false; } int acmod = 0; @@ -2067,7 +2067,7 @@ bool downgrade_zombie_to_skeleton(monster* mon) mon->hit_points = old_hp * mon->max_hit_points / old_maxhp; mon->hit_points = std::max(mon->hit_points, 1); - return (true); + return true; } static band_type _choose_band(monster_type mon_type, int power, int &band_size, @@ -2540,7 +2540,7 @@ static band_type _choose_band(monster_type mon_type, int power, int &band_size, if (band_size >= BIG_BAND) band_size = BIG_BAND - 1; - return (band); + return band; } static monster_type _band_member(band_type band, int power) @@ -2549,7 +2549,7 @@ static monster_type _band_member(band_type band, int power) int temp_rand; if (band == BAND_NO_BAND) - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; switch (band) { @@ -2918,7 +2918,7 @@ static monster_type _band_member(band_type band, int power) break; } - return (mon_type); + return mon_type; } void mark_interesting_monst(monster* mons, beh_type behaviour) @@ -2977,7 +2977,7 @@ static monster_type _pick_zot_exit_defender() return static_cast<monster_type>(MONS_MNOLEG + i); } } - return (MONS_PANDEMONIUM_LORD); + return MONS_PANDEMONIUM_LORD; } const int temp_rand = random2(276); @@ -3086,14 +3086,14 @@ monster* mons_place(mgen_data mg) static dungeon_feature_type _monster_primary_habitat_feature(monster_type mc) { if (_is_random_monster(mc)) - return (DNGN_FLOOR); + return DNGN_FLOOR; return (habitat2grid(mons_class_primary_habitat(mc))); } static dungeon_feature_type _monster_secondary_habitat_feature(monster_type mc) { if (_is_random_monster(mc)) - return (DNGN_FLOOR); + return DNGN_FLOOR; return (habitat2grid(mons_class_secondary_habitat(mc))); } @@ -3136,18 +3136,18 @@ public: bool path_flood(const coord_def &c, const coord_def &dc) { if (best_distance && traveled_distance > best_distance) - return (true); + return true; if (!in_bounds(dc) || (maxdistance > 0 && traveled_distance > maxdistance)) { - return (false); + return false; } if (!feat_compatible(feat_wanted, grd(dc))) { if (passable.find(grd(dc)) != passable.end()) good_square(dc); - return (false); + return false; } if (_valid_spot(dc) && one_chance_in(++nfound)) { @@ -3159,7 +3159,7 @@ public: { good_square(dc); } - return (false); + return false; } }; @@ -3215,7 +3215,7 @@ coord_def find_newmons_square(monster_type mons_class, const coord_def &p) pos = empty; } - return (pos); + return pos; } bool can_spawn_mushrooms(coord_def where) @@ -3307,10 +3307,10 @@ bool player_angers_monster(monster* mon) } } - return (true); + return true; } - return (false); + return false; } monster* create_monster(mgen_data mg, bool fail_msg) @@ -3383,7 +3383,7 @@ monster* create_monster(mgen_data mg, bool fail_msg) if (!summd && fail_msg && you.see_cell(mg.pos)) mpr("You see a puff of smoke."); - return (summd); + return summd; } bool empty_surrounds(const coord_def& where, dungeon_feature_type spc_wanted, @@ -3500,7 +3500,7 @@ monster_type summon_any_demon(demon_class_type dct) break; } - return (mon); + return mon; } monster_type summon_any_holy_being(holy_being_class_type hbct) @@ -3520,7 +3520,7 @@ monster_type summon_any_holy_being(holy_being_class_type hbct) break; } - return (mon); + return mon; } monster_type summon_any_dragon(dragon_class_type dct) @@ -3561,7 +3561,7 @@ monster_type summon_any_dragon(dragon_class_type dct) break; } - return (mon); + return mon; } ///////////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/mon-project.cc b/crawl-ref/source/mon-project.cc index 3fad320083..d7f84b31ae 100644 --- a/crawl-ref/source/mon-project.cc +++ b/crawl-ref/source/mon-project.cc @@ -180,7 +180,7 @@ static void _fuzz_direction(monster& mon, int pow) static bool _iood_shielded(monster& mon, actor &victim) { if (!victim.shield() || victim.incapacitated()) - return (false); + return false; const int to_hit = 15 + mon.props["iood_pow"].get_short()/12; const int con_block = random2(to_hit + victim.shield_block_penalty()); @@ -230,7 +230,7 @@ static bool _iood_hit(monster& mon, const coord_def &pos, bool big_boom = false) else beam.fire(); - return (true); + return true; } // returns true if the orb is gone @@ -250,7 +250,7 @@ bool iood_act(monster& mon, bool no_trail) if (!vx && !vy) // not initialized { _iood_dissipate(mon); - return (true); + return true; } _normalize(vx, vy); @@ -316,18 +316,18 @@ move_again: if (!in_bounds(pos)) { _iood_dissipate(mon); - return (true); + return true; } if (mon.props["iood_kc"].get_byte() == KC_YOU && (you.pos() - pos).rdist() > LOS_RADIUS) { // not actual vision, because of the smoke trail _iood_dissipate(mon); - return (true); + return true; } if (pos == mon.pos()) - return (false); + return false; if (!no_trail) place_cloud(CLOUD_MAGIC_TRAIL, mon.pos(), 2 + random2(3), &mon); @@ -353,7 +353,7 @@ move_again: noisy(40, pos, "You hear a loud magical explosion!"); monster_die(mons, KILL_DISMISSED, NON_MONSTER); _iood_hit(mon, pos, true); - return (true); + return true; } if (mons && mons->submerged()) @@ -369,7 +369,7 @@ move_again: mgrd(mons->pos()) = mons->mindex(); mgrd(pos) = mon.mindex(); - return (false); + return false; } else // if swap fails, move ahead { @@ -393,7 +393,7 @@ move_again: } victim->shield_block_succeeded(&mon); _iood_dissipate(mon); - return (true); + return true; } if (victim->is_player()) @@ -439,20 +439,20 @@ move_again: mprf("%s hits you!", mon.name(DESC_THE, true).c_str()); if (_iood_hit(mon, pos)) - return (true); + return true; } if (!mon.move_to_pos(pos)) { _iood_dissipate(mon); - return (true); + return true; } // move_to_pos() just trashed the coords, set them again mon.props["iood_x"] = x; mon.props["iood_y"] = y; - return (false); + return false; } // Reduced copy of iood_act to move the orb while the player @@ -468,7 +468,7 @@ static bool _iood_catchup_move(monster& mon) if (!vx && !vy) // not initialized { _iood_dissipate(mon, false); - return (true); + return true; } _normalize(vx, vy); @@ -484,31 +484,31 @@ static bool _iood_catchup_move(monster& mon) if (!in_bounds(pos)) { _iood_dissipate(mon, true); - return (true); + return true; } if (pos == mon.pos()) - return (false); + return false; actor *victim = actor_at(pos); if (cell_is_solid(pos) || victim) { // Just dissipate instead of hitting something. _iood_dissipate(mon, true); - return (true); + return true; } if (!mon.move_to_pos(pos)) { _iood_dissipate(mon); - return (true); + return true; } // move_to_pos() just trashed the coords, set them again mon.props["iood_x"] = x; mon.props["iood_y"] = y; - return (false); + return false; } void iood_catchup(monster* mons, int pturns) @@ -581,7 +581,7 @@ static void _boulder_stop(monster& mon, bool msg = true) static bool _boulder_shielded(monster& mon, actor &victim) { if (!victim.shield() || victim.incapacitated()) - return (false); + return false; const int to_hit = 15 + mon.hit_dice/2; const int con_block = random2(to_hit + victim.shield_block_penalty()); @@ -614,7 +614,7 @@ static bool _boulder_hit(monster& mon, const coord_def &pos) beam.fire(); - return (true); + return true; } bool boulder_act(monster& mon) @@ -634,7 +634,7 @@ bool boulder_act(monster& mon) if (!vx && !vy) // not initialized { _boulder_stop(mon); - return (true); + return true; } _normalize(vx, vy); @@ -700,11 +700,11 @@ move_again: if (!in_bounds(pos)) { _boulder_stop(mon); - return (true); + return true; } if (pos == mon.pos()) - return (false); + return false; // Place a dust trail (so we can see which way it's rolling) place_cloud(CLOUD_DUST_TRAIL, mon.pos(), 2 + random2(3), &mon); @@ -739,7 +739,7 @@ move_again: mon.add_ench(ENCH_CONFUSION); if (!mons->check_clarity(false)) mons->add_ench(ENCH_CONFUSION); - return (true); + return true; } if (mons && mons->submerged()) @@ -753,7 +753,7 @@ move_again: mgrd(mons->pos()) = mons->mindex(); mgrd(pos) = mon.mindex(); - return (false); + return false; } else // if swap fails, move ahead { @@ -777,7 +777,7 @@ move_again: } victim->shield_block_succeeded(&mon); _boulder_stop(mon); - return (true); + return true; } if (victim->atype() == ACT_PLAYER) @@ -823,19 +823,19 @@ move_again: { if (victim && victim->alive()) _boulder_stop(mon); - return (true); + return true; } } if (!mon.move_to_pos(pos)) { _boulder_stop(mon); - return (true); + return true; } // move_to_pos() just trashed the coords, set them again mon.props["boulder_x"] = x; mon.props["boulder_y"] = y; - return (false); + return false; } diff --git a/crawl-ref/source/mon-speak.cc b/crawl-ref/source/mon-speak.cc index c78fe3ead4..fff73a045e 100644 --- a/crawl-ref/source/mon-speak.cc +++ b/crawl-ref/source/mon-speak.cc @@ -135,7 +135,7 @@ static bool _invalid_msg(const std::string &msg, bool no_player, bool no_foe, || msg.find("@Player") != std::string::npos || msg.find(":You") != std::string::npos)) { - return (true); + return true; } if (no_player) @@ -146,7 +146,7 @@ static bool _invalid_msg(const std::string &msg, bool no_player, bool no_foe, if (starts_with(lines[i], "You") || ends_with(lines[i], "you.")) { - return (true); + return true; } } } @@ -156,22 +156,22 @@ static bool _invalid_msg(const std::string &msg, bool no_player, bool no_foe, || msg.find("foe@") != std::string::npos || msg.find("@species") != std::string::npos)) { - return (true); + return true; } if (no_god && (msg.find("_god@") != std::string::npos || msg.find("@god_") != std::string::npos)) { - return (true); + return true; } if (no_foe_name && msg.find("@foe_name@") != std::string::npos) - return (true); + return true; if (unseen && msg.find("VISUAL") != std::string::npos) - return (true); + return true; - return (false); + return false; } static std::string _try_exact_string(const std::vector<std::string> &prefixes, @@ -198,7 +198,7 @@ static std::string _try_exact_string(const std::vector<std::string> &prefixes, if (msg.empty()) { if (tries == 0) - return (msg); + return msg; else { tries--; @@ -214,7 +214,7 @@ static std::string _try_exact_string(const std::vector<std::string> &prefixes, break; } - return (msg); + return msg; } static std::string __get_speak_string(const std::vector<std::string> &prefixes, @@ -314,7 +314,7 @@ static std::string _get_speak_string(const std::vector<std::string> &prefixes, if (msg.empty()) { if (tries == 0) - return (msg); + return msg; else { tries--; @@ -331,7 +331,7 @@ static std::string _get_speak_string(const std::vector<std::string> &prefixes, break; } - return (msg); + return msg; } // Returns true if the monster did speak, false otherwise. @@ -412,7 +412,7 @@ bool mons_speaks(monster* mons) // to not have to deal with cases of speaking monsters which the // player can't see. if (unseen && !confused) - return (false); + return false; // Silenced monsters only "speak" 1/3 as often as non-silenced, // unless they're normally silent (S_SILENT). Use @@ -422,32 +422,32 @@ bool mons_speaks(monster* mons) && get_monster_data(mons->type)->shouts != S_SILENT) { if (!one_chance_in(3)) - return (false); + return false; } // Berserk monsters just want your hide. if (mons->berserk()) - return (false); + return false; // Rolling beetles shouldn't twitch antennae if (mons->rolling()) - return (false); + return false; // Monsters in a battle frenzy are likewise occupied. // But roused holy creatures are not. if (mons->has_ench(ENCH_BATTLE_FRENZY) && !one_chance_in(3)) - return (false); + return false; // Charmed monsters aren't too expressive. if (mons->has_ench(ENCH_CHARM) && !one_chance_in(3)) - return (false); + return false; } std::vector<std::string> prefixes; if (mons->neutral()) { if (!force_speak && coinflip()) // Neutrals speak half as often. - return (false); + return false; prefixes.push_back("neutral"); } @@ -642,7 +642,7 @@ bool mons_speaks(monster* mons) #ifdef DEBUG_MONSPEAK mpr("result: \"__NONE\"!", MSGCH_DIAGNOSTICS); #endif - return (false); + return false; } // Now that we're not dealing with a specific monster name, include @@ -671,7 +671,7 @@ bool mons_speaks(monster* mons) #ifdef DEBUG_MONSPEAK mpr("result: \"__NONE\"!", MSGCH_DIAGNOSTICS); #endif - return (false); + return false; } // Monster symbol didn't work, try monster shape. Since we're @@ -727,7 +727,7 @@ bool mons_speaks(monster* mons) #ifdef DEBUG_MONSPEAK mpr("result: \"__NONE\"!", MSGCH_DIAGNOSTICS); #endif - return (false); + return false; } // If we failed to get a message with a winged or tailed humanoid, @@ -758,7 +758,7 @@ bool mons_speaks(monster* mons) #ifdef DEBUG_MONSPEAK mpr("result: \"__NONE\"!", MSGCH_DIAGNOSTICS); #endif - return (false); + return false; } if (msg2 == "__NONE") @@ -781,7 +781,7 @@ bool mons_speaks(monster* mons) mprf(MSGCH_DIAGNOSTICS, "final result: %s!", (msg.empty() ? "empty" : "\"__NONE\"")); #endif - return (false); + return false; } if (msg == "__NEXT") @@ -789,7 +789,7 @@ bool mons_speaks(monster* mons) msg::streams(MSGCH_DIAGNOSTICS) << "__NEXT used by shape-based speech string for monster '" << mons->name(DESC_PLAIN) << "'" << std::endl; - return (false); + return false; } return (mons_speaks_msg(mons, msg, MSGCH_TALK, silence)); @@ -799,7 +799,7 @@ bool mons_speaks_msg(monster* mons, const std::string &msg, const msg_channel_type def_chan, bool silence) { if (!mons_near(mons)) - return (false); + return false; mon_acting mact(mons); @@ -850,5 +850,5 @@ bool mons_speaks_msg(monster* mons, const std::string &msg, mpr(line.c_str(), msg_type); } } - return (noticed); + return noticed; } diff --git a/crawl-ref/source/mon-stealth.cc b/crawl-ref/source/mon-stealth.cc index 1542a63b58..72d30d3265 100644 --- a/crawl-ref/source/mon-stealth.cc +++ b/crawl-ref/source/mon-stealth.cc @@ -11,12 +11,12 @@ static int _clamp_stealth(int stealth) { if (stealth > 3) - return (3); + return 3; else if (stealth < -3) return (-3); else { - return (stealth); + return stealth; } } diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index fedd1f7d16..676a233feb 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -105,7 +105,7 @@ bool curse_an_item(bool quiet) mprf(MSGCH_GOD, "The curse is absorbed by %s.", god_name(GOD_ASHENZARI).c_str()); } - return (false); + return false; } int count = 0; @@ -136,17 +136,17 @@ bool curse_an_item(bool quiet) // Any item to curse? if (item == ENDOFPACK) - return (false); + return false; do_curse_item(you.inv[item], false); - return (true); + return true; } // The default suitable() function for monster_drop_things(). bool is_any_item(const item_def& item) { - return (true); + return true; } void monster_drop_things(monster* mons, @@ -216,7 +216,7 @@ monster_type fill_out_corpse(const monster* mons, if (mons && (mons->is_summoned(NULL, &summon_type) || (mons->flags & (MF_BANISHED | MF_HARD_RESET)))) { - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; } monster_type corpse_class = mons_species(mtype); @@ -249,7 +249,7 @@ monster_type fill_out_corpse(const monster* mons, // Doesn't leave a corpse. if (!mons_class_can_leave_corpse(corpse_class) && !force_corpse) - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; corpse.flags = 0; corpse.base_type = OBJ_CORPSES; @@ -298,7 +298,7 @@ monster_type fill_out_corpse(const monster* mons, corpse.props[CORPSE_NAME_TYPE_KEY].get_int64() = 0; } - return (corpse_class); + return corpse_class; } bool explode_corpse(item_def& corpse, const coord_def& where) @@ -313,7 +313,7 @@ bool explode_corpse(item_def& corpse, const coord_def& where) // one piece? More importantly, it prevents a flavour feature // from becoming a trap for the unwary. - return (false); + return false; } ld.update(); @@ -365,7 +365,7 @@ bool explode_corpse(item_def& corpse, const coord_def& where) copy_item_to_grid(corpse, cp); } - return (true); + return true; } // Returns the item slot of a generated corpse, or -1 if no corpse. @@ -549,19 +549,19 @@ static int _calc_monster_experience(monster* victim, killer_type killer, const bool created_friendly = testbits(victim->flags, MF_NO_REWARD); if (no_xp || !MON_KILL(killer) || invalid_monster_index(killer_index)) - return (0); + return 0; monster* mon = &menv[killer_index]; if (!mon->alive()) - return (0); + return 0; if ((created_friendly && mon->friendly()) || mons_aligned(mon, victim)) { - return (0); + return 0; } - return (experience); + return experience; } static void _give_monster_experience(int experience, int killer_index) @@ -611,7 +611,7 @@ static int _calc_player_experience(const monster* mons) if (created_friendly || was_neutral || no_xp || mons_is_shedu(mons) && shedu_pair_alive(mons)) { - return (0); // No xp if monster was created friendly or summoned. + return 0; // No xp if monster was created friendly or summoned. // or if you've only killed one of two shedu. } @@ -687,17 +687,17 @@ static void _give_experience(int player_exp, int monster_exp, static bool _is_pet_kill(killer_type killer, int i) { if (!MON_KILL(killer)) - return (false); + return false; if (i == ANON_FRIENDLY_MONSTER) - return (true); + return true; if (invalid_monster_index(i)) - return (false); + return false; const monster* m = &menv[i]; if (m->friendly()) // This includes enslaved monsters. - return (true); + return true; // Check if the monster was confused by you or a friendly, which // makes casualties to this monster collateral kills. @@ -722,10 +722,10 @@ int exp_rate(int killer) static bool _ely_protect_ally(monster* mons, killer_type killer) { if (you.religion != GOD_ELYVILON) - return (false); + return false; if (!MON_KILL(killer) && !YOU_KILL(killer)) - return (false); + return false; if (!mons->is_holy() && mons->holiness() != MH_NATURAL @@ -733,7 +733,7 @@ static bool _ely_protect_ally(monster* mons, killer_type killer) || !you.can_see(mons) // for simplicity || !one_chance_in(20)) { - return (false); + return false; } mons->hit_points = 1; @@ -743,7 +743,7 @@ static bool _ely_protect_ally(monster* mons, killer_type killer) simple_god_message(info); - return (true); + return true; } // Elyvilon retribution effect: Heal hostile monsters that were about to @@ -753,24 +753,24 @@ static bool _ely_heal_monster(monster* mons, killer_type killer, int i) god_type god = GOD_ELYVILON; if (!you.penance[god] || !god_hates_your_god(god)) - return (false); + return false; const int ely_penance = you.penance[god]; if (mons->friendly() || !one_chance_in(10)) - return (false); + return false; if (MON_KILL(killer) && !invalid_monster_index(i)) { monster* mon = &menv[i]; if (!mon->friendly() || !one_chance_in(3)) - return (false); + return false; if (!mons_near(mons)) - return (false); + return false; } else if (!YOU_KILL(killer)) - return (false); + return false; dprf("monster hp: %d, max hp: %d", mons->hit_points, mons->max_hit_points); @@ -787,7 +787,7 @@ static bool _ely_heal_monster(monster* mons, killer_type killer, int i) god_speaks(god, info); dec_penance(god, 1); - return (true); + return true; } static bool _yred_enslave_soul(monster* mons, killer_type killer) @@ -800,10 +800,10 @@ static bool _yred_enslave_soul(monster* mons, killer_type killer) record_monster_defeat(mons, killer); record_monster_defeat(mons, KILL_ENSLAVED); yred_make_enslaved_soul(mons, player_under_penance()); - return (true); + return true; } - return (false); + return false; } static bool _beogh_forcibly_convert_orc(monster* mons, killer_type killer, @@ -845,12 +845,12 @@ static bool _beogh_forcibly_convert_orc(monster* mons, killer_type killer, && random2(mons->hit_dice) > 2) { beogh_convert_orc(mons, true, MON_KILL(killer)); - return (true); + return true; } } } - return (false); + return false; } static bool _monster_avoided_death(monster* mons, killer_type killer, int i) @@ -860,24 +860,24 @@ static bool _monster_avoided_death(monster* mons, killer_type killer, int i) || mons->max_hit_points <= 0 || mons->hit_dice < 1) { - return (false); + return false; } // Elyvilon specials. if (_ely_protect_ally(mons, killer)) - return (true); + return true; if (_ely_heal_monster(mons, killer, i)) - return (true); + return true; // Yredelemnul special. if (_yred_enslave_soul(mons, killer)) - return (true); + return true; // Beogh special. if (_beogh_forcibly_convert_orc(mons, killer, i)) - return (true); + return true; - return (false); + return false; } static void _jiyva_died() @@ -1090,7 +1090,7 @@ static bool _explode_monster(monster* mons, killer_type killer, || killer == KILL_RESET || killer == KILL_DISMISSED || killer == KILL_BANISHED) { if (killer != KILL_TIMEOUT) - return (false); + return false; } bolt beam; @@ -1126,7 +1126,7 @@ static bool _explode_monster(monster* mons, killer_type killer, msg::streams(MSGCH_DIAGNOSTICS) << "Unknown spore type: " << static_cast<int>(type) << std::endl; - return (false); + return false; } if (YOU_KILL(killer) && beam.aux_source.empty()) @@ -1147,7 +1147,7 @@ static bool _explode_monster(monster* mons, killer_type killer, } if (is_sanctuary(mons->pos())) - return (false); + return false; // Inner-flamed monsters leave behind some flame clouds. if (mons->has_ench(ENCH_INNER_FLAME)) @@ -1181,7 +1181,7 @@ static bool _explode_monster(monster* mons, killer_type killer, activate_ballistomycetes(mons, beam.target, YOU_KILL(beam.killer())); // Monster died in explosion, so don't re-attach it to the grid. - return (true); + return true; } static void _monster_die_cloud(const monster* mons, bool corpse, bool silent, @@ -1298,7 +1298,7 @@ static int _destroy_tentacle(int tentacle_idx, monster* origin) int seen = 0; if (invalid_monster_index(tentacle_idx)) - return (0); + return 0; // Some issue with using monster_die leading to DEAD_MONSTER // or w/e. Using hurt seems to cause more problems though. @@ -1325,7 +1325,7 @@ static int _destroy_tentacle(int tentacle_idx, monster* origin) monster_die(&menv[tentacle_idx], KILL_MISC, NON_MONSTER, true); } - return (seen); + return seen; } static int _destroy_tentacles(monster* head) @@ -2449,7 +2449,7 @@ int monster_die(monster* mons, killer_type killer, pet_kill, was_visible); crawl_state.dec_mon_acting(mons); - return (corpse); + return corpse; } mons_remove_from_grid(mons); @@ -2516,7 +2516,7 @@ int monster_die(monster* mons, killer_type killer, pet_kill, was_visible); } - return (corpse); + return corpse; } // Clean up after a dead monster. @@ -2590,7 +2590,7 @@ static bool _valid_morph(monster* mons, monster_type new_mclass) || (new_mclass == MONS_SHAPESHIFTER && mons->has_ench(ENCH_GLOWING_SHAPESHIFTER))) { - return (false); + return false; } // [ds] Non-base draconians are much more trouble than their HD @@ -2600,7 +2600,7 @@ static bool _valid_morph(monster* mons, monster_type new_mclass) && !player_in_branch(BRANCH_HALL_OF_ZOT) && !one_chance_in(10)) { - return (false); + return false; } // Various inappropriate polymorph targets. @@ -2632,7 +2632,7 @@ static bool _valid_morph(monster* mons, monster_type new_mclass) && (mons->type == MONS_PRINCE_RIBBIT || mons->mname == "Prince Ribbit"))) { - return (false); + return false; } // Determine if the monster is happy on current tile. @@ -2899,7 +2899,7 @@ bool monster_polymorph(monster* mons, monster_type targetc, { // Don't attempt to polymorph a monster that is busy using the stairs. if (mons->flags & MF_TAKING_STAIRS) - return (false); + return false; ASSERT(!(mons->flags & MF_BANISHED) || player_in_branch(BRANCH_ABYSS)); int source_power, target_power, relax; @@ -3027,7 +3027,7 @@ bool monster_polymorph(monster* mons, monster_type targetc, : 100); } - return (player_messaged); + return player_messaged; } // If the returned value is mon.pos(), then nothing was found. @@ -3087,7 +3087,7 @@ static coord_def _random_monster_nearby_habitable_space(const monster& mon, if (tries == 150) target = mon.pos(); - return (target); + return target; } bool monster_blink(monster* mons, bool quiet) @@ -3217,7 +3217,7 @@ bool swap_places(monster* mons, const coord_def &loc) if (monster_at(loc)) { mpr("Something prevents you from swapping places."); - return (false); + return false; } mpr("You swap places."); @@ -3241,14 +3241,14 @@ bool swap_check(monster* mons, coord_def &loc, bool quiet) if (is_feat_dangerous(grd(mons->pos())) && !you.can_cling_to(mons->pos())) { canned_msg(MSG_UNTHINKING_ACT); - return (false); + return false; } if (mons_is_projectile(mons->type)) { if (!quiet) mpr("It's unwise to walk into this."); - return (false); + return false; } if (mons->caught()) @@ -3258,14 +3258,14 @@ bool swap_check(monster* mons, coord_def &loc, bool quiet) simple_monster_message(mons, make_stringf(" is %s!", held_status(mons)).c_str()); } - return (false); + return false; } if (mons->is_constricted()) { if (!quiet) simple_monster_message(mons, " is being constricted!"); - return (false); + return false; } // First try: move monster onto your position. @@ -3296,7 +3296,7 @@ bool swap_check(monster* mons, coord_def &loc, bool quiet) interrupt_activity(AI_HIT_MONSTER, mons); } - return (swap); + return swap; } // Given an adjacent monster, returns true if the monster can hit it @@ -3306,10 +3306,10 @@ bool swap_check(monster* mons, coord_def &loc, bool quiet) bool monster_can_hit_monster(monster* mons, const monster* targ) { if (!targ->submerged() || mons->has_damage_type(DVORP_TENTACLE)) - return (true); + return true; if (grd(targ->pos()) != DNGN_SHALLOW_WATER) - return (false); + return false; const item_def *weapon = mons->weapon(); return (weapon && weapon_skill(*weapon) == SK_POLEARMS); @@ -3470,21 +3470,21 @@ bool can_go_straight(const monster* mon, const coord_def& p1, { // If no distance, then trivially true if (p1 == p2) - return (true); + return true; if (distance(p1, p2) > get_los_radius_sq()) - return (false); + return false; // XXX: Hack to improve results for now. See FIXME above. ray_def ray; if (!find_ray(p1, p2, ray, opc_immob)) - return (false); + return false; while (ray.advance() && ray.pos() != p2) if (!_can_safely_go_through(mon, ray.pos())) - return (false); + return false; - return (true); + return true; } // The default suitable() function for choose_random_nearby_monster(). @@ -3584,10 +3584,10 @@ bool simple_monster_message(const monster* mons, const char *event, channel = MSGCH_FRIEND_ACTION; mpr(msg.c_str(), channel, param); - return (true); + return true; } - return (false); + return false; } static bool _mons_avoids_cloud(const monster* mons, const cloud_struct& cloud, @@ -3602,7 +3602,7 @@ static bool _mons_avoids_cloud(const monster* mons, const cloud_struct& cloud, // Berserk monsters are less careful and will blindly plow through any // dangerous cloud, just to kill you. {due} if (!extra_careful && mons->berserk()) - return (false); + return false; if (you.religion == GOD_FEDHAS && fedhas_protects(mons) && (cloud.whose == KC_YOU || cloud.whose == KC_FRIENDLY) @@ -3620,117 +3620,117 @@ static bool _mons_avoids_cloud(const monster* mons, const cloud_struct& cloud, case CLOUD_FIRE: case CLOUD_FOREST_FIRE: if (mons->res_fire() > 1) - return (false); + return false; if (extra_careful) - return (true); + return true; if (mons_intel(mons) >= I_ANIMAL && mons->res_fire() < 0) - return (true); + return true; if (mons->hit_points >= 15 + random2avg(46, 5)) - return (false); + return false; break; case CLOUD_MEPHITIC: if (mons->res_poison() > 0) - return (false); + return false; if (extra_careful) - return (true); + return true; if (mons_intel(mons) >= I_ANIMAL && mons->res_poison() < 0) - return (true); + return true; if (x_chance_in_y(mons->hit_dice - 1, 5)) - return (false); + return false; if (mons->hit_points >= random2avg(19, 2)) - return (false); + return false; break; case CLOUD_COLD: if (mons->res_cold() > 1) - return (false); + return false; if (extra_careful) - return (true); + return true; if (mons_intel(mons) >= I_ANIMAL && mons->res_cold() < 0) - return (true); + return true; if (mons->hit_points >= 15 + random2avg(46, 5)) - return (false); + return false; break; case CLOUD_POISON: if (mons->res_poison() > 0) - return (false); + return false; if (extra_careful) - return (true); + return true; if (mons_intel(mons) >= I_ANIMAL && mons->res_poison() < 0) - return (true); + return true; if (mons->hit_points >= random2avg(37, 4)) - return (false); + return false; break; case CLOUD_GREY_SMOKE: if (placement) - return (false); + return false; // This isn't harmful, but dumb critters might think so. if (mons_intel(mons) > I_ANIMAL || coinflip()) - return (false); + return false; if (mons->res_fire() > 0) - return (false); + return false; if (mons->hit_points >= random2avg(19, 2)) - return (false); + return false; break; case CLOUD_RAIN: // Fiery monsters dislike the rain. if (mons->is_fiery() && extra_careful) - return (true); + return true; // We don't care about what's underneath the rain cloud if we can fly. if (mons->flight_mode() != FL_NONE) - return (false); + return false; // These don't care about deep water. if (monster_habitable_grid(mons, DNGN_DEEP_WATER)) - return (false); + return false; // This position could become deep water, and they might drown. if (grd(cloud.pos) == DNGN_SHALLOW_WATER) - return (true); + return true; // Otherwise, it's safe for everyone else. - return (false); + return false; break; case CLOUD_TORNADO: // Ball lightnings are not afraid of a _storm_, duh. Or elementals. if (mons->res_wind()) - return (false); + return false; // Locust swarms are too stupid to avoid winds. return (mons_intel(mons) >= I_ANIMAL); case CLOUD_PETRIFY: if (mons->res_petrify() > 0) - return (false); + return false; if (extra_careful) - return (true); + return true; if (mons_intel(mons) >= I_ANIMAL && mons->res_petrify() < 0) - return (true); + return true; break; @@ -3742,11 +3742,11 @@ static bool _mons_avoids_cloud(const monster* mons, const cloud_struct& cloud, if (is_harmless_cloud(cl_type) || mons_intel(mons) == I_PLANT && !extra_careful) { - return (false); + return false; } // If we get here, the cloud is potentially harmful. - return (true); + return true; } // Like the above, but allow a monster to move from one damaging cloud @@ -3754,23 +3754,23 @@ static bool _mons_avoids_cloud(const monster* mons, const cloud_struct& cloud, bool mons_avoids_cloud(const monster* mons, int cloud_num, bool placement) { if (cloud_num == EMPTY_CLOUD) - return (false); + return false; const cloud_struct &cloud = env.cloud[cloud_num]; // Is the target cloud okay? if (!_mons_avoids_cloud(mons, cloud, placement)) - return (false); + return false; // If we're already in a cloud that we'd want to avoid then moving // from one to the other is okay. if (!in_bounds(mons->pos()) || mons->pos() == cloud.pos) - return (true); + return true; const int our_cloud_num = env.cgrid(mons->pos()); if (our_cloud_num == EMPTY_CLOUD) - return (true); + return true; const cloud_struct &our_cloud = env.cloud[our_cloud_num]; @@ -3784,7 +3784,7 @@ int mons_thrown_weapon_damage(const item_def *weap, if (!weap || (only_returning_weapons && get_weapon_brand(*weap) != SPWPN_RETURNING)) { - return (0); + return 0; } return std::max(0, (property(*weap, PWPN_DAMAGE) + weap->plus2 / 2)); @@ -3800,7 +3800,7 @@ int mons_missile_damage(monster* mons, const item_def *launch, const item_def *missile) { if (!missile || (!launch && !is_throwable(mons, *missile))) - return (0); + return 0; const int missile_damage = property(*missile, PWPN_DAMAGE) / 2 + 1; const int launch_damage = launch? property(*launch, PWPN_DAMAGE) : 0; @@ -3846,7 +3846,7 @@ int mons_pick_best_missile(monster* mons, item_def **launcher, const int fdam = mons_missile_damage(mons, launch, missiles); if (!tdam && !fdam) - return (NON_ITEM); + return NON_ITEM; else if (tdam >= fdam) return (melee->index()); else @@ -3960,9 +3960,9 @@ bool monster_descriptor(monster_type which_class, mon_desc_type which_descriptor case MONS_PEARL_DRAGON: case MONS_YAK: case MONS_SHEEP: - return (true); + return true; default: - return (false); + return false; } } @@ -3986,9 +3986,9 @@ bool monster_descriptor(monster_type which_class, mon_desc_type which_descriptor case MONS_LERNAEAN_HYDRA: case MONS_DISSOLUTION: case MONS_TEST_SPAWNER: - return (true); + return true; default: - return (false); + return false; } } @@ -3999,20 +3999,20 @@ bool monster_descriptor(monster_type which_class, mon_desc_type which_descriptor if (mons_class_is_zombified(which_class) && which_class != MONS_SPECTRAL_THING) { - return (true); + return true; } switch (which_class) { case MONS_RAKSHASA: case MONS_RAKSHASA_FAKE: - return (true); + return true; default: - return (false); + return false; } } - return (false); + return false; } monster* get_current_target() @@ -4163,7 +4163,7 @@ int dismiss_monsters(std::string pattern) } } - return (ndismissed); + return ndismissed; } // Does the equivalent of KILL_RESET on all monsters in LOS. Should only be @@ -4204,18 +4204,18 @@ bool is_item_jelly_edible(const item_def &item) { // Don't eat artefacts. if (is_artefact(item)) - return (false); + return false; // Don't eat mimics. if (item.flags & ISFLAG_MIMIC) - return (false); + return false; // Shouldn't eat stone things // - but what about wands and rings? if (item.base_type == OBJ_MISSILES && (item.sub_type == MI_STONE || item.sub_type == MI_LARGE_ROCK)) { - return (false); + return false; } // Don't eat special game items. @@ -4224,10 +4224,10 @@ bool is_item_jelly_edible(const item_def &item) && (item.sub_type == MISC_RUNE_OF_ZOT || item.sub_type == MISC_HORN_OF_GERYON))) { - return (false); + return false; } - return (true); + return true; } bool monster_space_valid(const monster* mons, coord_def target, @@ -4263,7 +4263,7 @@ static bool _monster_random_space(const monster* mons, coord_def& target, return true; } - return (false); + return false; } void monster_teleport(monster* mons, bool instan, bool silent) @@ -4445,7 +4445,7 @@ std::string summoned_poof_msg(const monster* mons, bool plural) // Conjugate. msg = make_stringf(msg.c_str(), plural ? "" : "s"); - return (msg); + return msg; } std::string summoned_poof_msg(const int midx, const item_def &item) @@ -4488,7 +4488,7 @@ static bool _mons_reaped(actor *killer, monster* victim) if (animate_remains(victim->pos(), CORPSE_BODY, beh, hitting, killer, "", GOD_NO_GOD, true, true, true, &zombie) <= 0) { - return (false); + return false; } if (you.can_see(victim)) @@ -4498,7 +4498,7 @@ static bool _mons_reaped(actor *killer, monster* victim) player_angers_monster(zombie); - return (true); + return true; } beh_type attitude_creation_behavior(mon_attitude_type att) @@ -4506,15 +4506,15 @@ beh_type attitude_creation_behavior(mon_attitude_type att) switch (att) { case ATT_NEUTRAL: - return (BEH_NEUTRAL); + return BEH_NEUTRAL; case ATT_GOOD_NEUTRAL: - return (BEH_GOOD_NEUTRAL); + return BEH_GOOD_NEUTRAL; case ATT_STRICT_NEUTRAL: - return (BEH_STRICT_NEUTRAL); + return BEH_STRICT_NEUTRAL; case ATT_FRIENDLY: - return (BEH_FRIENDLY); + return BEH_FRIENDLY; default: - return (BEH_HOSTILE); + return BEH_HOSTILE; } } @@ -4624,7 +4624,7 @@ int count_monsters(monster_type mtyp, bool friendlyOnly) count++; } } - return (count); + return count; } int count_allies() diff --git a/crawl-ref/source/mon-transit.cc b/crawl-ref/source/mon-transit.cc index 69389a72ff..2fc0ad977f 100644 --- a/crawl-ref/source/mon-transit.cc +++ b/crawl-ref/source/mon-transit.cc @@ -260,11 +260,11 @@ bool follower::place(bool near_player) m->flags |= MF_JUST_SUMMONED; restore_mons_items(*m); env.mid_cache[m->mid] = m->mindex(); - return (true); + return true; } m->reset(); - return (false); + return false; } void follower::restore_mons_items(monster& m) @@ -297,22 +297,22 @@ static bool _is_religious_follower(const monster* mon) static bool _tag_follower_at(const coord_def &pos, bool &real_follower) { if (!in_bounds(pos) || pos == you.pos()) - return (false); + return false; monster* fol = monster_at(pos); if (fol == NULL) - return (false); + return false; if (!fol->alive() || fol->speed_increment < 50 || fol->incapacitated() || mons_is_stationary(fol)) { - return (false); + return false; } if (!monster_habitable_grid(fol, DNGN_FLOOR)) - return (false); + return false; // Only non-wandering friendly monsters or those actively // seeking the player will follow up/down stairs. @@ -320,7 +320,7 @@ static bool _tag_follower_at(const coord_def &pos, bool &real_follower) && (!mons_is_seeking(fol) || fol->foe != MHITYOU) || fol->foe == MHITNOT) { - return (false); + return false; } // Monsters that are not directly adjacent are subject to more @@ -328,12 +328,12 @@ static bool _tag_follower_at(const coord_def &pos, bool &real_follower) if ((pos - you.pos()).abs() > 2) { if (!fol->friendly()) - return (false); + return false; // Undead will follow Yredelemnul worshippers, and orcs will // follow Beogh worshippers. if (!_is_religious_follower(fol)) - return (false); + return false; } // Monsters that can't use stairs can still be marked as followers @@ -344,9 +344,9 @@ static bool _tag_follower_at(const coord_def &pos, bool &real_follower) if (_is_religious_follower(fol)) { fol->flags |= MF_TAKING_STAIRS; - return (true); + return true; } - return (false); + return false; } real_follower = true; @@ -364,7 +364,7 @@ static bool _tag_follower_at(const coord_def &pos, bool &real_follower) dprf("%s is marked for following.", fol->name(DESC_THE, true).c_str()); - return (true); + return true; } static int follower_tag_radius2() @@ -375,7 +375,7 @@ static int follower_tag_radius2() { if (const monster* mon = monster_at(*ai)) if (!mon->friendly()) - return (2); + return 2; } return (6 * 6); diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index fd9dd756a4..8d6a635e37 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -86,18 +86,18 @@ static int _mons_exp_mod(monster_type mclass); static habitat_type _grid2habitat(dungeon_feature_type grid) { if (feat_is_watery(grid)) - return (HT_WATER); + return HT_WATER; if (feat_is_rock(grid) && !feat_is_permarock(grid)) - return (HT_ROCK); + return HT_ROCK; switch (grid) { case DNGN_LAVA: - return (HT_LAVA); + return HT_LAVA; case DNGN_FLOOR: default: - return (HT_LAND); + return HT_LAND; } } @@ -106,15 +106,15 @@ dungeon_feature_type habitat2grid(habitat_type ht) switch (ht) { case HT_WATER: - return (DNGN_DEEP_WATER); + return DNGN_DEEP_WATER; case HT_LAVA: - return (DNGN_LAVA); + return DNGN_LAVA; case HT_ROCK: - return (DNGN_ROCK_WALL); + return DNGN_ROCK_WALL; case HT_LAND: case HT_AMPHIBIOUS: default: - return (DNGN_FLOOR); + return DNGN_FLOOR; } } @@ -217,7 +217,7 @@ monster_type get_monster_by_name(std::string name, bool exact) if (match == 0) break; } - return (mon); + return mon; } void init_monsters() @@ -278,15 +278,15 @@ void init_monster_symbols() static bool _get_kraken_head(const monster*& mon) { if (!valid_kraken_connection(mon)) - return (false); + return false; // For kraken tentacle segments, find the associated tentacle. if (mon->type == MONS_KRAKEN_TENTACLE_SEGMENT) { if (invalid_monster_index(mon->number)) - return (false); + return false; if (invalid_monster(&menv[mon->number])) - return (false); + return false; mon = &menv[mon->number]; } @@ -295,14 +295,14 @@ static bool _get_kraken_head(const monster*& mon) if (mon->type == MONS_KRAKEN_TENTACLE) { if (invalid_monster_index(mon->number)) - return (false); + return false; if (invalid_monster(&menv[mon->number])) - return (false); + return false; mon = &menv[mon->number]; } - return (true); + return true; } const mon_resist_def &get_mons_class_resists(monster_type mc) @@ -338,7 +338,7 @@ mon_resist_def get_mons_resists(const monster* mon) if (mon->holiness() == MH_UNDEAD) resists.poison += 1; - return (resists); + return resists; } monster* monster_at(const coord_def &pos) @@ -404,7 +404,7 @@ int scan_mon_inv_randarts(const monster* mon, } } - return (ret); + return ret; } mon_holy_type mons_class_holiness(monster_type mc) @@ -456,7 +456,7 @@ bool mons_has_body(const monster* mon) || mon->type == MONS_CURSE_TOE || mon->type == MONS_DANCING_WEAPON) { - return (false); + return false; } switch (mons_base_char(mon->type)) @@ -467,10 +467,10 @@ bool mons_has_body(const monster* mon) case '*': case '%': case 'J': - return (false); + return false; } - return (true); + return true; } bool mons_has_flesh(const monster* mon) @@ -616,14 +616,14 @@ bool mons_is_native_in_branch(const monster* mons, return (mons->type == MONS_DANCING_WEAPON); default: - return (false); + return false; } } bool mons_is_poisoner(const monster* mon) { if (chunk_is_poisonous(mons_corpse_effect(mon->type))) - return (true); + return true; if (mon->has_attack_flavour(AF_POISON) || mon->has_attack_flavour(AF_POISON_NASTY) @@ -634,17 +634,17 @@ bool mons_is_poisoner(const monster* mon) || mon->has_attack_flavour(AF_POISON_DEX) || mon->has_attack_flavour(AF_POISON_STAT)) { - return (true); + return true; } if (mon->type == MONS_DANCING_WEAPON && mon->primary_weapon() && get_weapon_brand(*mon->primary_weapon()) == SPWPN_VENOM) { - return (true); + return true; } - return (false); + return false; } // Monsters considered as "slime" for Jiyva. @@ -718,12 +718,12 @@ bool invalid_monster_index(int i) bool mons_is_statue(monster_type mc, bool allow_disintegrate) { if (mc == MONS_ORANGE_STATUE || mc == MONS_SILVER_STATUE) - return (true); + return true; if (!allow_disintegrate) return (mc == MONS_ICE_STATUE || mc == MONS_ROXANNE); - return (false); + return false; } bool mons_is_mimic(monster_type mc) @@ -896,10 +896,10 @@ bool mons_is_demon(monster_type mc) if (mons_class_holiness(mc) == MH_DEMONIC && (isadigit(show_char) || show_char == '&')) { - return (true); + return true; } - return (false); + return false; } int mons_demon_tier(monster_type mc) @@ -974,11 +974,11 @@ monster_type mons_genus(monster_type mc) || mc == RANDOM_NONBASE_DRACONIAN || (mc == MONS_PLAYER_ILLUSION && player_genus(GENPC_DRACONIAN))) { - return (MONS_DRACONIAN); + return MONS_DRACONIAN; } if (mc == MONS_NO_MONSTER) - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; ASSERT(smc); return (smc->genus); @@ -1001,7 +1001,7 @@ monster_type draco_subspecies(const monster* mon) if (retval == MONS_DRACONIAN && mon->type != MONS_DRACONIAN) retval = mon->base_monster; - return (retval); + return retval; } int get_shout_noise_level(const shout_type shout) @@ -1034,7 +1034,7 @@ int get_shout_noise_level(const shout_type shout) static bool _shout_fits_monster(monster_type mc, int shout) { if (shout == NUM_SHOUTS || shout >= NUM_LOUDNESS || shout == S_SILENT) - return (false); + return false; // Chaos spawns can do anything but demon taunts, since they're // not coherent enough to actually say words. @@ -1054,9 +1054,9 @@ static bool _shout_fits_monster(monster_type mc, int shout) case S_WHINE: // The beast cannot speak. case S_DEMON_TAUNT: - return (false); + return false; default: - return (true); + return true; } } @@ -1076,7 +1076,7 @@ shout_type mons_shouts(monster_type mc, bool demon_shout) while (!_shout_fits_monster(mc, u)); } - return (u); + return u; } bool mons_is_ghost_demon(monster_type mc) @@ -1142,7 +1142,7 @@ mon_itemeat_type mons_itemeat(const monster* mon) return _mons_class_itemeat(mons_zombie_base(mon)); if (mon->has_ench(ENCH_EAT_ITEMS)) - return (MONEAT_ITEMS); + return MONEAT_ITEMS; return _mons_class_itemeat(mon->type); } @@ -1163,7 +1163,7 @@ bool mons_can_regenerate(const monster* mon) _get_kraken_head(mon); if (testbits(mon->flags, MF_NO_REGEN)) - return (false); + return false; return (mons_class_can_regenerate(mon->type)); } @@ -1188,13 +1188,13 @@ zombie_size_type zombie_class_size(monster_type cs) case MONS_ZOMBIE_SMALL: case MONS_SIMULACRUM_SMALL: case MONS_SKELETON_SMALL: - return (Z_SMALL); + return Z_SMALL; case MONS_ZOMBIE_LARGE: case MONS_SIMULACRUM_LARGE: case MONS_SKELETON_LARGE: - return (Z_BIG); + return Z_BIG; case MONS_SPECTRAL_THING: - return (Z_NOZOMBIE); + return Z_NOZOMBIE; default: die("invalid zombie type"); } @@ -1309,13 +1309,13 @@ bool name_zombie(monster* mon, monster_type mc, const std::string &mon_name) if (starts_with(mon->mname, "shaped ")) mon->flags |= MF_NAME_SUFFIX; - return (true); + return true; } bool name_zombie(monster* mon, const monster* orig) { if (!mons_is_unique(orig->type) && orig->mname.empty()) - return (false); + return false; std::string name; @@ -1339,7 +1339,7 @@ static int _downscale_zombie_damage(int damage) if (damage > 14) damage--; - return (damage); + return damage; } static mon_attack_def _downscale_zombie_attack(const monster* mons, @@ -1367,7 +1367,7 @@ static mon_attack_def _downscale_zombie_attack(const monster* mons, attk.damage = _downscale_zombie_damage(attk.damage); - return (attk); + return attk; } mon_attack_def mons_attack_spec(const monster* mon, int attk_number) @@ -1524,7 +1524,7 @@ flight_type mons_flies(const monster* mon, bool temp) if (temp && ret == FL_NONE && mon->has_ench(ENCH_LEVITATION)) ret = FL_LEVITATE; - return (ret); + return ret; } bool mons_flattens_trees(const monster* mon) @@ -1560,7 +1560,7 @@ int hit_points(int hit_dice, int min_hp, int rand_hp) hrolled += min_hp; } - return (hrolled); + return hrolled; } // This function returns the standard number of hit dice for a type of @@ -1577,7 +1577,7 @@ int mons_avg_hp(monster_type mc) const monsterentry* me = get_monster_data(mc); if (!me) - return (0); + return 0; // [ds] XXX: Use monster experience value as a better indicator of diff.? return (me->hpdice[0] * (me->hpdice[1] + (me->hpdice[2]/2)) @@ -1633,7 +1633,7 @@ int exper_value(const monster* mon, bool real) // Early out for no XP monsters. if (mons_class_flag(mc, M_NO_EXP_GAIN)) - return (0); + return 0; // The beta26 statues have non-spell-like abilities that the experience // code can't see, so inflate their XP a bit. Ice statues and Roxanne @@ -1761,7 +1761,7 @@ int exper_value(const monster* mon, bool real) else if (x_val > 15000) x_val = 15000; - return (x_val); + return x_val; } monster_type random_draconian_monster_species() @@ -1854,7 +1854,7 @@ static bool _get_spellbook_list(mon_spellbook_type book[6], break; } - return (retval); + return retval; } static void _mons_load_spells(monster* mon, mon_spellbook_type book) @@ -1908,7 +1908,7 @@ colour_t random_monster_colour() while (col == DARKGREY) col = random_colour(); - return (col); + return col; } // Butterflies @@ -1934,7 +1934,7 @@ static colour_t _random_large_abomination_colour() col = random_monster_colour(); while (col == MAGENTA || col == GREEN); - return (col); + return col; } static colour_t _random_small_abomination_colour() @@ -1948,7 +1948,7 @@ static colour_t _random_small_abomination_colour() col = random_monster_colour(); while (col == MAGENTA || col == BROWN || col == LIGHTCYAN); - return (col); + return col; } bool init_abomination(monster* mon, int hd) @@ -1957,12 +1957,12 @@ bool init_abomination(monster* mon, int hd) || mon->type == MONS_MACABRE_MASS) { mon->hit_points = mon->max_hit_points = mon->hit_dice = hd; - return (true); + return true; } else if (mon->type != MONS_ABOMINATION_LARGE && mon->type != MONS_ABOMINATION_SMALL) { - return (false); + return false; } const int max_hd = mon->type == MONS_ABOMINATION_LARGE ? 30 : 15; @@ -1987,7 +1987,7 @@ bool init_abomination(monster* mon, int hd) mon->ev = std::min(max_ac, 4 + hd); } - return (true); + return true; } // Generate a shiny, new and unscarred monster. @@ -2227,7 +2227,7 @@ int str_to_ugly_thing_colour(const std::string &s) for (int i = 0, size = ARRAYSZ(ugly_colour_values); i < size; ++i) if (s == ugly_colour_names[i]) return ugly_colour_values[i]; - return (BLACK); + return BLACK; } int ugly_thing_colour_offset(colour_t colour) @@ -2235,7 +2235,7 @@ int ugly_thing_colour_offset(colour_t colour) for (unsigned i = 0; i < ARRAYSZ(ugly_colour_values); ++i) { if (make_low_colour(colour) == ugly_colour_values[i]) - return (i); + return i; } return (-1); @@ -2267,7 +2267,7 @@ monster_type draconian_colour_by_name(const std::string &name) return (static_cast<monster_type>(i + MONS_BLACK_DRACONIAN)); } - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; } std::string mons_type_name(monster_type mc, description_level_type desc) @@ -2288,19 +2288,19 @@ std::string mons_type_name(monster_type mc, description_level_type desc) { case RANDOM_MONSTER: result += "random monster"; - return (result); + return result; case RANDOM_DRACONIAN: result += "random draconian"; - return (result); + return result; case RANDOM_BASE_DRACONIAN: result += "random base draconian"; - return (result); + return result; case RANDOM_NONBASE_DRACONIAN: result += "random nonbase draconian"; - return (result); + return result; case WANDERING_MONSTER: result += "wandering monster"; - return (result); + return result; default: ; } @@ -2309,7 +2309,7 @@ std::string mons_type_name(monster_type mc, description_level_type desc) if (me == NULL) { result += make_stringf("invalid type %d", mc); - return (result); + return result; } result += me->name; @@ -2325,7 +2325,7 @@ std::string mons_type_name(monster_type mc, description_level_type desc) result.insert(1, "n"); } - return (result); + return result; } static std::string _get_proper_monster_name(const monster* mon) @@ -2336,16 +2336,16 @@ static std::string _get_proper_monster_name(const monster* mon) std::string name = getRandNameString(me->name, " name"); if (!name.empty()) - return (name); + return name; name = getRandNameString(get_monster_data(mons_genus(mon->type))->name, " name"); if (!name.empty()) - return (name); + return name; name = getRandNameString("generic_monster_name"); - return (name); + return name; } // Names a previously unnamed monster. @@ -2353,7 +2353,7 @@ bool give_monster_proper_name(monster* mon, bool orcs_only) { // Already has a unique name. if (mon->is_named()) - return (false); + return false; // Since this is called from the various divine blessing routines, // don't bless non-orcs, and normally don't bless plain orcs, either. @@ -2362,7 +2362,7 @@ bool give_monster_proper_name(monster* mon, bool orcs_only) if (mons_genus(mon->type) != MONS_ORC || mon->type == MONS_ORC && !one_chance_in(8)) { - return (false); + return false; } } @@ -2380,7 +2380,7 @@ monsterentry *get_monster_data(monster_type mc) if (mc >= 0 && mc < NUM_MONSTERS) return (&mondata[mon_entry[mc]]); else - return (NULL); + return NULL; } static int _mons_exp_mod(monster_type mc) @@ -2442,7 +2442,7 @@ static habitat_type _mons_class_habitat(monster_type mc, if (ht == HT_LAND && st >= SIZE_GIANT || mc == MONS_GREY_DRACONIAN) ht = HT_AMPHIBIOUS; } - return (ht); + return ht; } habitat_type mons_habitat(const monster* mon, bool real_amphibious) @@ -2455,7 +2455,7 @@ habitat_type mons_class_primary_habitat(monster_type mc) habitat_type ht = _mons_class_habitat(mc); if (ht == HT_AMPHIBIOUS) ht = HT_LAND; - return (ht); + return ht; } habitat_type mons_primary_habitat(const monster* mon) @@ -2470,7 +2470,7 @@ habitat_type mons_class_secondary_habitat(monster_type mc) ht = HT_WATER; else if (ht == HT_ROCK) ht = HT_LAND; - return (ht); + return ht; } habitat_type mons_secondary_habitat(const monster* mon) @@ -2501,7 +2501,7 @@ bool mons_aligned(const actor *m1, const actor *m2) const monster* mon1, *mon2; if (!m1 || !m2) - return (true); + return true; if (m1->is_player()) fr1 = ATT_FRIENDLY; @@ -2509,7 +2509,7 @@ bool mons_aligned(const actor *m1, const actor *m2) { mon1 = static_cast<const monster* >(m1); if (mons_is_projectile(mon1->type)) - return (true); + return true; fr1 = mons_attitude(mon1); } @@ -2519,7 +2519,7 @@ bool mons_aligned(const actor *m1, const actor *m2) { mon2 = static_cast<const monster* >(m2); if (mons_is_projectile(mon2->type)) - return (true); + return true; fr2 = mons_attitude(mon2); } @@ -2529,7 +2529,7 @@ bool mons_aligned(const actor *m1, const actor *m2) bool mons_atts_aligned(mon_attitude_type fr1, mon_attitude_type fr2) { if (mons_att_wont_attack(fr1) && mons_att_wont_attack(fr2)) - return (true); + return true; return (fr1 == fr2); } @@ -2542,7 +2542,7 @@ bool mons_class_wields_two_weapons(monster_type mc) bool mons_wields_two_weapons(const monster* mon) { if (testbits(mon->flags, MF_TWO_WEAPONS)) - return (true); + return true; return (mons_class_wields_two_weapons(mons_base_type(mon))); } @@ -2728,15 +2728,15 @@ static bool _mons_should_fire_beneficial(bolt &beam) if (beam.friend_info.count == 0 || beam.foe_info.count != 0) { - return (false); + return false; } // Should beneficial monster enchantment beams be allowed in a // sanctuary? -cao if (is_sanctuary(you.pos()) || is_sanctuary(beam.source)) - return (false); + return false; - return (true); + return true; } static bool _beneficial_beam_flavour(beam_type flavour) @@ -2746,10 +2746,10 @@ static bool _beneficial_beam_flavour(beam_type flavour) case BEAM_HASTE: case BEAM_HEALING: case BEAM_INVISIBILITY: - return (true); + return true; default: - return (false); + return false; } } @@ -2780,7 +2780,7 @@ bool mons_should_fire(struct bolt &beam) { monster& m = menv[beam.beam_source]; if (m.alive() && m.friendly() && beam.target == you.pos()) - return (false); + return false; } // Use of foeRatio: @@ -2791,14 +2791,14 @@ bool mons_should_fire(struct bolt &beam) // Quick check - did we in fact get any foes? if (beam.foe_info.count == 0) - return (false); + return false; if (is_sanctuary(you.pos()) || is_sanctuary(beam.source)) - return (false); + return false; // If we hit no friends, fire away. if (beam.friend_info.count == 0) - return (true); + return true; // Only fire if they do acceptably low collateral damage. return (beam.foe_info.power >= @@ -2813,7 +2813,7 @@ static bool _ms_los_spell(spell_type monspell) // water just like the kraken is, so it makes more sense not to // count them here. if (monspell == SPELL_KRAKEN_TENTACLES) - return (false); + return false; if (monspell == SPELL_SMITING || monspell == SPELL_AIRSTRIKE @@ -2822,10 +2822,10 @@ static bool _ms_los_spell(spell_type monspell) || monspell == SPELL_SUMMON_SPECTRAL_ORCS || spell_typematch(monspell, SPTYP_SUMMONING)) { - return (true); + return true; } - return (false); + return false; } static bool _ms_ranged_spell(spell_type monspell, bool attack_only = false, @@ -2837,7 +2837,7 @@ static bool _ms_ranged_spell(spell_type monspell, bool attack_only = false, && (monspell == SPELL_SMITING || monspell == SPELL_AIRSTRIKE || monspell == SPELL_MISLEAD)) { - return (true); + return true; } // These spells are ranged, but aren't direct attack spells. @@ -2859,7 +2859,7 @@ static bool _ms_ranged_spell(spell_type monspell, bool attack_only = false, case SPELL_BLINK_RANGE: case SPELL_BERSERKER_RAGE: case SPELL_SWIFTNESS: - return (false); + return false; // The animation spells don't work through transparent walls and // thus are listed here instead of above. @@ -2875,11 +2875,11 @@ static bool _ms_ranged_spell(spell_type monspell, bool attack_only = false, case SPELL_BLINK_OTHER_CLOSE: case SPELL_BLINK_AWAY: case SPELL_BLINK_OTHER: - return (ench_too); + return ench_too; default: // All conjurations count as ranged spells. - return (true); + return true; } } @@ -2893,18 +2893,18 @@ bool mons_has_los_ability(monster_type mon_type) || mon_type == MONS_GOLDEN_EYE || mon_type == MONS_MOTH_OF_WRATH) { - return (true); + return true; } // Although not using spells, these are exceedingly dangerous. if (mon_type == MONS_SILVER_STATUE || mon_type == MONS_ORANGE_STATUE) - return (true); + return true; // Beholding just needs LOS. if (mons_genus(mon_type) == MONS_MERMAID) - return (true); + return true; - return (false); + return false; } bool mons_has_ranged_spell(const monster* mon, bool attack_only, @@ -2912,16 +2912,16 @@ bool mons_has_ranged_spell(const monster* mon, bool attack_only, { // Monsters may have spell-like abilities. if (mons_has_los_ability(mon->type)) - return (true); + return true; if (mon->can_use_spells()) { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (_ms_ranged_spell(mon->spells[i], attack_only, ench_too)) - return (true); + return true; } - return (false); + return false; } static bool _mons_has_ranged_ability(const monster* mon) @@ -2962,11 +2962,11 @@ static bool _mons_has_ranged_weapon(const monster* mon) if (!missile && weapon != primary && primary && get_weapon_brand(*primary) == SPWPN_RETURNING) { - return (true); + return true; } if (!missile) - return (false); + return false; return (is_launched(mnc, weapon, *missile)); } @@ -3128,10 +3128,10 @@ static bool _mons_has_smite_attack(const monster* mons) || hspell_pass[i] == SPELL_AIRSTRIKE || hspell_pass[i] == SPELL_MISLEAD) { - return (true); + return true; } - return (false); + return false; } // Determines if a monster is smart and pushy enough to displace other @@ -3146,7 +3146,7 @@ bool monster_shover(const monster* m) { const monsterentry *me = get_monster_data(m->type); if (!me) - return (false); + return false; // Efreet and fire elementals are disqualified because they leave behind // clouds of flame. Rotting devils are disqualified because they trail @@ -3154,17 +3154,17 @@ bool monster_shover(const monster* m) if (mons_genus(m->type) == MONS_EFREET || m->type == MONS_FIRE_ELEMENTAL || m->type == MONS_ROTTING_DEVIL || m->type == MONS_CURSE_TOE) { - return (false); + return false; } // Monsters too stupid to use stairs (e.g. non-spectral zombified undead) // are also disqualified. if (!mons_can_use_stairs(m)) - return (false); + return false; // Smiters profit from staying back and smiting. if (_mons_has_smite_attack(m)) - return (false); + return false; char mchar = me->basechar; @@ -3185,7 +3185,7 @@ bool monster_senior(const monster* m1, const monster* m2, bool fleeing) *me2 = get_monster_data(m2->type); if (!me1 || !me2) - return (false); + return false; // Band leaders can displace followers regardless of type considerations. // -cao @@ -3193,14 +3193,14 @@ bool monster_senior(const monster* m1, const monster* m2, bool fleeing) { unsigned leader_mid = m2->props["band_leader"].get_int(); if (leader_mid == m1->mid) - return (true); + return true; } // And prevent followers to displace the leader to avoid constant swapping. else if (m1->props.exists("band_leader")) { unsigned leader_mid = m1->props["band_leader"].get_int(); if (leader_mid == m2->mid) - return (false); + return false; } char mchar1 = me1->basechar; @@ -3222,27 +3222,27 @@ bool monster_senior(const monster* m1, const monster* m2, bool fleeing) if (m1->holiness() == m2->holiness() && mons_can_use_stairs(m1) && !mons_can_use_stairs(m2)) { - return (true); + return true; } if (mons_genus(m1->type) == MONS_KILLER_BEE && mons_genus(m2->type) == MONS_KILLER_BEE) { if (fleeing) - return (true); + return true; if (m1->type == MONS_QUEEN_BEE && m2->type != MONS_QUEEN_BEE) - return (true); + return true; if (m1->type == MONS_KILLER_BEE && m2->type == MONS_KILLER_BEE_LARVA) - return (true); + return true; } // Special-case gnolls, so they can't get past (hob)goblins. if (mons_species(m1->type) == MONS_GNOLL && mons_species(m2->type) != MONS_GNOLL) { - return (false); + return false; } return (mchar1 == mchar2 && (fleeing || m1->hit_dice > m2->hit_dice)); @@ -3277,10 +3277,10 @@ static bool _mons_can_open_doors(const monster* mon) bool mons_can_open_door(const monster* mon, const coord_def& pos) { if (env.markers.property_at(pos, MAT_ANY, "door_restrict") == "veto") - return (false); + return false; if (!_mons_can_open_doors(mon)) - return (false); + return false; dungeon_feature_type feat = env.grid(pos); return (feat == DNGN_CLOSED_DOOR @@ -3292,20 +3292,20 @@ bool mons_can_open_door(const monster* mon, const coord_def& pos) bool mons_can_eat_door(const monster* mon, const coord_def& pos) { if (env.markers.property_at(pos, MAT_ANY, "door_restrict") == "veto") - return (false); + return false; if (mons_itemeat(mon) != MONEAT_ITEMS) - return (false); + return false; dungeon_feature_type feat = env.grid(pos); if (feat == DNGN_OPEN_DOOR) - return (true); + return true; if (env.markers.property_at(pos, MAT_ANY, "door_restrict") == "veto" // Doors with permarock marker cannot be eaten. || feature_marker_at(pos, DNGN_PERMAROCK_WALL)) { - return (false); + return false; } return (feat == DNGN_CLOSED_DOOR); @@ -3322,17 +3322,17 @@ bool mons_can_traverse(const monster* mon, const coord_def& p, bool checktraps) { if (_mons_can_pass_door(mon, p)) - return (true); + return true; if (!mon->is_habitable(p)) - return (false); + return false; // Your friends only know about doors you know about, unless they feel // at home in this branch. if (grd(p) == DNGN_SECRET_DOOR && mon->friendly() && (mons_intel(mon) < I_NORMAL || !mons_is_native_in_branch(mon))) { - return (false); + return false; } const trap_def* ptrap = find_trap(p); @@ -3345,15 +3345,15 @@ bool mons_can_traverse(const monster* mon, const coord_def& p, && ptrap->is_known(mon) && mon->friendly()) { - return (false); + return false; } // Monsters cannot travel over teleport traps. if (!can_place_on_trap(mons_base_type(mon), tt)) - return (false); + return false; } - return (true); + return true; } void mons_remove_from_grid(const monster* mon) @@ -3372,7 +3372,7 @@ mon_inv_type equip_slot_to_mslot(equipment_type eq) case EQ_SHIELD: return MSLOT_SHIELD; case EQ_RINGS: case EQ_AMULET: return MSLOT_JEWELLERY; - default: return (NUM_MONSTER_SLOTS); + default: return NUM_MONSTER_SLOTS; } } @@ -3425,7 +3425,7 @@ static std::string _replace_god_name(god_type god, bool need_verb = false, if (need_verb) result += (god == GOD_NO_GOD) ? " are" : " is"; - return (result); + return result; } static std::string _get_species_insult(const std::string &species, @@ -3453,7 +3453,7 @@ static std::string _get_species_insult(const std::string &species, insult = getSpeakString(lookup); } - return (insult); + return insult; } static std::string _pluralise_player_genus() @@ -3468,7 +3468,7 @@ static std::string _pluralise_player_genus() else if (you.species != SP_DEMONSPAWN) sp += "s"; - return (sp); + return sp; } // Replaces the "@foo@" strings in monster shout and monster speak @@ -3807,7 +3807,7 @@ std::string do_mon_str_replacements(const std::string &in_msg, msg = apostrophise_fixup(msg); - return (msg); + return msg; } static mon_body_shape _get_ghost_shape(const monster* mon) @@ -3817,10 +3817,10 @@ static mon_body_shape _get_ghost_shape(const monster* mon) switch (ghost.species) { case SP_NAGA: - return (MON_SHAPE_NAGA); + return MON_SHAPE_NAGA; case SP_CENTAUR: - return (MON_SHAPE_CENTAUR); + return MON_SHAPE_CENTAUR; case SP_RED_DRACONIAN: case SP_WHITE_DRACONIAN: @@ -3832,10 +3832,10 @@ static mon_body_shape _get_ghost_shape(const monster* mon) case SP_MOTTLED_DRACONIAN: case SP_PALE_DRACONIAN: case SP_BASE_DRACONIAN: - return (MON_SHAPE_HUMANOID_TAILED); + return MON_SHAPE_HUMANOID_TAILED; default: - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; } } @@ -3859,170 +3859,170 @@ mon_body_shape get_mon_shape(const monster_type mc) switch (mons_base_char(mc)) { case 'a': // ants - return (MON_SHAPE_INSECT); + return MON_SHAPE_INSECT; case 'b': // bats and butterflies if (mc == MONS_BUTTERFLY) - return (MON_SHAPE_INSECT_WINGED); + return MON_SHAPE_INSECT_WINGED; else - return (MON_SHAPE_BAT); + return MON_SHAPE_BAT; case 'c': // centaurs - return (MON_SHAPE_CENTAUR); + return MON_SHAPE_CENTAUR; case 'd': // draconions and drakes if (mons_genus(mc) == MONS_DRACONIAN) { if (flies) - return (MON_SHAPE_HUMANOID_WINGED_TAILED); + return MON_SHAPE_HUMANOID_WINGED_TAILED; else - return (MON_SHAPE_HUMANOID_TAILED); + return MON_SHAPE_HUMANOID_TAILED; } else if (flies) - return (MON_SHAPE_QUADRUPED_WINGED); + return MON_SHAPE_QUADRUPED_WINGED; else - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'e': // elves - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'f': // fungi - return (MON_SHAPE_FUNGUS); + return MON_SHAPE_FUNGUS; case 'g': // gnolls, goblins and hobgoblins - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'h': // hounds - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'i': // spriggans - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'j': // snails - return (MON_SHAPE_SNAIL); + return MON_SHAPE_SNAIL; case 'k': // killer bees - return (MON_SHAPE_INSECT_WINGED); + return MON_SHAPE_INSECT_WINGED; case 'l': // lizards - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'm': // merfolk - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'n': // necrophages and ghouls - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'o': // orcs - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'p': // ghosts if (mc != MONS_INSUBSTANTIAL_WISP && !mons_is_pghost(mc)) // handled elsewhere { - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; } break; case 'q': // dwarves - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'r': // rodents - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 's': // arachnids and centipedes/cockroaches if (mc == MONS_GIANT_CENTIPEDE || mc == MONS_DEMONIC_CRAWLER) - return (MON_SHAPE_CENTIPEDE); + return MON_SHAPE_CENTIPEDE; else if (mc == MONS_GIANT_COCKROACH) - return (MON_SHAPE_INSECT); + return MON_SHAPE_INSECT; else - return (MON_SHAPE_ARACHNID); + return MON_SHAPE_ARACHNID; case 'u': // mutated type, not enough info to determine shape - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case 't': // crocodiles/turtles if (mc == MONS_SNAPPING_TURTLE || mc == MONS_ALLIGATOR_SNAPPING_TURTLE) { - return (MON_SHAPE_QUADRUPED_TAILLESS); + return MON_SHAPE_QUADRUPED_TAILLESS; } else - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'v': // vortices - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case 'w': // worms - return (MON_SHAPE_SNAKE); + return MON_SHAPE_SNAKE; case 'x': // small abominations - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case 'y': // winged insects - return (MON_SHAPE_INSECT_WINGED); + return MON_SHAPE_INSECT_WINGED; case 'z': // small zombies, etc. if (mc == MONS_WIGHT || mc == MONS_SKELETAL_WARRIOR || mc == MONS_FLAMING_CORPSE) { - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; } else // constructed type, not enough info to determine shape - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case 'A': // angelic beings - return (MON_SHAPE_HUMANOID_WINGED); + return MON_SHAPE_HUMANOID_WINGED; case 'B': // beetles - return (MON_SHAPE_INSECT); + return MON_SHAPE_INSECT; case 'C': // giants - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'D': // dragons if (flies) - return (MON_SHAPE_QUADRUPED_WINGED); + return MON_SHAPE_QUADRUPED_WINGED; else - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'E': // elementals - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case 'F': // frogs - return (MON_SHAPE_QUADRUPED_TAILLESS); + return MON_SHAPE_QUADRUPED_TAILLESS; case 'G': // floating eyeballs and orbs - return (MON_SHAPE_ORB); + return MON_SHAPE_ORB; case 'H': // minotaurs, manticores, hippogriffs and griffins if (mc == MONS_MINOTAUR || mc == MONS_TENGU) - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; else if (mc == MONS_MANTICORE) - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; else if (mc == MONS_HARPY) - return (MON_SHAPE_HUMANOID_WINGED); + return MON_SHAPE_HUMANOID_WINGED; else - return (MON_SHAPE_QUADRUPED_WINGED); + return MON_SHAPE_QUADRUPED_WINGED; case 'I': // ice beasts - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'J': // jellies and jellyfish - return (MON_SHAPE_BLOB); + return MON_SHAPE_BLOB; case 'K': // kobolds - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'L': // liches - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'M': // mummies - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'N': // nagas if (mons_genus(mc) == MONS_GUARDIAN_SERPENT) - return (MON_SHAPE_SNAKE); + return MON_SHAPE_SNAKE; else - return (MON_SHAPE_NAGA); + return MON_SHAPE_NAGA; case 'O': // ogres - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'P': // plants - return (MON_SHAPE_PLANT); + return MON_SHAPE_PLANT; case 'R': // rakshasas and efreet; humanoid? - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'S': // snakes - return (MON_SHAPE_SNAKE); + return MON_SHAPE_SNAKE; case 'T': // trolls - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'U': // bears - return (MON_SHAPE_QUADRUPED_TAILLESS); + return MON_SHAPE_QUADRUPED_TAILLESS; case 'V': // vampires - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'W': // wraiths, humanoid if not a spectral thing if (mc == MONS_SPECTRAL_THING) // constructed type, not enough info to determine shape - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; else - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; case 'X': // large abominations - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case 'Y': // yaks, sheep and elephants if (mc == MONS_SHEEP) - return (MON_SHAPE_QUADRUPED_TAILLESS); + return MON_SHAPE_QUADRUPED_TAILLESS; else - return (MON_SHAPE_QUADRUPED); + return MON_SHAPE_QUADRUPED; case 'Z': // large zombies, etc. // constructed type, not enough info to determine shape - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; case ';': // water monsters if (mc == MONS_ELECTRIC_EEL) - return (MON_SHAPE_SNAKE); + return MON_SHAPE_SNAKE; else - return (MON_SHAPE_FISH); + return MON_SHAPE_FISH; // The various demons, plus some golems and statues. And humanoids. case '1': @@ -4047,22 +4047,22 @@ mon_body_shape get_mon_shape(const monster_type mc) } if (flies && tailed) - return (MON_SHAPE_HUMANOID_WINGED_TAILED); + return MON_SHAPE_HUMANOID_WINGED_TAILED; else if (flies && !tailed) - return (MON_SHAPE_HUMANOID_WINGED); + return MON_SHAPE_HUMANOID_WINGED; else if (!flies && tailed) - return (MON_SHAPE_HUMANOID_TAILED); + return MON_SHAPE_HUMANOID_TAILED; else - return (MON_SHAPE_HUMANOID); + return MON_SHAPE_HUMANOID; } case '9': // gargoyles - return (MON_SHAPE_HUMANOID_WINGED_TAILED); + return MON_SHAPE_HUMANOID_WINGED_TAILED; case '*': // orbs - return (MON_SHAPE_ORB); + return MON_SHAPE_ORB; } - return (MON_SHAPE_MISC); + return MON_SHAPE_MISC; } std::string get_mon_shape_str(const mon_body_shape shape) @@ -4092,7 +4092,7 @@ bool player_or_mon_in_sanct(const monster* mons) bool mons_landlubbers_in_reach(const monster* mons) { if (mons_has_ranged_attack(mons)) - return (true); + return true; actor *act; for (radius_iterator ai(mons->pos(), @@ -4102,9 +4102,9 @@ bool mons_landlubbers_in_reach(const monster* mons) true); ai; ++ai) if ((act = actor_at(*ai)) && !mons_aligned(mons, act)) - return (true); + return true; - return (false); + return false; } int get_dist_to_nearest_monster() @@ -4133,7 +4133,7 @@ int get_dist_to_nearest_monster() if (dist < minRange) minRange = dist; } - return (minRange); + return minRange; } bool monster_nearby() diff --git a/crawl-ref/source/mon-util.h b/crawl-ref/source/mon-util.h index 5953aea282..8523c97466 100644 --- a/crawl-ref/source/mon-util.h +++ b/crawl-ref/source/mon-util.h @@ -27,7 +27,7 @@ struct mon_attack_def attack_flavour flav = AF_PLAIN) { mon_attack_def def = { typ, flav, dam }; - return (def); + return def; } }; diff --git a/crawl-ref/source/mon_resist_def.cc b/crawl-ref/source/mon_resist_def.cc index c919690d57..a1202b3a60 100644 --- a/crawl-ref/source/mon_resist_def.cc +++ b/crawl-ref/source/mon_resist_def.cc @@ -91,6 +91,6 @@ short mon_resist_def::get_resist_level(mon_resist_flags res_type) const case MR_RES_COLD: return cold; case MR_RES_ACID: return acid; case MR_RES_ROTTING: return rotting; - default: return (0); + default: return 0; } } diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index aed09f03e3..953f597089 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -229,10 +229,10 @@ bool monster::wants_submerge() const // Don't submerge if we just unsubmerged to shout. if (seen_context == SC_FISH_SURFACES_SHOUT) - return (false); + return false; if (!mons_is_retreating(this) && mons_can_move_towards_target(this)) - return (false); + return false; return (!mons_landlubbers_in_reach(this)); } @@ -243,7 +243,7 @@ bool monster::submerged() const // Can't find any reference to MF_SUBMERGED anywhere. Don't know what // this means. - abrahamwl if (has_ench(ENCH_SUBMERGED)) - return (true); + return true; if (grd(pos()) == DNGN_DEEP_WATER && (!monster_habitable_grid(this, DNGN_DEEP_WATER) @@ -251,10 +251,10 @@ bool monster::submerged() const && draco_subspecies(this) == MONS_GREY_DRACONIAN)) && !can_drown()) { - return (true); + return true; } - return (false); + return false; } bool monster::extra_balanced_at(const coord_def p) const @@ -324,7 +324,7 @@ bool monster::can_drown() const { case HT_WATER: case HT_LAVA: - return (false); + return false; default: break; } @@ -349,7 +349,7 @@ int monster::body_weight(bool /*base*/) const monster_type mc = mons_base_type(this); if (mc == MONS_RAKSHASA_FAKE || mc == MONS_MARA_FAKE) - return (0); + return 0; int weight = mons_weight(mc); @@ -420,7 +420,7 @@ int monster::body_weight(bool /*base*/) const if (mc == MONS_SLIME_CREATURE && number > 1) weight *= number; - return (weight); + return weight; } int monster::total_weight() const @@ -443,7 +443,7 @@ brand_type monster::damage_brand(int which_attack) if (mons_is_ghost_demon(type)) return (ghost->brand); - return (SPWPN_NORMAL); + return SPWPN_NORMAL; } return (!is_range_weapon(*mweap) ? @@ -492,14 +492,14 @@ int monster::missile_count() if (const item_def *missile = missiles()) return (missile->quantity); - return (0); + return 0; } item_def *monster::launcher() { item_def *weap = mslot_item(MSLOT_WEAPON); if (weap && is_range_weapon(*weap)) - return (weap); + return weap; weap = mslot_item(MSLOT_ALT_WEAPON); return (weap && is_range_weapon(*weap) ? weap : NULL); @@ -516,7 +516,7 @@ item_def *monster::weapon(int which_attack) { const mon_attack_def attk = mons_attack_spec(this, which_attack); if (attk.type != AT_HIT && attk.type != AT_WEAP_ONLY) - return (NULL); + return NULL; // Even/odd attacks use main/offhand weapon. if (which_attack > 1) @@ -547,22 +547,22 @@ bool monster::can_wield(const item_def& item, bool ignore_curse, // Monsters can only wield weapons or go unarmed (OBJ_UNASSIGNED // means unarmed). if (item.base_type != OBJ_WEAPONS && item.base_type != OBJ_UNASSIGNED) - return (false); + return false; // These *are* weapons, so they can't wield another weapon or // unwield themselves. if (type == MONS_DANCING_WEAPON) - return (false); + return false; // MF_HARD_RESET means that all items the monster is carrying will // disappear when it does, so it can't accept new items or give up // the ones it has. if (flags & MF_HARD_RESET) - return (false); + return false; // Summoned items can only be held by summoned monsters. if ((item.flags & ISFLAG_SUMMONED) && !is_summoned()) - return (false); + return false; item_def* weap1 = NULL; if (inv[MSLOT_WEAPON] != NON_ITEM) @@ -582,7 +582,7 @@ bool monster::can_wield(const item_def& item, bool ignore_curse, // If we're already wielding it, then of course we can wield it. if (&item == weap1 || &item == weap2) - return (true); + return true; // Barehanded needs two hands. const bool two_handed = item.base_type == OBJ_UNASSIGNED @@ -594,7 +594,7 @@ bool monster::can_wield(const item_def& item, bool ignore_curse, ASSERT(!(weap1 && weap2)); if (two_handed && !ignore_shield) - return (false); + return false; _shield = &mitm[inv[MSLOT_SHIELD]]; } @@ -610,7 +610,7 @@ bool monster::can_wield(const item_def& item, bool ignore_curse, num_cursed++; if (two_handed && num_cursed > 0 || num_cursed >= avail_slots) - return (false); + return false; } return could_wield(item, ignore_brand, ignore_transform); @@ -623,15 +623,15 @@ bool monster::could_wield(const item_def &item, bool ignore_brand, // These *are* weapons, so they can't wield another weapon. if (type == MONS_DANCING_WEAPON) - return (false); + return false; // Monsters can't use unrandarts with special effects. if (is_special_unrandom_artefact(item) && !crawl_state.game_is_arena()) - return (false); + return false; // Wimpy monsters (e.g. kobolds, goblins) can't use halberds, etc. if (!check_weapon_wieldable_size(item, body_size())) - return (false); + return false; if (!ignore_brand) { @@ -639,18 +639,18 @@ bool monster::could_wield(const item_def &item, bool ignore_brand, // Draconians won't use dragon slaying weapons. if (brand == SPWPN_DRAGON_SLAYING && is_dragonkind(this)) - return (false); + return false; // Orcs won't use orc slaying weapons. if (brand == SPWPN_ORC_SLAYING && is_orckind(this)) - return (false); + return false; // Undead and demonic monsters and monsters that are // gifts/worshippers of Yredelemnul won't use holy weapons. if ((undead_or_demonic() || god == GOD_YREDELEMNUL) && is_holy_item(item)) { - return (false); + return false; } // Holy monsters that aren't gifts/worshippers of chaotic gods @@ -659,13 +659,13 @@ bool monster::could_wield(const item_def &item, bool ignore_brand, if (((is_holy() && !is_chaotic_god(god)) || is_good_god(god)) && is_potentially_unholy_item(item)) { - return (false); + return false; } // Holy monsters and monsters that are gifts/worshippers of good // gods won't use unholy weapons. if ((is_holy() || is_good_god(god)) && is_unholy_item(item)) - return (false); + return false; // Holy monsters that aren't gifts/worshippers of chaotic gods // and monsters that are gifts/worshippers of good gods won't @@ -674,7 +674,7 @@ bool monster::could_wield(const item_def &item, bool ignore_brand, || is_good_god(god)) && is_potentially_evil_item(item)) { - return (false); + return false; } // Holy monsters and monsters that are gifts/worshippers of good @@ -682,18 +682,18 @@ bool monster::could_wield(const item_def &item, bool ignore_brand, if (((is_holy() || is_good_god(god))) && is_evil_item(item)) { - return (false); + return false; } // Monsters that are gifts/worshippers of Fedhas won't use // corpse-violating weapons. if (god == GOD_FEDHAS && is_corpse_violating_item(item)) - return (false); + return false; // Monsters that are gifts/worshippers of Zin won't use unclean // weapons. if (god == GOD_ZIN && is_unclean_item(item)) - return (false); + return false; // Holy monsters that aren't gifts/worshippers of chaotic gods // and monsters that are gifts/worshippers of good gods won't @@ -701,16 +701,16 @@ bool monster::could_wield(const item_def &item, bool ignore_brand, if (((is_holy() && !is_chaotic_god(god)) || is_good_god(god)) && is_chaotic_item(item)) { - return (false); + return false; } // Monsters that are gifts/worshippers of TSO won't use poisoned // weapons. if (god == GOD_SHINING_ONE && is_poisoned_item(item)) - return (false); + return false; } - return (true); + return true; } bool monster::can_throw_large_rocks() const @@ -724,17 +724,17 @@ bool monster::can_throw_large_rocks() const bool monster::can_speak() { if (has_ench(ENCH_MUTE)) - return (false); + return false; // Priest and wizard monsters can always speak. if (is_priest() || is_actual_spellcaster()) - return (true); + return true; // Silent or non-sentient monsters can't use the original speech. if (mons_intel(this) < I_NORMAL || mons_shouts(type) == S_SILENT) { - return (false); + return false; } // Does it have the proper vocal equipment? @@ -750,9 +750,9 @@ bool monster::has_spell_of_type(unsigned disciplines) const continue; if (spell_typematch(spells[i], disciplines)) - return (true); + return true; } - return (false); + return false; } void monster::bind_melee_flags() @@ -791,17 +791,17 @@ static bool _needs_ranged_attack(const monster* mon) { // Prevent monsters that have conjurations from grabbing missiles. if (mon->has_spell_of_type(SPTYP_CONJURATION)) - return (false); + return false; // Same for summonings, but make an exception for friendlies. if (!mon->friendly() && mon->has_spell_of_type(SPTYP_SUMMONING)) - return (false); + return false; // Blademasters don't want to throw stuff. if (mon->type == MONS_DEEP_ELF_BLADEMASTER) - return (false); + return false; - return (true); + return true; } bool monster::can_use_missile(const item_def &item) const @@ -811,7 +811,7 @@ bool monster::can_use_missile(const item_def &item) const // hopefully take the monster to a stack of appropriate missiles. if (!_needs_ranged_attack(this)) - return (false); + return false; if (item.base_type == OBJ_WEAPONS || item.base_type == OBJ_MISSILES && !has_launcher(item)) @@ -824,18 +824,18 @@ bool monster::can_use_missile(const item_def &item) const // Stones are allowed even without launcher. if (item.sub_type == MI_STONE) - return (true); + return true; item_def *launch; for (int i = MSLOT_WEAPON; i <= MSLOT_ALT_WEAPON; ++i) { launch = mslot_item(static_cast<mon_inv_type>(i)); if (launch && fires_ammo_type(*launch) == item.sub_type) - return (true); + return true; } // No fitting launcher in inventory. - return (false); + return false; } void monster::swap_slots(mon_inv_type a, mon_inv_type b) @@ -1138,7 +1138,7 @@ void monster::unequip_jewellery(item_def &item, int near) bool monster::unequip(item_def &item, int slot, int near, bool force) { if (!force && item.cursed()) - return (false); + return false; if (!force && you.can_see(this)) set_ident_flags(item, ISFLAG_KNOW_CURSE); @@ -1163,7 +1163,7 @@ bool monster::unequip(item_def &item, int slot, int near, bool force) break; } - return (true); + return true; } void monster::lose_pickup_energy() @@ -1209,7 +1209,7 @@ bool monster::pickup(item_def &item, int slot, int near, bool force_merge) mprf(MSGCH_DIAGNOSTICS, "Monster %s already holding item %s.", name(DESC_PLAIN, true).c_str(), item.name(DESC_PLAIN, false, true).c_str()); - return (false); + return false; } else { @@ -1244,7 +1244,7 @@ bool monster::pickup(item_def &item, int slot, int near, bool force_merge) && hands_reqd(item, body_size()) == HANDS_TWO) { if (!drop_item(MSLOT_SHIELD, near)) - return (false); + return false; } // Similarly, monsters won't pick up shields if they're @@ -1254,9 +1254,9 @@ bool monster::pickup(item_def &item, int slot, int near, bool force_merge) const item_def* wpn = mslot_item(MSLOT_WEAPON); const item_def* alt = mslot_item(MSLOT_ALT_WEAPON); if (wpn && hands_reqd(*wpn, body_size()) == HANDS_TWO) - return (false); + return false; if (alt && hands_reqd(*alt, body_size()) == HANDS_TWO) - return (false); + return false; } if (inv[slot] != NON_ITEM) @@ -1275,13 +1275,13 @@ bool monster::pickup(item_def &item, int slot, int near, bool force_merge) destroy_item(item.index()); equip(item, slot, near); lose_pickup_energy(); - return (true); + return true; } - return (false); + return false; } if (item.flags & ISFLAG_MIMIC && !mons_is_item_mimic(type)) - return (false); + return false; dungeon_events.fire_position_event( dgn_event(DET_ITEM_PICKUP, pos(), 0, item.index(), @@ -1299,17 +1299,17 @@ bool monster::pickup(item_def &item, int slot, int near, bool force_merge) if (!mons_is_item_mimic(type)) equip(item, slot, near); lose_pickup_energy(); - return (true); + return true; } bool monster::drop_item(int eslot, int near) { if (eslot < 0 || eslot >= NUM_MONSTER_SLOTS) - return (false); + return false; int item_index = inv[eslot]; if (item_index == NON_ITEM) - return (true); + return true; item_def* pitem = &mitm[item_index]; @@ -1322,7 +1322,7 @@ bool monster::drop_item(int eslot, int near) || eslot == MSLOT_ALT_WEAPON && mons_wields_two_weapons(this)) { if (!unequip(*pitem, eslot, near)) - return (false); + return false; was_unequipped = true; } @@ -1354,7 +1354,7 @@ bool monster::drop_item(int eslot, int near) if (was_unequipped) equip(*pitem, eslot, near); - return (false); + return false; } if (friendly() && item_index != NON_ITEM) @@ -1371,7 +1371,7 @@ bool monster::drop_item(int eslot, int near) props.erase("wand_known"); inv[eslot] = NON_ITEM; - return (true); + return true; } // We don't want monsters to pick up ammunition that is identical to the @@ -1383,7 +1383,7 @@ static bool _nonredundant_launcher_ammo_brands(item_def *launcher, // If the monster has no ammo then there's no redundancy problems // to check. if (ammo == NULL) - return (true); + return true; const int bow_brand = get_weapon_brand(*launcher); const int ammo_brand = get_ammo_brand(*ammo); @@ -1399,7 +1399,7 @@ static bool _nonredundant_launcher_ammo_brands(item_def *launcher, case SPMSL_PENETRATION: return (bow_brand != SPWPN_PENETRATION); default: - return (true); + return true; } } @@ -1408,7 +1408,7 @@ bool monster::pickup_launcher(item_def &launch, int near, bool force) // Don't allow monsters to pick up launchers that would also // refuse to pick up the matching ammo. if (!force && !_needs_ranged_attack(this)) - return (false); + return false; // Don't allow monsters to switch to another type of launcher // as that would require them to also drop their ammunition @@ -1462,17 +1462,17 @@ static bool _is_signature_weapon(monster* mons, const item_def &weapon) // in case that ever changes we don't want him to switch away // from his quarterstaff of chaos. if (mons->type == MONS_CRAZY_YIUF) - return (false); + return false; // Distortion/chaos is immensely flavourful, and we shouldn't // allow Psyche to switch away from it. if (mons->type == MONS_PSYCHE) - return (false); + return false; // Don't switch Azrael away from the customary scimitar of // flaming. if (mons->type == MONS_AZRAEL) - return (false); + return false; if (mons->type == MONS_AGNES) return (weapon.sub_type == WPN_LAJATANG); @@ -1538,7 +1538,7 @@ static bool _is_signature_weapon(monster* mons, const item_def &weapon) } } - return (false); + return false; } static int _ego_damage_bonus(item_def &item) @@ -1564,7 +1564,7 @@ static bool _item_race_matches_monster(const item_def &item, monster* mons) if (get_equip_race(item) == ISFLAG_ORCISH) return (mons_genus(mons->type) == MONS_ORC); - return (false); + return false; } bool monster::pickup_melee_weapon(item_def &item, int near) @@ -1617,7 +1617,7 @@ bool monster::pickup_melee_weapon(item_def &item, int near) && _is_signature_weapon(this, *weap) && !dual_wielding) { - return (false); + return false; } // If we get here, the weapon is a melee weapon. @@ -1663,18 +1663,18 @@ bool monster::pickup_melee_weapon(item_def &item, int near) else if (!dual_wielding) { // We've got a good melee weapon, that's enough. - return (false); + return false; } } } // No slot found to place this item. if (eslot == -1) - return (false); + return false; // Current item cannot be dropped. if (inv[eslot] != NON_ITEM && !drop_item(eslot, near)) - return (false); + return false; return (pickup(item, eslot, near)); } @@ -1692,13 +1692,13 @@ bool monster::pickup_throwable_weapon(item_def &item, int near) // If it's a melee weapon then pickup_melee_weapon() already rejected // it, even though it can also be thrown. if (slot == MSLOT_WEAPON) - return (false); + return false; ASSERT(slot == MSLOT_MISSILE); // Spellcasters shouldn't bother with missiles. if (mons_has_ranged_spell(this, true, false)) - return (false); + return false; // If occupied, don't pick up a throwable weapons if it would just // stack with an existing one. (Upgrading is possible.) @@ -1706,7 +1706,7 @@ bool monster::pickup_throwable_weapon(item_def &item, int near) && (mons_is_wandering(this) || friendly() && foe == MHITYOU) && pickup(item, slot, near, true)) { - return (true); + return true; } item_def *launch = NULL; @@ -1718,23 +1718,23 @@ bool monster::pickup_throwable_weapon(item_def &item, int near) < _q_adj_damage(mons_thrown_weapon_damage(&item), item.quantity))) { if (inv[slot] != NON_ITEM && !drop_item(slot, near)) - return (false); + return false; return pickup(item, slot, near); } - return (false); + return false; } bool monster::wants_weapon(const item_def &weap) const { if (!could_wield(weap)) - return (false); + return false; // Blademasters and master archers like their starting weapon and // don't want another, thank you. if (type == MONS_DEEP_ELF_BLADEMASTER || type == MONS_DEEP_ELF_MASTER_ARCHER) { - return (false); + return false; } // Monsters capable of dual-wielding will always prefer two weapons @@ -1742,7 +1742,7 @@ bool monster::wants_weapon(const item_def &weap) const if (mons_wields_two_weapons(this) && hands_reqd(weap, body_size()) == HANDS_TWO) { - return (false); + return false; } // Arcane spellcasters don't want -CAST. @@ -1750,14 +1750,14 @@ bool monster::wants_weapon(const item_def &weap) const && is_artefact(weap) && artefact_wpn_property(weap, ARTP_PREVENT_SPELLCASTING)) { - return (false); + return false; } // Nobody picks up giant clubs. Starting equipment is okay, of course. if (is_giant_club_type(weap.sub_type)) - return (false); + return false; - return (true); + return true; } bool monster::wants_armour(const item_def &item) const @@ -1770,7 +1770,7 @@ bool monster::wants_armour(const item_def &item) const && hands_reqd(*mslot_item(MSLOT_WEAPON), body_size()) == HANDS_TWO)) { - return (false); + return false; } // Spellcasters won't pick up restricting armour, although they can @@ -1794,7 +1794,7 @@ bool monster::wants_jewellery(const item_def &item) const && is_artefact(item) && artefact_wpn_property(item, ARTP_PREVENT_SPELLCASTING)) { - return (false); + return false; } // TODO: figure out what monsters actually want rings or amulets @@ -1843,7 +1843,7 @@ bool monster::pickup_armour(item_def &item, int near, bool force) ASSERT(item.base_type == OBJ_ARMOUR); if (!force && !wants_armour(item)) - return (false); + return false; equipment_type eq = EQ_NONE; @@ -1892,15 +1892,15 @@ bool monster::pickup_armour(item_def &item, int near, bool force) // Bardings are only wearable by the appropriate monster. if (eq == EQ_NONE) - return (false); + return false; // XXX: Monsters can only equip body armour and shields (as of 0.4). if (!force && eq != EQ_BODY_ARMOUR && eq != EQ_SHIELD) - return (false); + return false; const mon_inv_type mslot = equip_slot_to_mslot(eq); if (mslot == NUM_MONSTER_SLOTS) - return (false); + return false; int value_new = _get_monster_armour_value(this, item); @@ -1916,7 +1916,7 @@ bool monster::pickup_armour(item_def &item, int near, bool force) int value_old = _get_monster_armour_value(this, *existing_armour); if (value_old > value_new) - return (false); + return false; if (value_old == value_new) { @@ -1934,12 +1934,12 @@ bool monster::pickup_armour(item_def &item, int near, bool force) value_new = item_value(item, true); } if (value_old >= value_new) - return (false); + return false; } } if (!drop_item(mslot, near)) - return (false); + return false; } return (pickup(item, mslot, near)); @@ -1995,13 +1995,13 @@ bool monster::pickup_jewellery(item_def &item, int near, bool force) ASSERT(item.base_type == OBJ_JEWELLERY); if (!force && !wants_jewellery(item)) - return (false); + return false; equipment_type eq = EQ_RINGS; const mon_inv_type mslot = equip_slot_to_mslot(eq); if (mslot == NUM_MONSTER_SLOTS) - return (false); + return false; int value_new = _get_monster_jewellery_value(this, item); @@ -2016,7 +2016,7 @@ bool monster::pickup_jewellery(item_def &item, int near, bool force) { int value_old = _get_monster_jewellery_value(this, *existing_jewellery); if (value_old > value_new) - return (false); + return false; if (value_old == value_new) { @@ -2025,12 +2025,12 @@ bool monster::pickup_jewellery(item_def &item, int near, bool force) value_old = item_value(*existing_jewellery, true); value_new = item_value(item, true); if (value_old >= value_new) - return (false); + return false; } } if (!drop_item(mslot, near)) - return (false); + return false; } return (pickup(item, mslot, near)); @@ -2039,7 +2039,7 @@ bool monster::pickup_jewellery(item_def &item, int near, bool force) bool monster::pickup_weapon(item_def &item, int near, bool force) { if (!force && !wants_weapon(item)) - return (false); + return false; // Weapon pickup involves: // - If we have no weapons, always pick this up. @@ -2055,7 +2055,7 @@ bool monster::pickup_weapon(item_def &item, int near, bool force) return (pickup_launcher(item, near, force)); if (pickup_melee_weapon(item, near)) - return (true); + return true; return (can_use_missile(item) && pickup_throwable_weapon(item, near)); } @@ -2070,7 +2070,7 @@ bool monster::pickup_missile(item_def &item, int near, bool force) { // Monster may not pick up trapping net. if (caught() && item_is_stationary(item)) - return (false); + return false; } else // None of these exceptions hold for throwing nets. { @@ -2078,7 +2078,7 @@ bool monster::pickup_missile(item_def &item, int near, bool force) // Neither summons nor hostile enchantments are counted for // this purpose. if (!force && mons_has_ranged_spell(this, true, false)) - return (false); + return false; // Monsters in a fight will only pick up missiles if doing so // is worthwhile. @@ -2086,7 +2086,7 @@ bool monster::pickup_missile(item_def &item, int near, bool force) && (!friendly() || foe != MHITYOU) && (item.quantity < 5 || miss && miss->quantity >= 7)) { - return (false); + return false; } } } @@ -2095,7 +2095,7 @@ bool monster::pickup_missile(item_def &item, int near, bool force) return (pickup(item, MSLOT_MISSILE, near)); if (!force && !can_use_missile(item)) - return (false); + return false; if (miss) { @@ -2119,7 +2119,7 @@ bool monster::pickup_missile(item_def &item, int near, bool force) && _nonredundant_launcher_ammo_brands(launch, miss))) { if (!drop_item(MSLOT_MISSILE, near)) - return (false); + return false; break; } } @@ -2134,7 +2134,7 @@ bool monster::pickup_missile(item_def &item, int near, bool force) && get_ammo_brand(item) != SPMSL_NORMAL)) { if (!drop_item(MSLOT_MISSILE, near)) - return (false); + return false; } } @@ -2145,26 +2145,26 @@ bool monster::pickup_wand(item_def &item, int near) { // Don't pick up empty wands. if (item.plus == 0) - return (false); + return false; // Only low-HD monsters bother with wands. if (hit_dice >= 14) - return (false); + return false; // Holy monsters and worshippers of good gods won't pick up evil // wands. if ((is_holy() || is_good_god(god)) && is_evil_item(item)) - return (false); + return false; // If a monster already has a charged wand, don't bother. // Otherwise, replace with a charged one. if (item_def *wand = mslot_item(MSLOT_WAND)) { if (wand->plus > 0) - return (false); + return false; if (!drop_item(MSLOT_WAND, near)) - return (false); + return false; } if (pickup(item, MSLOT_WAND, near)) @@ -2183,13 +2183,13 @@ bool monster::pickup_scroll(item_def &item, int near) && item.sub_type != SCR_BLINKING && item.sub_type != SCR_UNHOLY_CREATION) { - return (false); + return false; } // Holy monsters and worshippers of good gods won't pick up evil // scrolls. if ((is_holy() || is_good_god(god)) && is_evil_item(item)) - return (false); + return false; return (pickup(item, MSLOT_SCROLL, near)); } @@ -2201,7 +2201,7 @@ bool monster::pickup_potion(item_def &item, int near) const potion_type ptype = static_cast<potion_type>(item.sub_type); if (!can_drink_potion(ptype)) - return (false); + return false; return (pickup(item, MSLOT_POTION, near)); } @@ -2233,13 +2233,13 @@ bool monster::pickup_misc(item_def &item, int near) if (item.base_type == OBJ_MISCELLANY && item.sub_type == MISC_RUNE_OF_ZOT && !mons_is_item_mimic(type)) { - return (false); + return false; } // Holy monsters and worshippers of good gods won't pick up evil // miscellaneous items. if ((is_holy() || is_good_god(god)) && is_evil_item(item)) - return (false); + return false; return (pickup(item, MSLOT_MISCELLANY, near)); } @@ -2261,7 +2261,7 @@ bool monster::pickup_item(item_def &item, int near, bool force) if (!wandering && (hit_points * 10 < max_hit_points || hit_points < 10) && mon_enemies_around(this)) { - return (false); + return false; } if (friendly()) @@ -2277,7 +2277,7 @@ bool monster::pickup_item(item_def &item, int near, bool force) if (itype != OBJ_ARMOUR && itype != OBJ_WEAPONS && itype != OBJ_MISSILES) { - return (false); + return false; } // Depending on the friendly pickup toggle, your allies may not @@ -2289,7 +2289,7 @@ bool monster::pickup_item(item_def &item, int near, bool force) && !(item.flags & (ISFLAG_DROPPED | ISFLAG_THROWN | ISFLAG_DROPPED_BY_ALLY))) { - return (false); + return false; } } @@ -2301,14 +2301,14 @@ bool monster::pickup_item(item_def &item, int near, bool force) || itype == OBJ_JEWELLERY || itype == OBJ_MISCELLANY || itype == OBJ_GOLD) { - return (false); + return false; } if (itype == OBJ_WEAPONS || itype == OBJ_MISSILES) { // Fleeing monsters only pick up emergency equipment. if (mons_is_fleeing(this)) - return (false); + return false; // While occupied, hostile monsters won't pick up items // dropped or thrown by you. (You might have done that to @@ -2317,7 +2317,7 @@ bool monster::pickup_item(item_def &item, int near, bool force) && (testbits(item.flags, ISFLAG_DROPPED) || testbits(item.flags, ISFLAG_THROWN))) { - return (false); + return false; } } } @@ -2357,7 +2357,7 @@ bool monster::pickup_item(item_def &item, int near, bool force) return pickup_misc(item, near); // else fall through default: - return (false); + return false; } } @@ -2469,13 +2469,13 @@ static std::string _invalid_monster_str(monster_type type) str += make_stringf("#%d", (int) type); if (type < 0) - return (str); + return str; if (type > NUM_MONSTERS) { str += make_stringf(" (NUM_MONSTERS + %d)", int (NUM_MONSTERS - type)); - return (str); + return str; } int i; @@ -2492,7 +2492,7 @@ static std::string _invalid_monster_str(monster_type type) mons_type_name(new_type, DESC_PLAIN).c_str(), i); - return (str); + return str; } static std::string _mon_special_name(const monster& mon, description_level_type desc, bool force_seen) @@ -2712,7 +2712,7 @@ std::string monster::hand_name(bool plural, bool *can_plural) const if (plural && *can_plural) str = pluralise(str); - return (str); + return str; } std::string monster::foot_name(bool plural, bool *can_plural) const @@ -2827,7 +2827,7 @@ std::string monster::foot_name(bool plural, bool *can_plural) const if (plural && *can_plural) str = pluralise(str); - return (str); + return str; } std::string monster::arm_name(bool plural, bool *can_plural) const @@ -2877,7 +2877,7 @@ std::string monster::arm_name(bool plural, bool *can_plural) const if (plural) str = pluralise(str); - return (str); + return str; } int monster::mindex() const @@ -2887,7 +2887,7 @@ int monster::mindex() const int monster::get_experience_level() const { - return (hit_dice); + return hit_dice; } void monster::moveto(const coord_def& c, bool clear_net) @@ -2924,13 +2924,13 @@ bool monster::fumbles_attack(bool verbose) mpr("You hear a splashing noise.", MSGCH_SOUND); } - return (true); + return true; } if (submerged()) - return (true); + return true; - return (false); + return false; } bool monster::cannot_fight() const @@ -3052,54 +3052,54 @@ bool monster::has_spells() const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (spells[i] != SPELL_NO_SPELL) - return (true); + return true; - return (false); + return false; } bool monster::has_spell(spell_type spell) const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (spells[i] == spell) - return (true); + return true; - return (false); + return false; } bool monster::has_unholy_spell() const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (is_unholy_spell(spells[i])) - return (true); + return true; - return (false); + return false; } bool monster::has_evil_spell() const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (is_evil_spell(spells[i])) - return (true); + return true; - return (false); + return false; } bool monster::has_unclean_spell() const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (is_unclean_spell(spells[i])) - return (true); + return true; - return (false); + return false; } bool monster::has_chaotic_spell() const { for (int i = 0; i < NUM_MONSTER_SPELL_SLOTS; ++i) if (is_chaotic_spell(spells[i])) - return (true); + return true; - return (false); + return false; } bool monster::has_attack_flavour(int flavour) const @@ -3108,10 +3108,10 @@ bool monster::has_attack_flavour(int flavour) const { const int attk_flavour = mons_attack_spec(this, i).flavour; if (attk_flavour == flavour) - return (true); + return true; } - return (false); + return false; } bool monster::has_damage_type(int dam_type) @@ -3120,10 +3120,10 @@ bool monster::has_damage_type(int dam_type) { const int dmg_type = damage_type(i); if (dmg_type == dam_type) - return (true); + return true; } - return (false); + return false; } int monster::constriction_damage() const @@ -3180,11 +3180,11 @@ bool monster::asleep() const bool monster::backlit(bool check_haloed, bool self_halo) const { if (has_ench(ENCH_CORONA) || has_ench(ENCH_STICKY_FLAME) || has_ench(ENCH_SILVER_CORONA)) - return (true); + return true; if (check_haloed) return (!umbraed() && haloed() && (self_halo || halo_radius2() == -1)); - return (false); + return false; } bool monster::umbra(bool check_haloed, bool self_halo) const @@ -3192,7 +3192,7 @@ bool monster::umbra(bool check_haloed, bool self_halo) const if (check_haloed) return (umbraed() && !haloed() && (self_halo || umbra_radius2() == -1)); - return (false); + return false; } bool monster::glows_naturally() const @@ -3270,7 +3270,7 @@ int monster::shield_bonus() const { // Note that 0 is not quite no-blocking. if (incapacitated()) - return (0); + return 0; int shld_c = property(*shld, PARM_AC) + shld->plus; shld_c = shld_c * 2 + (body_size(PSIZE_TORSO) - SIZE_MEDIUM) @@ -3318,7 +3318,7 @@ int monster::melee_evasion(const actor *act, ev_ignore_type evit) const evasion -= 8; if (evit & EV_IGNORE_HELPLESS) - return (evasion); + return evasion; if (paralysed() || petrified() || petrifying() || asleep()) evasion = 0; @@ -3326,21 +3326,21 @@ int monster::melee_evasion(const actor *act, ev_ignore_type evit) const evasion /= (body_size(PSIZE_BODY) + 2); else if (confused()) evasion /= 2; - return (evasion); + return evasion; } bool monster::heal(int amount, bool max_too) { if (mons_is_statue(type)) - return (false); + return false; if (has_ench(ENCH_DEATHS_DOOR)) - return (false); + return false; if (amount < 1) - return (false); + return false; else if (!max_too && hit_points == max_hit_points) - return (false); + return false; hit_points += amount; @@ -3372,7 +3372,7 @@ bool monster::heal(int amount, bool max_too) props.erase("reaping_damage"); } - return (success); + return success; } void monster::blame_damage(const actor* attacker, int amount) @@ -3395,7 +3395,7 @@ mon_holy_type monster::holiness() const { // zombie kraken tentacles if (testbits(flags, MF_FAKE_UNDEAD)) - return (MH_UNDEAD); + return MH_UNDEAD; return (mons_class_holiness(type)); } @@ -3410,57 +3410,57 @@ bool monster::undead_or_demonic() const bool monster::is_holy(bool check_spells) const { if (holiness() == MH_HOLY) - return (true); + return true; // Assume that all unknown gods (GOD_NAMELESS) are not holy. if (is_priest() && is_good_god(god) && check_spells) - return (true); + return true; - return (false); + return false; } bool monster::is_unholy(bool check_spells) const { if (type == MONS_SILVER_STATUE) - return (true); + return true; if (holiness() == MH_DEMONIC) - return (true); + return true; if (has_unholy_spell() && check_spells) - return (true); + return true; - return (false); + return false; } bool monster::is_evil(bool check_spells) const { if (holiness() == MH_UNDEAD) - return (true); + return true; // Assume that all unknown gods (GOD_NAMELESS) are evil. if (is_priest() && (is_evil_god(god) || god == GOD_NAMELESS) && check_spells) { - return (true); + return true; } if (has_evil_spell() && check_spells) - return (true); + return true; if (has_attack_flavour(AF_DRAIN_XP) || has_attack_flavour(AF_VAMPIRIC)) { - return (true); + return true; } - return (false); + return false; } bool monster::is_unclean(bool check_spells) const { if (has_unclean_spell() && check_spells) - return (true); + return true; if (has_attack_flavour(AF_DISEASE) || has_attack_flavour(AF_HUNGER) @@ -3468,7 +3468,7 @@ bool monster::is_unclean(bool check_spells) const || has_attack_flavour(AF_STEAL) || has_attack_flavour(AF_STEAL_FOOD)) { - return (true); + return true; } // Zin considers insanity unclean. And slugs that speak. @@ -3476,7 +3476,7 @@ bool monster::is_unclean(bool check_spells) const || type == MONS_PSYCHE || type == MONS_GASTRONOK) { - return (true); + return true; } // Assume that all unknown gods (GOD_NAMELESS) are not chaotic. @@ -3484,16 +3484,16 @@ bool monster::is_unclean(bool check_spells) const // physically/essentially chaotic (so you don't get hurt by silver), // but Zin does mind. if (is_priest() && is_chaotic_god(god) && check_spells) - return (true); + return true; if (has_chaotic_spell() && is_actual_spellcaster() && check_spells) - return (true); + return true; corpse_effect_type ce = mons_corpse_effect(type); if ((ce == CE_ROT || ce == CE_MUTAGEN) && !is_chaotic()) - return (true); + return true; - return (false); + return false; } bool monster::is_known_chaotic() const @@ -3505,26 +3505,26 @@ bool monster::is_known_chaotic() const || type == MONS_KILLER_KLOWN // For their random attacks. || type == MONS_TIAMAT) // For her colour-changing. { - return (true); + return true; } if (is_shapeshifter() && (flags & MF_KNOWN_SHIFTER)) - return (true); + return true; // Knowing chaotic spells is not enough to make you "essentially" // chaotic (i.e., silver doesn't hurt you), it's just unclean for // Zin. Having chaotic abilities (not actual spells) does mean // you're truly changed by chaos. if (has_chaotic_spell() && !is_actual_spellcaster()) - return (true); + return true; if (has_attack_flavour(AF_MUTATE) || has_attack_flavour(AF_CHAOS)) { - return (true); + return true; } - return (false); + return false; } bool monster::is_chaotic() const @@ -3545,7 +3545,7 @@ bool monster::is_unbreathing() const || holi == MH_NONLIVING || holi == MH_PLANT) { - return (true); + return true; } return (mons_class_flag(type, M_UNBREATHING)); @@ -3596,7 +3596,7 @@ int monster::res_fire() const else if (u > 3) u = 3; - return (u); + return u; } int monster::res_steam() const @@ -3610,7 +3610,7 @@ int monster::res_steam() const if (res > 3) res = 3; - return (res); + return res; } int monster::res_cold() const @@ -3644,7 +3644,7 @@ int monster::res_cold() const else if (u > 3) u = 3; - return (u); + return u; } int monster::res_elec() const @@ -3678,7 +3678,7 @@ int monster::res_elec() const // Monsters can legitimately get multiple levels of electricity resistance. - return (u); + return u; } int monster::res_asphyx() const @@ -3686,21 +3686,21 @@ int monster::res_asphyx() const int res = get_mons_resists(this).asphyx; if (is_unbreathing()) res += 1; - return (res); + return res; } int monster::res_water_drowning() const { if (is_unbreathing()) - return (1); + return 1; switch (mons_habitat(this)) { case HT_WATER: case HT_AMPHIBIOUS: - return (1); + return 1; default: - return (0); + return 0; } } @@ -3738,7 +3738,7 @@ int monster::res_poison(bool temp) const // like players, equipment doesn't stack. if (u > 0) return 1; - return (u); + return u; } int monster::res_sticky_flame() const @@ -3748,7 +3748,7 @@ int monster::res_sticky_flame() const res += 1; if (has_equipped(EQ_BODY_ARMOUR, ARM_MOTTLED_DRAGON_ARMOUR)) res += 1; - return (res); + return res; } int monster::res_rotting(bool temp) const @@ -3791,7 +3791,7 @@ int monster::res_rotting(bool temp) const int monster::res_holy_energy(const actor *attacker) const { if (type == MONS_PROFANE_SERVITOR) - return (1); + return 1; if (undead_or_demonic()) return (-2); @@ -3805,10 +3805,10 @@ int monster::res_holy_energy(const actor *attacker) const || is_unchivalric_attack(attacker, this) || is_good_god(you.religion) && is_follower(this)) { - return (1); + return 1; } - return (0); + return 0; } int monster::res_negative_energy() const @@ -3816,7 +3816,7 @@ int monster::res_negative_energy() const if (holiness() != MH_NATURAL || type == MONS_SHADOW_DRAGON) { - return (3); + return 3; } int u = 0; @@ -3846,7 +3846,7 @@ int monster::res_negative_energy() const if (u > 3) u = 3; - return (u); + return u; } int monster::res_torment() const @@ -3857,10 +3857,10 @@ int monster::res_torment() const || holy == MH_PLANT || holy == MH_NONLIVING) { - return (1); + return 1; } - return (0); + return 0; } int monster::res_wind() const @@ -3912,7 +3912,7 @@ int monster::res_acid() const int monster::res_magic() const { if (mons_immune_magic(this)) - return (MAG_IMMUNE); + return MAG_IMMUNE; int u = (get_monster_data(type))->resist_magic; @@ -3948,7 +3948,7 @@ int monster::res_magic() const if (has_ench(ENCH_RAISED_MR)) //trog's hand u += 70; - return (u); + return u; } bool monster::no_tele(bool calc_unid, bool permit_id) const @@ -3994,7 +3994,7 @@ monster_type monster::mons_species(bool zombie_base) const bool monster::poison(actor *agent, int amount, bool force) { if (amount <= 0) - return (false); + return false; // Scale poison down for monsters. if (!(amount /= 2)) @@ -4026,7 +4026,7 @@ int monster::skill(skill_type sk, int scale, bool real) const return (is_actual_spellcaster() ? hd : hd / 3); default: - return (0); + return 0; } } @@ -4047,13 +4047,13 @@ bool monster::alive() const god_type monster::deity() const { - return (god); + return god; } bool monster::drain_exp(actor *agent, bool quiet, int pow) { if (x_chance_in_y(res_negative_energy(), 3)) - return (false); + return false; if (!quiet && you.can_see(this)) mprf("%s is drained!", name(DESC_THE).c_str()); @@ -4073,13 +4073,13 @@ bool monster::drain_exp(actor *agent, bool quiet, int pow) hit_points = std::min(max_hit_points, hit_points); } - return (true); + return true; } bool monster::rot(actor *agent, int amount, int immediate, bool quiet) { if (res_rotting() || amount <= 0) - return (false); + return false; if (!quiet && you.can_see(this)) { @@ -4104,14 +4104,14 @@ bool monster::rot(actor *agent, int amount, int immediate, bool quiet) add_ench(mon_enchant(ENCH_ROT, std::min(amount, 4), agent)); - return (true); + return true; } int monster::hurt(const actor *agent, int amount, beam_type flavour, bool cleanup_dead) { if (mons_is_projectile(type) || mindex() == ANON_FRIENDLY_MONSTER) - return (0); + return 0; if (alive()) { @@ -4123,12 +4123,12 @@ int monster::hurt(const actor *agent, int amount, beam_type flavour, dprf("(mon) HP shaved: %d.", shave); amount -= shave; if (amount <= 0) - return (0); + return 0; } if (amount != INSTANT_DEATH) if (this->has_ench(ENCH_DEATHS_DOOR)) - return (0); + return 0; else if (petrified()) amount /= 2; else if (petrifying()) @@ -4139,7 +4139,7 @@ int monster::hurt(const actor *agent, int amount, beam_type flavour, else if (hit_dice <= 0) amount = hit_points; else if (amount <= 0 && hit_points <= max_hit_points) - return (0); + return 0; if (agent && agent->is_player() && you.duration[DUR_QUAD_DAMAGE]) { @@ -4188,7 +4188,7 @@ int monster::hurt(const actor *agent, int amount, beam_type flavour, monster_die(this, KILL_MON, agent->mindex()); } - return (amount); + return amount; } void monster::confuse(actor *atk, int strength) @@ -4314,18 +4314,18 @@ bool monster::check_set_valid_home(const coord_def &place, int &nvalid) const { if (!in_bounds(place)) - return (false); + return false; if (actor_at(place)) - return (false); + return false; if (!monster_habitable_grid(this, grd(place))) - return (false); + return false; if (one_chance_in(++nvalid)) chosen = place; - return (true); + return true; } #define MAX_PLACE_NEAR_DIST 8 @@ -4366,7 +4366,7 @@ bool monster::find_home_near_place(const coord_def &c) } } - return (false); + return false; } bool monster::find_home_near_player() @@ -4381,7 +4381,7 @@ bool monster::find_home_anywhere() for (int tries = 0; tries < 600; ++tries) if (check_set_valid_home(random_in_bounds(), place, nvalid)) return (move_to_pos(place)); - return (false); + return false; } bool monster::find_place_to_live(bool near_player) @@ -4456,7 +4456,7 @@ bool monster::has_hydra_multi_attack() const bool monster::has_multitargetting() const { if (mons_wields_two_weapons(this)) - return (true); + return true; // Hacky little list for now. evk return ((has_hydra_multi_attack() && !mons_is_zombified(this)) @@ -4531,7 +4531,7 @@ bool monster::sicken(int amount, bool unused) UNUSED(unused); if (res_rotting() || (amount /= 2) < 1) - return (false); + return false; if (!has_ench(ENCH_SICK) && you.can_see(this)) { @@ -4541,7 +4541,7 @@ bool monster::sicken(int amount, bool unused) add_ench(mon_enchant(ENCH_SICK, 0, 0, amount * 10)); - return (true); + return true; } bool monster::bleed(const actor* agent, int amount, int degree) @@ -4554,7 +4554,7 @@ bool monster::bleed(const actor* agent, int amount, int degree) add_ench(mon_enchant(ENCH_BLEED, degree, agent, amount * 10)); - return (true); + return true; } // Recalculate movement speed. @@ -4624,7 +4624,7 @@ void monster::check_speed() actor *monster::get_foe() const { if (foe == MHITNOT) - return (NULL); + return NULL; else if (foe == MHITYOU) return (friendly() ? NULL : &you); @@ -4643,23 +4643,23 @@ int monster::foe_distance() const bool monster::can_go_berserk() const { if (holiness() != MH_NATURAL || mons_is_tentacle(type)) - return (false); + return false; if (mons_intel(this) == I_PLANT) - return (false); + return false; if (paralysed() || petrified() || petrifying() || asleep()) - return (false); + return false; if (berserk() || has_ench(ENCH_FATIGUE)) - return (false); + return false; // If we have no melee attack, going berserk is pointless. const mon_attack_def attk = mons_attack_spec(this, 0); if (attk.type == AT_NONE || attk.damage == 0) - return (false); + return false; - return (true); + return true; } bool monster::frenzied() const @@ -4675,13 +4675,13 @@ bool monster::berserk() const bool monster::needs_berserk(bool check_spells) const { if (!can_go_berserk()) - return (false); + return false; if (has_ench(ENCH_HASTE) || has_ench(ENCH_TP)) - return (false); + return false; if (foe_distance() > 3) - return (false); + return false; if (check_spells) { @@ -4689,11 +4689,11 @@ bool monster::needs_berserk(bool check_spells) const { const int spell = spells[i]; if (spell != SPELL_NO_SPELL && spell != SPELL_BERSERKER_RAGE) - return (false); + return false; } } - return (true); + return true; } bool monster::can_see_invisible() const @@ -4701,10 +4701,10 @@ bool monster::can_see_invisible() const if (mons_is_ghost_demon(type)) return (ghost->see_invis); else if (mons_class_flag(type, M_SEE_INVIS)) - return (true); + return true; else if (scan_mon_inv_randarts(this, ARTP_EYESIGHT) > 0) - return (true); - return (false); + return true; + return false; } bool monster::invisible() const @@ -4766,14 +4766,14 @@ bool monster::can_bleed(bool /*allow_tran*/) const bool monster::mutate(const std::string &reason) { if (!can_mutate()) - return (false); + return false; // Polymorphing a (very) ugly thing will mutate it into a different // (very) ugly thing. if (type == MONS_UGLY_THING || type == MONS_VERY_UGLY_THING) { ugly_thing_mutate(this); - return (true); + return true; } // Polymorphing a shapeshifter will make it revert to its original @@ -4788,7 +4788,7 @@ bool monster::mutate(const std::string &reason) if (type == MONS_SLIME_CREATURE) { slime_creature_mutate(this); - return (true); + return true; } return (monster_polymorph(this, RANDOM_MONSTER)); @@ -4963,16 +4963,16 @@ bool monster::self_destructs() suicide(); // Do the explosion right now. monster_die(as_monster(), KILL_MON, mindex()); - return (true); + return true; } - return (false); + return false; } bool monster::move_to_pos(const coord_def &newpos, bool clear_net) { const actor* a = actor_at(newpos); if (a && (!a->is_player() || !fedhas_passthrough(this))) - return (false); + return false; const int index = mindex(); @@ -4986,14 +4986,14 @@ bool monster::move_to_pos(const coord_def &newpos, bool clear_net) // Set new monster grid pointer to this monster. mgrd(newpos) = index; - return (true); + return true; } // Returns true if the trap should be revealed to the player. bool monster::do_shaft() { if (!is_valid_shaft_level()) - return (false); + return false; // Handle instances of do_shaft() being invoked magically when // the monster isn't standing over a shaft. @@ -5012,7 +5012,7 @@ bool monster::do_shaft() break; default: - return (false); + return false; } if (!ground_level() || total_weight() == 0) @@ -5029,14 +5029,14 @@ bool monster::do_shaft() } handle_items_on_shaft(pos(), false); - return (false); + return false; } } level_id lev = shaft_dest(false); if (lev == level_id::current()) - return (false); + return false; // If a pacified monster is leaving the level via a shaft trap, and // has reached its goal, handle it here. @@ -5052,7 +5052,7 @@ bool monster::do_shaft() destroy_inventory(); monster_cleanup(this); - return (reveal); + return reveal; } void monster::hibernate(int) @@ -5172,17 +5172,17 @@ void monster::gain_energy(energy_use_type et, int div, int mult) bool monster::can_drink_potion(potion_type ptype) const { if (mons_class_is_stationary(type)) - return (false); + return false; if (mons_itemuse(this) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; // These monsters cannot drink. if (is_skeletal() || is_insubstantial() || mons_species() == MONS_LICH || mons_genus(type) == MONS_MUMMY || type == MONS_GASTRONOK) { - return (false); + return false; } switch (ptype) @@ -5201,12 +5201,12 @@ bool monster::can_drink_potion(potion_type ptype) const case POT_INVISIBILITY: // If there are any item using monsters that are permanently // invisible, this might have to be restricted. - return (true); + return true; default: break; } - return (false); + return false; } bool monster::should_drink_potion(potion_type ptype) const @@ -5243,7 +5243,7 @@ bool monster::should_drink_potion(potion_type ptype) const break; } - return (false); + return false; } // Return the ID status gained. @@ -5310,16 +5310,16 @@ item_type_id_state_type monster::drink_potion_effect(potion_type pot_eff) break; } - return (ident); + return ident; } bool monster::can_evoke_jewellery(jewellery_type jtype) const { if (mons_class_is_stationary(type)) - return (false); + return false; if (mons_itemuse(this) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; switch (jtype) { @@ -5328,14 +5328,14 @@ bool monster::can_evoke_jewellery(jewellery_type jtype) const case RING_INVISIBILITY: // If there are any item using monsters that are permanently // invisible, this might have to be restricted. - return (true); + return true; case AMU_RAGE: return (can_go_berserk()); default: break; } - return (false); + return false; } bool monster::should_evoke_jewellery(jewellery_type jtype) const @@ -5357,7 +5357,7 @@ bool monster::should_evoke_jewellery(jewellery_type jtype) const break; } - return (false); + return false; } // Return the ID status gained. @@ -5390,7 +5390,7 @@ item_type_id_state_type monster::evoke_jewellery_effect(jewellery_type jtype) break; } - return (ident); + return ident; } void monster::react_to_damage(const actor *oppressor, int damage, @@ -5596,12 +5596,12 @@ reach_type monster::reach_range() const { const mon_attack_def attk(mons_attack_spec(this, 0)); if (attk.flavour == AF_REACH && attk.damage) - return (REACH_TWO); + return REACH_TWO; const item_def *wpn = primary_weapon(); if (wpn) return weapon_reach(*wpn); - return (REACH_NONE); + return REACH_NONE; } bool monster::can_cling_to_walls() const diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index e8d2797844..28da9f10a9 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -103,7 +103,7 @@ static mutation_def* _seek_mutation(mutation_type mut) { ASSERT(mut >= 0 && mut < NUM_MUTATIONS); if (mut_index[mut] == -1) - return (NULL); + return NULL; else return (&mut_data[mut_index[mut]]); } @@ -127,9 +127,9 @@ static bool _is_covering(mutation_type mut) { for (unsigned i = 0; i < ARRAYSZ(_all_scales); ++i) if (_all_scales[i] == mut) - return (true); + return true; - return (false); + return false; } bool is_body_facet(mutation_type mut) @@ -137,10 +137,10 @@ bool is_body_facet(mutation_type mut) for (unsigned i = 0; i < ARRAYSZ(_body_facets); i++) { if (_body_facets[i].mut == mut) - return (true); + return true; } - return (false); + return false; } const mutation_def& get_mutation_def(mutation_type mut) @@ -178,7 +178,7 @@ mutation_activity_type mutation_activity_level(mutation_type mut) if (mut == MUT_BREATHE_POISON) { if (form_changed_physiology() && you.form != TRAN_SPIDER) - return (MUTACT_INACTIVE); + return MUTACT_INACTIVE; } else if (!form_keeps_mutations()) { @@ -186,15 +186,15 @@ mutation_activity_type mutation_activity_level(mutation_type mut) { monster_type drag = dragon_form_dragon_type(); if (mut == MUT_SHOCK_RESISTANCE && drag == MONS_STORM_DRAGON) - return (MUTACT_FULL); + return MUTACT_FULL; if (mut == MUT_UNBREATHING && drag == MONS_IRON_DRAGON) - return (MUTACT_FULL); + return MUTACT_FULL; } // Dex and HP changes are kept in all forms. if (mut == MUT_ROUGH_BLACK_SCALES || mut == MUT_RUGGED_BROWN_SCALES) - return (MUTACT_PARTIAL); + return MUTACT_PARTIAL; else if (get_mutation_def(mut).form_based) - return (MUTACT_INACTIVE); + return MUTACT_INACTIVE; } if (you.form == TRAN_STATUE) @@ -211,11 +211,11 @@ mutation_activity_type mutation_activity_level(mutation_type mut) case MUT_FAST: case MUT_SLOW: case MUT_IRIDESCENT_SCALES: - return (MUTACT_INACTIVE); + return MUTACT_INACTIVE; case MUT_LARGE_BONE_PLATES: case MUT_ROUGH_BLACK_SCALES: case MUT_RUGGED_BROWN_SCALES: - return (MUTACT_PARTIAL); + return MUTACT_PARTIAL; case MUT_YELLOW_SCALES: case MUT_ICY_BLUE_SCALES: case MUT_MOLTEN_SCALES: @@ -232,24 +232,24 @@ mutation_activity_type mutation_activity_level(mutation_type mut) { // Innate mutations are always active if (you.innate_mutations[mut]) - return (MUTACT_FULL); + return MUTACT_FULL; // ... as are all mutations for semi-undead who are fully alive if (you.hunger_state == HS_ENGORGED) - return (MUTACT_FULL); + return MUTACT_FULL; // ... as are physical mutations. if (get_mutation_def(mut).physical) - return (MUTACT_FULL); + return MUTACT_FULL; // Other mutations are partially active at satiated and above. if (you.hunger_state >= HS_SATIATED) - return (MUTACT_HUNGER); + return MUTACT_HUNGER; else - return (MUTACT_INACTIVE); + return MUTACT_INACTIVE; } else - return (MUTACT_FULL); + return MUTACT_FULL; } // Counts of various statuses/types of mutations from the current/most @@ -267,14 +267,14 @@ static int _num_hunger_based = 0; static bool _player_can_transform() { if (you.species == SP_MUMMY || you.species == SP_GHOUL) - return (false); + return false; if (form_changed_physiology()) - return (true); + return true; // Bat form if (you.species == SP_VAMPIRE && you.experience_level >= 3) - return (true); + return true; for (int i = 0; i < MAX_KNOWN_SPELLS; i++) { @@ -285,13 +285,13 @@ static bool _player_can_transform() case SPELL_STATUE_FORM: case SPELL_DRAGON_FORM: case SPELL_NECROMUTATION: - return (true); + return true; default: break; } } - return (false); + return false; } static std::string _annotate_form_based(std::string desc, bool suppressed) @@ -827,21 +827,21 @@ static int _calc_mutation_amusement_value(mutation_type which_mutation) break; } - return (amusement); + return amusement; } static bool _accept_mutation(mutation_type mutat, bool ignore_rarity = false) { if (!is_valid_mutation(mutat)) - return (false); + return false; const mutation_def& mdef = get_mutation_def(mutat); if (you.mutation[mutat] >= mdef.levels) - return (false); + return false; if (ignore_rarity) - return (true); + return true; const int rarity = mdef.rarity + you.innate_mutations[mutat]; @@ -902,13 +902,13 @@ static mutation_type _get_random_xom_mutation() mutat = static_cast<mutation_type>(random2(NUM_MUTATIONS)); if (one_chance_in(1000)) - return (NUM_MUTATIONS); + return NUM_MUTATIONS; else if (one_chance_in(5)) mutat = RANDOM_ELEMENT(bad_muts); } while (!_accept_mutation(mutat, false)); - return (mutat); + return mutat; } static bool _mut_matches_class(mutation_type mutclass, const mutation_def& mdef) @@ -916,7 +916,7 @@ static bool _mut_matches_class(mutation_type mutclass, const mutation_def& mdef) switch (mutclass) { case RANDOM_MUTATION: - return (true); + return true; case RANDOM_BAD_MUTATION: return (mdef.bad); case RANDOM_GOOD_MUTATION: @@ -952,7 +952,7 @@ static mutation_type _get_random_mutation(mutation_type mutclass) chosen = curr; } - return (chosen); + return chosen; } // Tries to give you the mutation by deleting a conflicting @@ -1021,7 +1021,7 @@ static int _handle_conflicting_mutations(mutation_type mutation, // If we have one of the pair, delete a level of the // other, and that's it. delete_mutation(b, reason, true, true); - return (1); // Nothing more to do. + return 1; // Nothing more to do. default: die("bad mutation conflict resulution"); } @@ -1029,7 +1029,7 @@ static int _handle_conflicting_mutations(mutation_type mutation, } } - return (0); + return 0; } static int _body_covered() @@ -1046,7 +1046,7 @@ static int _body_covered() for (unsigned i = 0; i < ARRAYSZ(_all_scales); ++i) covered += you.mutation[_all_scales[i]]; - return (covered); + return covered; } bool physiology_mutation_conflict(mutation_type mutat) @@ -1070,46 +1070,46 @@ bool physiology_mutation_conflict(mutation_type mutat) // Strict 3-scale limit. if (_is_covering(mutat) && _body_covered() >= 3) - return (true); + return true; // Only Nagas and Draconians can get this one. if (you.species != SP_NAGA && !player_genus(GENPC_DRACONIAN) && mutat == MUT_STINGER) { - return (true); + return true; } // Need tentacles to grow something on them. if (you.species != SP_OCTOPODE && mutat == MUT_TENTACLE_SPIKE) - return (true); + return true; // No bones. if (you.species == SP_OCTOPODE && mutat == MUT_THIN_SKELETAL_STRUCTURE) - return (true); + return true; // No feet. if (!player_has_feet(false) && (mutat == MUT_HOOVES || mutat == MUT_TALONS)) { - return (true); + return true; } // Only Nagas can get this upgrade. if (you.species != SP_NAGA && mutat == MUT_BREATHE_POISON) - return (true); + return true; // Red Draconians can already breathe flames. if (you.species == SP_RED_DRACONIAN && mutat == MUT_BREATHE_FLAMES) - return (true); + return true; // Green Draconians can breathe mephitic, poison is not really redundant // but its name might confuse players a bit ("noxious" vs "poison"). if (you.species == SP_GREEN_DRACONIAN && mutat == MUT_SPIT_POISON) - return (true); + return true; // Only Draconians can get wings. if (!player_genus(GENPC_DRACONIAN) && mutat == MUT_BIG_WINGS) - return (true); + return true; // Vampires' healing and thirst rates depend on their blood level. if (you.species == SP_VAMPIRE @@ -1117,20 +1117,20 @@ bool physiology_mutation_conflict(mutation_type mutat) || mutat == MUT_REGENERATION || mutat == MUT_SLOW_HEALING || mutat == MUT_FAST_METABOLISM || mutat == MUT_SLOW_METABOLISM)) { - return (true); + return true; } // Felids have innate claws, and unlike trolls/ghouls, there are no // increases for them. if (you.species == SP_FELID && mutat == MUT_CLAWS) - return (true); + return true; // Merfolk have no feet in the natural form, and we never allow mutations // that show up only in a certain transformation. if (you.species == SP_MERFOLK && (mutat == MUT_TALONS || mutat == MUT_HOOVES)) { - return (true); + return true; } equipment_type eq_type = EQ_NONE; @@ -1151,13 +1151,13 @@ bool physiology_mutation_conflict(mutation_type mutat) && mutat != _body_facets[i].mut && player_mutation_level(_body_facets[i].mut, false)) { - return (true); + return true; } } } } - return (false); + return false; } static const char* _stat_mut_desc(mutation_type mut, bool gain) @@ -1229,7 +1229,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, mpr("You feel odd for a moment.", MSGCH_MUTATION); maybe_id_resist(BEAM_POLYMORPH); } - return (false); + return false; } } @@ -1240,7 +1240,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, && !stat_gain_potion) { simple_god_message(" protects your body from mutation!"); - return (false); + return false; } } @@ -1277,7 +1277,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, if (rotting && !demonspawn) { if (no_rot) - return (false); + return false; mpr("Your body decomposes!", MSGCH_MUTATION); @@ -1290,7 +1290,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, } xom_is_stimulated(50); - return (true); + return true; } if (which_mutation == RANDOM_MUTATION @@ -1302,7 +1302,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, // God gifts override mutation loss due to being heavily // mutated. if (!one_chance_in(3) && !god_gift && !force_mutation) - return (false); + return false; else return (delete_mutation(RANDOM_MUTATION, reason, failMsg, force_mutation, false)); @@ -1327,11 +1327,11 @@ bool mutate(mutation_type which_mutation, const std::string &reason, } if (!is_valid_mutation(mutat)) - return (false); + return false; // [Cha] don't allow teleportitis in sprint if (mutat == MUT_TELEPORT && crawl_state.game_is_sprint()) - return (false); + return false; if (you.species == SP_NAGA) { @@ -1339,7 +1339,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, if (mutat == MUT_SPIT_POISON) { if (coinflip()) - return (false); + return false; mutat = MUT_BREATHE_POISON; @@ -1351,7 +1351,7 @@ bool mutate(mutation_type which_mutation, const std::string &reason, } if (physiology_mutation_conflict(mutat)) - return (false); + return false; const mutation_def& mdef = get_mutation_def(mutat); @@ -1369,15 +1369,15 @@ bool mutate(mutation_type which_mutation, const std::string &reason, break; } if (!found) - return (false); + return false; } // God gifts and forced mutations clear away conflicting mutations. int rc = _handle_conflicting_mutations(mutat, god_gift || force_mutation, reason); if (rc == 1) - return (true); + return true; if (rc == -1) - return (false); + return false; ASSERT(rc == 0); @@ -1494,17 +1494,17 @@ bool mutate(mutation_type which_mutation, const std::string &reason, { learned_something_new(HINT_NEW_ABILITY_MUT); } - return (true); + return true; } static bool _delete_single_mutation_level(mutation_type mutat, const std::string &reason) { if (you.mutation[mutat] == 0) - return (false); + return false; if (you.innate_mutations[mutat] >= you.mutation[mutat]) - return (false); + return false; const mutation_def& mdef = get_mutation_def(mutat); @@ -1560,7 +1560,7 @@ static bool _delete_single_mutation_level(mutation_type mutat, take_note(Note(NOTE_LOSE_MUTATION, mutat, you.mutation[mutat], reason.c_str())); - return (true); + return true; } bool delete_mutation(mutation_type which_mutation, const std::string &reason, @@ -1590,7 +1590,7 @@ bool delete_mutation(mutation_type which_mutation, const std::string &reason, { if (failMsg) mpr("You feel rather odd for a moment.", MSGCH_MUTATION); - return (false); + return false; } } } @@ -1604,7 +1604,7 @@ bool delete_mutation(mutation_type which_mutation, const std::string &reason, while (true) { if (one_chance_in(1000)) - return (false); + return false; mutat = static_cast<mutation_type>(random2(NUM_MUTATIONS)); @@ -1786,7 +1786,7 @@ std::string mutation_name(mutation_type mut, int level, bool colour) result = ostr.str(); } - return (result); + return result; } // The "when" numbers indicate the range of times in which the mutation tries @@ -2130,7 +2130,7 @@ int how_mutated(bool all, bool levels) dprf("how_mutated(): all = %u, levels = %u, j = %d", all, levels, j); - return (j); + return j; } // Return whether current tension is balanced @@ -2143,7 +2143,7 @@ static bool _balance_demonic_guardian() // tension is unfavorably high, perhaps another guardian should spawn if (tension*3/4 > mutlevel*6 + random2(mutlevel*mutlevel*2)) - return (false); + return false; for (int i = 0; mons && i <= 20/mutlevel; ++mons) { @@ -2164,7 +2164,7 @@ static bool _balance_demonic_guardian() total += mons_val; } - return (true); + return true; } // Primary function to handle and balance demonic guardians, if the tension @@ -2298,7 +2298,7 @@ int handle_pbd_corpses(bool do_rot) } } - return (corpse_count); + return corpse_count; } int augmentation_amount() diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 285b4bd764..2c153cd8e6 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -139,7 +139,7 @@ static std::string _welcome(const newgame_def* ng) if (!text.empty()) text = ", " + text; text = "Welcome" + text + "."; - return (text); + return text; } static void _print_character_info(const newgame_def* ng) @@ -153,33 +153,33 @@ static void _print_character_info(const newgame_def* ng) static bool _is_species_valid_choice(species_type species) { if (species < 0 || species > NUM_SPECIES) - return (false); + return false; if (species >= SP_ELF) // These are all invalid. - return (false); + return false; #if 0 if (species == SP_MY_NEW_TRUNK_ONLY_EXPERIMENT && Version::ReleaseType() != VER_ALPHA) { - return (false); + return false; } #endif // Non-base draconians cannot be selected either. if (species >= SP_RED_DRACONIAN && species < SP_BASE_DRACONIAN) - return (false); + return false; - return (true); + return true; } // Determines if a job is valid. static bool _is_job_valid_choice(job_type job) { if (job < 0 || job > NUM_JOBS) - return (false); + return false; - return (true); + return true; } #ifdef ASSERTS @@ -201,7 +201,7 @@ undead_state_type get_undead_state(const species_type sp) return US_SEMI_UNDEAD; default: ASSERT(!_species_is_undead(sp)); - return (US_ALIVE); + return US_ALIVE; } } @@ -502,7 +502,7 @@ bool choose_game(newgame_def* ng, newgame_def* choice, cprintf("\nDo you really want to overwrite your old game? "); char c = getchm(); if (c != 'Y' && c != 'y') - return (true); + return true; } } #endif @@ -516,7 +516,7 @@ bool choose_game(newgame_def* ng, newgame_def* choice, write_newgame_options_file(*choice); - return (false); + return false; } // Set ng_choice to defaults without overwriting name and game type. @@ -1327,11 +1327,11 @@ static weapon_type _fixup_weapon(weapon_type wp, const std::vector<weapon_choice>& weapons) { if (wp == WPN_UNKNOWN || wp == WPN_RANDOM || wp == WPN_VIABLE) - return (wp); + return wp; for (unsigned int i = 0; i < weapons.size(); ++i) if (wp == weapons[i].first) - return (wp); - return (WPN_UNKNOWN); + return wp; + return WPN_UNKNOWN; } static void _construct_weapon_menu(const weapon_type& defweapon, @@ -1731,7 +1731,7 @@ static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice, { // No weapon use at all. The actual item will be removed later. if (ng->species == SP_FELID) - return (true); + return true; switch (ng->job) { @@ -1746,7 +1746,7 @@ static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice, case JOB_ARCANE_MARKSMAN: break; default: - return (true); + return true; } std::vector<weapon_choice> weapons = _get_weapons(ng); @@ -1755,15 +1755,15 @@ static bool _choose_weapon(newgame_def* ng, newgame_def* ng_choice, if (weapons.size() == 1) { ng->weapon = ng_choice->weapon = weapons[0].first; - return (true); + return true; } if (ng_choice->weapon == WPN_UNKNOWN) if (!_prompt_weapon(ng, ng_choice, defaults, weapons)) - return (false); + return false; _resolve_weapon(ng, ng_choice, weapons); - return (true); + return true; } static void _construct_gamemode_map_menu(const mapref_vector& maps, diff --git a/crawl-ref/source/ng-input.cc b/crawl-ref/source/ng-input.cc index fb3cf3e95d..b551ad14d0 100644 --- a/crawl-ref/source/ng-input.cc +++ b/crawl-ref/source/ng-input.cc @@ -69,11 +69,11 @@ bool is_good_name(const std::string& name, bool blankOK, bool verbose) if (name.empty()) { if (blankOK) - return (true); + return true; if (verbose) cprintf("\nThat's a silly name!\n"); - return (false); + return false; } return (validate_player_name(name, verbose)); @@ -99,11 +99,11 @@ static bool _read_player_name(std::string &name) if (!ret) { name = buf; - return (true); + return true; } if (key_is_escape(ret)) - return (false); + return false; // Go back and prompt the user. } @@ -138,7 +138,7 @@ bool validate_player_name(const std::string &name, bool verbose) { if (verbose) cprintf("\nSorry, that name gives your OS a headache.\n"); - return (false); + return false; } #endif @@ -146,7 +146,7 @@ bool validate_player_name(const std::string &name, bool verbose) { if (verbose) cprintf("\nThat name is too long.\n"); - return (false); + return false; } ucs_t c; @@ -166,9 +166,9 @@ bool validate_player_name(const std::string &name, bool verbose) "and underscores only, please." "\n"); } - return (false); + return false; } } - return (true); + return true; } diff --git a/crawl-ref/source/ng-restr.cc b/crawl-ref/source/ng-restr.cc index 59ff7b0329..3272d241bf 100644 --- a/crawl-ref/source/ng-restr.cc +++ b/crawl-ref/source/ng-restr.cc @@ -32,16 +32,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_VAMPIRE: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_GLADIATOR: switch (speci) { case SP_FELID: - return (CC_BANNED); + return CC_BANNED; case SP_DEEP_ELF: case SP_SLUDGE_ELF: case SP_HALFLING: @@ -54,9 +54,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_VAMPIRE: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_MONK: @@ -73,16 +73,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_DEMIGOD: case SP_MUMMY: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_BERSERKER: switch (speci) { case SP_DEMIGOD: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_SLUDGE_ELF: @@ -91,25 +91,25 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_CHAOS_KNIGHT: switch (speci) { case SP_DEMIGOD: - return (CC_BANNED); + return CC_BANNED; default: - return (CC_RESTRICTED); + return CC_RESTRICTED; } case JOB_DEATH_KNIGHT: switch (speci) { case SP_DEMIGOD: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_SLUDGE_ELF: @@ -123,16 +123,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_VAMPIRE: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_ABYSSAL_KNIGHT: switch (speci) { case SP_DEMIGOD: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_SLUDGE_ELF: @@ -147,9 +147,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_VAMPIRE: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_PRIEST: @@ -160,7 +160,7 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_GHOUL: case SP_VAMPIRE: - return (CC_BANNED); + return CC_BANNED; case SP_DEEP_ELF: case SP_SLUDGE_ELF: case SP_DEEP_DWARF: @@ -176,9 +176,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_BASE_DRACONIAN: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_HEALER: @@ -189,7 +189,7 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_GHOUL: case SP_VAMPIRE: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_HALFLING: @@ -199,9 +199,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_TENGU: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_SKALD: @@ -221,9 +221,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_WARPER: @@ -245,9 +245,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_WIZARD: @@ -263,9 +263,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_FELID: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_CONJURER: @@ -285,9 +285,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_FELID: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_ENCHANTER: @@ -309,9 +309,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_SUMMONER: @@ -329,9 +329,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_TROLL: case SP_MINOTAUR: case SP_GHOUL: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_NECROMANCER: @@ -344,9 +344,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_OGRE: case SP_TROLL: case SP_MINOTAUR: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_TRANSMUTER: @@ -354,7 +354,7 @@ char_choice_restriction job_allowed(species_type speci, job_type job) { case SP_MUMMY: case SP_GHOUL: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_DEEP_DWARF: @@ -366,9 +366,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MINOTAUR: case SP_TENGU: case SP_VAMPIRE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_FIRE_ELEMENTALIST: @@ -386,9 +386,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_FELID: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_ICE_ELEMENTALIST: @@ -404,9 +404,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MINOTAUR: case SP_TENGU: case SP_FELID: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_AIR_ELEMENTALIST: @@ -423,9 +423,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_FELID: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_EARTH_ELEMENTALIST: @@ -442,9 +442,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_VAMPIRE: case SP_FELID: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_VENOM_MAGE: @@ -461,9 +461,9 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_GHOUL: case SP_VAMPIRE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_STALKER: @@ -487,16 +487,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_FELID: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_ASSASSIN: switch (speci) { case SP_FELID: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_DEEP_DWARF: @@ -512,16 +512,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_GHOUL: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_HUNTER: switch (speci) { case SP_FELID: - return (CC_BANNED); + return CC_BANNED; case SP_DEEP_ELF: case SP_HILL_ORC: case SP_MERFOLK: @@ -534,16 +534,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_ARTIFICER: switch (speci) { case SP_FELID: - return (CC_BANNED); + return CC_BANNED; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_SLUDGE_ELF: @@ -558,16 +558,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_GHOUL: case SP_VAMPIRE: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_ARCANE_MARKSMAN: switch (speci) { case SP_FELID: - return (CC_BANNED); + return CC_BANNED; case SP_DEEP_DWARF: case SP_HILL_ORC: case SP_MERFOLK: @@ -580,16 +580,16 @@ char_choice_restriction job_allowed(species_type speci, job_type job) case SP_MUMMY: case SP_GHOUL: case SP_OCTOPODE: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; } case JOB_WANDERER: - return (CC_RESTRICTED); + return CC_RESTRICTED; default: - return (CC_BANNED); + return CC_BANNED; } } @@ -616,8 +616,8 @@ char_choice_restriction weapon_restriction(weapon_type wpn, { case WPN_UNARMED: if (species_has_claws(ng.species)) - return (CC_UNRESTRICTED); - return (CC_BANNED); + return CC_UNRESTRICTED; + return CC_BANNED; case WPN_SHORT_SWORD: switch (ng.species) @@ -626,7 +626,7 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_VAMPIRE: // The fighter's heavy armour hinders stabbing. if (ng.job == JOB_FIGHTER) - return (CC_RESTRICTED); + return CC_RESTRICTED; // else fall through case SP_HIGH_ELF: case SP_DEEP_ELF: @@ -636,18 +636,18 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_HALFLING: case SP_KOBOLD: case SP_SPRIGGAN: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; default: - return (CC_RESTRICTED); + return CC_RESTRICTED; } // Maces and hand axes usually share the same restrictions. case WPN_MACE: if (ng.species == SP_TROLL || ng.species == SP_OGRE) - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; if (ng.species == SP_VAMPIRE) - return (CC_RESTRICTED); + return CC_RESTRICTED; // else fall-through case WPN_HAND_AXE: switch (ng.species) @@ -665,10 +665,10 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_VAMPIRE: case SP_OCTOPODE: case SP_BASE_DRACONIAN: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; default: - return (CC_RESTRICTED); + return CC_RESTRICTED; } case WPN_SPEAR: @@ -687,7 +687,7 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_MUMMY: case SP_OCTOPODE: case SP_BASE_DRACONIAN: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; case SP_SPRIGGAN: case SP_HALFLING: @@ -696,14 +696,14 @@ char_choice_restriction weapon_restriction(weapon_type wpn, // jobs with other benefits like Warper, Skald or godlies // are better with two-handers. if (ng.job == JOB_FIGHTER || ng.job == JOB_GLADIATOR) - return (CC_BANNED); + return CC_BANNED; default: return CC_RESTRICTED; } case WPN_FALCHION: if (ng.job != JOB_FIGHTER && ng.job != JOB_GLADIATOR) - return (CC_BANNED); + return CC_BANNED; switch (ng.species) { case SP_HUMAN: @@ -722,17 +722,17 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_VAMPIRE: case SP_OCTOPODE: case SP_BASE_DRACONIAN: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; default: - return (CC_RESTRICTED); + return CC_RESTRICTED; } case WPN_TRIDENT: if (ng.job != JOB_FIGHTER && ng.job != JOB_GLADIATOR || species_size(ng.species, PSIZE_BODY) < SIZE_MEDIUM) { - return (CC_BANNED); + return CC_BANNED; } // Tridents are strictly better than spears, so unrestrict them @@ -742,7 +742,7 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_DEEP_DWARF: case SP_GHOUL: case SP_VAMPIRE: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; default: break; } @@ -752,7 +752,7 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case WPN_QUARTERSTAFF: if (ng.job != JOB_GLADIATOR) - return (CC_BANNED); + return CC_BANNED; switch (ng.species) { case SP_CENTAUR: @@ -768,10 +768,10 @@ char_choice_restriction weapon_restriction(weapon_type wpn, case SP_OCTOPODE: case SP_SLUDGE_ELF: case SP_BASE_DRACONIAN: - return (CC_UNRESTRICTED); + return CC_UNRESTRICTED; default: - return (CC_RESTRICTED); + return CC_RESTRICTED; } case WPN_CROSSBOW: @@ -863,6 +863,6 @@ char_choice_restriction weapon_restriction(weapon_type wpn, // intentional fall-through default: - return (CC_BANNED); + return CC_BANNED; } } diff --git a/crawl-ref/source/ng-wanderer.cc b/crawl-ref/source/ng-wanderer.cc index fb7eadfa1f..c472a9c952 100644 --- a/crawl-ref/source/ng-wanderer.cc +++ b/crawl-ref/source/ng-wanderer.cc @@ -88,7 +88,7 @@ static bool _give_wanderer_weapon(int & slot, int wpn_skill, int plus) you.inv[slot].plus = random2(plus) + offset; you.inv[slot].plus2 = random2(plus) + offset; - return (true); + return true; } // The overall role choice for wanderers is a weighted chance based on @@ -110,7 +110,7 @@ static stat_type _wanderer_choose_role() else role = STAT_INT; - return (role); + return role; } static skill_type _apt_weighted_choice(const skill_type * skill_array, @@ -136,7 +136,7 @@ static skill_type _apt_weighted_choice(const skill_type * skill_array, return (skill_array[i]); } - return (NUM_SKILLS); + return NUM_SKILLS; } static skill_type _wanderer_role_skill_select(stat_type selected_role, @@ -209,7 +209,7 @@ static skill_type _wanderer_role_skill_select(stat_type selected_role, ASSERT(you.species == SP_FELID); selected_skill = SK_UNARMED_COMBAT; } - return (selected_skill); + return selected_skill; } static skill_type _wanderer_role_weapon_select(stat_type role) @@ -249,7 +249,7 @@ static skill_type _wanderer_role_weapon_select(stat_type role) break; } - return (skill); + return skill; } static void _wanderer_role_skill(stat_type role, int levels) @@ -288,7 +288,7 @@ static skill_type _weighted_skill_roll() return (skill_type(i)); } - return (NUM_SKILLS); + return NUM_SKILLS; } static void _give_wanderer_book(skill_type skill, int & slot) diff --git a/crawl-ref/source/notes.cc b/crawl-ref/source/notes.cc index cdb387107d..fb80a399f2 100644 --- a/crawl-ref/source/notes.cc +++ b/crawl-ref/source/notes.cc @@ -48,9 +48,9 @@ static bool _is_noteworthy_skill_level(int level) { for (unsigned int i = 0; i < Options.note_skill_levels.size(); ++i) if (level == Options.note_skill_levels[i]) - return (true); + return true; - return (false); + return false; } static bool _is_highest_skill(int skill) @@ -60,9 +60,9 @@ static bool _is_highest_skill(int skill) if (i == skill) continue; if (you.skills[i] >= you.skills[skill]) - return (false); + return false; } - return (true); + return true; } static bool _is_noteworthy_hp(int hp, int maxhp) @@ -85,21 +85,21 @@ static bool _is_noteworthy_dlevel(unsigned short place) // The Abyss is noted a different way (since we care mostly about the cause). if (branch == BRANCH_ABYSS) - return (false); + return false; // Other portal levels are always interesting. if (!is_connected_branch(static_cast<branch_type>(branch))) - return (true); + return true; if (lev == _dungeon_branch_depth(branch) || branch == BRANCH_MAIN_DUNGEON && (lev % 5) == 0 || branch == BRANCH_MAIN_DUNGEON && lev == 14 || branch != BRANCH_MAIN_DUNGEON && lev == 1) { - return (true); + return true; } - return (false); + return false; } // Is a note worth taking? @@ -134,7 +134,7 @@ static bool _is_noteworthy(const Note& note) || note.type == NOTE_ALLY_DEATH || note.type == NOTE_FEAT_MIMIC) { - return (true); + return true; } // Never noteworthy, hooked up for fun or future use. @@ -142,7 +142,7 @@ static bool _is_noteworthy(const Note& note) || note.type == NOTE_MAXHP_CHANGE || note.type == NOTE_MAXMP_CHANGE) { - return (false); + return false; } // Xom effects are only noteworthy if the option is true. @@ -153,14 +153,14 @@ static bool _is_noteworthy(const Note& note) if (note.type == NOTE_GOD_POWER && _real_god_power(note.first, note.second) == -1) { - return (false); + return false; } // HP noteworthiness is handled in its own function. if (note.type == NOTE_HP_CHANGE && !_is_noteworthy_hp(note.first, note.second)) { - return (false); + return false; } // Skills are noteworthy if in the skill value list or if @@ -171,9 +171,9 @@ static bool _is_noteworthy(const Note& note) || _is_noteworthy_skill_level(note.second) || Options.note_skill_max && _is_highest_skill(note.first)) { - return (true); + return true; } - return (false); + return false; } if (note.type == NOTE_DUNGEON_LEVEL_CHANGE) @@ -189,7 +189,7 @@ static bool _is_noteworthy(const Note& note) { case NOTE_GOD_POWER: if (rnote.first == note.first && rnote.second == note.second) - return (false); + return false; break; case NOTE_HP_CHANGE: @@ -198,7 +198,7 @@ static bool _is_noteworthy(const Note& note) if (note.turn - rnote.turn < 5 && note.first * 2 >= rnote.first) { - return (false); + return false; } break; @@ -206,10 +206,10 @@ static bool _is_noteworthy(const Note& note) mpr("Buggy note passed: unknown note type"); // Return now, rather than give a "Buggy note passed" message // for each note of the matching type in the note list. - return (true); + return true; } } - return (true); + return true; } static const char* _number_to_ordinal(int number) @@ -482,7 +482,7 @@ static bool notes_active = false; bool notes_are_active() { - return (notes_active); + return notes_active; } void take_note(const Note& note, bool force) diff --git a/crawl-ref/source/orb.cc b/crawl-ref/source/orb.cc index bbfd54db61..119fe06aeb 100644 --- a/crawl-ref/source/orb.cc +++ b/crawl-ref/source/orb.cc @@ -35,10 +35,10 @@ static bool _orb_noise(const coord_def& where, int loudness) flash_view_delay(MAGENTA, 100); flash_view_delay(LIGHTMAGENTA, 100); - return (false); + return false; } - return (true); + return true; } /** diff --git a/crawl-ref/source/ouch.cc b/crawl-ref/source/ouch.cc index d80dfac87f..e27cef9f67 100644 --- a/crawl-ref/source/ouch.cc +++ b/crawl-ref/source/ouch.cc @@ -354,7 +354,7 @@ int check_your_resists(int hurted, beam_type flavour, std::string source, if (doEffects && hurted != original) maybe_id_resist(flavour); - return (hurted); + return hurted; } void splash_with_acid(int acid_strength, bool corrode_items, @@ -545,7 +545,7 @@ static int _get_target_class(beam_type flavour) break; } - return (target_class); + return target_class; } // XXX: These expose functions could use being reworked into a real system... @@ -559,7 +559,7 @@ static bool _expose_invent_to_element(beam_type flavour, int strength) const int target_class = _get_target_class(flavour); if (target_class == OBJ_UNASSIGNED) - return (false); + return false; // Fedhas worshipers are exempt from the food destruction effect // of spores. @@ -568,7 +568,7 @@ static bool _expose_invent_to_element(beam_type flavour, int strength) { simple_god_message(" protects your food from the spores.", GOD_FEDHAS); - return (false); + return false; } // Currently we test against each stack (and item in the stack) @@ -686,15 +686,15 @@ static bool _expose_invent_to_element(beam_type flavour, int strength) } if (!total_dest) - return (false); + return false; // Message handled elsewhere. if (flavour == BEAM_DEVOUR_FOOD) - return (true); + return true; xom_is_stimulated((num_dest > 1) ? 25 : 12); - return (true); + return true; } bool expose_items_to_element(beam_type flavour, const coord_def& where, @@ -704,11 +704,11 @@ bool expose_items_to_element(beam_type flavour, const coord_def& where, const int target_class = _get_target_class(flavour); if (target_class == OBJ_UNASSIGNED) - return (false); + return false; // Beams fly *over* water and lava. if (grd(where) == DNGN_LAVA || grd(where) == DNGN_DEEP_WATER) - return (false); + return false; for (stack_iterator si(where); si; ++si) { @@ -731,10 +731,10 @@ bool expose_items_to_element(beam_type flavour, const coord_def& where, } if (!num_dest) - return (false); + return false; if (flavour == BEAM_DEVOUR_FOOD) - return (true); + return true; if (you.see_cell(where)) { @@ -765,7 +765,7 @@ bool expose_items_to_element(beam_type flavour, const coord_def& where, xom_is_stimulated((num_dest > 1) ? 25 : 12); - return (true); + return true; } // Handle side-effects for exposure to element other than damage. This @@ -784,7 +784,7 @@ bool expose_player_to_element(beam_type flavour, int strength, _maybe_melt_player_enchantments(flavour, strength ? strength : 10); if (strength <= 0 || !damage_inventory) - return (false); + return false; return (_expose_invent_to_element(flavour, strength)); } @@ -835,7 +835,7 @@ bool drain_exp(bool announce_full) if (announce_full) canned_msg(MSG_YOU_RESIST); - return (false); + return false; } if (you.experience == 0) @@ -843,14 +843,14 @@ bool drain_exp(bool announce_full) ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_DRAINING); // Return in case death was escaped via wizard mode. - return (true); + return true; } if (you.experience_level == 1) { you.experience = 0; - return (true); + return true; } unsigned int total_exp = exp_needed(you.experience_level + 1) @@ -886,10 +886,10 @@ bool drain_exp(bool announce_full) level_change(); - return (true); + return true; } - return (false); + return false; } static void _xom_checks_damage(kill_method_type death_type, @@ -1391,7 +1391,7 @@ std::string morgue_name(std::string char_name, time_t when_crawl_got_even) if (!time.empty()) name += "-" + time; - return (name); + return name; } // Delete save files on game end. @@ -1556,11 +1556,11 @@ void _end_game(scorefile_entry &se) int actor_to_death_source(const actor* agent) { if (agent->is_player()) - return (NON_MONSTER); + return NON_MONSTER; else if (agent->is_monster()) return (agent->as_monster()->mindex()); else - return (NON_MONSTER); + return NON_MONSTER; } int timescale_damage(const actor *act, int damage) diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 985df4482b..636e5bb64a 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -314,7 +314,7 @@ static void _print_stats_hp(int x, int y) static short _get_stat_colour(stat_type stat) { if (you.stat_zero[stat] > 0) - return (LIGHTRED); + return LIGHTRED; // Check the stat_colour option for warning thresholds. for (unsigned int i = 0; i < Options.stat_colour.size(); ++i) @@ -328,14 +328,14 @@ static short _get_stat_colour(stat_type stat) || stat == STAT_INT && you.duration[DUR_BRILLIANCE] || stat == STAT_DEX && you.duration[DUR_AGILITY]) { - return (LIGHTBLUE); // no end of effect warning + return LIGHTBLUE; // no end of effect warning } // Stat is degenerated. if (you.stat_loss[stat] > 0) - return (YELLOW); + return YELLOW; - return (HUD_VALUE_COLOUR); + return HUD_VALUE_COLOUR; } static void _print_stat(stat_type stat, int x, int y) @@ -999,7 +999,7 @@ static std::string _get_monster_name(const monster_info& mi, } desc += monpane_desc; - return (desc); + return desc; } // If past is true, the messages should be printed in the past tense @@ -1017,7 +1017,7 @@ std::string mpr_monster_list(bool past) msg += (past ? "were" : "are"); msg += " no monsters in sight!"; - return (msg); + return msg; } std::vector<std::string> describe; @@ -1045,7 +1045,7 @@ std::string mpr_monster_list(bool past) msg += comma_separated_line(describe.begin(), describe.end()); msg += "."; - return (msg); + return msg; } #ifndef USE_TILE_LOCAL @@ -1200,13 +1200,13 @@ int update_monster_pane() if (mons.empty()) return (-1); - return (full_info); + return full_info; } #else // FIXME: Implement this for Tiles! int update_monster_pane() { - return (false); + return false; } #endif @@ -1502,7 +1502,7 @@ static std::string _god_powers(bool simple) std::string asterisks = std::string(prank, '*') + std::string(6 - prank, '.'); if (simple) - return (asterisks); + return asterisks; godpowers = chop_string(godpowers, 20, false) + " [" + asterisks + "]"; return (colour_string(godpowers, god_colour(you.religion))); @@ -1943,7 +1943,7 @@ static std::string _annotate_form_based(std::string desc, bool suppressed) if (suppressed) return ("<darkgrey>(" + desc + ")</darkgrey>"); else - return (desc); + return desc; } static std::string _dragon_abil(std::string desc) diff --git a/crawl-ref/source/place.cc b/crawl-ref/source/place.cc index 51a2a26315..0fcfebe1d8 100644 --- a/crawl-ref/source/place.cc +++ b/crawl-ref/source/place.cc @@ -117,7 +117,7 @@ std::vector<level_id> all_dungeon_ids() for (int depth = 1; depth <= brdepth[i]; depth++) out.push_back(level_id(branch.id, depth)); } - return (out); + return out; } bool is_level_on_stack(level_id lev) diff --git a/crawl-ref/source/player-act.cc b/crawl-ref/source/player-act.cc index fd5a6b7ce1..eaca5e8cab 100644 --- a/crawl-ref/source/player-act.cc +++ b/crawl-ref/source/player-act.cc @@ -31,17 +31,17 @@ int player::mindex() const { - return (MHITYOU); + return MHITYOU; } kill_category player::kill_alignment() const { - return (KC_YOU); + return KC_YOU; } god_type player::deity() const { - return (religion); + return religion; } bool player::alive() const @@ -58,7 +58,7 @@ bool player::is_summoned(int* _duration, int* summon_type) const if (summon_type != NULL) *summon_type = 0; - return (false); + return false; } void player::moveto(const coord_def &c, bool clear_net) @@ -117,7 +117,7 @@ bool player::swimming() const bool player::submerged() const { - return (false); + return false; } bool player::floundering() const @@ -138,7 +138,7 @@ bool player::extra_balanced() const int player::get_experience_level() const { - return (experience_level); + return experience_level; } bool player::can_pass_through_feat(dungeon_feature_type grid) const @@ -149,18 +149,18 @@ bool player::can_pass_through_feat(dungeon_feature_type grid) const bool player::is_habitable_feat(dungeon_feature_type actual_grid) const { if (!can_pass_through_feat(actual_grid)) - return (false); + return false; if (airborne()) - return (true); + return true; if (actual_grid == DNGN_LAVA || actual_grid == DNGN_DEEP_WATER && !can_swim()) { - return (false); + return false; } - return (true); + return true; } size_type player::body_size(size_part_type psize, bool base) const @@ -180,7 +180,7 @@ int player::body_weight(bool base) const int weight = actor::body_weight(base); if (base) - return (weight); + return weight; switch (form) { @@ -194,7 +194,7 @@ int player::body_weight(bool base) const break; } - return (weight); + return weight; } int player::total_weight() const @@ -207,13 +207,13 @@ int player::damage_type(int) if (const item_def* wp = weapon()) return (get_vorpal_type(*wp)); else if (form == TRAN_BLADE_HANDS) - return (DVORP_SLICING); + return DVORP_SLICING; else if (has_usable_claws()) - return (DVORP_CLAWING); + return DVORP_CLAWING; else if (has_usable_tentacles()) - return (DVORP_TENTACLE); + return DVORP_TENTACLE; - return (DVORP_CRUSHING); + return DVORP_CRUSHING; } brand_type player::damage_brand(int) @@ -265,7 +265,7 @@ item_def *player::slot_item(equipment_type eq, bool include_melded) const int item = equip[eq]; if (item == -1 || !include_melded && melded[eq]) - return (NULL); + return NULL; return (&inv[item]); } @@ -276,7 +276,7 @@ const item_def *player::slot_item(equipment_type eq, bool include_melded) const const int item = equip[eq]; if (item == -1 || !include_melded && melded[eq]) - return (NULL); + return NULL; return (&inv[item]); } @@ -284,7 +284,7 @@ const item_def *player::slot_item(equipment_type eq, bool include_melded) const item_def *player::weapon(int /* which_attack */) { if (you.melded[EQ_WEAPON]) - return (NULL); + return NULL; return (slot_item(EQ_WEAPON, false)); } @@ -296,7 +296,7 @@ bool player::can_wield(const item_def& item, bool ignore_curse, if (equip[EQ_WEAPON] != -1 && !ignore_curse) { if (inv[equip[EQ_WEAPON]].cursed()) - return (false); + return false; } // Unassigned means unarmed combat. @@ -304,7 +304,7 @@ bool player::can_wield(const item_def& item, bool ignore_curse, || hands_reqd(item, body_size()) == HANDS_TWO; if (two_handed && !ignore_shield && player_wearing_slot(EQ_SHIELD)) - return (false); + return false; return could_wield(item, ignore_brand, ignore_transform); } @@ -313,36 +313,36 @@ bool player::could_wield(const item_def &item, bool ignore_brand, bool ignore_transform) const { if (species == SP_FELID) - return (false); + return false; if (body_size(PSIZE_TORSO, ignore_transform) < SIZE_LARGE && (item_mass(item) >= 500 || item.base_type == OBJ_WEAPONS && item_mass(item) >= 300)) - return (false); + return false; // Anybody can wield missiles to enchant, item_mass permitting if (item.base_type == OBJ_MISSILES) - return (true); + return true; // Or any other object, although there's no point here. if (!is_weapon(item)) - return (true); + return true; // Small species wielding large weapons... if (body_size(PSIZE_BODY, ignore_transform) < SIZE_MEDIUM && !check_weapon_wieldable_size(item, body_size(PSIZE_BODY, ignore_transform))) { - return (false); + return false; } if (!ignore_brand) { if (undead_or_demonic() && is_holy_item(item)) - return (false); + return false; } - return (true); + return true; } // Returns the shield the player is wearing, or NULL if none. @@ -388,7 +388,7 @@ std::string player::pronoun(pronoun_type pro, bool) const std::string player::conj_verb(const std::string &verb) const { - return (verb); + return verb; } std::string player::hand_name(bool plural, bool *can_plural) const @@ -501,7 +501,7 @@ std::string player::arm_name(bool plural, bool *can_plural) const if (plural) str = pluralise(str); - return (str); + return str; } bool player::fumbles_attack(bool verbose) @@ -520,12 +520,12 @@ bool player::fumbles_attack(bool verbose) if (floundering()) learned_something_new(HINT_FUMBLING_SHALLOW_WATER); } - return (did_fumble); + return did_fumble; } bool player::cannot_fight() const { - return (false); + return false; } // If you have a randart equipped that has the ARTP_ANGRY property, @@ -535,7 +535,7 @@ bool player::cannot_fight() const static bool _equipment_make_berserk() { if (you.suppressed()) - return (false); + return false; for (int eq = EQ_WEAPON; eq < NUM_EQUIP; eq++) { @@ -547,11 +547,11 @@ static bool _equipment_make_berserk() continue; if (artefact_wpn_property(*item, ARTP_ANGRY) && one_chance_in(100)) - return (true); + return true; } // nothing found - return (false); + return false; } void player::attacking(actor *other) @@ -592,7 +592,7 @@ bool player::can_go_berserk(bool intentional, bool potion) const if (verbose) mpr("You're already berserk!"); // or else you won't notice -- no message here. - return (false); + return false; } if (duration[DUR_EXHAUSTED]) @@ -600,14 +600,14 @@ bool player::can_go_berserk(bool intentional, bool potion) const if (verbose) mpr("You're too exhausted to go berserk."); // or else they won't notice -- no message here - return (false); + return false; } if (duration[DUR_DEATHS_DOOR]) { if (verbose) mpr("Your body is effectively dead; that's not a shape for a blood rage."); - return (false); + return false; } if (beheld() && !player_equip_unrand_effect(UNRAND_DEMON_AXE)) @@ -615,7 +615,7 @@ bool player::can_go_berserk(bool intentional, bool potion) const if (verbose) mpr("You are too mesmerised to rage."); // or else they won't notice -- no message here - return (false); + return false; } if (afraid()) @@ -623,7 +623,7 @@ bool player::can_go_berserk(bool intentional, bool potion) const if (verbose) mpr("You are too terrified to rage."); - return (false); + return false; } if (!you.can_bleed(false)) @@ -633,7 +633,7 @@ bool player::can_go_berserk(bool intentional, bool potion) const mpr("You cannot raise a blood rage in your lifeless body."); // or else you won't notice -- no message here - return (false); + return false; } // Stasis, but only for identified amulets; unided amulets will @@ -648,7 +648,7 @@ bool player::can_go_berserk(bool intentional, bool potion) const mprf("You cannot go berserk with %s on.", amulet? amulet->name(DESC_YOUR).c_str() : "your amulet"); } - return (false); + return false; } if (!intentional && !potion && player_mental_clarity(true)) @@ -664,7 +664,7 @@ bool player::can_go_berserk(bool intentional, bool potion) const } } - return (false); + return false; } ASSERT(HUNGER_STARVING + BERSERK_NUTRITION < 2066); @@ -672,10 +672,10 @@ bool player::can_go_berserk(bool intentional, bool potion) const { if (verbose) mpr("You're too hungry to go berserk."); - return (false); + return false; } - return (true); + return true; } bool player::berserk() const diff --git a/crawl-ref/source/player-equip.cc b/crawl-ref/source/player-equip.cc index d8638ecac2..85b5054fa9 100644 --- a/crawl-ref/source/player-equip.cc +++ b/crawl-ref/source/player-equip.cc @@ -79,7 +79,7 @@ bool unequip_item(equipment_type slot, bool msg) const int item_slot = you.equip[slot]; if (item_slot == -1) - return (false); + return false; else { item_skills(you.inv[item_slot], you.stop_train); @@ -92,7 +92,7 @@ bool unequip_item(equipment_type slot, bool msg) else you.melded[slot] = false; ash_check_bondage(); - return (true); + return true; } } @@ -106,9 +106,9 @@ bool meld_slot(equipment_type slot, bool msg) { you.melded[slot] = true; _unequip_effect(slot, you.equip[slot], true, msg); - return (true); + return true; } - return (false); + return false; } bool unmeld_slot(equipment_type slot, bool msg) @@ -120,9 +120,9 @@ bool unmeld_slot(equipment_type slot, bool msg) { you.melded[slot] = false; _equip_effect(slot, you.equip[slot], true, msg); - return (true); + return true; } - return (false); + return false; } static void _equip_weapon_effect(item_def& item, bool showMsgs, bool unmeld); @@ -1549,13 +1549,13 @@ static void _unequip_jewellery_effect(item_def &item, bool mesg, bool meld) bool unwield_item(bool showMsgs) { if (!you.weapon()) - return (false); + return false; if (you.berserk()) { if (showMsgs) canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } item_def& item = *you.weapon(); @@ -1563,7 +1563,7 @@ bool unwield_item(bool showMsgs) const bool is_weapon = get_item_slot(item) == EQ_WEAPON; if (is_weapon && !safe_to_remove(item)) - return (false); + return false; unequip_item(EQ_WEAPON, showMsgs); @@ -1571,5 +1571,5 @@ bool unwield_item(bool showMsgs) you.redraw_quiver = true; you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0; - return (true); + return true; } diff --git a/crawl-ref/source/player-stats.cc b/crawl-ref/source/player-stats.cc index 9ad2bfaf2b..c1f327afdf 100644 --- a/crawl-ref/source/player-stats.cc +++ b/crawl-ref/source/player-stats.cc @@ -353,7 +353,7 @@ static int _strength_modifier() default: break; } - return (result); + return result; } static int _int_modifier() @@ -384,7 +384,7 @@ static int _int_modifier() result += player_mutation_level(MUT_CLEVER) - player_mutation_level(MUT_DOPEY); - return (result); + return result; } static int _dex_modifier() @@ -429,7 +429,7 @@ static int _dex_modifier() default: break; } - return (result); + return result; } static int _stat_modifier(stat_type stat) @@ -474,7 +474,7 @@ bool lose_stat(stat_type which_stat, int stat_loss, bool force, { mprf("Your divine stamina protects you from %s loss.", _stat_name(which_stat).c_str()); - return (false); + return false; } int sust = player_sust_abil(); @@ -501,10 +501,10 @@ bool lose_stat(stat_type which_stat, int stat_loss, bool force, you.stat_loss[which_stat] = std::min<int>(100, you.stat_loss[which_stat] + stat_loss); _handle_stat_change(which_stat, cause, see_source); - return (true); + return true; } else - return (false); + return false; } bool lose_stat(stat_type which_stat, int stat_loss, bool force, @@ -541,7 +541,7 @@ static stat_type _random_lost_stat() if (one_chance_in(found)) choice = static_cast<stat_type>(i); } - return (choice); + return choice; } // Restore the stat in which_stat by the amount in stat_gain, displaying @@ -560,14 +560,14 @@ bool restore_stat(stat_type which_stat, int stat_gain, if (restore_stat(static_cast<stat_type>(i), stat_gain, suppress_msg)) stat_restored = true; - return (stat_restored); + return stat_restored; } if (which_stat == STAT_RANDOM) which_stat = _random_lost_stat(); if (which_stat >= NUM_STATS || you.stat_loss[which_stat] == 0) - return (false); + return false; if (!suppress_msg) { @@ -581,7 +581,7 @@ bool restore_stat(stat_type which_stat, int stat_gain, you.stat_loss[which_stat] -= stat_gain; _handle_stat_change(which_stat); - return (true); + return true; } static void _normalize_stat(stat_type stat) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index c2b4824e49..1243133cd7 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -146,11 +146,11 @@ static bool _check_moveto_cloud(const coord_def& p, if (!yesno(prompt.c_str(), false, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } } } - return (true); + return true; } static bool _check_moveto_trap(const coord_def& p, const std::string &move_verb) @@ -189,7 +189,7 @@ static bool _check_moveto_trap(const coord_def& p, const std::string &move_verb) if (!you.running.is_any_travel()) more(); - return (false); + return false; } } else if (trap->type == TRAP_ZOT && !crawl_state.disables[DIS_CONFIRMATIONS]) @@ -201,7 +201,7 @@ static bool _check_moveto_trap(const coord_def& p, const std::string &move_verb) if (!yes_or_no("%s", prompt.c_str())) { canned_msg(MSG_OK); - return (false); + return false; } } else if (!trap->is_safe() && !crawl_state.disables[DIS_CONFIRMATIONS]) @@ -216,10 +216,10 @@ static bool _check_moveto_trap(const coord_def& p, const std::string &move_verb) if (!yesno(prompt.c_str(), true, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } } - return (true); + return true; } static bool _check_moveto_dangerous(const coord_def& p, const std::string& msg, @@ -229,7 +229,7 @@ static bool _check_moveto_dangerous(const coord_def& p, const std::string& msg, || you.airborne() || cling && you.can_cling_to(p) || !is_feat_dangerous(env.grid(p))) { - return (true); + return true; } if (msg != "") @@ -239,7 +239,7 @@ static bool _check_moveto_dangerous(const coord_def& p, const std::string& msg, else canned_msg(MSG_UNTHINKING_ACT); - return (false); + return false; } static bool _check_moveto_terrain(const coord_def& p, @@ -300,10 +300,10 @@ static bool _check_moveto_exclusion(const coord_def& p, if (!yesno(prompt.c_str(), false, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } } - return (true); + return true; } bool check_moveto(const coord_def& p, const std::string &move_verb, @@ -514,7 +514,7 @@ bool player_under_penance(void) if (you.religion != GOD_NO_GOD) return (you.penance[you.religion]); else - return (false); + return false; } // TODO: get rid of this. @@ -563,7 +563,7 @@ bool is_player_same_species(const monster_type mon, bool transform) return (mons_species(mon) == MONS_GHOUL); if (you.species == SP_MERFOLK && mons_genus(mon) == MONS_MERMAID) - return (true); + return true; // Note that these are currently considered to be the same species: // * halflings and humans @@ -585,7 +585,7 @@ monster_type player_mons(bool transform) { mons = transform_mons(); if (mons != MONS_PLAYER) - return (mons); + return mons; } mons = player_species_to_mons_species(you.species); @@ -603,7 +603,7 @@ monster_type player_mons(bool transform) mons = MONS_OGRE_MAGE; } - return (mons); + return mons; } void update_vision_range() @@ -649,7 +649,7 @@ bool you_can_wear(int eq, bool special_armour) if (you.species == SP_OCTOPODE) { if (special_armour && eq == EQ_HELMET) - return (true); + return true; else return (eq >= EQ_RING_ONE && eq <= EQ_RING_EIGHT || eq == EQ_AMULET || eq == EQ_SHIELD || eq == EQ_WEAPON); @@ -661,81 +661,81 @@ bool you_can_wear(int eq, bool special_armour) case EQ_RIGHT_RING: case EQ_AMULET: case EQ_CLOAK: - return (true); + return true; case EQ_GLOVES: if (player_mutation_level(MUT_CLAWS, false) == 3) - return (false); + return false; // These species cannot wear gloves. if (you.species == SP_TROLL || you.species == SP_SPRIGGAN || you.species == SP_OGRE) { - return (false); + return false; } - return (true); + return true; case EQ_BOOTS: // Bardings. if (you.species == SP_NAGA || you.species == SP_CENTAUR) - return (special_armour); + return special_armour; if (player_mutation_level(MUT_HOOVES, false) == 3 || player_mutation_level(MUT_TALONS, false) == 3) { - return (false); + return false; } // These species cannot wear boots. if (you.species == SP_TROLL || you.species == SP_SPRIGGAN || you.species == SP_OGRE) { - return (false); + return false; } - return (true); + return true; case EQ_BODY_ARMOUR: if (player_genus(GENPC_DRACONIAN)) - return (false); + return false; case EQ_SHIELD: // Most races can wear robes or a buckler/shield. if (special_armour) - return (true); + return true; if (you.species == SP_TROLL || you.species == SP_SPRIGGAN || you.species == SP_OGRE) { - return (false); + return false; } - return (true); + return true; case EQ_HELMET: // No caps or hats with Horns 3 or Antennae 3. if (player_mutation_level(MUT_HORNS, false) == 3 || player_mutation_level(MUT_ANTENNAE, false) == 3) { - return (false); + return false; } // Anyone else can wear caps. if (special_armour) - return (true); + return true; if (player_mutation_level(MUT_HORNS, false) || player_mutation_level(MUT_BEAK, false) || player_mutation_level(MUT_ANTENNAE, false)) { - return (false); + return false; } if (you.species == SP_TROLL || you.species == SP_SPRIGGAN || you.species == SP_OGRE || player_genus(GENPC_DRACONIAN)) { - return (false); + return false; } - return (true); + return true; default: - return (true); + return true; } } @@ -746,16 +746,16 @@ bool player_has_feet(bool temp) || you.species == SP_OCTOPODE || you.fishtail && temp) { - return (false); + return false; } if (player_mutation_level(MUT_HOOVES, temp) == 3 || player_mutation_level(MUT_TALONS, temp) == 3) { - return (false); + return false; } - return (true); + return true; } bool player_wearing_slot(int eq) @@ -781,19 +781,19 @@ bool you_tran_can_wear(const item_def &item) return (you.species == SP_CENTAUR && you_tran_can_wear(EQ_BOOTS)); if (fit_armour_size(item, you.body_size()) != 0) - return (false); + return false; return you_tran_can_wear(get_armour_slot(item), true); default: - return (true); + return true; } } bool you_tran_can_wear(int eq, bool check_mutation) { if (eq == EQ_NONE) - return (true); + return true; if (eq == EQ_STAFF) eq = EQ_WEAPON; @@ -802,26 +802,26 @@ bool you_tran_can_wear(int eq, bool check_mutation) // Everybody can wear at least some type of armour. if (eq == EQ_ALL_ARMOUR) - return (true); + return true; // Not a transformation, but also temporary -> check first. if (check_mutation) { if (eq == EQ_GLOVES && you.has_claws(false) == 3) - return (false); + return false; if (eq == EQ_HELMET && player_mutation_level(MUT_HORNS) == 3) - return (false); + return false; if (eq == EQ_HELMET && player_mutation_level(MUT_ANTENNAE) == 3) - return (false); + return false; if (eq == EQ_BOOTS && (you.fishtail || player_mutation_level(MUT_HOOVES) == 3 || you.has_talons(false) == 3)) { - return (false); + return false; } } @@ -830,19 +830,19 @@ bool you_tran_can_wear(int eq, bool check_mutation) || you.form == TRAN_LICH || you.form == TRAN_APPENDAGE) { - return (true); + return true; } // Bats and pigs cannot wear anything except amulets. if ((you.form == TRAN_BAT || you.form == TRAN_PIG) && eq != EQ_AMULET) - return (false); + return false; // Everyone else can wear jewellery... if (eq == EQ_AMULET || eq == EQ_RINGS || eq == EQ_LEFT_RING || eq == EQ_RIGHT_RING || eq == EQ_RING_ONE || eq == EQ_RING_TWO) { - return (true); + return true; } // ...but not necessarily in all slots. @@ -854,20 +854,20 @@ bool you_tran_can_wear(int eq, bool check_mutation) // These cannot use anything but jewellery. if (you.form == TRAN_SPIDER || you.form == TRAN_DRAGON) - return (false); + return false; if (you.form == TRAN_BLADE_HANDS) { if (eq == EQ_WEAPON || eq == EQ_GLOVES || eq == EQ_SHIELD) - return (false); - return (true); + return false; + return true; } if (you.form == TRAN_ICE_BEAST) { if (eq != EQ_CLOAK) - return (false); - return (true); + return false; + return true; } if (you.form == TRAN_STATUE) @@ -875,35 +875,35 @@ bool you_tran_can_wear(int eq, bool check_mutation) if (eq == EQ_WEAPON || eq == EQ_SHIELD || eq == EQ_CLOAK || eq == EQ_HELMET) { - return (true); + return true; } - return (false); + return false; } - return (true); + return true; } bool player_weapon_wielded() { if (you.melded[EQ_WEAPON]) - return (false); + return false; const int wpn = you.equip[EQ_WEAPON]; if (wpn == -1) - return (false); + return false; if (!is_weapon(you.inv[wpn])) - return (false); + return false; - return (true); + return true; } // Returns false if the player is wielding a weapon inappropriate for Berserk. bool berserk_check_wielded_weapon() { if (!you.weapon()) - return (true); + return true; const item_def weapon = *you.weapon(); if (weapon.defined() && (!is_weapon(weapon) || is_range_weapon(weapon)) @@ -916,13 +916,13 @@ bool berserk_check_wielded_weapon() if (!yesno(prompt.c_str(), true, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } you.attribute[ATTR_WEAPON_SWAP_INTERRUPTED] = 0; } - return (true); + return true; } // Looks in equipment "slot" to see if there is an equipped "sub_type". @@ -1021,7 +1021,7 @@ int player_equip(equipment_type slot, int sub_type, bool calc_unid) break; } - return (ret); + return ret; } // Looks in equipment "slot" to see if equipped item has "special" ego-type @@ -1081,7 +1081,7 @@ int player_equip_ego_type(int slot, int special, bool calc_unid) break; } - return (ret); + return ret; } bool player_equip_unrand_effect(int unrand_index) @@ -1112,7 +1112,7 @@ bool player_equip_unrand(int unrand_index) && is_unrandom_artefact(*item) && item->special == unrand_index) { - return (true); + return true; } break; @@ -1126,7 +1126,7 @@ bool player_equip_unrand(int unrand_index) && is_unrandom_artefact(*item) && item->special == unrand_index) { - return (true); + return true; } } break; @@ -1149,12 +1149,12 @@ bool player_equip_unrand(int unrand_index) && is_unrandom_artefact(*item) && item->special == unrand_index) { - return (true); + return true; } break; } - return (false); + return false; } int player_evokable_levitation() @@ -1177,10 +1177,10 @@ int player_evokable_invis() bool player_can_hit_monster(const monster* mon) { if (!mon->submerged()) - return (true); + return true; if (grd(mon->pos()) != DNGN_SHALLOW_WATER) - return (false); + return false; const item_def *weapon = you.weapon(); return (weapon && weapon_skill(*weapon) == SK_POLEARMS); @@ -1263,7 +1263,7 @@ static int _player_bonus_regen() if (you.duration[DUR_POWERED_BY_DEATH]) rr += handle_pbd_corpses(false) * 100; - return (rr); + return rr; } int player_regen() @@ -1316,7 +1316,7 @@ int player_regen() if (you.attribute[ATTR_DIVINE_REGENERATION]) rr += 100; - return (rr); + return rr; } int player_hunger_rate(bool temp) @@ -1324,7 +1324,7 @@ int player_hunger_rate(bool temp) int hunger = 3; if (temp && player_in_bat_form()) - return (1); + return 1; if (you.species == SP_TROLL) hunger += 3; // in addition to the +3 for fast metabolism @@ -1419,7 +1419,7 @@ int player_hunger_rate(bool temp) if (hunger < 1) hunger = 1; - return (hunger); + return hunger; } int player_spell_levels(void) @@ -1452,7 +1452,7 @@ int player_spell_levels(void) if (sl < 0) sl = 0; - return (sl); + return sl; } int player_likes_chunks(bool permanently) @@ -1550,7 +1550,7 @@ int player_res_fire(bool calc_unid, bool temp, bool items) else if (rf > 3) rf = 3; - return (rf); + return rf; } int player_res_steam(bool calc_unid, bool temp, bool items) @@ -1575,7 +1575,7 @@ int player_res_steam(bool calc_unid, bool temp, bool items) if (res > 3) res = 3; - return (res); + return res; } int player_res_cold(bool calc_unid, bool temp, bool items) @@ -1667,7 +1667,7 @@ int player_res_cold(bool calc_unid, bool temp, bool items) else if (rc > 3) rc = 3; - return (rc); + return rc; } int player_res_corr(bool calc_unid, bool items) @@ -1758,7 +1758,7 @@ int player_res_electricity(bool calc_unid, bool temp, bool items) re = 1; } - return (re); + return re; } bool player_control_teleport(bool calc_unid, bool temp, bool items) @@ -1860,7 +1860,7 @@ int player_res_poison(bool calc_unid, bool temp, bool items) rp--; } - return (rp); + return rp; } static int _maybe_reduce_poison(int amount) @@ -1904,7 +1904,7 @@ int player_res_sticky_flame(bool calc_unid, bool temp, bool items) if (rsf > 1) rsf = 1; - return (rsf); + return rsf; } int player_spec_death() @@ -2168,7 +2168,7 @@ int player_prot_life(bool calc_unid, bool temp, bool items) pl = std::min(3, pl); - return (pl); + return pl; } // New player movement speed system... allows for a bit more than @@ -2246,7 +2246,7 @@ int player_movement_speed(bool ignore_burden) if (mv < 6) mv = 6; - return (mv); + return mv; } // This function differs from the above in that it's used to set the @@ -2291,13 +2291,13 @@ static int _mut_level(mutation_type mut, mutation_activity_type minact) const mutation_activity_type active = mutation_activity_level(mut); if (active >= minact) - return (mlevel); + return mlevel; else if (active == MUTACT_HUNGER) { switch (you.hunger_state) { case HS_ENGORGED: - return (mlevel); + return mlevel; case HS_VERY_FULL: case HS_FULL: return (std::min(mlevel, 2)); @@ -2308,7 +2308,7 @@ static int _mut_level(mutation_type mut, mutation_activity_type minact) } } - return (0); + return 0; } // Output level of player mutation. If temp is true (the default), take into @@ -2388,10 +2388,10 @@ bool player_is_shapechanged(void) || you.form == TRAN_LICH || you.form == TRAN_APPENDAGE) { - return (false); + return false; } - return (true); + return true; } // An evasion factor based on the player's body size, smaller == higher @@ -2438,7 +2438,7 @@ static int _player_para_evasion_bonuses(ev_ignore_type evit) if (player_mutation_level(MUT_DISTORTION_FIELD) > 0) evbonus += player_mutation_level(MUT_DISTORTION_FIELD) + 1; - return (evbonus); + return evbonus; } // Player EV bonuses for various effects and transformations. This @@ -2472,7 +2472,7 @@ static int _player_evasion_bonuses(ev_ignore_type evit) if (you.form == TRAN_STATUE) evbonus -= 10; // stiff and slow - return (evbonus); + return evbonus; } // Player EV scaling for being flying tengu or swimming merfolk. @@ -2510,7 +2510,7 @@ static int _player_scale_evasion(int prescaled_ev, const int scale) default: break; } - return (prescaled_ev); + return prescaled_ev; } // Total EV for player using the revised 0.6 evasion model. @@ -2581,7 +2581,7 @@ static int _player_body_armour_racial_spellcasting_bonus(const int scale) { const item_def *body_armour = you.slot_item(EQ_BODY_ARMOUR, false); if (!body_armour) - return (0); + return 0; const iflags_t armour_race = get_equip_race(*body_armour); const iflags_t player_race = get_species_race(you.species); @@ -2620,7 +2620,7 @@ int player_armour_shield_spell_penalty() static int _player_magical_power(void) { if (you.suppressed()) - return (0); + return 0; int ret = 0; @@ -2628,7 +2628,7 @@ static int _player_magical_power(void) ret += 9 * player_equip(EQ_RINGS, RING_MAGICAL_POWER); ret += scan_artefacts(ARTP_MAGICAL_POWER); - return (ret); + return ret; } int player_mag_abil(bool is_weighted) @@ -2657,7 +2657,7 @@ int player_shield_class(void) int stat = 0; if (you.incapacitated()) - return (0); + return 0; if (player_wearing_slot(EQ_SHIELD)) { @@ -2728,7 +2728,7 @@ int player_sust_abil(bool calc_unid) if (sa > 2) sa = 2; - return (sa); + return sa; } int player_warding(bool calc_unid) @@ -2759,7 +2759,7 @@ int carrying_capacity(burden_state_type bs) else if (bs == BS_ENCUMBERED) return ((cap * 11) / 12); else - return (cap); + return cap; } int burden_change(void) @@ -3613,11 +3613,11 @@ int check_stealth(void) #ifdef WIZARD // Extreme stealthiness can be enforced by wizmode stealth setting. if (you.skills[SK_STEALTH] > 27) - return (1000); + return 1000; #endif if (you.attribute[ATTR_SHADOWS] || you.berserk() || you.stat_zero[STAT_DEX]) - return (0); + return 0; int stealth = you.dex() * 3; @@ -3804,7 +3804,7 @@ int check_stealth(void) stealth = std::max(0, stealth); - return (stealth); + return stealth; } // Returns the medium duration value which is usually announced by a special @@ -3859,7 +3859,7 @@ int get_expiration_threshold(duration_type dur) return (20 * BASELINE_DELAY); default: - return (0); + return 0; } } @@ -3868,7 +3868,7 @@ bool dur_expiring(duration_type dur) { const int value = you.duration[dur]; if (value <= 0) - return (false); + return false; return (value <= get_expiration_threshold(dur)); } @@ -4360,24 +4360,24 @@ bool extrinsic_amulet_effect(jewellery_type amulet) return player_mental_clarity(true, false); case AMU_RESIST_CORROSION: if (you.religion == GOD_JIYVA && you.piety >= piety_breakpoint(2)) - return (true); + return true; // else fall-through case AMU_CONSERVATION: return (player_equip_ego_type(EQ_ALL_ARMOUR, SPARM_PRESERVATION)); case AMU_THE_GOURMAND: return (player_mutation_level(MUT_GOURMAND) > 0); default: - return (false); + return false; } } bool wearing_amulet(jewellery_type amulet, bool calc_unid, bool ignore_extrinsic) { if (!ignore_extrinsic && extrinsic_amulet_effect(amulet)) - return (true); + return true; if (!player_wearing_slot(EQ_AMULET)) - return (false); + return false; const item_def& amu(you.inv[you.equip[EQ_AMULET]]); return (amu.sub_type == amulet && (calc_unid || item_type_known(amu))); @@ -4495,7 +4495,7 @@ int slaying_bonus(weapon_property_type which_affected, bool ranged) ret += std::min(you.duration[DUR_SLAYING] / (13 * BASELINE_DELAY), 6); ret += 3 * augmentation_amount(); - return (ret); + return ret; } // Checks each equip slot for an evokable item (jewellery or randart). @@ -4520,15 +4520,15 @@ bool items_give_ability(const int slot, artefact_prop_type abil) if (eq >= EQ_LEFT_RING && eq < NUM_EQUIP && eq != EQ_AMULET) { if (abil == ARTP_LEVITATE && you.inv[eq].sub_type == RING_LEVITATION) - return (true); + return true; if (abil == ARTP_INVISIBLE && you.inv[eq].sub_type == RING_INVISIBILITY) - return (true); + return true; } else if (eq == EQ_AMULET) { if (abil == ARTP_BERSERK && you.inv[eq].sub_type == AMU_RAGE) - return (true); + return true; } // other items are not evokable @@ -4536,11 +4536,11 @@ bool items_give_ability(const int slot, artefact_prop_type abil) continue; if (artefact_wpn_property(you.inv[ eq ], abil)) - return (true); + return true; } // none of the equipped items possesses this ability - return (false); + return false; } // Checks each equip slot for a randart, and adds up all of those with @@ -4574,7 +4574,7 @@ int scan_artefacts(artefact_prop_type which_property, bool calc_unid) retval += artefact_wpn_property(you.inv[ eq ], which_property); } - return (retval); + return retval; } void dec_hp(int hp_loss, bool fatal, const char *aux) @@ -4635,10 +4635,10 @@ bool enough_hp(int minimum, bool suppress_msg) crawl_state.cancel_cmd_again(); crawl_state.cancel_cmd_repeat(); - return (false); + return false; } - return (true); + return true; } bool enough_mp(int minimum, bool suppress_msg, bool include_items) @@ -4666,7 +4666,7 @@ bool enough_mp(int minimum, bool suppress_msg, bool include_items) crawl_state.cancel_cmd_repeat(); } - return (rc); + return rc; } bool enough_zp(int minimum, bool suppress_msg) @@ -4680,9 +4680,9 @@ bool enough_zp(int minimum, bool suppress_msg) crawl_state.cancel_cmd_again(); crawl_state.cancel_cmd_repeat(); - return (false); + return false; } - return (true); + return true; } void inc_mp(int mp_gain) @@ -4868,7 +4868,7 @@ int get_real_hp(bool trans, bool rotted) if (trans) // Some transformations give you extra hp. hitp = hitp * form_hp_mod() / 10; - return (hitp); + return hitp; } int get_real_mp(bool include_items) @@ -4920,17 +4920,17 @@ int get_contamination_level() if (glow > 60) return (glow / 20 + 3); if (glow > 40) - return (5); + return 5; if (glow > 25) - return (4); + return 4; if (glow > 15) - return (3); + return 3; if (glow > 5) - return (2); + return 2; if (glow > 0) - return (1); + return 1; - return (0); + return 0; } std::string describe_contamination(int cont) @@ -5018,7 +5018,7 @@ bool confuse_player(int amount, bool resistable) ASSERT(!crawl_state.game_is_arena()); if (amount <= 0) - return (false); + return false; if (resistable && player_mental_clarity()) { @@ -5029,13 +5029,13 @@ bool confuse_player(int amount, bool resistable) item_def* const amu = you.slot_item(EQ_AMULET, false); wear_id_type(*amu); } - return (false); + return false; } if (you.duration[DUR_DIVINE_STAMINA] > 0) { mpr("Your divine stamina protects you from confusion!"); - return (false); + return false; } const int old_value = you.duration[DUR_CONF]; @@ -5054,7 +5054,7 @@ bool confuse_player(int amount, bool resistable) / BASELINE_DELAY); } - return (true); + return true; } bool curare_hits_player(int death_source, int amount, const bolt &beam) @@ -5062,10 +5062,10 @@ bool curare_hits_player(int death_source, int amount, const bolt &beam) ASSERT(!crawl_state.game_is_arena()); if (player_res_poison() >= 3) - return (false); + return false; if (!poison_player(amount, beam.get_source_name(), beam.name)) - return (false); + return false; int hurted = 0; @@ -5104,16 +5104,16 @@ bool poison_player(int amount, std::string source, std::string source_aux, if (player_res_poison() >= 3) { dprf("Cannot poison, you are immune!"); - return (false); + return false; } if (!force && !(amount = _maybe_reduce_poison(amount))) - return (false); + return false; if (!force && you.duration[DUR_DIVINE_STAMINA] > 0) { mpr("Your divine stamina protects you from poison!"); - return (false); + return false; } const int old_value = you.duration[DUR_POISONING]; @@ -5214,12 +5214,12 @@ bool miasma_player(std::string source, std::string source_aux) ASSERT(!crawl_state.game_is_arena()); if (you.res_rotting() || you.duration[DUR_DEATHS_DOOR]) - return (false); + return false; if (you.duration[DUR_DIVINE_STAMINA] > 0) { mpr("Your divine stamina protects you from the miasma!"); - return (false); + return false; } bool success = poison_player(1, source, source_aux); @@ -5236,7 +5236,7 @@ bool miasma_player(std::string source, std::string source_aux) success = true; } - return (success); + return success; } bool napalm_player(int amount) @@ -5244,7 +5244,7 @@ bool napalm_player(int amount) ASSERT(!crawl_state.game_is_arena()); if (player_res_sticky_flame() || amount <= 0) - return (false); + return false; const int old_value = you.duration[DUR_LIQUID_FLAMES]; you.increase_duration(DUR_LIQUID_FLAMES, amount, 100); @@ -5252,7 +5252,7 @@ bool napalm_player(int amount) if (you.duration[DUR_LIQUID_FLAMES] > old_value) mpr("You are covered in liquid flames!", MSGCH_WARN); - return (true); + return true; } void dec_napalm_player(int delay) @@ -5305,10 +5305,10 @@ bool slow_player(int turns) ASSERT(!crawl_state.game_is_arena()); if (turns <= 0) - return (false); + return false; if (stasis_blocks_effect(true, true, "%s rumbles.", 20, "%s rumbles.")) - return (false); + return false; // Doubling these values because moving while slowed takes twice the // usual delay. @@ -5328,7 +5328,7 @@ bool slow_player(int turns) learned_something_new(HINT_YOU_ENCHANTED); } - return (true); + return true; } void dec_slow_player(int delay) @@ -5372,12 +5372,12 @@ bool haste_player(int turns, bool rageext) ASSERT(!crawl_state.game_is_arena()); if (turns <= 0) - return (false); + return false; if (stasis_blocks_effect(true, true, "%s emits a piercing whistle.", 20, "%s makes your neck tingle.")) { - return (false); + return false; } // Cutting the nominal turns in half since hasted actions take half the @@ -5397,7 +5397,7 @@ bool haste_player(int turns, bool rageext) you.increase_duration(DUR_HASTE, turns, threshold); - return (true); + return true; } void dec_haste_player(int delay) @@ -5540,7 +5540,7 @@ int count_worn_ego(int which_ego) } } - return (result); + return result; } player::player() @@ -5958,14 +5958,14 @@ int player::visible_igrd(const coord_def &where) const { // shop hack, etc. if (where.x == 0) - return (NON_ITEM); + return NON_ITEM; if (grd(where) == DNGN_LAVA || (grd(where) == DNGN_DEEP_WATER && species != SP_MERFOLK && species != SP_GREY_DRACONIAN && species != SP_OCTOPODE)) { - return (NON_ITEM); + return NON_ITEM; } return (igrd(where)); @@ -5976,22 +5976,22 @@ bool player::has_spell(spell_type spell) const for (int i = 0; i < MAX_KNOWN_SPELLS; i++) { if (spells[i] == spell) - return (true); + return true; } - return (false); + return false; } bool player::cannot_speak() const { if (silenced(pos())) - return (true); + return true; if (cannot_move()) // we allow talking during sleep ;) - return (true); + return true; // No transform that prevents the player from speaking yet. - return (false); + return false; } std::string player::shout_verb() const @@ -6050,7 +6050,7 @@ int calc_hunger(int food_cost) return (food_cost/2); } - return (food_cost); + return food_cost; } int player::warding() const @@ -6131,7 +6131,7 @@ int player::unadjusted_body_armour_penalty() const { const item_def *body_armour = slot_item(EQ_BODY_ARMOUR, false); if (!body_armour) - return (0); + return 0; const int base_ev_penalty = -property(*body_armour, PARM_EVASION); return base_ev_penalty; @@ -6142,7 +6142,7 @@ int player::adjusted_body_armour_penalty(int scale, bool use_size) const { const int base_ev_penalty = unadjusted_body_armour_penalty(); if (!base_ev_penalty) - return (0); + return 0; if (use_size) { @@ -6166,7 +6166,7 @@ int player::adjusted_shield_penalty(int scale) const { const item_def *shield_l = you.slot_item(EQ_SHIELD, false); if (!shield_l) - return (0); + return 0; const int base_shield_penalty = -property(*shield_l, PARM_EVASION); return std::max(0, @@ -6224,7 +6224,7 @@ int player::traps_skill() const int player_icemail_armour_class() { if (!you.mutation[MUT_ICEMAIL]) - return (0); + return 0; return (ICEMAIL_MAX - (you.duration[DUR_ICEMAIL_DEPLETED] @@ -6406,7 +6406,7 @@ int player::gdr_perc() const const item_def *body_armour = slot_item(EQ_BODY_ARMOUR, false); if (!body_armour) - return (0); + return 0; const int body_base_AC = property(*body_armour, PARM_AC); return (14 * pow(std::max(body_base_AC - 2, 0), 0.5)); @@ -6434,15 +6434,15 @@ bool player::heal(int amount, bool max_too) mon_holy_type player::holiness() const { if (form == TRAN_STATUE || petrified()) - return (MH_NONLIVING); + return MH_NONLIVING; if (is_undead) - return (MH_UNDEAD); + return MH_UNDEAD; if (species == SP_DEMONSPAWN) - return (MH_DEMONIC); + return MH_DEMONIC; - return (MH_NATURAL); + return MH_NATURAL; } bool player::undead_or_demonic() const @@ -6453,9 +6453,9 @@ bool player::undead_or_demonic() const bool player::is_holy(bool check_spells) const { if (is_good_god(religion) && check_spells) - return (true); + return true; - return (false); + return false; } bool player::is_unholy(bool check_spells) const @@ -6466,12 +6466,12 @@ bool player::is_unholy(bool check_spells) const bool player::is_evil(bool check_spells) const { if (holiness() == MH_UNDEAD) - return (true); + return true; if (is_evil_god(religion) && check_spells) - return (true); + return true; - return (false); + return false; } // This is a stub. Check is used only for silver damage. Worship of chaotic @@ -6479,7 +6479,7 @@ bool player::is_evil(bool check_spells) const // which could be used for something Zin-related (such as a priestly monster). bool player::is_chaotic() const { - return (false); + return false; } bool player::is_artificial() const @@ -6493,13 +6493,13 @@ bool player::is_unbreathing() const { case TRAN_LICH: case TRAN_STATUE: - return (true); + return true; default: break; } if (petrified()) - return (true); + return true; return player_mutation_level(MUT_UNBREATHING); } @@ -6507,7 +6507,7 @@ bool player::is_unbreathing() const // This is a stub. Makes checking for silver damage a little cleaner. bool player::is_insubstantial() const { - return (false); + return false; } int player::res_acid() const @@ -6598,9 +6598,9 @@ int player::res_holy_energy(const actor *attacker) const return (-1); if (is_holy()) - return (1); + return 1; - return (0); + return 0; } int player::res_negative_energy() const @@ -6695,7 +6695,7 @@ int player_res_magic(bool calc_unid, bool temp) if (you.duration[DUR_LOWERED_MR] && temp) rm /= 2; - return (rm); + return rm; } bool player::no_tele(bool calc_unid, bool permit_id) const @@ -6728,7 +6728,7 @@ flight_type player::flight_mode() const if (form == TRAN_DRAGON || form == TRAN_BAT) { - return (FL_FLY); + return FL_FLY; } else if (is_levitating()) { @@ -6738,7 +6738,7 @@ flight_type player::flight_mode() const : FL_LEVITATE); } else - return (FL_NONE); + return FL_NONE; } bool player::cancellable_levitation() const @@ -6826,7 +6826,7 @@ int player::hurt(const actor *agent, int amount, beam_type flavour, if ((flavour == BEAM_NUKE || flavour == BEAM_DISINTEGRATION) && can_bleed()) blood_spray(pos(), type, amount / 5); - return (amount); + return amount; } void player::drain_stat(stat_type s, int amount, actor *attacker) @@ -6846,18 +6846,18 @@ bool player::rot(actor *who, int amount, int immediate, bool quiet) ASSERT(!crawl_state.game_is_arena()); if (amount <= 0 && immediate <= 0) - return (false); + return false; if (res_rotting() || you.duration[DUR_DEATHS_DOOR]) { mpr("You feel terrible."); - return (false); + return false; } if (you.duration[DUR_DIVINE_STAMINA] > 0) { mpr("Your divine stamina protects you from decay!"); - return (false); + return false; } if (immediate > 0) @@ -6878,7 +6878,7 @@ bool player::rot(actor *who, int amount, int immediate, bool quiet) if (one_chance_in(4)) sicken(50 + random2(100)); - return (true); + return true; } bool player::drain_exp(actor *who, bool quiet, int pow) @@ -6989,19 +6989,19 @@ int player::has_claws(bool allow_tran) const { // these transformations bring claws with them if (form == TRAN_DRAGON) - return (3); + return 3; // blade hands override claws if (form == TRAN_BLADE_HANDS) - return (0); + return 0; // Most forms suppress natural claws. if (!form_keeps_mutations()) - return (0); + return 0; } if (const int c = species_has_claws(you.species)) - return (c); + return c; return (player_mutation_level(MUT_CLAWS, allow_tran)); } @@ -7015,7 +7015,7 @@ int player::has_talons(bool allow_tran) const { // XXX: Do merfolk in water belong under allow_tran? if (you.fishtail) - return (0); + return 0; return (player_mutation_level(MUT_TALONS, allow_tran)); } @@ -7031,7 +7031,7 @@ int player::has_fangs(bool allow_tran) const { // these transformations bring fangs with them if (form == TRAN_DRAGON) - return (3); + return 3; } return (player_mutation_level(MUT_FANGS, allow_tran)); @@ -7048,11 +7048,11 @@ int player::has_tail(bool allow_tran) const { // these transformations bring a tail with them if (form == TRAN_DRAGON) - return (1); + return 1; // Most transformations suppress a tail. if (!form_keeps_mutations()) - return (0); + return 0; } // XXX: Do merfolk in water belong under allow_tran? @@ -7060,10 +7060,10 @@ int player::has_tail(bool allow_tran) const || you.fishtail || player_mutation_level(MUT_STINGER, allow_tran)) { - return (1); + return 1; } - return (0); + return 0; } int player::has_usable_tail(bool allow_tran) const @@ -7073,7 +7073,7 @@ int player::has_usable_tail(bool allow_tran) const if (you.religion == GOD_SHINING_ONE && player_mutation_level(MUT_STINGER, allow_tran) > 0) { - return (0); + return 0; } return (has_tail(allow_tran)); @@ -7086,7 +7086,7 @@ int player::has_usable_tail(bool allow_tran) const bool player::has_usable_offhand() const { if (player_wearing_slot(EQ_SHIELD)) - return (false); + return false; const item_def* wp = slot_item(EQ_WEAPON); return (!wp @@ -7105,7 +7105,7 @@ int player::usable_tentacles() const int numtentacle = has_usable_tentacles(); if (numtentacle == 0) - return (false); + return false; int free_tentacles = numtentacle - num_constricting(); @@ -7141,13 +7141,13 @@ int player::has_tentacles(bool allow_tran) const { // Most transformations suppress tentacles. if (!form_keeps_mutations()) - return (0); + return 0; } if (you.species == SP_OCTOPODE) - return (8); + return 8; - return (0); + return 0; } int player::has_usable_tentacles(bool allow_tran) const @@ -7160,12 +7160,12 @@ bool player::sicken(int amount, bool allow_hint) ASSERT(!crawl_state.game_is_arena()); if (res_rotting() || amount <= 0) - return (false); + return false; if (you.duration[DUR_DIVINE_STAMINA] > 0) { mpr("Your divine stamina protects you from disease!"); - return (false); + return false; } mpr("You feel ill."); @@ -7176,13 +7176,13 @@ bool player::sicken(int amount, bool allow_hint) if (allow_hint) learned_something_new(HINT_YOU_SICK); - return (true); + return true; } bool player::can_see_invisible(bool calc_unid, bool transient) const { if (crawl_state.game_is_arena()) - return (true); + return true; int si = 0; @@ -7224,7 +7224,7 @@ bool player::can_see_invisible(bool calc_unid, bool transient) const if (si > 1) si = 1; - return (si); + return si; } bool player::can_see_invisible() const @@ -7245,7 +7245,7 @@ bool player::misled() const bool player::visible_to(const actor *looker) const { if (crawl_state.game_is_arena()) - return (false); + return false; if (this == looker) return (can_see_invisible() || !invisible()); @@ -7263,28 +7263,28 @@ bool player::backlit(bool check_haloed, bool self_halo) const if (get_contamination_level() > 1 || duration[DUR_CORONA] || duration[DUR_LIQUID_FLAMES] || duration[DUR_QUAD_DAMAGE]) { - return (true); + return true; } if (check_haloed) return (!umbraed() && haloed() && (self_halo || halo_radius2() == -1)); - return (false); + return false; } bool player::umbra(bool check_haloed, bool self_halo) const { if (backlit()) - return (false); + return false; if (check_haloed) return (umbraed() && !haloed() && (self_halo || umbra_radius2() == -1)); - return (false); + return false; } bool player::glows_naturally() const { - return (false); + return false; } // This is the imperative version. @@ -7316,13 +7316,13 @@ bool player::has_lifeforce() const bool player::can_mutate() const { - return (true); + return true; } bool player::can_safely_mutate() const { if (!can_mutate()) - return (false); + return false; return (!is_undead || is_undead == US_SEMI_UNDEAD @@ -7337,17 +7337,17 @@ bool player::can_bleed(bool allow_tran) const if (you.form == TRAN_STATUE || you.form == TRAN_ICE_BEAST || you.form == TRAN_SPIDER) { - return (false); + return false; } } if ((is_undead && is_undead != US_SEMI_UNDEAD) || (is_undead == US_SEMI_UNDEAD && hunger_state <= HS_SATIATED)) { - return (false); + return false; } - return (true); + return true; } bool player::mutate(const std::string &reason) @@ -7355,14 +7355,14 @@ bool player::mutate(const std::string &reason) ASSERT(!crawl_state.game_is_arena()); if (!can_mutate()) - return (false); + return false; if (one_chance_in(5)) { if (::mutate(RANDOM_MUTATION, reason)) { learned_something_new(HINT_YOU_MUTATED); - return (true); + return true; } } @@ -7376,12 +7376,12 @@ bool player::is_icy() const bool player::is_fiery() const { - return (false); + return false; } bool player::is_skeletal() const { - return (false); + return false; } void player::shiftto(const coord_def &c) @@ -7510,7 +7510,7 @@ bool player::do_shaft() dungeon_feature_type force_stair = DNGN_UNSEEN; if (!is_valid_shaft_level()) - return (false); + return false; // Handle instances of do_shaft() being invoked magically when // the player isn't standing over a shaft. @@ -7528,20 +7528,20 @@ bool player::do_shaft() break; default: - return (false); + return false; } handle_items_on_shaft(pos(), false); if (!ground_level() || total_weight() == 0) - return (true); + return true; force_stair = DNGN_TRAP_NATURAL; } down_stairs(force_stair); - return (true); + return true; } bool player::did_escape_death() const diff --git a/crawl-ref/source/potion.cc b/crawl-ref/source/potion.cc index 120331a838..a18f269bd2 100644 --- a/crawl-ref/source/potion.cc +++ b/crawl-ref/source/potion.cc @@ -290,7 +290,7 @@ bool potion_effect(potion_type pot_eff, int pow, bool drank_it, bool was_known, // And also cancel corona (for whatever good that will do). you.duration[DUR_CORONA] = 0; - return (true); + return true; } if (get_contamination_level() > 1) diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index e708b007b5..48fc4cfaa0 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -542,26 +542,26 @@ static bool _item_matches(const item_def &item, fire_type types, if (item.inscription.find(manual ? "+F" : "+f", 0) != std::string::npos) { - return (true); + return true; } if (item.base_type == OBJ_MISSILES) { if ((types & FIRE_DART) && item.sub_type == MI_DART) - return (true); + return true; if ((types & FIRE_STONE) && item.sub_type == MI_STONE) - return (true); + return true; if ((types & FIRE_JAVELIN) && item.sub_type == MI_JAVELIN) - return (true); + return true; if ((types & FIRE_ROCK) && item.sub_type == MI_LARGE_ROCK) - return (true); + return true; if ((types & FIRE_NET) && item.sub_type == MI_THROWING_NET) - return (true); + return true; if (types & FIRE_LAUNCHER) { if (launcher && item.launched_by(*launcher)) - return (true); + return true; } } else if (item.base_type == OBJ_WEAPONS && is_throwable(&you, item)) @@ -570,18 +570,18 @@ static bool _item_matches(const item_def &item, fire_type types, && item.special == SPWPN_RETURNING && item_ident(item, ISFLAG_KNOW_TYPE)) { - return (true); + return true; } if ((types & FIRE_DAGGER) && item.sub_type == WPN_DAGGER) - return (true); + return true; if ((types & FIRE_SPEAR) && item.sub_type == WPN_SPEAR) - return (true); + return true; if ((types & FIRE_HAND_AXE) && item.sub_type == WPN_HAND_AXE) - return (true); + return true; if ((types & FIRE_CLUB) && item.sub_type == WPN_CLUB) - return (true); + return true; } - return (false); + return false; } // Returns inv slot that contains an item that looks like item, diff --git a/crawl-ref/source/random-var.cc b/crawl-ref/source/random-var.cc index 33f7029d6a..ee05315351 100644 --- a/crawl-ref/source/random-var.cc +++ b/crawl-ref/source/random-var.cc @@ -37,7 +37,7 @@ const random_var& random_var::operator=(const random_var& other) int random_var::weight(int val) const { if (val < start || val >= end) - return (0); + return 0; return (weights[val - start]); } @@ -67,7 +67,7 @@ int random_var::roll2val(int r) const v++; w += weight(v); } - return (v); + return v; } int random_var::roll() const @@ -82,7 +82,7 @@ int random_var::max() const int random_var::min() const { - return (start); + return start; } double random_var::expected() const @@ -90,7 +90,7 @@ double random_var::expected() const double ev = 0; for (int i = start; i < end; ++i) ev += i * weight(i) / (double)total; - return (ev); + return ev; } @@ -134,13 +134,13 @@ random_var operator-(const random_var& x, const random_var& y) const random_var& operator+=(random_var& x, const random_var& y) { x = x + y; - return (x); + return x; } const random_var& operator-=(random_var& x, const random_var& y) { x = x - y; - return (x); + return x; } random_var operator/(const random_var& x, int d) @@ -205,7 +205,7 @@ random_var rv::roll_dice(int d, int n) random_var x = constant(0); for (int i = 0; i < d; ++i) x += random_var(1, n+1); - return (x); + return x; } random_var rv::random2(int n) diff --git a/crawl-ref/source/random-weight.h b/crawl-ref/source/random-weight.h index 55a6db400f..a73eb50ef2 100644 --- a/crawl-ref/source/random-weight.h +++ b/crawl-ref/source/random-weight.h @@ -21,7 +21,7 @@ T* random_choose_weighted(std::vector<std::pair<T, int> >& choices) if (sum > r) return (&choices[i].first); } - return (NULL); + return NULL; } /* @@ -45,7 +45,7 @@ T random_choose_weighted(FixedVector<T, SIZE>& choices) sum += choices[i]; if (sum > r) - return (i); + return i; } return -1; } diff --git a/crawl-ref/source/random.cc b/crawl-ref/source/random.cc index 91ba6191b6..ed84e7beaf 100644 --- a/crawl-ref/source/random.cc +++ b/crawl-ref/source/random.cc @@ -42,7 +42,7 @@ const char* random_choose<const char*>(const char* first, ...) ASSERT(nargs > 0); va_end(args); - return (chosen); + return chosen; } #ifndef UINT32_MAX @@ -53,7 +53,7 @@ const char* random_choose<const char*>(const char* first, ...) int random2(int max) { if (max <= 1) - return (0); + return 0; uint32_t partn = UINT32_MAX / max; @@ -78,7 +78,7 @@ bool coinflip(void) int maybe_random2(int x, bool random_factor) { if (x <= 1) - return (0); + return 0; if (random_factor) return (random2(x)); else @@ -89,7 +89,7 @@ int maybe_random2(int x, bool random_factor) int maybe_random_div(int nom, int denom, bool random_factor) { if (nom <= 0) - return (0); + return 0; if (random_factor) return (random2(nom + denom) / denom); else @@ -121,7 +121,7 @@ int roll_dice(int num, int size) ret += random2(size); } - return (ret); + return ret; } int dice_def::roll() const @@ -151,7 +151,7 @@ dice_def calc_dice(int num_dice, int max_damage) ret.size += x_chance_in_y(max_damage % num_dice, num_dice); } - return (ret); + return ret; } // Attempts to make missile weapons nicer to the player by reducing the @@ -190,7 +190,7 @@ int bestroll(int max, int rolls) best = curr; } - return (best); + return best; } // random2avg() returns same mean value as random2() but with a lower variance @@ -216,13 +216,13 @@ int random2limit(int max, int limit) int sum = 0; if (max < 1) - return (0); + return 0; for (i = 0; i < max; i++) if (random2(limit) >= i) sum++; - return (sum); + return sum; } // Generate samples from a binomial distribution with n_trials and trial_prob @@ -265,10 +265,10 @@ bool one_chance_in(int a_million) bool x_chance_in_y(int x, int y) { if (x <= 0) - return (false); + return false; if (x >= y) - return (true); + return true; return (random2(y) < x); } @@ -286,10 +286,10 @@ int fuzz_value(int val, int lowfuzz, int highfuzz, int naverage) bool defer_rand::x_chance_in_y_contd(int x, int y, int index) { if (x <= 0) - return (false); + return false; if (x >= y) - return (true); + return true; do { @@ -301,10 +301,10 @@ bool defer_rand::x_chance_in_y_contd(int x, int y, int index) uint64_t expn_minimum_fail = uint64_t(x) << 32; if (expn_minimum_fail <= expn_rand_1) - return (false); + return false; if (expn_rand_2 <= expn_minimum_fail) - return (true); + return true; // y = expn_rand_2 - expn_rand_1; no-op x = expn_minimum_fail - expn_rand_1; @@ -314,7 +314,7 @@ bool defer_rand::x_chance_in_y_contd(int x, int y, int index) int defer_rand::random2(int maxp1) { if (maxp1 <= 1) - return (0); + return 0; if (bits.empty()) bits.push_back(random_int()); @@ -326,7 +326,7 @@ int defer_rand::random2(int maxp1) int val2 = int(expn_rand_2 >> 32); if (val2 == val1) - return (val1); + return val1; // val2 == val1 + 1 uint64_t expn_thresh = uint64_t(val2) << 32; diff --git a/crawl-ref/source/random.h b/crawl-ref/source/random.h index 7d8a1dfaa8..b01dd0629e 100644 --- a/crawl-ref/source/random.h +++ b/crawl-ref/source/random.h @@ -50,7 +50,7 @@ T random_choose(T first, ...) va_end(args); ASSERT(nargs > 0); - return (chosen); + return chosen; } template <> @@ -78,7 +78,7 @@ T random_choose_weighted(int weight, T first, ...) va_end(args); ASSERT(nargs > 0); - return (chosen); + return chosen; } struct dice_def diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index aebc596c36..cd9f447eb1 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -36,7 +36,7 @@ static int ifloor(double d) { int r = iround(d); if (double_is_zero(d - r)) - return (r); + return r; else return (_ifloor(d)); } @@ -89,7 +89,7 @@ static bool _to_grid(geom::ray *r, bool half); static bool bad_corner(const geom::ray &r) { if (!is_corner(r.start)) - return (false); + return false; geom::ray copy = r; _to_grid(©, true); return (in_non_diamond_int(copy.start)); @@ -144,7 +144,7 @@ static bool _to_next_cell(geom::ray *r) bool c = r->to_next_cell(diamonds); if (c) _round_to_corner(r); - return (c); + return c; } static bool _to_grid(geom::ray *r, bool half) @@ -155,7 +155,7 @@ static bool _to_grid(geom::ray *r, bool half) c = c || is_corner(r->start); if (c) _round_to_corner(r); - return (c); + return c; } static bool _advance_from_non_diamond(geom::ray *r) @@ -164,13 +164,13 @@ static bool _advance_from_non_diamond(geom::ray *r) if (!_to_next_cell(r)) { ASSERT(in_diamond_int(r->start)); - return (false); + return false; } else { // r is now on a corner, going from non-diamond to non-diamond. ASSERT(is_corner(r->start)); - return (true); + return true; } } @@ -209,7 +209,7 @@ bool ray_def::advance() // r is now on a corner, going from diamond to diamond. _to_grid(&r, true); ASSERT(_valid()); - return (true); + return true; } } @@ -237,7 +237,7 @@ static geom::vector _mirror_pt(const geom::vector &vorig, const coord_def &side) v.x = 1.0 - v.x; if (side.y == -1) v.y = 1.0 - v.y; - return (v); + return v; } static geom::vector _mirror_dir(const geom::vector &vorig, const coord_def &side) @@ -247,7 +247,7 @@ static geom::vector _mirror_dir(const geom::vector &vorig, const coord_def &side v.x = -v.x; if (side.y == -1) v.y = -v.y; - return (v); + return v; } static geom::ray _mirror(const geom::ray &rorig, const coord_def &side) @@ -255,7 +255,7 @@ static geom::ray _mirror(const geom::ray &rorig, const coord_def &side) geom::ray r; r.start = _mirror_pt(rorig.start, side); r.dir = _mirror_dir(rorig.dir, side); - return (r); + return r; } static geom::line _choose_reflect_line(bool rx, bool ry, bool rxy) @@ -305,7 +305,7 @@ static geom::line _choose_reflect_line(bool rx, bool ry, bool rxy) l.f = geom::form(0, 1); l.val = 1; } - return (l); + return l; } static geom::vector _fudge_corner(const geom::vector &w, const reflect_grid &rg) @@ -327,7 +327,7 @@ static geom::vector _fudge_corner(const geom::vector &w, const reflect_grid &rg) v.y -= 20 * EPSILON_VALUE; ASSERT(!rg(floor_vec(v))); } - return (v); + return v; } // Bounce a ray leaving (0,0) through the positive side @@ -349,7 +349,7 @@ static geom::ray _bounce_diag_corridor(const geom::ray &rorig) } // Now pointing inside the destination cell (1,1) -- move inside. _to_grid(&r, true); - return (r); + return r; } // Bounce a ray leaving (0,0) properly through one of the sides @@ -465,7 +465,7 @@ static geom::ray _bounce_corner(const geom::ray &rorig, const coord_def &side, _to_grid(&r, true); } } - return (r); + return r; } void ray_def::bounce(const reflect_grid &rg) diff --git a/crawl-ref/source/religion.cc b/crawl-ref/source/religion.cc index 0e0d90f647..94a57a0874 100644 --- a/crawl-ref/source/religion.cc +++ b/crawl-ref/source/religion.cc @@ -478,22 +478,22 @@ bool is_chaotic_god(god_type god) bool is_unavailable_god(god_type god) { if (god == GOD_JIYVA && jiyva_is_dead()) - return (true); + return true; // Don't allow Fedhas in ZotDef, as his invocations are duplicated, and // passives thoroughly overpowered. Protection for plants, speed-up of // oklobs, etc... // Basically, ZotDef is Fedhas. if (god == GOD_FEDHAS && crawl_state.game_is_zotdef()) - return (true); + return true; // No Ashenzari, too -- nothing to explore, can't use his abilities, // piety for runes won't give you reskilling on time. We could give some // piety for every wave, but there's little point. if (god == GOD_ASHENZARI && crawl_state.game_is_zotdef()) - return (true); + return true; - return (false); + return false; } god_type random_god(bool available) @@ -504,7 +504,7 @@ god_type random_god(bool available) god = static_cast<god_type>(random2(NUM_GODS - 1) + 1); while (available && is_unavailable_god(god)); - return (god); + return god; } std::string get_god_powers(god_type which_god) @@ -514,7 +514,7 @@ std::string get_god_powers(god_type which_god) return (""); std::string result = getLongDescription(god_name(which_god) + " powers"); - return (result); + return result; } std::string get_god_likes(god_type which_god, bool verbose) @@ -805,7 +805,7 @@ std::string get_god_likes(god_type which_god, bool verbose) } } - return (text); + return text; } std::string get_god_dislikes(god_type which_god, bool /*verbose*/) @@ -959,7 +959,7 @@ std::string get_god_dislikes(god_type which_god, bool /*verbose*/) text += "."; } - return (text); + return text; } void dec_penance(god_type god, int val) @@ -1209,7 +1209,7 @@ int yred_random_servants(unsigned int threshold, bool force_hostile) _delayed_monster(mg); } - return (created); + return created; } static const item_def* _find_missile_launcher(int skill) @@ -1226,7 +1226,7 @@ static const item_def* _find_missile_launcher(int skill) return (&item); } } - return (NULL); + return NULL; } static bool _need_missile_gift(bool forced) @@ -1325,11 +1325,11 @@ static misc_item_type _gift_type_to_deck(int gift) { switch (gift) { - case NEM_GIFT_ESCAPE: return (MISC_DECK_OF_ESCAPE); - case NEM_GIFT_DESTRUCTION: return (MISC_DECK_OF_DESTRUCTION); - case NEM_GIFT_DUNGEONS: return (MISC_DECK_OF_DUNGEONS); - case NEM_GIFT_SUMMONING: return (MISC_DECK_OF_SUMMONING); - case NEM_GIFT_WONDERS: return (MISC_DECK_OF_WONDERS); + case NEM_GIFT_ESCAPE: return MISC_DECK_OF_ESCAPE; + case NEM_GIFT_DESTRUCTION: return MISC_DECK_OF_DESTRUCTION; + case NEM_GIFT_DUNGEONS: return MISC_DECK_OF_DUNGEONS; + case NEM_GIFT_SUMMONING: return MISC_DECK_OF_SUMMONING; + case NEM_GIFT_WONDERS: return MISC_DECK_OF_WONDERS; } die("invalid gift card type"); } @@ -1339,7 +1339,7 @@ static bool _give_nemelex_gift(bool forced = false) // But only if you're not levitating over deep water. // Merfolk don't get gifts in deep water. {due} if (!feat_has_solid_floor(grd(you.pos()))) - return (false); + return false; // Nemelex will give at least one gift early. if (forced @@ -1407,10 +1407,10 @@ static bool _give_nemelex_gift(bool forced = false) you.num_total_gifts[you.religion]++; take_note(Note(NOTE_GOD_GIFT, you.religion)); } - return (true); + return true; } - return (false); + return false; } void mons_make_god_gift(monster* mon, god_type god) @@ -1475,8 +1475,8 @@ static bool _has_jelly() for (monster_iterator mi; mi; ++mi) if (mons_is_god_gift(*mi, GOD_JIYVA)) - return (true); - return (false); + return true; + return false; } bool is_follower(const monster* mon) @@ -1500,7 +1500,7 @@ static bool _blessing_wpn(monster* mon) const int alt_weapon = mon->inv[MSLOT_ALT_WEAPON]; if (weapon == NON_ITEM && alt_weapon == NON_ITEM) - return (false); + return false; int slot; @@ -1513,10 +1513,10 @@ static bool _blessing_wpn(monster* mon) // And enchant or uncurse it. int which = random2(2); if (!enchant_weapon(wpn, which, 1 - which, NULL)) - return (false); + return false; item_set_appearance(wpn); - return (true); + return true; } static bool _blessing_AC(monster* mon) @@ -1526,7 +1526,7 @@ static bool _blessing_AC(monster* mon) const int shield = mon->inv[MSLOT_SHIELD]; if (armour == NON_ITEM && shield == NON_ITEM) - return (false); + return false; int slot; @@ -1540,10 +1540,10 @@ static bool _blessing_AC(monster* mon) // And enchant or uncurse it. if (!enchant_armour(ac_change, true, arm)) - return (false); + return false; item_set_appearance(arm); - return (true); + return true; } static bool _blessing_balms(monster* mon) @@ -1571,7 +1571,7 @@ static bool _blessing_balms(monster* mon) if (mon->del_ench(ENCH_FATIGUE, true)) success = true; - return (success); + return success; } static bool _blessing_healing(monster* mon) @@ -1584,10 +1584,10 @@ static bool _blessing_healing(monster* mon) // A high-HP monster might get a unique name. if (x_chance_in_y(mon->max_hit_points + 1, 100)) give_monster_proper_name(mon); - return (true); + return true; } - return (false); + return false; } static bool _tso_blessing_holy_wpn(monster* mon) @@ -1597,7 +1597,7 @@ static bool _tso_blessing_holy_wpn(monster* mon) const int alt_weapon = mon->inv[MSLOT_ALT_WEAPON]; if (weapon == NON_ITEM && alt_weapon == NON_ITEM) - return (false); + return false; int slot; @@ -1616,7 +1616,7 @@ static bool _tso_blessing_holy_wpn(monster* mon) && wpn_brand != SPWPN_REAPING && wpn_brand != SPWPN_CHAOS && wpn_brand != SPWPN_VENOM)) { - return (false); + return false; } // Convert a demonic weapon into a non-demonic weapon. @@ -1628,21 +1628,21 @@ static bool _tso_blessing_holy_wpn(monster* mon) set_item_ego_type(wpn, OBJ_WEAPONS, SPWPN_HOLY_WRATH); wpn.colour = YELLOW; - return (true); + return true; } static bool _tso_blessing_holy_arm(monster* mon) { // If a monster has full negative energy resistance, get out. if (mon->res_negative_energy() == 3) - return (false); + return false; // Pick either a monster's armour or its shield. const int armour = mon->inv[MSLOT_ARMOUR]; const int shield = mon->inv[MSLOT_SHIELD]; if (armour == NON_ITEM && shield == NON_ITEM) - return (false); + return false; int slot; @@ -1656,14 +1656,14 @@ static bool _tso_blessing_holy_arm(monster* mon) // Override certain brands. if (is_artefact(arm) || arm_brand != SPARM_NORMAL) - return (false); + return false; // And make it resistant to negative energy. set_equip_desc(arm, ISFLAG_GLOWING); set_item_ego_type(arm, OBJ_ARMOUR, SPARM_POSITIVE_ENERGY); arm.colour = WHITE; - return (true); + return true; } static bool _increase_ench_duration(monster* mon, @@ -1675,18 +1675,18 @@ static bool _increase_ench_duration(monster* mon, const int newdur = std::min(ench.duration + increase, MARSHALL_MAX); if (ench.duration >= newdur) - return (false); + return false; ench.duration = newdur; mon->update_ench(ench); - return (true); + return true; } static int _tso_blessing_extend_stay(monster* mon) { if (!mon->has_ench(ENCH_ABJ)) - return (0); + return 0; mon_enchant abj = mon->get_ench(ENCH_ABJ); @@ -1703,7 +1703,7 @@ static int _tso_blessing_extend_stay(monster* mon) static bool _tso_blessing_friendliness(monster* mon) { if (!mon->has_ench(ENCH_CHARM)) - return (false); + return false; // [ds] Just increase charm duration, no permanent friendliness. const int base_increase = 700; @@ -1778,10 +1778,10 @@ static bool _beogh_blessing_priesthood(monster* mon) mon->upgrade_type(priest_type, true, true); give_monster_proper_name(mon); - return (true); + return true; } - return (false); + return false; } // Bless the follower indicated in follower, if any. If there isn't @@ -1802,10 +1802,10 @@ bool bless_follower(monster* follower, { // Only Beogh blesses random followers. if (god != GOD_BEOGH) - return (false); + return false; if (chance > 2) - return (false); + return false; // Choose a random follower in LOS, preferably a named or // priestly one (10% chance). @@ -1814,7 +1814,7 @@ bool bless_follower(monster* follower, if (!follower) { if (coinflip()) - return (false); + return false; // Try again, without the LOS restriction (5% chance). follower = choose_random_nearby_monster(0, suitable, false, true, @@ -1823,7 +1823,7 @@ bool bless_follower(monster* follower, if (!follower) { if (coinflip()) - return (false); + return false; // Try *again*, on the entire level (2.5% chance). follower = choose_random_monster_on_level(0, suitable, false, @@ -1844,7 +1844,7 @@ bool bless_follower(monster* follower, // Return true, even though the reinforcements might // not be placed. - return (true); + return true; } } } @@ -1996,7 +1996,7 @@ bool bless_follower(monster* follower, else if (force) mpr("Couldn't heal monster."); - return (false); + return false; } default: @@ -2025,7 +2025,7 @@ blessing_done: flash_monster_colour(follower, god_colour(god), 200); #endif - return (true); + return true; } static void _delayed_gift_callback(const mgen_data &mg, monster *&mon, @@ -2250,7 +2250,7 @@ bool do_god_gift(bool forced) gift == BOOK_NECROMANCY); } if (thing_created == NON_ITEM) - return (false); + return false; // Mark the book type as known to avoid duplicate // gifts if players don't read their gifts for some @@ -2301,7 +2301,7 @@ bool do_god_gift(bool forced) you.num_total_gifts[you.religion]); } #endif - return (success); + return success; } std::string god_name(god_type which_god, bool long_name) @@ -2357,7 +2357,7 @@ std::string god_name_jiyva(bool second_name) if (second_name) name += " " + you.jiyva_second_name; - return (name); + return name; } god_type str_to_god(const std::string &_name, bool exact) @@ -2367,7 +2367,7 @@ god_type str_to_god(const std::string &_name, bool exact) lowercase(target); if (target.empty()) - return (GOD_NO_GOD); + return GOD_NO_GOD; int num_partials = 0; god_type partial = GOD_NO_GOD; @@ -2377,22 +2377,22 @@ god_type str_to_god(const std::string &_name, bool exact) std::string name = lowercase_string(god_name(god, false)); if (name == target) - return (god); + return god; if (!exact && name.find(target) != std::string::npos) { // Return nothing for ambiguous partial names. num_partials++; if (num_partials > 1) - return (GOD_NO_GOD); + return GOD_NO_GOD; partial = god; } } if (!exact && num_partials == 1) - return (partial); + return partial; - return (GOD_NO_GOD); + return GOD_NO_GOD; } void god_speaks(god_type god, const char *mesg) @@ -2481,14 +2481,14 @@ std::string adjust_abil_message(const char *pmsg, bool allow_upgrades) pm.replace(pos, 11, "remains"); } - return (pm); + return pm; } static bool _abil_chg_message(const char *pmsg, const char *youcanmsg, int breakpoint) { if (!*pmsg) - return (false); + return false; // Set piety to the passed-in piety breakpoint value when getting // the ability message. If we have an ability upgrade, which will @@ -2512,7 +2512,7 @@ static bool _abil_chg_message(const char *pmsg, const char *youcanmsg, make_stringf(youcanmsg, pm.c_str()).c_str()); } - return (true); + return true; } void dock_piety(int piety_loss, int penance) @@ -2565,7 +2565,7 @@ int piety_scale(int piety) if (player_effect_faith()) return (piety + div_rand_round(piety, 3)); - return (piety); + return piety; } static void _gain_piety_point(); @@ -3165,7 +3165,7 @@ static std::string _sacrifice_message(std::string msg, msg.insert(0, itname); msg = tag_start + msg + tag_end; - return (msg); + return msg; } void print_sacrifice_message(god_type god, const item_def &item, @@ -3201,19 +3201,19 @@ void nemelex_death_message() bool god_hates_attacking_friend(god_type god, const actor *fr) { if (!fr || fr->kill_alignment() != KC_FRIENDLY) - return (false); + return false; monster_type species = fr->mons_species(); if (mons_is_object(species)) - return (false); + return false; switch (god) { case GOD_ZIN: case GOD_SHINING_ONE: case GOD_ELYVILON: case GOD_OKAWARU: - return (true); + return true; case GOD_BEOGH: // added penance to avoid killings for loot return (mons_genus(species) == MONS_ORC); case GOD_JIYVA: @@ -3221,14 +3221,14 @@ bool god_hates_attacking_friend(god_type god, const actor *fr) case GOD_FEDHAS: return (_fedhas_protects_species(species)); default: - return (false); + return false; } } bool god_likes_items(god_type god) { if (god_likes_fresh_corpses(god)) - return (true); + return true; switch (god) { @@ -3236,20 +3236,20 @@ bool god_likes_items(god_type god) case GOD_NEMELEX_XOBEH: case GOD_ASHENZARI: case GOD_ELYVILON: - return (true); + return true; case NUM_GODS: case GOD_RANDOM: case GOD_NAMELESS: mprf(MSGCH_ERROR, "Bad god, no biscuit! %d", static_cast<int>(god)); default: - return (false); + return false; } } bool god_likes_item(god_type god, const item_def& item) { if (!god_likes_items(god)) - return (false); + return false; if (god_likes_fresh_corpses(god)) { @@ -3290,32 +3290,32 @@ bool god_likes_item(god_type god, const item_def& item) && item.sub_type == SCR_REMOVE_CURSE); default: - return (false); + return false; } } bool player_can_join_god(god_type which_god) { if (you.species == SP_DEMIGOD) - return (false); + return false; if (is_good_god(which_god) && you.undead_or_demonic()) - return (false); + return false; if (which_god == GOD_YREDELEMNUL && you.is_artificial()) - return (false); + return false; if (which_god == GOD_BEOGH && you.species != SP_HILL_ORC) - return (false); + return false; // Fedhas hates undead, but will accept demonspawn. if (which_god == GOD_FEDHAS && you.holiness() == MH_UNDEAD) - return (false); + return false; if (which_god == GOD_SIF_MUNA && !you.spell_no) - return (false); + return false; - return (true); + return true; } static bool _transformed_player_can_join_god(god_type which_god) @@ -3323,19 +3323,19 @@ static bool _transformed_player_can_join_god(god_type which_god) if ((is_good_god(which_god) || which_god == GOD_FEDHAS) && you.form == TRAN_LICH) { - return (false); + return false; } if (which_god == GOD_ZIN && you.form != TRAN_NONE) - return (false); + return false; if (which_god == GOD_YREDELEMNUL && (you.form == TRAN_STATUE || you.petrified())) { // it's rather hard to pray while petrified, though - return (false); + return false; } - return (true); + return true; } // Identify any interesting equipment when the player signs up with a @@ -3654,15 +3654,15 @@ bool god_hates_your_god(god_type god, god_type your_god) { // Gods do not hate themselves. if (god == your_god) - return (false); + return false; // Non-good gods always hate your current god. if (!is_good_god(god)) - return (true); + return true; // Zin hates chaotic gods. if (god == GOD_ZIN && is_chaotic_god(your_god)) - return (true); + return true; return (is_evil_god(your_god)); } @@ -3700,7 +3700,7 @@ bool god_hates_killing(god_type god, const monster* mon) if (god == GOD_FEDHAS) retval = (fedhas_protects(mon)); - return (retval); + return retval; } bool god_likes_fresh_corpses(god_type god) @@ -3720,14 +3720,14 @@ bool god_likes_spell(spell_type spell, god_type god) case GOD_KIKUBAAQUDGHA: return (spell_typematch(spell, SPTYP_NECROMANCY)); default: // quash unhandled constants warnings - return (false); + return false; } } bool god_hates_spell(spell_type spell, god_type god) { if (is_good_god(god) && (is_unholy_spell(spell) || is_evil_spell(spell))) - return (true); + return true; unsigned int disciplines = get_spell_disciplines(spell); @@ -3735,7 +3735,7 @@ bool god_hates_spell(spell_type spell, god_type god) { case GOD_ZIN: if (is_unclean_spell(spell) || is_chaotic_spell(spell)) - return (true); + return true; break; case GOD_SHINING_ONE: // TSO hates using poison, but is fine with curing it @@ -3743,25 +3743,25 @@ bool god_hates_spell(spell_type spell, god_type god) if ((disciplines & SPTYP_POISON) && spell != SPELL_CURE_POISON && spell != SPELL_IGNITE_POISON) { - return (true); + return true; } break; case GOD_YREDELEMNUL: if (spell == SPELL_STATUE_FORM) - return (true); + return true; break; case GOD_FEDHAS: if (is_corpse_violating_spell(spell)) - return (true); + return true; break; case GOD_CHEIBRIADOS: if (is_hasty_spell(spell)) - return (true); + return true; break; default: break; } - return (false); + return false; } bool god_loathes_spell(spell_type spell, god_type god) @@ -3956,7 +3956,7 @@ int god_colour(god_type god) // mv - added case GOD_ELYVILON: case GOD_OKAWARU: case GOD_FEDHAS: - return (CYAN); + return CYAN; case GOD_YREDELEMNUL: case GOD_KIKUBAAQUDGHA: @@ -3966,22 +3966,22 @@ int god_colour(god_type god) // mv - added case GOD_BEOGH: case GOD_LUGONU: case GOD_ASHENZARI: - return (LIGHTRED); + return LIGHTRED; case GOD_XOM: - return (YELLOW); + return YELLOW; case GOD_NEMELEX_XOBEH: - return (LIGHTMAGENTA); + return LIGHTMAGENTA; case GOD_SIF_MUNA: - return (LIGHTBLUE); + return LIGHTBLUE; case GOD_JIYVA: - return (GREEN); + return GREEN; case GOD_CHEIBRIADOS: - return (LIGHTCYAN); + return LIGHTCYAN; case GOD_NO_GOD: case NUM_GODS: @@ -3991,7 +3991,7 @@ int god_colour(god_type god) // mv - added break; } - return (YELLOW); + return YELLOW; } colour_t god_message_altar_colour(god_type god) @@ -4001,16 +4001,16 @@ colour_t god_message_altar_colour(god_type god) switch (god) { case GOD_SHINING_ONE: - return (YELLOW); + return YELLOW; case GOD_ZIN: - return (WHITE); + return WHITE; case GOD_ELYVILON: - return (LIGHTBLUE); // Really, LIGHTGREY but that's plain text. + return LIGHTBLUE; // Really, LIGHTGREY but that's plain text. case GOD_OKAWARU: - return (CYAN); + return CYAN; case GOD_YREDELEMNUL: return (coinflip() ? DARKGREY : RED); @@ -4019,7 +4019,7 @@ colour_t god_message_altar_colour(god_type god) return (coinflip() ? BROWN : LIGHTRED); case GOD_KIKUBAAQUDGHA: - return (DARKGREY); + return DARKGREY; case GOD_FEDHAS: return (coinflip() ? BROWN : GREEN); @@ -4040,25 +4040,25 @@ colour_t god_message_altar_colour(god_type god) : YELLOW); case GOD_TROG: - return (RED); + return RED; case GOD_NEMELEX_XOBEH: - return (LIGHTMAGENTA); + return LIGHTMAGENTA; case GOD_SIF_MUNA: - return (BLUE); + return BLUE; case GOD_LUGONU: - return (LIGHTRED); + return LIGHTRED; case GOD_CHEIBRIADOS: - return (LIGHTCYAN); + return LIGHTCYAN; case GOD_JIYVA: return (coinflip() ? GREEN : LIGHTGREEN); default: - return (YELLOW); + return YELLOW; } } @@ -4092,7 +4092,7 @@ int piety_breakpoint(int i) { int breakpoints[MAX_GOD_ABILITIES] = { 30, 50, 75, 100, 120 }; if (i >= MAX_GOD_ABILITIES || i < 0) - return (255); + return 255; else return (breakpoints[i]); } @@ -4218,7 +4218,7 @@ int get_tension(god_type god) // At least one monster has to be nearby, for tension to count. if (!nearby_monster) - return (0); + return 0; const int scale = 1; @@ -4253,7 +4253,7 @@ int get_tension(god_type god) tension *= 10; tension = std::max(1, tension); - return (tension); + return tension; } if (you.confused()) @@ -4407,7 +4407,7 @@ static bool _is_god(god_type god) static bool _is_temple_god(god_type god) { if (!_is_god(god)) - return (false); + return false; switch (god) { @@ -4415,10 +4415,10 @@ static bool _is_temple_god(god_type god) case GOD_LUGONU: case GOD_BEOGH: case GOD_JIYVA: - return (false); + return false; default: - return (true); + return true; } } diff --git a/crawl-ref/source/shopping.cc b/crawl-ref/source/shopping.cc index b98a8700d1..fa4409ac87 100644 --- a/crawl-ref/source/shopping.cc +++ b/crawl-ref/source/shopping.cc @@ -95,7 +95,7 @@ static std::string _hyphenated_suffix(char prev, char last) if (prev != last) s += prev; - return (s); + return s; } static std::string _purchase_keys(const std::string &s) @@ -117,7 +117,7 @@ static std::string _purchase_keys(const std::string &s) list += _hyphenated_suffix(s[s.length() - 1], last); list += "</w>"; - return (list); + return list; } static bool _can_shoplist(level_id lev = level_id::current()) @@ -302,7 +302,7 @@ static std::string _shop_print_stock(const std::vector<int>& stock, } textcolor(LIGHTGREY); - return (purchasable); + return purchasable; } static int _count_identical(const std::vector<int>& stock, @@ -316,7 +316,7 @@ static int _count_identical(const std::vector<int>& stock, if (ShoppingList::items_are_same(item, other)) count++; } - return (count); + return count; } // Rather than prompting for each individual item, shopping now works more @@ -416,7 +416,7 @@ static bool _in_a_shop(int shopidx, int &num_in_list) { _shop_print("I'm sorry, my shop is empty now.", 1); _shop_more(); - return (bought_something); + return bought_something; } const std::string purchasable = _shop_print_stock(stock, selected, @@ -765,7 +765,7 @@ static bool _in_a_shop(int shopidx, int &num_in_list) if (you.last_pickup.empty()) you.last_pickup = tmp_l_p; - return (bought_something); + return bought_something; } bool shoptype_identifies_stock(shop_type type) @@ -801,9 +801,9 @@ static bool _purchase(int shop, int item_got, int cost, bool id) if (num < quant) { move_item_to_grid(&item_got, env.shop[shop].pos); - return (false); + return false; } - return (true); + return true; } // This probably still needs some work. Rings used to be the only @@ -2106,7 +2106,7 @@ void destroy_shop_at(coord_def p) shop_struct *get_shop(const coord_def& where) { if (grd(where) != DNGN_ENTER_SHOP) - return (NULL); + return NULL; unsigned short t = env.tgrid(where); ASSERT(t != NON_ENTITY && t < MAX_SHOPS); @@ -2120,7 +2120,7 @@ std::string shop_name(const coord_def& where, bool add_stop) std::string name(shop_name(where)); if (add_stop) name += "."; - return (name); + return name; } static std::string _shop_type_name(shop_type type) @@ -2213,7 +2213,7 @@ std::string shop_name(const coord_def& where) sh_name += " " + sh_suffix; } - return (sh_name); + return sh_name; } bool is_shop_item(const item_def &item) @@ -2265,14 +2265,14 @@ bool ShoppingList::add_thing(const item_def &item, int cost, { mpr("The shopping list can only contain things in the dungeon.", MSGCH_ERROR); - return (false); + return false; } if (find_thing(item, pos) != -1) { mprf(MSGCH_ERROR, "%s is already on the shopping list.", item.name(DESC_THE).c_str()); - return (false); + return false; } SETUP_THING(); @@ -2280,7 +2280,7 @@ bool ShoppingList::add_thing(const item_def &item, int cost, list->push_back(*thing); refresh(); - return (true); + return true; } bool ShoppingList::add_thing(std::string desc, std::string buy_verb, int cost, @@ -2296,14 +2296,14 @@ bool ShoppingList::add_thing(std::string desc, std::string buy_verb, int cost, { mpr("The shopping list can only contain things in the dungeon.", MSGCH_ERROR); - return (false); + return false; } if (find_thing(desc, pos) != -1) { mprf(MSGCH_ERROR, "%s is already on the shopping list.", desc.c_str()); - return (false); + return false; } SETUP_THING(); @@ -2312,7 +2312,7 @@ bool ShoppingList::add_thing(std::string desc, std::string buy_verb, int cost, list->push_back(*thing); refresh(); - return (true); + return true; } #undef SETUP_THING @@ -2351,11 +2351,11 @@ bool ShoppingList::del_thing(const item_def &item, { mprf(MSGCH_ERROR, "%s isn't on shopping list, can't delete it.", item.name(DESC_THE).c_str()); - return (false); + return false; } del_thing_at_index(idx); - return (true); + return true; } bool ShoppingList::del_thing(std::string desc, const level_pos* _pos) @@ -2368,11 +2368,11 @@ bool ShoppingList::del_thing(std::string desc, const level_pos* _pos) { mprf(MSGCH_ERROR, "%s isn't on shopping list, can't delete it.", desc.c_str()); - return (false); + return false; } del_thing_at_index(idx); - return (true); + return true; } #undef SETUP_POS @@ -2392,12 +2392,12 @@ unsigned int ShoppingList::cull_identical_items(const item_def& item, { // Dead men can't update their shopping lists. if (!crawl_state.need_save) - return (0); + return 0; // Can't put items in Bazaar shops in the shopping list, so // don't bother transferring shopping list items to Bazaar shops. if (cost != -1 && !_can_shoplist()) - return (0); + return 0; switch (item.base_type) { @@ -2408,21 +2408,21 @@ unsigned int ShoppingList::cull_identical_items(const item_def& item, break; default: - return (0); + return 0; } if (!item_type_known(item) || is_artefact(item)) - return (0); + return 0; // Ignore stat-modification rings which reduce a stat, since they're // worthless. if (item.base_type == OBJ_JEWELLERY) { if (item.sub_type == RING_SLAYING && item.plus < 0 && item.plus2 < 0) - return (0); + return 0; if (item.plus < 0) - return (0); + return 0; } // Item is already on shopping-list. @@ -2901,7 +2901,7 @@ int ShoppingList::find_thing(const item_def &item, const item_def &_item = get_thing_item(thing); if (item_name_simple(item) == item_name_simple(_item)) - return (i); + return i; } return (-1); @@ -2922,7 +2922,7 @@ int ShoppingList::find_thing(const std::string &desc, continue; if (desc == name_thing(thing)) - return (i); + return i; } return (-1); @@ -2940,7 +2940,7 @@ const item_def& ShoppingList::get_thing_item(const CrawlHashTable& thing) const item_def &item = thing[SHOPPING_THING_ITEM_KEY].get_item(); ASSERT(item.defined()); - return (item); + return item; } std::string ShoppingList::get_thing_desc(const CrawlHashTable& thing) @@ -2948,7 +2948,7 @@ std::string ShoppingList::get_thing_desc(const CrawlHashTable& thing) ASSERT(thing.exists(SHOPPING_THING_DESC_KEY)); std::string desc = thing[SHOPPING_THING_DESC_KEY].get_string(); - return (desc); + return desc; } int ShoppingList::thing_cost(const CrawlHashTable& thing) @@ -2990,7 +2990,7 @@ std::string ShoppingList::describe_thing(const CrawlHashTable& thing, else desc += pos.id.describe(); - return (desc); + return desc; } // Item name without curse-status or inscription. diff --git a/crawl-ref/source/shout.cc b/crawl-ref/source/shout.cc index dae1d3f5c4..3cd2d59c0e 100644 --- a/crawl-ref/source/shout.cc +++ b/crawl-ref/source/shout.cc @@ -279,16 +279,16 @@ bool check_awaken(monster* mons) // Usually redundant because we iterate over player LOS, // but e.g. for you.xray_vision. if (!mons->see_cell(you.pos())) - return (false); + return false; // Monsters put to sleep by ensorcelled hibernation will sleep // at least one turn. if (mons->has_ench(ENCH_SLEEPY)) - return (false); + return false; // Berserkers aren't really concerned about stealth. if (you.berserk()) - return (true); + return true; // I assume that creatures who can sense invisible are very perceptive. int mons_perc = 10 + (mons_intel(mons) * 4) + mons->hit_dice @@ -330,7 +330,7 @@ bool check_awaken(monster* mons) mons_perc = 0; if (x_chance_in_y(mons_perc + 1, stealth)) - return (true); // Oops, the monster wakes up! + return true; // Oops, the monster wakes up! // You didn't wake the monster! if (you.can_see(mons) // to avoid leaking information @@ -341,7 +341,7 @@ bool check_awaken(monster* mons) practise(unnatural_stealthy ? EX_SNEAK_INVIS : EX_SNEAK); } - return (false); + return false; } void item_noise(const item_def &item, std::string msg, int loudness) @@ -463,7 +463,7 @@ bool noisy(int original_loudness, const coord_def& where, bool mermaid, bool message_if_unseen, bool fake_noise) { if (original_loudness <= 0) - return (false); + return false; // high ambient noise makes sounds harder to hear const int ambient = current_level_ambient_noise(); @@ -475,12 +475,12 @@ bool noisy(int original_loudness, const coord_def& where, loudness, original_loudness, ambient, where.x, where.y); if (loudness <= 0) - return (false); + return false; // If the origin is silenced there is no noise, unless we're // faking it. if (silenced(where) && !fake_noise) - return (false); + return false; // [ds] Reduce noise propagation for Sprint. const int scaled_loudness = @@ -511,9 +511,9 @@ bool noisy(int original_loudness, const coord_def& where, { if (msg && !fake_noise) mpr(msg, MSGCH_SOUND); - return (true); + return true; } - return (false); + return false; } bool noisy(int loudness, const coord_def& where, int who, @@ -753,20 +753,20 @@ bool noise_cell::apply_noise(int _noise_intensity_millis, noise_intensity_millis = _noise_intensity_millis; noise_travel_distance = _noise_travel_distance; neighbour_delta = _neighbour_delta; - return (true); + return true; } - return (false); + return false; } int noise_cell::turn_angle(const coord_def &next_delta) const { if (neighbour_delta.origin()) - return (0); + return 0; // Going in reverse? if (next_delta.x == -neighbour_delta.x && next_delta.y == -neighbour_delta.y) - return (4); + return 4; const int xdiff = std::abs(neighbour_delta.x - next_delta.x); const int ydiff = std::abs(neighbour_delta.y - next_delta.y); @@ -888,7 +888,7 @@ bool noise_grid::propagate_noise_to_neighbour(int base_attenuation, noise_cell &neighbour(cells(next_pos)); if (!neighbour.can_apply_noise(cell.noise_intensity_millis - base_attenuation)) - return (false); + return false; // Diagonals cost more. if ((next_pos - current_pos).abs() == 2) @@ -912,7 +912,7 @@ bool noise_grid::propagate_noise_to_neighbour(int base_attenuation, // cell as a neighbour (presumably with a lower volume). return (neighbour_old_distance != travel_distance); } - return (false); + return false; } @@ -1029,7 +1029,7 @@ coord_def noise_grid::noise_perceived_position(actor *act, affected_pos.x, affected_pos.y, cell_grid_distance, noise_travel_distance); #endif - return (final_perceived_point); + return final_perceived_point; } #ifdef DEBUG_NOISE_PROPAGATION diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc index ff655b629e..eeda476d5b 100644 --- a/crawl-ref/source/show.cc +++ b/crawl-ref/source/show.cc @@ -86,9 +86,9 @@ show_type::show_type(show_item_type t) bool show_type::operator < (const show_type &other) const { if (cls < other.cls) - return (false); + return false; else if (cls > other.cls) - return (true); + return true; switch (cls) { case SH_FEATURE: @@ -98,7 +98,7 @@ bool show_type::operator < (const show_type &other) const case SH_MONSTER: return (mons < other.mons); default: - return (false); + return false; } } @@ -192,24 +192,24 @@ static show_item_type _item_to_show_code(const item_def &item) { switch (item.base_type) { - case OBJ_ORBS: return (SHOW_ITEM_ORB); - case OBJ_WEAPONS: return (SHOW_ITEM_WEAPON); - case OBJ_MISSILES: return (SHOW_ITEM_MISSILE); - case OBJ_ARMOUR: return (SHOW_ITEM_ARMOUR); - case OBJ_WANDS: return (SHOW_ITEM_WAND); - case OBJ_FOOD: return (SHOW_ITEM_FOOD); - case OBJ_SCROLLS: return (SHOW_ITEM_SCROLL); + case OBJ_ORBS: return SHOW_ITEM_ORB; + case OBJ_WEAPONS: return SHOW_ITEM_WEAPON; + case OBJ_MISSILES: return SHOW_ITEM_MISSILE; + case OBJ_ARMOUR: return SHOW_ITEM_ARMOUR; + case OBJ_WANDS: return SHOW_ITEM_WAND; + case OBJ_FOOD: return SHOW_ITEM_FOOD; + case OBJ_SCROLLS: return SHOW_ITEM_SCROLL; case OBJ_JEWELLERY: return (jewellery_is_amulet(item)? SHOW_ITEM_AMULET : SHOW_ITEM_RING); - case OBJ_POTIONS: return (SHOW_ITEM_POTION); - case OBJ_BOOKS: return (SHOW_ITEM_BOOK); - case OBJ_STAVES: return (SHOW_ITEM_STAVE); - case OBJ_RODS: return (SHOW_ITEM_STAVE); - case OBJ_MISCELLANY: return (SHOW_ITEM_MISCELLANY); - case OBJ_CORPSES: return (SHOW_ITEM_CORPSE); - case OBJ_GOLD: return (SHOW_ITEM_GOLD); - case OBJ_DETECTED: return (SHOW_ITEM_DETECTED); - default: return (SHOW_ITEM_ORB); // bad item character + case OBJ_POTIONS: return SHOW_ITEM_POTION; + case OBJ_BOOKS: return SHOW_ITEM_BOOK; + case OBJ_STAVES: return SHOW_ITEM_STAVE; + case OBJ_RODS: return SHOW_ITEM_STAVE; + case OBJ_MISCELLANY: return SHOW_ITEM_MISCELLANY; + case OBJ_CORPSES: return SHOW_ITEM_CORPSE; + case OBJ_GOLD: return SHOW_ITEM_GOLD; + case OBJ_DETECTED: return SHOW_ITEM_DETECTED; + default: return SHOW_ITEM_ORB; // bad item character } } @@ -313,12 +313,12 @@ static bool _valid_invis_spot(const coord_def &where, const monster* mons) monster *mons_at = monster_at(where); if (mons_at && mons_at != mons) - return (false); + return false; if (monster_habitable_grid(mons, grd(where))) - return (true); + return true; - return (false); + return false; } static int _hashed_rand(const monster* mons, uint32_t id, uint32_t die) diff --git a/crawl-ref/source/showsymb.cc b/crawl-ref/source/showsymb.cc index c093feaa58..80b3c78cce 100644 --- a/crawl-ref/source/showsymb.cc +++ b/crawl-ref/source/showsymb.cc @@ -126,7 +126,7 @@ unsigned short _cell_feat_show_colour(const map_cell& cell, if (Options.show_travel_trail && travel_trail_index(loc) >= 0) colour |= COLFLAG_REVERSE; - return (colour); + return colour; } static int _get_mons_colour(const monster_info& mi) @@ -185,7 +185,7 @@ static int _get_mons_colour(const monster_info& mi) col = DARKGREY; } - return (col); + return col; } show_class get_cell_show_class(const map_cell& cell, @@ -410,7 +410,7 @@ glyph get_item_glyph(const item_def *item) glyph g; g.ch = get_feature_def(show_type(*item)).symbol; g.col = item->colour; - return (g); + return g; } glyph get_mons_glyph(const monster_info& mi) @@ -432,7 +432,7 @@ glyph get_mons_glyph(const monster_info& mi) else g.col = _get_mons_colour(mi); g.col = real_colour(g.col); - return (g); + return g; } std::string glyph_to_tagstr(const glyph& g) diff --git a/crawl-ref/source/skills.cc b/crawl-ref/source/skills.cc index fb2cb0fd45..8ec384a1b0 100644 --- a/crawl-ref/source/skills.cc +++ b/crawl-ref/source/skills.cc @@ -979,7 +979,7 @@ static int _train(skill_type exsk, int &max_exp, bool simu) } if (skill_inc <= 0) - return (0); + return 0; // Bonus from manual if (exsk == you.manual_skill) @@ -1006,7 +1006,7 @@ static int _train(skill_type exsk, int &max_exp, bool simu) ASSERT(max_exp >= 0); you.redraw_experience = true; - return (skill_inc); + return skill_inc; } void set_skill_level(skill_type skill, double amount) diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index ed054278dc..651093afe1 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -174,7 +174,7 @@ skill_type str_to_skill(const std::string &skill) if (skills[i][0] && skill == skills[i][0]) return (static_cast<skill_type>(i)); - return (SK_FIGHTING); + return SK_FIGHTING; } static std::string _stk_adj_cap() diff --git a/crawl-ref/source/species.cc b/crawl-ref/source/species.cc index 721e0feac0..be18daaf18 100644 --- a/crawl-ref/source/species.cc +++ b/crawl-ref/source/species.cc @@ -47,7 +47,7 @@ species_type random_draconian_player_species() species_type get_species(const int index) { if (index < 0 || index >= ng_num_species()) - return (SP_UNKNOWN); + return SP_UNKNOWN; return (species_order[index]); } @@ -104,10 +104,10 @@ species_type str_to_species(const std::string &species) { sp = static_cast<species_type>(i); if (species == species_name(sp)) - return (sp); + return sp; } - return (SP_UNKNOWN); + return SP_UNKNOWN; } std::string species_name(species_type speci, bool genus, bool adj) @@ -200,17 +200,17 @@ std::string species_name(species_type speci, bool genus, bool adj) int species_has_claws(species_type species, bool mut_level) { if (species == SP_TROLL) - return (3); + return 3; if (species == SP_GHOUL) - return (1); + return 1; // Felid claws don't count as a claws mutation. The claws mutation // does only hands, not paws. if (species == SP_FELID && !mut_level) - return (1); + return 1; - return (0); + return 0; } bool species_likes_water(species_type species) @@ -233,15 +233,15 @@ genus_type species_genus(species_type species) case SP_MOTTLED_DRACONIAN: case SP_PALE_DRACONIAN: case SP_BASE_DRACONIAN: - return (GENPC_DRACONIAN); + return GENPC_DRACONIAN; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_SLUDGE_ELF: - return (GENPC_ELVEN); + return GENPC_ELVEN; default: - return (GENPC_NONE); + return GENPC_NONE; } } @@ -251,24 +251,24 @@ size_type species_size(species_type species, size_part_type psize) { case SP_OGRE: case SP_TROLL: - return (SIZE_LARGE); + return SIZE_LARGE; case SP_NAGA: // Most of their body is on the ground giving them a low profile. if (psize == PSIZE_TORSO || psize == PSIZE_PROFILE) - return (SIZE_MEDIUM); + return SIZE_MEDIUM; else - return (SIZE_LARGE); + return SIZE_LARGE; case SP_CENTAUR: return ((psize == PSIZE_TORSO) ? SIZE_MEDIUM : SIZE_LARGE); case SP_HALFLING: case SP_KOBOLD: - return (SIZE_SMALL); + return SIZE_SMALL; case SP_SPRIGGAN: case SP_FELID: - return (SIZE_LITTLE); + return SIZE_LITTLE; default: - return (SIZE_MEDIUM); + return SIZE_MEDIUM; } } @@ -277,69 +277,69 @@ monster_type player_species_to_mons_species(species_type species) switch (species) { case SP_HUMAN: - return (MONS_HUMAN); + return MONS_HUMAN; case SP_HIGH_ELF: case SP_DEEP_ELF: case SP_SLUDGE_ELF: - return (MONS_ELF); + return MONS_ELF; case SP_HALFLING: - return (MONS_HALFLING); + return MONS_HALFLING; case SP_HILL_ORC: - return (MONS_ORC); + return MONS_ORC; case SP_KOBOLD: - return (MONS_KOBOLD); + return MONS_KOBOLD; case SP_MUMMY: - return (MONS_MUMMY); + return MONS_MUMMY; case SP_NAGA: - return (MONS_NAGA); + return MONS_NAGA; case SP_OGRE: - return (MONS_OGRE); + return MONS_OGRE; case SP_TROLL: - return (MONS_TROLL); + return MONS_TROLL; case SP_RED_DRACONIAN: - return (MONS_RED_DRACONIAN); + return MONS_RED_DRACONIAN; case SP_WHITE_DRACONIAN: - return (MONS_WHITE_DRACONIAN); + return MONS_WHITE_DRACONIAN; case SP_GREEN_DRACONIAN: - return (MONS_GREEN_DRACONIAN); + return MONS_GREEN_DRACONIAN; case SP_YELLOW_DRACONIAN: - return (MONS_YELLOW_DRACONIAN); + return MONS_YELLOW_DRACONIAN; case SP_GREY_DRACONIAN: - return (MONS_GREY_DRACONIAN); + return MONS_GREY_DRACONIAN; case SP_BLACK_DRACONIAN: - return (MONS_BLACK_DRACONIAN); + return MONS_BLACK_DRACONIAN; case SP_PURPLE_DRACONIAN: - return (MONS_PURPLE_DRACONIAN); + return MONS_PURPLE_DRACONIAN; case SP_MOTTLED_DRACONIAN: - return (MONS_MOTTLED_DRACONIAN); + return MONS_MOTTLED_DRACONIAN; case SP_PALE_DRACONIAN: - return (MONS_PALE_DRACONIAN); + return MONS_PALE_DRACONIAN; case SP_BASE_DRACONIAN: - return (MONS_DRACONIAN); + return MONS_DRACONIAN; case SP_CENTAUR: - return (MONS_CENTAUR); + return MONS_CENTAUR; case SP_DEMIGOD: - return (MONS_DEMIGOD); + return MONS_DEMIGOD; case SP_SPRIGGAN: - return (MONS_SPRIGGAN); + return MONS_SPRIGGAN; case SP_MINOTAUR: - return (MONS_MINOTAUR); + return MONS_MINOTAUR; case SP_DEMONSPAWN: - return (MONS_DEMONSPAWN); + return MONS_DEMONSPAWN; case SP_GHOUL: - return (MONS_GHOUL); + return MONS_GHOUL; case SP_TENGU: - return (MONS_TENGU); + return MONS_TENGU; case SP_MERFOLK: - return (MONS_MERFOLK); + return MONS_MERFOLK; case SP_VAMPIRE: - return (MONS_VAMPIRE); + return MONS_VAMPIRE; case SP_DEEP_DWARF: - return (MONS_DEEP_DWARF); + return MONS_DEEP_DWARF; case SP_FELID: - return (MONS_FELID); + return MONS_FELID; case SP_OCTOPODE: - return (MONS_OCTOPODE); + return MONS_OCTOPODE; case SP_ELF: case SP_HILL_DWARF: case SP_MOUNTAIN_DWARF: @@ -352,7 +352,7 @@ monster_type player_species_to_mons_species(species_type species) case SP_VIABLE: die("player of an invalid species"); default: - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; } } diff --git a/crawl-ref/source/spl-book.cc b/crawl-ref/source/spl-book.cc index 3c783232a5..9a9fdf38b2 100644 --- a/crawl-ref/source/spl-book.cc +++ b/crawl-ref/source/spl-book.cc @@ -214,7 +214,7 @@ int spellbook_contents(item_def &book, read_book_action_type action, if (update_screen) keyn = tolower(getchm(KMC_MENU)); - return (keyn); // try to figure out that for which this is used {dlb} + return keyn; // try to figure out that for which this is used {dlb} } // Rarity 100 is reserved for unused books. @@ -351,7 +351,7 @@ int spell_rarity(spell_type which_spell) if (rarity == 255) return (-1); - return (rarity); + return rarity; } bool is_valid_spell_in_book(const item_def &book, int spell) @@ -364,10 +364,10 @@ bool is_valid_spell_in_book(const item_def &book, int spell) bool player_can_memorise_from_spellbook(const item_def &book) { if (book.base_type != OBJ_BOOKS) - return (true); + return true; if (book.props.exists(SPELL_LIST_KEY)) - return (true); + return true; if ((book.sub_type == BOOK_ANNIHILATIONS && you.religion != GOD_VEHUMET @@ -382,10 +382,10 @@ bool player_can_memorise_from_spellbook(const item_def &book) && (you.skill(SK_NECROMANCY) < 10 || you.skill(SK_SPELLCASTING) < 6))) { - return (false); + return false; } - return (true); + return true; } void mark_had_book(const item_def &book) @@ -436,7 +436,7 @@ int read_book(item_def &book, read_book_action_type action) more(); inscribe_book_highlevel(book); - return (0); + return 0; } #ifdef USE_TILE_WEB @@ -458,7 +458,7 @@ int read_book(item_def &book, read_book_action_type action) set_ident_flags(book, ISFLAG_KNOW_TYPE); set_ident_flags(book, ISFLAG_IDENT_MASK); - return (keyin); + return keyin; } bool you_cannot_memorise(spell_type spell) @@ -561,13 +561,13 @@ bool you_cannot_memorise(spell_type spell, bool &undead) rc = true, undead = false; } - return (rc); + return rc; } bool player_can_memorise(const item_def &book) { if (!item_is_spellbook(book) || !player_spell_levels()) - return (false); + return false; for (int j = 0; j < SPELLBOOK_SIZE; j++) { @@ -580,7 +580,7 @@ bool player_can_memorise(const item_def &book) if (spell_difficulty(stype) > you.experience_level || player_spell_levels() < spell_levels_required(stype)) { - return (false); + return false; } bool knows_spell = false; @@ -589,9 +589,9 @@ bool player_can_memorise(const item_def &book) // You don't already know this spell. if (!knows_spell) - return (true); + return true; } - return (false); + return false; } typedef std::vector<spell_type> spell_list; @@ -706,7 +706,7 @@ static bool _get_mem_list(spell_list &mem_spells, MSGCH_PROMPT); } } - return (false); + return false; } else if (num_on_ground && num_on_ground == num_books && !player_can_reach_floor("", just_check)) @@ -721,7 +721,7 @@ static bool _get_mem_list(spell_list &mem_spells, "current level of comprehension.", num_on_ground == 0 ? " you're carrying" : ""); } - return (false); + return false; } else if (book_hash.empty()) { @@ -730,7 +730,7 @@ static bool _get_mem_list(spell_list &mem_spells, mpr("None of the spellbooks you are carrying contain any spells.", MSGCH_PROMPT); } - return (false); + return false; } unsigned int num_known = 0; @@ -769,11 +769,11 @@ static bool _get_mem_list(spell_list &mem_spells, { if (!just_check) mpr("Your head is already too full of spells!"); - return (false); + return false; } if (num_memable) - return (true); + return true; // Return true even if there are only spells we can't memorise _yet_. if (just_check) @@ -796,7 +796,7 @@ static bool _get_mem_list(spell_list &mem_spells, { // Just because we can't memorise them doesn't mean we don't want to // see what we have available. See FR #235. {due} - return (true); + return true; } else { @@ -811,7 +811,7 @@ static bool _get_mem_list(spell_list &mem_spells, "spells in them are available to you.", num_unreadable); } - return (false); + return false; } // If current_spell is a valid spell, returns whether you'll be able to @@ -833,12 +833,12 @@ static bool _sort_mem_spells(spell_type a, spell_type b) if (player_spell_levels() >= spell_levels_required(a) && player_spell_levels() < spell_levels_required(b)) { - return (true); + return true; } else if (player_spell_levels() < spell_levels_required(a) && player_spell_levels() >= spell_levels_required(b)) { - return (false); + return false; } // Don't sort by failure rate beyond what the player can see in the @@ -864,7 +864,7 @@ std::vector<spell_type> get_mem_spell_list(std::vector<int> &books) unsigned int num_race; if (!_get_mem_list(mem_spells, book_hash, num_unreadable, num_race)) - return (spells); + return spells; std::sort(mem_spells.begin(), mem_spells.end(), _sort_mem_spells); @@ -877,7 +877,7 @@ std::vector<spell_type> get_mem_spell_list(std::vector<int> &books) books.push_back(it->second); } - return (spells); + return spells; } static spell_type _choose_mem_spell(spell_list &spells, @@ -1032,7 +1032,7 @@ static spell_type _choose_mem_spell(spell_list &spells, redraw_screen(); if (sel.empty()) - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; ASSERT(sel.size() == 1); @@ -1042,7 +1042,7 @@ static spell_type _choose_mem_spell(spell_list &spells, if (spell_menu.menu_action == Menu::ACT_EXAMINE) describe_spell(spell); else - return (spell); + return spell; } } @@ -1052,37 +1052,37 @@ bool can_learn_spell(bool silent) { if (!silent) canned_msg(MSG_PRESENT_FORM); - return (false); + return false; } if (you.stat_zero[STAT_INT]) { if (!silent) mpr("Your brain is not functional enough to learn spells."); - return (false); + return false; } if (you.confused()) { if (!silent) mpr("You are too confused!"); - return (false); + return false; } if (you.berserk()) { if (!silent) canned_msg(MSG_TOO_BERSERK); - return (false); + return false; } - return (true); + return true; } bool learn_spell() { if (!can_learn_spell()) - return (false); + return false; spell_list mem_spells; spells_to_books book_hash; @@ -1090,7 +1090,7 @@ bool learn_spell() unsigned int num_unreadable, num_race; if (!_get_mem_list(mem_spells, book_hash, num_unreadable, num_race)) - return (false); + return false; spell_type specspell = _choose_mem_spell(mem_spells, book_hash, num_unreadable, num_race); @@ -1098,7 +1098,7 @@ bool learn_spell() if (specspell == SPELL_NO_SPELL) { canned_msg(MSG_OK); - return (false); + return false; } spells_to_books::iterator it = book_hash.find(specspell); @@ -1127,54 +1127,54 @@ std::string desc_cannot_memorise_reason(bool undead) desc += "."; - return (desc); + return desc; } static bool _learn_spell_checks(spell_type specspell) { if (!can_learn_spell()) - return (false); + return false; if (already_learning_spell((int) specspell)) - return (false); + return false; bool undead = false; if (you_cannot_memorise(specspell, undead)) { mpr(desc_cannot_memorise_reason(undead).c_str()); - return (false); + return false; } if (you.has_spell(specspell)) { mpr("You already know that spell!"); - return (false); + return false; } if (you.spell_no >= MAX_KNOWN_SPELLS) { mpr("Your head is already too full of spells!"); - return (false); + return false; } if (you.experience_level < spell_difficulty(specspell)) { mpr("You're too inexperienced to learn that spell!"); - return (false); + return false; } if (player_spell_levels() < spell_levels_required(specspell)) { mpr("You can't memorise that many levels of magic yet!"); - return (false); + return false; } - return (true); + return true; } bool learn_spell(spell_type specspell, int book, bool is_safest_book) { if (!_learn_spell_checks(specspell)) - return (false); + return false; int chance = spell_fail(specspell); @@ -1203,7 +1203,7 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book) if (!yesno(prompt.c_str(), false, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } } @@ -1225,7 +1225,7 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book) (temp_rand2 == 2) ? "learn" : "absorb")); if (chance >= 100) - return (false); + return false; snprintf(info, INFO_SIZE, "Memorise %s, consuming %d spell level%s and leaving %d?", @@ -1238,7 +1238,7 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book) if (!yesno(info, true, 'n', false)) { canned_msg(MSG_OK); - return (false); + return false; } if (player_mutation_level(MUT_BLURRY_VISION) > 0 @@ -1246,7 +1246,7 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book) { mpr("The writing blurs into unreadable gibberish."); you.turn_is_over = true; - return (false); + return false; } if (random2avg(100, 3) < chance && !one_chance_in(10)) @@ -1279,11 +1279,11 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book) #ifdef WIZARD if (!you.wizard) - return (false); + return false; else if (!yesno("Memorise anyway?", true, 'n')) - return (false); + return false; #else - return (false); + return false; #endif } @@ -1292,7 +1292,7 @@ bool learn_spell(spell_type specspell, int book, bool is_safest_book) did_god_conduct(DID_SPELL_CASTING, 2 + random2(5)); - return (true); + return true; } bool forget_spell_from_book(spell_type spell, const item_def* book) @@ -1309,7 +1309,7 @@ bool forget_spell_from_book(spell_type spell, const item_def* book) if (!yesno(prompt.c_str(), false, 'n')) { canned_msg(MSG_OK); - return (false); + return false; } mprf("As you tear out the page describing %s, the book crumbles to dust.", spell_title(spell)); @@ -1320,13 +1320,13 @@ bool forget_spell_from_book(spell_type spell, const item_def* book) destroy_spellbook(*book); dec_inv_item_quantity(book->link, 1); you.turn_is_over = true; - return (true); + return true; } else { // This shouldn't happen. mprf("A bug prevents you from forgetting %s.", spell_title(spell)); - return (false); + return false; } } @@ -1336,17 +1336,17 @@ int count_rod_spells(const item_def &item, bool need_id) return (-1); if (need_id && !item_type_known(item)) - return (0); + return 0; const int type = item.book_number(); if (type == -1) - return (0); + return 0; int nspel = 0; while (nspel < SPELLBOOK_SIZE && is_valid_spell_in_book(item, nspel)) ++nspel; - return (nspel); + return nspel; } int rod_spell(int rod) @@ -1367,7 +1367,7 @@ int rod_spell(int rod) if (num_spells == 0) { canned_msg(MSG_NOTHING_HAPPENS); // shouldn't happen - return (0); + return 0; } else if (num_spells == 1) keyin = 'a'; // automatically selected if it's the only option @@ -1451,11 +1451,11 @@ int rod_spell(int rod) static bool _compare_spells(spell_type a, spell_type b) { if (a == SPELL_NO_SPELL && b == SPELL_NO_SPELL) - return (false); + return false; else if (a != SPELL_NO_SPELL && b == SPELL_NO_SPELL) - return (true); + return true; else if (a == SPELL_NO_SPELL && b != SPELL_NO_SPELL) - return (false); + return false; int level_a = spell_difficulty(a); int level_b = spell_difficulty(b); @@ -1491,9 +1491,9 @@ bool is_memorised(spell_type spell) { for (int i = 0; i < MAX_KNOWN_SPELLS; i++) if (you.spells[i] == spell) - return (true); + return true; - return (false); + return false; } static void _get_spell_list(std::vector<spell_type> &spells, int level, @@ -1690,7 +1690,7 @@ bool make_book_level_randart(item_def &book, int level, int num_spells, mprf(MSGCH_ERROR, "Could not create fixed level randart spellbook: %s", buf); - return (false); + return false; } random_shuffle(spells.begin(), spells.end()); @@ -1844,7 +1844,7 @@ bool make_book_level_randart(item_def &book, int level, int num_spells, set_artefact_name(book, name); - return (true); + return true; } static bool _get_weighted_discs(bool completely_random, god_type god, @@ -1889,7 +1889,7 @@ static bool _get_weighted_discs(bool completely_random, god_type god, // all available spells. We could simply re-allow all disciplines // but the player isn't going to get any new spells, anyway, so just // consider this acquirement failed. (jpeg) - return (false); + return false; } int skill_weights[SPTYP_LAST_EXPONENT + 1]; @@ -1930,7 +1930,7 @@ static bool _get_weighted_discs(bool completely_random, god_type god, } while (disciplines_conflict(disc1, disc2)); - return (true); + return true; } static void _get_weighted_spells(bool completely_random, god_type god, @@ -2137,13 +2137,13 @@ bool make_book_theme_randart(item_def &book, if (!_get_weighted_discs(completely_random, god, disc1, disc2)) { if (completely_random) - return (false); + return false; // Rather than give up at this point, choose schools randomly. // This way, an acquirement won't fail once the player has // seen all spells. if (!_get_weighted_discs(true, god, disc1, disc2)) - return (false); + return false; } } else if (disc2 == 0) @@ -2455,7 +2455,7 @@ bool make_book_theme_randart(item_def &book, book.plus = max1; book.plus2 = max2; - return (true); + return true; } // Give Roxanne a randart spellbook of the disciplines Transmutations/Earth @@ -2554,7 +2554,7 @@ bool book_has_title(const item_def &book) ASSERT(book.base_type == OBJ_BOOKS); if (!is_artefact(book)) - return (false); + return false; return (book.props.exists("is_named") && book.props["is_named"].get_bool() == true); @@ -2567,11 +2567,11 @@ bool is_dangerous_spellbook(const int book_type) case BOOK_NECRONOMICON: case BOOK_GRAND_GRIMOIRE: case BOOK_ANNIHILATIONS: - return (true); + return true; default: break; } - return (false); + return false; } bool is_dangerous_spellbook(const item_def &book) diff --git a/crawl-ref/source/spl-cast.cc b/crawl-ref/source/spl-cast.cc index 7d787c3428..6f2e2af3eb 100644 --- a/crawl-ref/source/spl-cast.cc +++ b/crawl-ref/source/spl-cast.cc @@ -377,7 +377,7 @@ int spell_fail(spell_type spell) if (chance2 > 100) chance2 = 100; - return (chance2); + return chance2; } int calc_spell_power(spell_type spell, bool apply_intel, bool fail_rate_check, @@ -447,7 +447,7 @@ int calc_spell_power(spell_type spell, bool apply_intel, bool fail_rate_check, if (cap > 0 && cap_power) power = std::min(power, cap); - return (power); + return power; } static int _spell_enhancement(unsigned int typeflags) @@ -501,7 +501,7 @@ static int _spell_enhancement(unsigned int typeflags) else if (enhanced < -3) enhanced = -3; - return (enhanced); + return enhanced; } void inspect_spells() @@ -645,7 +645,7 @@ bool cast_a_spell(bool check_range, spell_type spell) if (key_is_escape(keyin)) { canned_msg(MSG_OK); - return (false); + return false; } else if (keyin == '.' || keyin == CK_ENTER) spell = you.last_cast_spell; @@ -653,7 +653,7 @@ bool cast_a_spell(bool check_range, spell_type spell) { mpr("You don't know that spell."); crawl_state.zero_turns_taken(); - return (false); + return false; } else { @@ -665,13 +665,13 @@ bool cast_a_spell(bool check_range, spell_type spell) { mpr("You don't know that spell."); crawl_state.zero_turns_taken(); - return (false); + return false; } if (spell_mana(spell) > you.magic_points) { mpr("You don't have enough magic to cast that spell."); - return (false); + return false; } if (check_range && spell_no_hostile_in_range(spell, minRange)) @@ -687,7 +687,7 @@ bool cast_a_spell(bool check_range, spell_type spell) range_view_annotator show_range(&range); delay(50); } - return (false); + return false; } if (!you.is_undead @@ -695,7 +695,7 @@ bool cast_a_spell(bool check_range, spell_type spell) || you.hunger <= spell_hunger(spell))) { canned_msg(MSG_NO_ENERGY); - return (false); + return false; } // This needs more work: there are spells which are hated but allowed if @@ -716,7 +716,7 @@ bool cast_a_spell(bool check_range, spell_type spell) true, 'n')) { crawl_state.zero_turns_taken(); - return (false); + return false; } } @@ -725,7 +725,7 @@ bool cast_a_spell(bool check_range, spell_type spell) if (cast_result == SPRET_ABORT) { crawl_state.zero_turns_taken(); - return (false); + return false; } if (cast_result == SPRET_SUCCESS) @@ -752,7 +752,7 @@ bool cast_a_spell(bool check_range, spell_type spell) you.turn_is_over = true; alert_nearby_monsters(); - return (true); + return true; } static void _spellcasting_side_effects(spell_type spell, int pow, god_type god) @@ -800,10 +800,10 @@ static void _spellcasting_side_effects(spell_type spell, int pow, god_type god) static bool _vampire_cannot_cast(spell_type spell) { if (you.species != SP_VAMPIRE) - return (false); + return false; if (you.hunger_state > HS_SATIATED) - return (false); + return false; // Satiated or less switch (spell) @@ -816,9 +816,9 @@ static bool _vampire_cannot_cast(spell_type spell) case SPELL_SPIDER_FORM: case SPELL_STATUE_FORM: case SPELL_STONESKIN: - return (true); + return true; default: - return (false); + return false; } } @@ -838,16 +838,16 @@ bool spell_is_uncastable(spell_type spell, std::string &msg) if (spell != SPELL_NECROMUTATION && you_cannot_memorise(spell)) { msg = "You cannot cast that spell in your current form!"; - return (true); + return true; } if (_vampire_cannot_cast(spell)) { msg = "Your current blood level is not sufficient to cast that spell."; - return (true); + return true; } - return (false); + return false; } #ifdef WIZARD @@ -950,13 +950,13 @@ static bool _spellcasting_aborted(spell_type spell, if (!wiz_cast && spell_is_uncastable(spell, msg)) { mpr(msg); - return (true); + return true; } if (is_prevented_teleport(spell)) { mpr("You cannot teleport right now."); - return (true); + return true; } if (check_range_usability @@ -964,23 +964,23 @@ static bool _spellcasting_aborted(spell_type spell, && !corpse_at(you.pos())) { mpr("There aren't any corpses here."); - return (true); + return true; } if (spell == SPELL_MALIGN_GATEWAY && !can_cast_malign_gateway()) { mpr("The dungeon can only cope with one malign gateway at a time!"); - return (true); + return true; } if (spell == SPELL_TORNADO && (you.duration[DUR_TORNADO] || you.duration[DUR_TORNADO_COOLDOWN])) { mpr("You need to wait for the winds to calm down."); - return (true); + return true; } - return (false); + return false; } static targetter* _spell_targetter(spell_type spell, int pow, int range) @@ -1018,7 +1018,7 @@ spret_type your_spells(spell_type spell, int powc, // [dshaligram] Any action that depends on the spellcasting attempt to have // succeeded must be performed after the switch. if (_spellcasting_aborted(spell, check_range, wiz_cast)) - return (SPRET_ABORT); + return SPRET_ABORT; const unsigned int flags = get_spell_flags(spell); @@ -1056,7 +1056,7 @@ spret_type your_spells(spell_type spell, int powc, { potion = _setup_evaporate_cast(); if (potion == -1) - return (SPRET_ABORT); + return SPRET_ABORT; } else if (dir == DIR_DIR) mpr(prompt ? prompt : "Which direction?", MSGCH_PROMPT); @@ -1083,7 +1083,7 @@ spret_type your_spells(spell_type spell, int powc, { if (hitfunc) delete hitfunc; - return (SPRET_ABORT); + return SPRET_ABORT; } if (hitfunc) @@ -1097,7 +1097,7 @@ spret_type your_spells(spell_type spell, int powc, else canned_msg(MSG_UNTHINKING_ACT); - return (SPRET_ABORT); + return SPRET_ABORT; } } @@ -1154,7 +1154,7 @@ spret_type your_spells(spell_type spell, int powc, { case SPRET_SUCCESS: _spellcasting_side_effects(spell, powc, god); - return (SPRET_SUCCESS); + return SPRET_SUCCESS; case SPRET_FAIL: { @@ -1167,7 +1167,7 @@ spret_type your_spells(spell_type spell, int powc, && you.piety >= 100 && x_chance_in_y(you.piety + 1, 150)) { canned_msg(MSG_NOTHING_HAPPENS); - return (SPRET_FAIL); + return SPRET_FAIL; } // All spell failures give a bit of magical radiation. @@ -1184,11 +1184,11 @@ spret_type your_spells(spell_type spell, int powc, MiscastEffect(&you, NON_MONSTER, spell, spell_difficulty(spell), fail); - return (SPRET_FAIL); + return SPRET_FAIL; } case SPRET_ABORT: - return (SPRET_ABORT); + return SPRET_ABORT; case SPRET_NONE: #ifdef WIZARD @@ -1196,7 +1196,7 @@ spret_type your_spells(spell_type spell, int powc, && (flags & SPFLAG_MONSTER)) { _try_monster_cast(spell, powc, spd, beam); - return (SPRET_SUCCESS); + return SPRET_SUCCESS; } #endif @@ -1208,10 +1208,10 @@ spret_type your_spells(spell_type spell, int powc, else mpr("Invalid spell!", MSGCH_ERROR); - return (SPRET_ABORT); + return SPRET_ABORT; } - return (SPRET_SUCCESS); + return SPRET_SUCCESS; } // Special-cased after-effects. @@ -1445,12 +1445,12 @@ static spret_type _do_cast(spell_type spell, int powc, // XXX: I don't think any call to healing goes through here. --rla case SPELL_MINOR_HEALING: if (cast_healing(5, 5) < 0) - return (SPRET_ABORT); + return SPRET_ABORT; break; case SPELL_MAJOR_HEALING: if (cast_healing(25, 25) < 0) - return (SPRET_ABORT); + return SPRET_ABORT; break; // Self-enchantments. (Spells that can only affect the player.) @@ -1597,10 +1597,10 @@ static spret_type _do_cast(spell_type spell, int powc, return cast_shroud_of_golubria(powc, fail); default: - return (SPRET_NONE); + return SPRET_NONE; } - return (SPRET_SUCCESS); + return SPRET_SUCCESS; } @@ -1824,7 +1824,7 @@ int calc_spell_range(spell_type spell, int power, bool rod) power = calc_spell_power(spell, true, false, false, rod); const int range = spell_range(spell, power); - return (range); + return range; } std::string spell_range_string(spell_type spell, bool rod) @@ -1858,7 +1858,7 @@ std::string spell_schools_string(spell_type spell) } } - return (desc); + return desc; } void spell_skills(spell_type spell, std::set<skill_type> &skills) diff --git a/crawl-ref/source/spl-clouds.cc b/crawl-ref/source/spl-clouds.cc index 4e066c9462..67b963527d 100644 --- a/crawl-ref/source/spl-clouds.cc +++ b/crawl-ref/source/spl-clouds.cc @@ -381,7 +381,7 @@ static std::vector<int> _get_evaporate_result(int potion) clouds.push_back(CLOUD_STEAM); } - return (clouds); + return clouds; } // Returns a comma-separated list of all cloud types potentially created diff --git a/crawl-ref/source/spl-damage.cc b/crawl-ref/source/spl-damage.cc index 2a9ba227c0..c233db9392 100644 --- a/crawl-ref/source/spl-damage.cc +++ b/crawl-ref/source/spl-damage.cc @@ -167,7 +167,7 @@ bool cast_hellfire_burst(int pow, bolt &beam) if (beam.beam_cancelled) { canned_msg(MSG_OK); - return (false); + return false; } mpr("You call forth a pillar of hellfire!"); @@ -176,7 +176,7 @@ bool cast_hellfire_burst(int pow, bolt &beam) beam.in_explosion_phase = false; beam.explode(true); - return (true); + return true; } // XXX no friendly check @@ -835,11 +835,11 @@ static bool _player_hurt_monster(monster& m, int damage, else { monster_die(&m, KILL_YOU, NON_MONSTER); - return (true); + return true; } } - return (false); + return false; } // Here begin the actual spells: @@ -905,7 +905,7 @@ static int _shatter_monsters(coord_def where, int pow, actor *agent) monster* mon = monster_at(where); if (mon == NULL || mon == agent) - return (0); + return 0; dam_dice.num = _shatter_mon_dice(mon); int damage = std::max(0, dam_dice.roll() - random2(mon->armour_class())); @@ -923,7 +923,7 @@ static int _shatter_monsters(coord_def where, int pow, actor *agent) else mon->hurt(agent, damage); - return (damage); + return damage; } static int _shatter_items(coord_def where, int pow, actor *) @@ -1025,10 +1025,10 @@ static int _shatter_walls(coord_def where, int pow, actor *) if (grid == DNGN_ORCISH_IDOL) did_god_conduct(DID_DESTROY_ORCISH_IDOL, 8); - return (1); + return 1; } - return (0); + return 0; } static bool _shatterable(const actor *act) @@ -1105,7 +1105,7 @@ static int _shatter_player(int pow, actor *wielder) if (damage > 0) ouch(damage, wielder->mindex(), KILLED_BY_MONSTER); - return (damage); + return damage; } void shillelagh(actor *wielder, coord_def where, int pow) @@ -1267,7 +1267,7 @@ static int _ignite_poison_objects(coord_def where, int pow, int, actor *actor) strength + roll_dice(3, strength / 4), actor); } - return (strength); + return strength; } static int _ignite_poison_clouds(coord_def where, int pow, int, actor *actor) @@ -1311,7 +1311,7 @@ static int _ignite_poison_monsters(coord_def where, int pow, int, actor *actor) monster* mon = monster_at(where); if (mon == NULL || mon == actor) - return (0); + return 0; // Monsters which have poison corpses or poisonous attacks. if (mons_is_poisoner(mon)) @@ -1354,10 +1354,10 @@ static int _ignite_poison_monsters(coord_def where, int pow, int, actor *actor) actor->mindex()); } - return (1); + return 1; } - return (0); + return 0; } // The self effects of Ignite Poison are beautiful and @@ -1367,7 +1367,7 @@ static int _ignite_poison_monsters(coord_def where, int pow, int, actor *actor) static int _ignite_poison_player(coord_def where, int pow, int, actor *actor) { if (actor->is_player() || where != you.pos()) - return (0); + return 0; int totalstrength = 0; @@ -1432,9 +1432,9 @@ static int _ignite_poison_player(coord_def where, int pow, int, actor *actor) } if (damage || totalstrength) - return (1); + return 1; else - return (0); + return 0; } spret_type cast_ignite_poison(int pow, bool fail) @@ -1478,9 +1478,9 @@ static int _discharge_monsters(coord_def where, int pow, int, actor *) ouch(damage, NON_MONSTER, KILLED_BY_WILD_MAGIC, "static electricity"); } else if (mons == NULL) - return (0); + return 0; else if (mons->res_elec() > 0 || mons_flies(mons)) - return (0); + return 0; else { damage = 3 + random2(5 + pow / 10 + (random2(pow) / 10)); @@ -1512,7 +1512,7 @@ static int _discharge_monsters(coord_def where, int pow, int, actor *) mpr("The lightning grounds out."); } - return (damage); + return damage; } // XXX no friendly check. @@ -1549,9 +1549,9 @@ spret_type cast_discharge(int pow, bool fail) static int _disperse_monster(monster* mon, int pow) { if (!mon) - return (0); + return 0; if (mons_is_projectile(mon->type)) - return (0); + return 0; if (mon->no_tele()) return 1; @@ -1567,15 +1567,15 @@ static int _disperse_monster(monster* mon, int pow) else simple_monster_message(mon, mons_resist_string(mon, res_margin)); - return (1); + return 1; } else { monster_teleport(mon, true); - return (1); + return 1; } - return (0); + return 0; } spret_type cast_dispersal(int pow, bool fail) @@ -1864,13 +1864,13 @@ int wielding_rocks() { const item_def* wpn = you.weapon(); if (!wpn || wpn->base_type != OBJ_MISSILES) - return (0); + return 0; else if (wpn->sub_type == MI_STONE) - return (1); + return 1; else if (wpn->sub_type == MI_LARGE_ROCK) - return (2); + return 2; else - return (0); + return 0; } spret_type cast_sandblast(int pow, bolt &beam, bool fail) @@ -1909,10 +1909,10 @@ actor* forest_near_enemy(const actor *mon) for (adjacent_iterator ai(*ri); ai; ++ai) if (feat_is_tree(grd(*ai)) && cell_see_cell(pos, *ai, LOS_DEFAULT)) - return (foe); + return foe; } - return (NULL); + return NULL; } // Print a message only if you can see any affected trees. diff --git a/crawl-ref/source/spl-goditem.cc b/crawl-ref/source/spl-goditem.cc index 8d805471f2..4651c27e67 100644 --- a/crawl-ref/source/spl-goditem.cc +++ b/crawl-ref/source/spl-goditem.cc @@ -56,7 +56,7 @@ int identify(int power, int item_slot, std::string *pre_msg) OSEL_UNIDENT, true, true, false); } if (prompt_failed(item_slot)) - return (identified); + return identified; item_def& item(you.inv[item_slot]); @@ -117,7 +117,7 @@ int identify(int power, int item_slot, std::string *pre_msg) item_slot = -1; } while (id_used > identified); - return (identified); + return identified; } static bool _mons_hostile(const monster* mon) @@ -178,7 +178,7 @@ static int _can_pacify_monster(const monster* mon, const int healed, return pacifiable; if (healed < 1) - return (0); + return 0; const int factor = (mons_intel(mon) <= I_ANIMAL) ? 3 : // animals (is_player_same_species(mon->type)) ? 2 // same species @@ -208,11 +208,11 @@ static int _can_pacify_monster(const monster* mon, const int healed, you.skill(SK_INVOCATIONS), healed, random_factor); if (mon->max_hit_points < factor * random_factor) - return (1); + return 1; if (mon->max_hit_points < factor * random_factor * 1.15) return (-3); - return (0); + return 0; } static std::vector<std::string> _desc_mindless(const monster_info& mi) @@ -261,7 +261,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, mpr("You are healed."); inc_hp(healed); - return (1); + return 1; } monster* mons = monster_at(spd.target); @@ -270,7 +270,7 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, canned_msg(MSG_NOTHING_THERE); // This isn't a cancel, to avoid leaking invisible monster // locations. - return (0); + return 0; } const int can_pacify = _can_pacify_monster(mons, healed, max_healed); @@ -285,19 +285,19 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, { mprf("The light of Elyvilon fails to reach %s.", mons->name(DESC_THE).c_str()); - return (0); + return 0; } else if (can_pacify == -3) { mprf("The light of Elyvilon almost touches upon %s.", mons->name(DESC_THE).c_str()); - return (0); + return 0; } else if (can_pacify == -4) { mprf("%s is completely unfazed by your meager offer of peace.", mons->name(DESC_THE).c_str()); - return (0); + return 0; } else { @@ -363,10 +363,10 @@ static int _healing_spell(int healed, int max_healed, bool divine_ability, if (!did_something) { canned_msg(MSG_NOTHING_HAPPENS); - return (0); + return 0; } - return (1); + return 1; } // Returns: 1 -- success, 0 -- failure, -1 -- cancel @@ -496,7 +496,7 @@ int detect_items(int pow) } } - return (items_found); + return items_found; } static void _fuzz_detect_creatures(int pow, int *fuzz_radius, int *fuzz_chance) @@ -559,7 +559,7 @@ static bool _mark_detected_creature(coord_def where, monster* mon, env.map_knowledge(where).set_detected_monster(mons_detected_base(mon->type)); - return (found_good); + return found_good; } int detect_creatures(int pow, bool telepathic) @@ -589,7 +589,7 @@ int detect_creatures(int pow, bool telepathic) } } - return (creatures_found); + return creatures_found; } static bool _selectively_remove_curse(std::string *pre_msg) @@ -681,7 +681,7 @@ bool remove_curse(bool alreadyknown, std::string *pre_msg) canned_msg(MSG_NOTHING_HAPPENS); } - return (success); + return success; } static bool _selectively_curse_item(bool armour, std::string *pre_msg) @@ -819,7 +819,7 @@ static bool _do_imprison(int pow, const coord_def& where, bool zin) mprf(none_vis ? "You briefly glimpse something next to %s." : "You need more space to imprison %s.", targname.c_str()); - return (false); + return false; } } @@ -907,7 +907,7 @@ bool entomb(int pow) if (crawl_state.game_is_zotdef()) { mpr("The dungeon rumbles ominously, and rocks fall from the ceiling!"); - return (false); + return false; } if (_do_imprison(pow, you.pos(), false)) { @@ -917,10 +917,10 @@ bool entomb(int pow) you.mindex(), you.mindex())); env.markers.clear_need_activate(); // doesn't need activation - return (true); + return true; } - return (false); + return false; } bool cast_imprison(int pow, monster* mons, int source) @@ -933,10 +933,10 @@ bool cast_imprison(int pow, monster* mons, int source) source, mons->mindex())); env.markers.clear_need_activate(); // doesn't need activation - return (true); + return true; } - return (false); + return false; } bool cast_smiting(int pow, monster* mons) @@ -946,7 +946,7 @@ bool cast_smiting(int pow, monster* mons) canned_msg(MSG_NOTHING_THERE); // Counts as a real cast, due to victory-dancing and // invisible/submerged monsters. - return (true); + return true; } god_conduct_trigger conducts[3]; @@ -975,5 +975,5 @@ bool cast_smiting(int pow, monster* mons) print_wounds(mons); } - return (success); + return success; } diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc index 8057a9f62b..cdc1ca0b87 100644 --- a/crawl-ref/source/spl-miscast.cc +++ b/crawl-ref/source/spl-miscast.cc @@ -518,7 +518,7 @@ bool MiscastEffect::_ouch(int dam, beam_type flavour) dam = check_your_resists(dam, flavour, cause); if (avoid_lethal(dam)) - return (false); + return false; do_msg(true); @@ -544,7 +544,7 @@ bool MiscastEffect::_ouch(int dam, beam_type flavour) ouch(dam, kill_source, method, cause.c_str(), see_source); } - return (true); + return true; } bool MiscastEffect::_explosion() @@ -556,24 +556,24 @@ bool MiscastEffect::_explosion() int max_dam = beam.damage.num * beam.damage.size; max_dam = check_your_resists(max_dam, beam.flavour, cause); if (avoid_lethal(max_dam)) - return (false); + return false; do_msg(true); beam.explode(); - return (true); + return true; } bool MiscastEffect::_big_cloud(cloud_type cl_type, int cloud_pow, int size, int spread_rate) { if (avoid_lethal(2 * max_cloud_damage(cl_type, cloud_pow))) - return (false); + return false; do_msg(true); big_cloud(cl_type, guilty, target->pos(), cloud_pow, size, spread_rate); - return (true); + return true; } bool MiscastEffect::_lose_stat(stat_type which_stat, int8_t stat_loss) @@ -619,7 +619,7 @@ bool MiscastEffect::_send_to_abyss() return (_malign_gateway()); // attempt to degrade to malign gateway target->banish(act_source, cause); - return (true); + return true; } // XXX: Mostly duplicated from cast_malign_gateway. @@ -648,13 +648,13 @@ bool MiscastEffect::_malign_gateway() do_msg(); } - return (success); + return success; } bool MiscastEffect::avoid_lethal(int dam) { if (lethality_margin <= 0 || (you.hp - dam) > lethality_margin) - return (false); + return false; if (recursion_depth == MAX_RECURSE) { @@ -662,7 +662,7 @@ bool MiscastEffect::avoid_lethal(int dam) mpr("Couldn't avoid lethal miscast: too much recursion.", MSGCH_ERROR); #endif - return (false); + return false; } if (did_msg) @@ -671,7 +671,7 @@ bool MiscastEffect::avoid_lethal(int dam) mpr("Couldn't avoid lethal miscast: already printed message for this " "miscast.", MSGCH_ERROR); #endif - return (false); + return false; } #if defined(DEBUG_DIAGNOSTICS) || defined(DEBUG_MISCAST) @@ -680,7 +680,7 @@ bool MiscastEffect::avoid_lethal(int dam) do_miscast(); - return (true); + return true; } bool MiscastEffect::_create_monster(monster_type what, int abj_deg, @@ -745,7 +745,7 @@ static bool _has_hair(actor* target) { // Don't bother for monsters. if (target->is_monster()) - return (false); + return false; return (!form_changed_physiology() && you.species != SP_GHOUL && you.species != SP_OCTOPODE diff --git a/crawl-ref/source/spl-monench.cc b/crawl-ref/source/spl-monench.cc index bb4aa45dfa..cd57e6de63 100644 --- a/crawl-ref/source/spl-monench.cc +++ b/crawl-ref/source/spl-monench.cc @@ -26,13 +26,13 @@ static int _englaciate_monsters(coord_def where, int pow, int, actor *actor) monster* mons = monster_at(where); if (!mons) - return (0); + return 0; if (mons->res_cold() > 0 || mons_is_stationary(mons)) { if (!mons_is_firewood(mons)) simple_monster_message(mons, " is unaffected."); - return (0); + return 0; } int duration = (roll_dice(3, pow) / 6 - random2(mons->get_experience_level())) @@ -41,7 +41,7 @@ static int _englaciate_monsters(coord_def where, int pow, int, actor *actor) if (duration <= 0) { simple_monster_message(mons, " resists."); - return (0); + return 0; } if (mons_class_flag(mons->type, M_COLD_BLOOD)) @@ -65,11 +65,11 @@ bool backlight_monsters(coord_def where, int pow, int garbage) monster* mons = monster_at(where); if (mons == NULL) - return (false); + return false; // Already glowing. if (mons->glows_naturally()) - return (false); + return false; mon_enchant bklt = mons->get_ench(ENCH_CORONA); mon_enchant zin_bklt = mons->get_ench(ENCH_SILVER_CORONA); @@ -84,7 +84,7 @@ bool backlight_monsters(coord_def where, int pow, int garbage) mon_enchant(ENCH_CORONA, 1, 0, random_range(30, 50))); simple_monster_message(mons, " is lined in light."); } - return (true); + return true; } mons->add_ench(mon_enchant(ENCH_CORONA, 1)); @@ -96,19 +96,19 @@ bool backlight_monsters(coord_def where, int pow, int garbage) else simple_monster_message(mons, " glows brighter."); - return (true); + return true; } bool do_slow_monster(monster* mon, const actor* agent, int dur) { if (mon->check_stasis(false)) - return (true); + return true; // Try to remove haste, if monster is hasted. if (mon->del_ench(ENCH_HASTE, true)) { if (simple_monster_message(mon, " is no longer moving quickly.")) - return (true); + return true; } // Not hasted, slow it. @@ -119,11 +119,11 @@ bool do_slow_monster(monster* mon, const actor* agent, int dur) if (!mon->paralysed() && !mon->petrified() && simple_monster_message(mon, " seems to slow down.")) { - return (true); + return true; } } - return (false); + return false; } // XXX: Not sure why you can't exit map and cancel the spell. diff --git a/crawl-ref/source/spl-other.cc b/crawl-ref/source/spl-other.cc index a3ff0addde..7a11c34a3c 100644 --- a/crawl-ref/source/spl-other.cc +++ b/crawl-ref/source/spl-other.cc @@ -238,7 +238,7 @@ bool recall(int type_recalled) if (!success) mpr("Nothing appears to have answered your call."); - return (success); + return success; } // Cast_phase_shift: raises evasion (by 8 currently) via Translocations. @@ -266,9 +266,9 @@ static bool _feat_is_passwallable(dungeon_feature_type feat) case DNGN_SLIMY_WALL: case DNGN_CLEAR_ROCK_WALL: case DNGN_SECRET_DOOR: - return (true); + return true; default: - return (false); + return false; } } diff --git a/crawl-ref/source/spl-selfench.cc b/crawl-ref/source/spl-selfench.cc index e5b6d6bf58..b7241213a9 100644 --- a/crawl-ref/source/spl-selfench.cc +++ b/crawl-ref/source/spl-selfench.cc @@ -252,7 +252,7 @@ int cast_selective_amnesia(std::string *pre_msg) if (you.spell_no == 0) { canned_msg(MSG_NO_SPELLS); - return (0); + return 0; } int keyin = 0; @@ -305,7 +305,7 @@ int cast_selective_amnesia(std::string *pre_msg) "it unravels."); } - return (1); + return 1; } spret_type cast_see_invisible(int pow, bool fail) @@ -349,13 +349,13 @@ spret_type cast_liquefaction(int pow, bool fail) mpr("You can't cast this spell without touching the ground."); else mpr("You need to be on clear, solid ground to cast this spell."); - return (SPRET_ABORT); + return SPRET_ABORT; } if (you.duration[DUR_LIQUEFYING] || liquefied(you.pos())) { mpr("The ground here is already liquefied! You'll have to wait."); - return (SPRET_ABORT); + return SPRET_ABORT; } fail_check(); diff --git a/crawl-ref/source/spl-summoning.cc b/crawl-ref/source/spl-summoning.cc index 6730120447..a933d31e2c 100644 --- a/crawl-ref/source/spl-summoning.cc +++ b/crawl-ref/source/spl-summoning.cc @@ -101,7 +101,7 @@ bool summon_animals(int pow) } } - return (success); + return success; } spret_type cast_summon_butterflies(int pow, god_type god, bool fail) @@ -438,14 +438,14 @@ static int _count_summons(monster_type type) cnt++; } - return (cnt); + return cnt; } static monster_type _feature_to_elemental(const coord_def& where, monster_type strict_elem) { if (!in_bounds(where)) - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; if (strict_elem != MONS_NO_MONSTER && strict_elem != MONS_EARTH_ELEMENTAL @@ -453,7 +453,7 @@ static monster_type _feature_to_elemental(const coord_def& where, && strict_elem != MONS_WATER_ELEMENTAL && strict_elem != MONS_AIR_ELEMENTAL) { - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; } const bool any_elem = strict_elem == MONS_NO_MONSTER; @@ -461,7 +461,7 @@ static monster_type _feature_to_elemental(const coord_def& where, if ((any_elem || strict_elem == MONS_EARTH_ELEMENTAL) && (grd(where) == DNGN_ROCK_WALL || grd(where) == DNGN_CLEAR_ROCK_WALL)) { - return (MONS_EARTH_ELEMENTAL); + return MONS_EARTH_ELEMENTAL; } if ((any_elem || strict_elem == MONS_FIRE_ELEMENTAL) @@ -469,22 +469,22 @@ static monster_type _feature_to_elemental(const coord_def& where, && env.cloud[env.cgrid(where)].type == CLOUD_FIRE || grd(where) == DNGN_LAVA)) { - return (MONS_FIRE_ELEMENTAL); + return MONS_FIRE_ELEMENTAL; } if ((any_elem || strict_elem == MONS_WATER_ELEMENTAL) && feat_is_watery(grd(where))) { - return (MONS_WATER_ELEMENTAL); + return MONS_WATER_ELEMENTAL; } if ((any_elem || strict_elem == MONS_AIR_ELEMENTAL) && grd(where) >= DNGN_FLOOR && env.cgrid(where) == EMPTY_CLOUD) { - return (MONS_AIR_ELEMENTAL); + return MONS_AIR_ELEMENTAL; } - return (MONS_NO_MONSTER); + return MONS_NO_MONSTER; } // 'unfriendly' is percentage chance summoned elemental goes @@ -839,10 +839,10 @@ bool summon_berserker(int pow, actor *caster, monster_type override_mons) monster *mons = create_monster(mg); if (!mons) - return (false); + return false; _make_mons_berserk_summon(mons); - return (true); + return true; } static bool _summon_holy_being_wrapper(int pow, god_type god, int spell, @@ -868,7 +868,7 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, int spell, monster *summon = create_monster(mg); if (!summon) - return (false); + return false; summon->flags |= MF_ATT_CHANGE_ATTEMPT; @@ -876,7 +876,7 @@ static bool _summon_holy_being_wrapper(int pow, god_type god, int spell, mpr("You are momentarily dazzled by a brilliant light."); player_angers_monster(summon); - return (true); + return true; } static bool _summon_holy_being_wrapper(int pow, god_type god, int spell, @@ -1080,7 +1080,7 @@ static bool _summon_demon_wrapper(int pow, god_type god, int spell, } } - return (success); + return success; } static bool _summon_demon_wrapper(int pow, god_type god, int spell, @@ -1247,7 +1247,7 @@ coord_def find_gateway_location(actor* caster) you.xray_vision = xray; - return (point); + return point; } spret_type cast_malign_gateway(actor * caster, int pow, god_type god, bool fail) @@ -1548,10 +1548,10 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha, const item_def& item = mitm[corps]; if (!_animatable_remains(item)) - return (false); + return false; if (!actual) - return (true); + return true; const monster_type zombie_type = item.mon_type; @@ -1575,7 +1575,7 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha, mprf("The headless hydra %s sways and immediately collapses!", item.sub_type == CORPSE_BODY ? "corpse" : "skeleton"); } - return (false); + return false; } monster_type mon = MONS_PROGRAM_BUG; @@ -1611,7 +1611,7 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha, *raised = mons; if (!mons) - return (false); + return false; // If the original monster has been drained or levelled up, its HD // might be different from its class HD, in which case its HP should @@ -1667,7 +1667,7 @@ static bool _raise_remains(const coord_def &pos, int corps, beh_type beha, else *motions_r |= DEAD_ARE_WALKING; - return (true); + return true; } // Note that quiet will *not* suppress the message about a corpse @@ -1681,7 +1681,7 @@ int animate_remains(const coord_def &a, corpse_type class_allowed, monster** mon, int* motions_r) { if (is_sanctuary(a)) - return (0); + return 0; int number_found = 0; bool success = false; @@ -1736,9 +1736,9 @@ int animate_remains(const coord_def &a, corpse_type class_allowed, return (-1); if (!success) - return (0); + return 0; - return (1); + return 1; } int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting, @@ -1773,7 +1773,7 @@ int animate_dead(actor *caster, int pow, beh_type beha, unsigned short hitting, if (actual && number_seen > 0) _display_undead_motions(motions); - return (number_raised); + return number_raised; } // XXX: we could check if there's any corpse or skeleton and abort @@ -2256,7 +2256,7 @@ bool twisted_resurrection(actor *caster, int pow, beh_type beha, return (num_crawlies >= (caster->is_player() ? 1 : 2)); if (num_lost + num_crawlies + num_masses == 0) - return (false); + return false; if (num_lost) mprf("%s %s into %s!", @@ -2280,7 +2280,7 @@ bool twisted_resurrection(actor *caster, int pow, beh_type beha, if (num_holy > 0 && caster->is_player()) did_god_conduct(DID_DESECRATE_HOLY_REMAINS, 2 * num_holy); - return (true); + return true; } spret_type cast_twisted_resurrection(int pow, god_type god, bool fail) @@ -2372,7 +2372,7 @@ static int _abjuration(int pow, monster *mon) // XXX: make this a prompt if (mon->wont_attack()) - return (false); + return false; int duration; if (mon->is_summoned(&duration)) @@ -2409,7 +2409,7 @@ static int _abjuration(int pow, monster *mon) simple_monster_message(mon, " shudders."); } - return (true); + return true; } spret_type cast_abjuration(int pow, const coord_def& where, bool fail) diff --git a/crawl-ref/source/spl-transloc.cc b/crawl-ref/source/spl-transloc.cc index 9a1d0b672c..c011272f3d 100644 --- a/crawl-ref/source/spl-transloc.cc +++ b/crawl-ref/source/spl-transloc.cc @@ -235,7 +235,7 @@ int blink(int pow, bool high_level_controlled_blink, bool wizard_blink, crawl_state.cancel_cmd_again(); crawl_state.cancel_cmd_repeat(); - return (1); + return 1; } spret_type cast_blink(bool allow_partial_control, bool fail) @@ -303,7 +303,7 @@ bool allow_control_teleport(bool quiet) mpr("A powerful magic prevents control of your teleportation."); } - return (retval); + return retval; } spret_type cast_teleport_self(bool fail) @@ -351,14 +351,14 @@ static bool _cell_vetoes_teleport(const coord_def cell, bool check_monsters = tr { // Monsters always veto teleport. if (monster_at(cell) && check_monsters) - return (true); + return true; // As do all clouds; this may change. if (env.cgrid(cell) != EMPTY_CLOUD && !wizard_tele) - return (true); + return true; if (cell_is_solid(cell)) - return (true); + return true; return is_feat_dangerous(grd(cell), true) && !wizard_tele; } @@ -421,7 +421,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, && !new_abyss_area) { canned_msg(MSG_STRANGE_STASIS); - return (false); + return false; } // After this point, we're guaranteed to teleport. Kill the appropriate @@ -440,7 +440,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, if (you.pet_target != MHITYOU) you.pet_target = MHITNOT; - return (true); + return true; } coord_def pos(1, 0); @@ -475,7 +475,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, "cancelling teleport.", MSGCH_ERROR); if (!wizard_tele) contaminate_player(1, true); - return (false); + return false; } dprf("Target square (%d,%d)", pos.x, pos.y); @@ -493,7 +493,7 @@ static bool _teleport_player(bool allow_control, bool new_abyss_area, if (!wizard_tele) contaminate_player(1, true); maybe_id_ring_TC(); - return (false); + return false; } monster* beholder = you.get_beholder(pos); @@ -654,7 +654,7 @@ bool you_teleport_to(const coord_def where_to, bool move_monsters) // Don't bother to calculate a possible new position if it's out of bounds. if (!in_bounds(where)) - return (false); + return false; if (_cell_vetoes_teleport(where)) { @@ -687,7 +687,7 @@ bool you_teleport_to(const coord_def where_to, bool move_monsters) } // Give up, we can't find a suitable spot. if (where == old_where) - return (false); + return false; } } @@ -700,7 +700,7 @@ bool you_teleport_to(const coord_def where_to, bool move_monsters) move_player_to_grid(where, false, true); _handle_teleport_update(large_change, check_ring_TC, old_pos); - return (true); + return true; } void you_teleport_now(bool allow_control, bool new_abyss_area, bool wizard_tele) diff --git a/crawl-ref/source/spl-util.cc b/crawl-ref/source/spl-util.cc index 1f762ce670..6d88c4f852 100644 --- a/crawl-ref/source/spl-util.cc +++ b/crawl-ref/source/spl-util.cc @@ -150,7 +150,7 @@ void init_spell_name_cache() spell_type spell_by_name(std::string name, bool partial_match) { if (name.empty()) - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; lowercase(name); @@ -161,7 +161,7 @@ spell_type spell_by_name(std::string name, bool partial_match) if (i != spell_name_cache.end()) return (i->second); - return (SPELL_NO_SPELL); + return SPELL_NO_SPELL; } spell_type spellmatch = SPELL_NO_SPELL; @@ -326,7 +326,7 @@ bool add_spell_to_memory(spell_type spell) redraw_screen(); #endif - return (true); + return true; } bool del_spell_from_memory_by_slot(int slot) @@ -356,14 +356,14 @@ bool del_spell_from_memory_by_slot(int slot) redraw_screen(); #endif - return (true); + return true; } bool del_spell_from_memory(spell_type spell) { int i = _get_spell_slot(spell); if (i == -1) - return (false); + return false; else return del_spell_from_memory_by_slot(i); } @@ -485,7 +485,7 @@ int spell_levels_required(spell_type which_spell) levels = 0; } - return (levels); + return levels; } unsigned int get_spell_flags(spell_type which_spell) @@ -522,7 +522,7 @@ int count_bits(unsigned int bits) if (n & bits) c++; - return (c); + return c; } // NOTE: Assumes that any single spell won't belong to conflicting @@ -557,7 +557,7 @@ int apply_area_visible(cell_func cf, int power, actor *agent) if (you.see_cell_no_trans(*ri)) rv += cf(*ri, power, 0, agent); - return (rv); + return rv; } // Applies the effect to all nine squares around/including the target. @@ -570,7 +570,7 @@ static int _apply_area_square(cell_func cf, const coord_def& where, for (adjacent_iterator ai(where, false); ai; ++ai) rv += cf(*ai, power, 0, agent); - return (rv); + return rv; } @@ -584,7 +584,7 @@ static int _apply_area_around_square(cell_func cf, const coord_def& where, for (adjacent_iterator ai(where, true); ai; ++ai) rv += cf(*ai, power, 0, agent); - return (rv); + return rv; } // Like apply_area_around_square, but for monsters in those squares, @@ -604,7 +604,7 @@ int apply_monsters_around_square(monster_func mf, const coord_def& where, } } - return (rv); + return rv; } // Affect up to max_targs monsters around a point, chosen randomly. @@ -726,7 +726,7 @@ int apply_random_around_square(cell_func cf, const coord_def& where, } } - return (rv); + return rv; } void apply_area_cloud(cloud_func func, const coord_def& where, @@ -797,13 +797,13 @@ bool spell_direction(dist &spelld, bolt &pbolt, { // Check for user cancel. canned_msg(MSG_OK); - return (false); + return false; } pbolt.set_target(spelld); pbolt.source = you.pos(); - return (true); + return true; } const char* spelltype_short_name(int which_spelltype) @@ -884,23 +884,23 @@ skill_type spell_type2skill(unsigned int spelltype) { switch (spelltype) { - case SPTYP_CONJURATION: return (SK_CONJURATIONS); - case SPTYP_HEXES: return (SK_HEXES); - case SPTYP_CHARMS: return (SK_CHARMS); - case SPTYP_FIRE: return (SK_FIRE_MAGIC); - case SPTYP_ICE: return (SK_ICE_MAGIC); - case SPTYP_TRANSMUTATION: return (SK_TRANSMUTATIONS); - case SPTYP_NECROMANCY: return (SK_NECROMANCY); - case SPTYP_SUMMONING: return (SK_SUMMONINGS); - case SPTYP_TRANSLOCATION: return (SK_TRANSLOCATIONS); - case SPTYP_POISON: return (SK_POISON_MAGIC); - case SPTYP_EARTH: return (SK_EARTH_MAGIC); - case SPTYP_AIR: return (SK_AIR_MAGIC); + case SPTYP_CONJURATION: return SK_CONJURATIONS; + case SPTYP_HEXES: return SK_HEXES; + case SPTYP_CHARMS: return SK_CHARMS; + case SPTYP_FIRE: return SK_FIRE_MAGIC; + case SPTYP_ICE: return SK_ICE_MAGIC; + case SPTYP_TRANSMUTATION: return SK_TRANSMUTATIONS; + case SPTYP_NECROMANCY: return SK_NECROMANCY; + case SPTYP_SUMMONING: return SK_SUMMONINGS; + case SPTYP_TRANSLOCATION: return SK_TRANSLOCATIONS; + case SPTYP_POISON: return SK_POISON_MAGIC; + case SPTYP_EARTH: return SK_EARTH_MAGIC; + case SPTYP_AIR: return SK_AIR_MAGIC; default: case SPTYP_DIVINATION: dprf("spell_type2skill: called with spelltype %u", spelltype); - return (SK_NONE); + return SK_NONE; } } @@ -942,17 +942,17 @@ int spell_power_cap(spell_type spell) const int zcap = spell_zap_power_cap(spell); if (scap == 0) - return (zcap); + return zcap; else if (zcap == 0) - return (scap); + return scap; else { // Two separate power caps; pre-zapping spell power // goes into range. if (scap <= zcap || _spell_range_varies(spell)) - return (scap); + return scap; else - return (zcap); + return zcap; } } @@ -1021,9 +1021,9 @@ int spell_noise(spell_type spell) int level = desc->level + desc->noise_mod; if (disciplines == SPTYP_NONE) - return (0); + return 0; else if (disciplines & SPTYP_CONJURATION) - return (level); + return level; else if (disciplines && !(disciplines & (SPTYP_POISON | SPTYP_AIR))) return div_round_up(level * 3, 4); else @@ -1086,7 +1086,7 @@ static bool _spell_is_empowered(spell_type spell) && vehumet_supports_spell(spell) && piety_rank() > 2) { - return (true); + return true; } switch (spell) @@ -1096,7 +1096,7 @@ static bool _spell_is_empowered(spell_type spell) && you.form == TRAN_STATUE && you.duration[DUR_STONESKIN] < 1) { - return (true); + return true; } break; case SPELL_OZOCUBUS_ARMOUR: @@ -1104,14 +1104,14 @@ static bool _spell_is_empowered(spell_type spell) && you.form == TRAN_ICE_BEAST && you.duration[DUR_ICY_ARMOUR] < 1) { - return (true); + return true; } break; default: break; } - return (false); + return false; } // This function attempts to determine if 'spell' is useless to @@ -1122,7 +1122,7 @@ static bool _spell_is_empowered(spell_type spell) bool spell_is_useless(spell_type spell, bool transient) { if (you_cannot_memorise(spell)) - return (true); + return true; if (transient) { @@ -1130,7 +1130,7 @@ bool spell_is_useless(spell_type spell, bool transient) || spell_mana(spell) > you.magic_points || spell_no_hostile_in_range(spell, get_dist_to_nearest_monster())) { - return (true); + return true; } } @@ -1145,25 +1145,25 @@ bool spell_is_useless(spell_type spell, bool transient) case SPELL_SWIFTNESS: // looking at player_movement_speed, this should be correct ~DMB if (player_movement_speed() <= 6) - return (true); + return true; break; case SPELL_FLY: if (you.species == SP_TENGU && you.experience_level >= 15) - return (true); + return true; if (transient && you.is_levitating()) - return (true); + return true; break; case SPELL_INVISIBILITY: if (transient && (you.duration[DUR_INVIS] > 0 || you.backlit())) - return (true); + return true; break; case SPELL_CONTROL_TELEPORT: if (transient && you.duration[DUR_CONTROL_TELEPORT] > 0) - return (true); + return true; break; case SPELL_SEE_INVISIBLE: if (you.can_see_invisible(false, false)) - return (true); + return true; break; case SPELL_DARKNESS: // mere corona is not enough, but divine light blocks it completely @@ -1180,7 +1180,7 @@ bool spell_is_useless(spell_type spell, bool transient) break; // quash unhandled constants warnings } - return (false); + return false; } // This function takes a spell, and determines what color it should be @@ -1198,7 +1198,7 @@ int spell_highlight_by_utility(spell_type spell, int default_color, // If your god hates the spell, that // overrides all other concerns if (god_hates_spell(spell, you.religion)) - return (COL_FORBIDDEN); + return COL_FORBIDDEN; if (_spell_is_empowered(spell) && !rod_spell) default_color = COL_EMPOWERED; @@ -1206,13 +1206,13 @@ int spell_highlight_by_utility(spell_type spell, int default_color, if (spell_is_useless(spell, transient)) default_color = COL_USELESS; - return (default_color); + return default_color; } bool spell_no_hostile_in_range(spell_type spell, int minRange) { if (minRange < 0) - return (false); + return false; bool bonus = 0; switch (spell) @@ -1232,7 +1232,7 @@ bool spell_no_hostile_in_range(spell_type spell, int minRange) case SPELL_LIGHTNING_BOLT: case SPELL_FIRE_STORM: - return (false); + return false; case SPELL_EVAPORATE: case SPELL_MEPHITIC_CLOUD: @@ -1250,15 +1250,15 @@ bool spell_no_hostile_in_range(spell_type spell, int minRange) // The healing spells. if (testbits(get_spell_flags(spell), SPFLAG_HELPFUL)) - return (false); + return false; const int range = calc_spell_range(spell); if (range < 0) - return (false); + return false; const int rsq = (range + bonus) * (range + bonus) + 1; if (rsq < minRange) - return (true); + return true; - return (false); + return false; } diff --git a/crawl-ref/source/spl-wpnench.cc b/crawl-ref/source/spl-wpnench.cc index bf27328180..a97ebb9415 100644 --- a/crawl-ref/source/spl-wpnench.cc +++ b/crawl-ref/source/spl-wpnench.cc @@ -43,7 +43,7 @@ static brand_type _convert_to_launcher(brand_type which_brand) { case SPWPN_FREEZING: return SPWPN_FROST; case SPWPN_FLAMING: return SPWPN_FLAME; - default: return (which_brand); + default: return which_brand; } } @@ -61,9 +61,9 @@ static bool _ok_for_launchers(brand_type which_brand) case SPWPN_RETURNING: case SPWPN_CHAOS: case SPWPN_VORPAL: - return (true); + return true; default: - return (false); + return false; } } diff --git a/crawl-ref/source/spl-zap.cc b/crawl-ref/source/spl-zap.cc index 05c2b0cb77..95ea5fb7d2 100644 --- a/crawl-ref/source/spl-zap.cc +++ b/crawl-ref/source/spl-zap.cc @@ -119,7 +119,7 @@ int spell_zap_power(spell_type spell, int pow) case SPELL_HIBERNATION: return (stepdown_value(pow * 9 / 10, 5, 35, 45, 50)); default: - return (pow); + return pow; } } @@ -128,7 +128,7 @@ int spell_zap_power_cap(spell_type spell) const zap_type zap = spell_to_zap(spell); if (zap == NUM_ZAPS) - return (0); + return 0; const int cap = zap_power_cap(zap); @@ -137,8 +137,8 @@ int spell_zap_power_cap(spell_type spell) case SPELL_CORONA: return (std::max<int>(cap - 10, 0)); case SPELL_HIBERNATION: - return (50); + return 50; default: - return (cap); + return cap; } } diff --git a/crawl-ref/source/sqldbm.cc b/crawl-ref/source/sqldbm.cc index f2a272e319..89a8082a97 100644 --- a/crawl-ref/source/sqldbm.cc +++ b/crawl-ref/source/sqldbm.cc @@ -117,11 +117,11 @@ From SQLite's documentation: close(); error = saveerr; errc = serrc; - return (errc); + return errc; } init_schema(); - return (errc); + return errc; } int SQL_DBM::init_schema() @@ -140,7 +140,7 @@ int SQL_DBM::init_schema() for (sqlite_retry_iterator ri; ri; ri.check(ec(sqlite3_exec(db, "BEGIN;", NULL, NULL, NULL)))); } - return (err); + return err; } void SQL_DBM::close() @@ -161,26 +161,26 @@ void SQL_DBM::close() int SQL_DBM::try_insert(const std::string &key, const std::string &value) { if (init_insert() != SQLITE_OK) - return (errc); + return errc; ec(sqlite3_bind_text(s_insert, 1, key.c_str(), -1, SQLITE_TRANSIENT)); if (errc != SQLITE_OK) - return (errc); + return errc; ec(sqlite3_bind_text(s_insert, 2, value.c_str(), -1, SQLITE_TRANSIENT)); if (errc != SQLITE_OK) - return (errc); + return errc; ec(sqlite3_step(s_insert)); sqlite3_reset(s_insert); - return (errc); + return errc; } int SQL_DBM::insert(const std::string &key, const std::string &value) { for (sqlite_retry_iterator ri; ri; ri.check(do_insert(key, value))); - return (errc); + return errc; } int SQL_DBM::do_insert(const std::string &key, const std::string &value) @@ -191,7 +191,7 @@ int SQL_DBM::do_insert(const std::string &key, const std::string &value) remove(key); try_insert(key, value); } - return (errc); + return errc; } int SQL_DBM::init_insert() @@ -203,16 +203,16 @@ int SQL_DBM::init_insert() int SQL_DBM::remove(const std::string &key) { if (init_remove() != SQLITE_OK) - return (errc); + return errc; ec(sqlite3_bind_text(s_remove, 1, key.c_str(), -1, SQLITE_TRANSIENT)); if (errc != SQLITE_OK) - return (errc); + return errc; ec(sqlite3_step(s_remove)); sqlite3_reset(s_remove); - return (errc); + return errc; } int SQL_DBM::init_remove() @@ -224,12 +224,12 @@ int SQL_DBM::init_remove() int SQL_DBM::do_query(const std::string &key, std::string *result) { if (init_query() != SQLITE_OK) - return (errc); + return errc; if (ec(sqlite3_bind_text(s_query, 1, key.c_str(), -1, SQLITE_TRANSIENT)) != SQLITE_OK) { - return (errc); + return errc; } int err = SQLITE_OK; @@ -250,7 +250,7 @@ std::string SQL_DBM::query(const std::string &key) std::string result; for (sqlite_retry_iterator ri; ri; ri.check(do_query(key, &result))); - return (result); + return result; } std::auto_ptr<std::string> SQL_DBM::firstkey() @@ -258,7 +258,7 @@ std::auto_ptr<std::string> SQL_DBM::firstkey() if (init_iterator() != SQLITE_OK) { std::auto_ptr<std::string> result; - return (result); + return result; } return nextkey(); @@ -276,7 +276,7 @@ std::auto_ptr<std::string> SQL_DBM::nextkey() else sqlite3_reset(s_iterator); } - return (result); + return result; } int SQL_DBM::init_query() @@ -294,13 +294,13 @@ int SQL_DBM::init_iterator() int SQL_DBM::finalise_query(sqlite3_stmt **q) { if (!*q) - return (SQLITE_OK); + return SQLITE_OK; sqlite3_reset(*q); int ret = ec(sqlite3_finalize(*q)); *q = NULL; - return (ret); + return ret; } int SQL_DBM::prepare_query(sqlite3_stmt **q, const char *sql) @@ -395,16 +395,16 @@ SQL_DBM *dbm_open(const char *filename, int mode, int) if (!n->is_open()) { delete n; - return (NULL); + return NULL; } - return (n); + return n; } int dbm_close(SQL_DBM *db) { delete db; - return (0); + return 0; } sql_datum dbm_fetch(SQL_DBM *db, const sql_datum &key) @@ -444,7 +444,7 @@ int dbm_store(SQL_DBM *db, const sql_datum &key, const sql_datum &value, int) err = SQLITE_OK; else end(1, false, "%d: %s", db->errc, db->error.c_str()); - return (err); + return err; } #endif // USE_SQLITE_DBM diff --git a/crawl-ref/source/stairs.cc b/crawl-ref/source/stairs.cc index 84f6a1c604..1b6d0c0f11 100644 --- a/crawl-ref/source/stairs.cc +++ b/crawl-ref/source/stairs.cc @@ -59,9 +59,9 @@ bool check_annotation_exclusion_warning() { canned_msg(MSG_OK); interrupt_activity(AI_FORCE_INTERRUPT); - return (false); + return false; } - return (true); + return true; } level_id next_level_id = level_id::get_next_level_id(you.pos()); @@ -93,9 +93,9 @@ bool check_annotation_exclusion_warning() canned_msg(MSG_OK); interrupt_activity(AI_FORCE_INTERRUPT); crawl_state.level_annotation_shown = false; - return (false); + return false; } - return (true); + return true; } static void _player_change_level_reset() @@ -123,16 +123,16 @@ static bool _marker_vetoes_level_change() static bool _stair_moves_pre(dungeon_feature_type stair) { if (crawl_state.prev_cmd == CMD_WIZARD) - return (false); + return false; if (stair != grd(you.pos())) - return (false); + return false; if (feat_stair_direction(stair) == CMD_NO_CMD) - return (false); + return false; if (!you.duration[DUR_REPEL_STAIRS_CLIMB]) - return (false); + return false; int pct; if (you.duration[DUR_REPEL_STAIRS_MOVE]) @@ -146,14 +146,14 @@ static bool _stair_moves_pre(dungeon_feature_type stair) pct += dur/20; if (!x_chance_in_y(pct, 100)) - return (false); + return false; // Get feature name before sliding stair over. std::string stair_str = feature_description_at(you.pos(), false, DESC_THE, false); if (!slide_feature_over(you.pos(), coord_def(-1, -1), false)) - return (false); + return false; std::string verb = stair_climb_verb(stair); @@ -162,7 +162,7 @@ static bool _stair_moves_pre(dungeon_feature_type stair) you.turn_is_over = true; - return (true); + return true; } static void _exit_stair_message(dungeon_feature_type stair, bool /* going_up */) diff --git a/crawl-ref/source/startup.cc b/crawl-ref/source/startup.cc index 9ba80ace0d..01b7fac9ae 100644 --- a/crawl-ref/source/startup.cc +++ b/crawl-ref/source/startup.cc @@ -512,7 +512,7 @@ static int _find_save(const std::vector<player_save_info>& chars, { for (int i = 0; i < static_cast<int>(chars.size()); ++i) if (chars[i].name == name) - return (i); + return i; return (-1); } @@ -956,5 +956,5 @@ bool startup_step() _post_init(newchar); - return (newchar); + return newchar; } diff --git a/crawl-ref/source/stash.cc b/crawl-ref/source/stash.cc index 342a76fc07..52fd9923d0 100644 --- a/crawl-ref/source/stash.cc +++ b/crawl-ref/source/stash.cc @@ -64,7 +64,7 @@ std::string userdef_annotate_item(const char *s, const item_def *item, std::string ann; if (lua_isstring(clua, -1)) ann = luaL_checkstring(clua, -1); - return (ann); + return ann; #else return (""); #endif @@ -115,7 +115,7 @@ bool is_stash(const coord_def& c) Stash *s = ls->find_stash(c); return (s && s->enabled); } - return (false); + return false; } std::string get_stash_desc(const coord_def& c) @@ -220,9 +220,9 @@ bool Stash::pickup_eligible() const { for (int i = 0, size = items.size(); i < size; ++i) if (item_needs_autopickup(items[i])) - return (true); + return true; - return (false); + return false; } bool Stash::is_boring_feature(dungeon_feature_type feature) @@ -245,7 +245,7 @@ bool Stash::is_boring_feature(dungeon_feature_type feature) case DNGN_ENTER_SHOP: case DNGN_ABANDONED_SHOP: case DNGN_UNDISCOVERED_TRAP: - return (true); + return true; default: return (feat_is_solid(feature)); } @@ -474,14 +474,14 @@ bool StashMenu::process_key(int key) { // Travel activates. lastch = 1; - return (false); + return false; } return Menu::process_key(key); } unsigned char StashMenu::getkey() const { - return (lastch); + return lastch; } static MenuEntry *stash_menu_fixup(MenuEntry *me) @@ -493,7 +493,7 @@ static MenuEntry *stash_menu_fixup(MenuEntry *me) me->colour = DARKGREY; } - return (me); + return me; } bool Stash::show_menu(const level_pos &prefix, bool can_travel, @@ -515,7 +515,7 @@ bool Stash::show_menu(const level_pos &prefix, bool can_travel, { sel = menu.show(); if (menu.getkey() == 1) - return (true); + return true; if (sel.size() != 1) break; @@ -523,7 +523,7 @@ bool Stash::show_menu(const level_pos &prefix, bool can_travel, item_def *item = static_cast<item_def *>(sel[0]->data); describe_item(*item); } - return (false); + return false; } std::string Stash::description() const @@ -543,7 +543,7 @@ std::string Stash::description() const (unsigned int) (sz - 1)); desc += additionals; } - return (desc); + return desc; } std::string Stash::feature_description() const @@ -559,7 +559,7 @@ bool Stash::matches_search(const std::string &prefix, stash_search_result &res) const { if (!enabled || items.empty() && feat == DNGN_FLOOR) - return (false); + return false; for (unsigned i = 0; i < items.size(); ++i) { @@ -921,7 +921,7 @@ bool ShopInfo::show_menu(const level_pos &place, { sel = menu.show(); if (menu.getkey() == 1) - return (true); + return true; if (sel.size() != 1) break; @@ -943,12 +943,12 @@ bool ShopInfo::show_menu(const level_pos &place, fill_out_menu(menu, place); } } - return (false); + return false; } std::string ShopInfo::description() const { - return (name); + return name; } bool ShopInfo::matches_search(const std::string &prefix, @@ -956,7 +956,7 @@ bool ShopInfo::matches_search(const std::string &prefix, stash_search_result &res) const { if (items.empty() && visited) - return (false); + return false; bool note_status = notes_are_active(); activate_notes(false); @@ -1122,7 +1122,7 @@ const ShopInfo *LevelStashes::find_shop(const coord_def& c) const if (m_shops[i].isAt(c)) return (&m_shops[i]); - return (NULL); + return NULL; } bool LevelStashes::shop_needs_visit(const coord_def& c) const @@ -1135,7 +1135,7 @@ bool LevelStashes::needs_visit(const coord_def& c) const { const Stash *s = find_stash(c); if (s && (s->unverified() || s->pickup_eligible())) - return (true); + return true; return (shop_needs_visit(c)); } @@ -1169,7 +1169,7 @@ bool LevelStashes::update_stash(const coord_def& c) s->update(); if (s->empty()) kill_stash(*s); - return (true); + return true; } void LevelStashes::move_stash(const coord_def& from, const coord_def& to) @@ -1252,7 +1252,7 @@ int LevelStashes::_num_enabled_stashes() const { int rawcount = m_stashes.size(); if (!rawcount) - return (0); + return 0; for (stashes_t::const_iterator iter = m_stashes.begin(); iter != m_stashes.end(); ++iter) @@ -1446,9 +1446,9 @@ bool StashTracker::update_stash(const coord_def& c) bool res = lev->update_stash(c); if (!lev->stash_count()) remove_level(); - return (res); + return res; } - return (false); + return false; } void StashTracker::move_stash(const coord_def& from, const coord_def& to) @@ -1612,7 +1612,7 @@ protected: if (ch == '?' && !pos) { *buffer = 0; - return (ch); + return ch; } return line_reader::process_key(ch); } @@ -1650,7 +1650,7 @@ public: return (lhs.match < rhs.match); } else - return (false); + return false; } }; @@ -1677,7 +1677,7 @@ public: return (lhs.matches > rhs.matches); } else - return (false); + return false; } }; @@ -1854,12 +1854,12 @@ bool StashSearchMenu::process_key(int key) if (key == '/') { request_toggle_sort_method = true; - return (false); + return false; } else if (key == '-') { request_toggle_show_as_stack = true; - return (false); + return false; } return Menu::process_key(key); @@ -1924,7 +1924,7 @@ bool StashTracker::display_search_results( bool& show_as_stacks) { if (results_in.empty()) - return (false); + return false; std::vector<stash_search_result> * results = &results_in; std::vector<stash_search_result> results_single_items; @@ -2002,13 +2002,13 @@ bool StashTracker::display_search_results( if (stashmenu.request_toggle_sort_method) { sort_by_dist = !sort_by_dist; - return (true); + return true; } if (stashmenu.request_toggle_show_as_stack) { show_as_stacks = !show_as_stacks; - return (true); + return true; } if (sel.size() == 1 @@ -2026,7 +2026,7 @@ bool StashTracker::display_search_results( if (show_map(lp, true, true, true)) { start_translevel_travel(lp); - return (false); + return false; } } continue; @@ -2043,9 +2043,9 @@ bool StashTracker::display_search_results( if (show_map(lp, true, true, true)) start_translevel_travel(lp); else - return (true); + return true; } - return (false); + return false; } void StashTracker::update_corpses() @@ -2097,22 +2097,22 @@ const item_def& ST_ItemIterator::operator *() const const item_def* ST_ItemIterator::operator->() const { - return (m_item); + return m_item; } const level_id &ST_ItemIterator::place() { - return (m_place); + return m_place; } const ShopInfo* ST_ItemIterator::shop() { - return (m_shop); + return m_shop; } unsigned ST_ItemIterator::price() { - return (m_price); + return m_price; } const ST_ItemIterator& ST_ItemIterator::operator ++ () @@ -2219,7 +2219,7 @@ ST_ItemIterator ST_ItemIterator::operator ++ (int dummy) { const ST_ItemIterator copy = *this; ++(*this); - return (copy); + return copy; } bool stash_search_result::show_menu() const diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index 64e6d15d97..0ccdfec63a 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -177,10 +177,10 @@ bool interrupt_cmd_repeat(activity_interrupt_type ai, const activity_interrupt_data &at) { if (crawl_state.cmd_repeat_start) - return (false); + return false; if (crawl_state.repeat_cmd == CMD_WIZARD) - return (false); + return false; switch (ai) { @@ -191,7 +191,7 @@ bool interrupt_cmd_repeat(activity_interrupt_type ai, case AI_HP_LOSS: case AI_MONSTER_ATTACKS: crawl_state.cancel_cmd_repeat("Command repetition interrupted."); - return (true); + return true; default: break; @@ -201,12 +201,12 @@ bool interrupt_cmd_repeat(activity_interrupt_type ai, { const monster* mon = static_cast<const monster* >(at.data); if (!you.can_see(mon)) - return (false); + return false; if (crawl_state.cmd_repeat_started_unsafe && at.context != SC_NEWLY_SEEN) { - return (false); + return false; } crawl_state.cancel_cmd_repeat(); @@ -235,7 +235,7 @@ bool interrupt_cmd_repeat(activity_interrupt_type ai, formatted_mpr(fs, MSGCH_WARN); #endif - return (true); + return true; } // If command repetition is being used to imitate the rest command, @@ -250,11 +250,11 @@ bool interrupt_cmd_repeat(activity_interrupt_type ai, else crawl_state.cancel_cmd_repeat("Command repetition interrupted."); - return (true); + return true; } if (crawl_state.cmd_repeat_started_unsafe) - return (false); + return false; if (ai == AI_HIT_MONSTER) { @@ -266,14 +266,14 @@ bool interrupt_cmd_repeat(activity_interrupt_type ai, if (mons_class_flag(mon->type, M_NO_EXP_GAIN) && mon->visible_to(&you)) { - return (false); + return false; } crawl_state.cancel_cmd_repeat("Command repetition interrupted."); - return (true); + return true; } - return (false); + return false; } void game_state::reset_cmd_repeat() @@ -401,7 +401,7 @@ bool game_state::is_mon_acting() const monster* game_state::which_mon_acting() const { - return (mon_act); + return mon_act; } void game_state::inc_mon_acting(monster* mon) diff --git a/crawl-ref/source/status.cc b/crawl-ref/source/status.cc index b2fa882b4b..3d72e7d7d4 100644 --- a/crawl-ref/source/status.cc +++ b/crawl-ref/source/status.cc @@ -154,7 +154,7 @@ static const duration_def* _lookup_duration(duration_type dur) { ASSERT(dur >= 0 && dur < NUM_DURATIONS); if (duration_index[dur] == -1) - return (NULL); + return NULL; else return (&duration_data[duration_index[dur]]); } @@ -170,31 +170,31 @@ static void _reset_status_info(status_info* inf) static int _bad_ench_colour(int lvl, int orange, int red) { if (lvl > red) - return (RED); + return RED; else if (lvl > orange) - return (LIGHTRED); + return LIGHTRED; - return (YELLOW); + return YELLOW; } static int _dur_colour(int exp_colour, bool expiring) { if (expiring) - return (exp_colour); + return exp_colour; else { switch (exp_colour) { case GREEN: - return (LIGHTGREEN); + return LIGHTGREEN; case BLUE: - return (LIGHTBLUE); + return LIGHTBLUE; case MAGENTA: - return (LIGHTMAGENTA); + return LIGHTMAGENTA; case LIGHTGREY: - return (WHITE); + return WHITE; default: - return (exp_colour); + return exp_colour; } } } diff --git a/crawl-ref/source/store.cc b/crawl-ref/source/store.cc index 501385c6f4..5d9f769853 100644 --- a/crawl-ref/source/store.cc +++ b/crawl-ref/source/store.cc @@ -1340,7 +1340,7 @@ static std::map<std::string, int> accesses; bool CrawlHashTable::exists(const std::string &key) const { if (hash_map == NULL) - return (false); + return false; ACCESS(key); ASSERT_VALIDITY(); @@ -1430,7 +1430,7 @@ CrawlStoreValue& CrawlHashTable::get_value(const std::string &key) (*hash_map)[key] = CrawlStoreValue(); CrawlStoreValue &val = (*hash_map)[key]; - return (val); + return val; } return (i->second); @@ -1462,7 +1462,7 @@ const CrawlStoreValue& CrawlHashTable::get_value(const std::string &key) const hash_size CrawlHashTable::size() const { if (hash_map == NULL) - return (0); + return 0; return hash_map->size(); } @@ -1470,7 +1470,7 @@ hash_size CrawlHashTable::size() const bool CrawlHashTable::empty() const { if (hash_map == NULL) - return (true); + return true; return hash_map->empty(); } diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 40827d5221..fbff7cb012 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -519,11 +519,11 @@ bool yes_or_no(const char* fmt, ...) mprf(MSGCH_PROMPT, "%s? (Confirm with \"yes\".) ", buf); if (cancelable_get_line(buf, sizeof buf)) - return (false); + return false; if (strcasecmp(buf, "yes") != 0) - return (false); + return false; - return (true); + return true; } // jmf: general helper (should be used all over in code) @@ -579,9 +579,9 @@ bool yesno(const char *str, bool safe, int safeanswer, bool clear_after, mesclr(); if (tmp == 'N') - return (false); + return false; else if (tmp == 'Y') - return (true); + return true; else if (!noprompt) { bool upper = (!safe && crawl_state.game_is_hints_tutorial()); @@ -646,7 +646,7 @@ static std::string _list_allowed_keys(char yes1, char yes2, result += (lowered ? "/(n)o/(q)uit" : "/(N)o/(Q)uit"); result += "]"; - return (result); + return result; } // Like yesno(), but returns 0 for no, 1 for yes, and -1 for quit. @@ -750,12 +750,12 @@ bool tobool(maybe_bool mb, bool def) switch (mb) { case B_TRUE: - return (true); + return true; case B_FALSE: - return (false); + return false; case B_MAYBE: default: - return (def); + return def; } } @@ -803,7 +803,7 @@ int prompt_for_int(const char *prompt, bool nonneg) if (ret < 0 && nonneg || ret == 0 && end == specs) ret = (nonneg ? -1 : 0); - return (ret); + return ret; } double prompt_for_float(const char* prompt) @@ -821,6 +821,6 @@ double prompt_for_float(const char* prompt) if (ret == 0 && end == specs) ret = -1; - return (ret); + return ret; } diff --git a/crawl-ref/source/syscalls.cc b/crawl-ref/source/syscalls.cc index 55743323bc..0af73a8dab 100644 --- a/crawl-ref/source/syscalls.cc +++ b/crawl-ref/source/syscalls.cc @@ -233,7 +233,7 @@ bool dir_exists(const std::string &dir) if (d) closedir(d); - return (exists); + return exists; #endif } @@ -268,7 +268,7 @@ std::vector<std::string> get_dir_files(const std::string &dirname) DIR *dir = opendir(OUTS(dirname)); if (!dir) - return (files); + return files; while (dirent *entry = readdir(dir)) { @@ -279,7 +279,7 @@ std::vector<std::string> get_dir_files(const std::string &dirname) closedir(dir); #endif - return (files); + return files; } int rename_u(const char *oldpath, const char *newpath) diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index f486910166..b5f010baf9 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -624,7 +624,7 @@ coord_def unmarshallCoord(reader &th) coord_def c; c.x = unmarshallShort(th); c.y = unmarshallShort(th); - return (c); + return c; } static void _marshall_constriction(writer &th, const actor *who) @@ -858,7 +858,7 @@ static int unmarshallCString(reader &th, char *data, int maxSize) data[copylen] = 0; th.read(NULL, len - copylen); - return (copylen); + return copylen; } std::string unmarshallString(reader &th, int maxSize) @@ -873,7 +873,7 @@ std::string unmarshallString(reader &th, int maxSize) ASSERT(slen >= 0 && slen < maxSize); const std::string res(buffer, slen); delete [] buffer; - return (res); + return res; } // To pass to unmarshallMap @@ -1628,7 +1628,7 @@ static m_transit_list unmarshall_follower_list(reader &th) mlist.push_back(f); } - return (mlist); + return mlist; } static i_transit_list unmarshall_item_list(reader &th) @@ -1644,7 +1644,7 @@ static i_transit_list unmarshall_item_list(reader &th) ilist.push_back(item); } - return (ilist); + return ilist; } static void marshall_level_map_masks(writer &th) @@ -2560,7 +2560,7 @@ static int _last_used_index(const Z &thinglist, int max_things) for (int i = max_things - 1; i >= 0; --i) if (thinglist[i].defined()) return (i + 1); - return (0); + return 0; } // ------------------------------- level tags ---------------------------- // @@ -2955,7 +2955,7 @@ static mon_enchant unmarshall_mon_enchant(reader &th) me.source = unmarshallInt(th); me.duration = unmarshallShort(th); me.maxduration = unmarshallShort(th); - return (me); + return me; } void marshallMonster(writer &th, const monster& m) @@ -3847,7 +3847,7 @@ static ghost_demon unmarshallGhost(reader &th) unmarshallSpells(th, ghost.spells); - return (ghost); + return ghost; } static void tag_construct_ghost(writer &th) diff --git a/crawl-ref/source/tagstring.cc b/crawl-ref/source/tagstring.cc index 4e04c1e308..2c8d8b7647 100644 --- a/crawl-ref/source/tagstring.cc +++ b/crawl-ref/source/tagstring.cc @@ -7,7 +7,7 @@ std::string colour_string(std::string in, int col) { if (in.empty()) - return (in); + return in; const std::string cols = colour_to_str(col); return ("<" + cols + ">" + in + "</" + cols + ">"); } diff --git a/crawl-ref/source/teleport.cc b/crawl-ref/source/teleport.cc index df8a90fea1..db6582a585 100644 --- a/crawl-ref/source/teleport.cc +++ b/crawl-ref/source/teleport.cc @@ -30,13 +30,13 @@ bool player::blink_to(const coord_def& dest, bool quiet) ASSERT(is_player()); if (dest == pos()) - return (false); + return false; if (item_blocks_teleport(true, true)) { if (!quiet) canned_msg(MSG_STRANGE_STASIS); - return (false); + return false; } if (!quiet) @@ -49,16 +49,16 @@ bool player::blink_to(const coord_def& dest, bool quiet) place_cloud(CLOUD_TLOC_ENERGY, origin, 1 + random2(3), this); - return (true); + return true; } bool monster::blink_to(const coord_def& dest, bool quiet) { if (dest == pos()) - return (false); + return false; if (!attempt_escape(2)) - return (false); + return false; const bool jump = type == MONS_JUMPING_SPIDER; @@ -70,7 +70,7 @@ bool monster::blink_to(const coord_def& dest, bool quiet) const coord_def oldplace = pos(); if (!move_to_pos(dest, true)) - return (false); + return false; // Leave a purple cloud. if (!jump) @@ -81,7 +81,7 @@ bool monster::blink_to(const coord_def& dest, bool quiet) mons_relocated(this); - return (true); + return true; } @@ -253,7 +253,7 @@ bool random_near_space(const coord_def& origin, coord_def& target, } if (!trans_wall_block && !origin_is_player) - return (true); + return true; // If the monster is on a visible square which is on the other // side of one or more translucent walls from the player, then it @@ -266,13 +266,13 @@ bool random_near_space(const coord_def& origin, coord_def& target, // walls monsters can blink to places which are not in either // the monster's nor the player's LOS. if (!origin_is_player && !you.see_cell(target)) - return (true); + return true; // Player can't randomly pass through translucent walls. if (origin_is_player) { if (you.see_cell_no_trans(target)) - return (true); + return true; continue; } @@ -282,7 +282,7 @@ bool random_near_space(const coord_def& origin, coord_def& target, DNGN_MAX_NONREACH, true, true); if (walls_passed == 0) - return (true); + return true; // Player can't randomly pass through translucent walls. if (origin_is_player) @@ -297,8 +297,8 @@ bool random_near_space(const coord_def& origin, coord_def& target, } if (walls_between >= min_walls_between) - return (true); + return true; } - return (false); + return false; } diff --git a/crawl-ref/source/terrain.cc b/crawl-ref/source/terrain.cc index ae1c99aa9c..d4faf0be8b 100644 --- a/crawl-ref/source/terrain.cc +++ b/crawl-ref/source/terrain.cc @@ -46,7 +46,7 @@ actor* actor_at(const coord_def& c) { if (!in_bounds(c)) - return (NULL); + return NULL; if (c == you.pos()) return (&you); return (monster_at(c)); @@ -83,23 +83,23 @@ bool feat_is_stone_stair(dungeon_feature_type feat) case DNGN_STONE_STAIRS_DOWN_I: case DNGN_STONE_STAIRS_DOWN_II: case DNGN_STONE_STAIRS_DOWN_III: - return (true); + return true; default: - return (false); + return false; } } bool feat_is_staircase(dungeon_feature_type feat) { if (feat_is_stone_stair(feat)) - return (true); + return true; // All branch entries/exits are staircases, except for Zot. if (feat == DNGN_ENTER_ZOT || feat == DNGN_RETURN_FROM_ZOT) - return (false); + return false; if (feat == DNGN_EXIT_DUNGEON) - return (true); + return true; return (feat >= DNGN_ENTER_FIRST_BRANCH && feat <= DNGN_ENTER_LAST_BRANCH || feat >= DNGN_RETURN_FROM_FIRST_BRANCH @@ -172,9 +172,9 @@ bool feat_is_travelable_stair(dungeon_feature_type feat) case DNGN_RETURN_FROM_SHOALS: case DNGN_RETURN_FROM_SPIDER_NEST: case DNGN_RETURN_FROM_FOREST: - return (true); + return true; default: - return (false); + return false; } } @@ -185,9 +185,9 @@ bool feat_is_escape_hatch(dungeon_feature_type feat) { case DNGN_ESCAPE_HATCH_DOWN: case DNGN_ESCAPE_HATCH_UP: - return (true); + return true; default: - return (false); + return false; } } @@ -213,9 +213,9 @@ bool feat_is_gate(dungeon_feature_type feat) case DNGN_ENTER_GEHENNA: case DNGN_ENTER_COCYTUS: case DNGN_ENTER_TARTARUS: - return (true); + return true; default: - return (false); + return false; } } @@ -247,7 +247,7 @@ command_type feat_stair_direction(dungeon_feature_type feat) case DNGN_ENTER_SHOP: case DNGN_EXIT_HELL: case DNGN_EXIT_PORTAL_VAULT: - return (CMD_GO_UPSTAIRS); + return CMD_GO_UPSTAIRS; case DNGN_ENTER_PORTAL_VAULT: case DNGN_ENTER_HELL: @@ -282,10 +282,10 @@ command_type feat_stair_direction(dungeon_feature_type feat) case DNGN_ENTER_SHOALS: case DNGN_ENTER_SPIDER_NEST: case DNGN_ENTER_FOREST: - return (CMD_GO_DOWNSTAIRS); + return CMD_GO_DOWNSTAIRS; default: - return (CMD_NO_CMD); + return CMD_NO_CMD; } } @@ -384,7 +384,7 @@ god_type feat_altar_god(dungeon_feature_type feat) if (feat >= DNGN_ALTAR_FIRST_GOD && feat <= DNGN_ALTAR_LAST_GOD) return (static_cast<god_type>(feat - DNGN_ALTAR_FIRST_GOD + 1)); - return (GOD_NO_GOD); + return GOD_NO_GOD; } // Returns DNGN_FLOOR for non-gods, otherwise returns the altar for the @@ -392,7 +392,7 @@ god_type feat_altar_god(dungeon_feature_type feat) dungeon_feature_type altar_for_god(god_type god) { if (god == GOD_NO_GOD || god >= NUM_GODS) - return (DNGN_FLOOR); // Yeah, lame. Tell me about it. + return DNGN_FLOOR; // Yeah, lame. Tell me about it. return (static_cast<dungeon_feature_type>(DNGN_ALTAR_FIRST_GOD + god - 1)); } @@ -508,7 +508,7 @@ std::set<coord_def> connected_doors(const coord_def& d) { std::set<coord_def> doors; _find_connected_range(d, DNGN_CLOSED_DOOR, DNGN_SECRET_DOOR, doors); - return (doors); + return doors; } void get_door_description(int door_size, const char** adjective, const char** noun) @@ -580,7 +580,7 @@ bool find_secret_door_info(const coord_def &where, { if (appearance) *appearance = DNGN_ROCK_WALL; - return (false); + return false; } else { @@ -588,7 +588,7 @@ bool find_secret_door_info(const coord_def &where, *appearance = feat; if (gc) *gc = loc; - return (true); + return true; } } @@ -596,7 +596,7 @@ dungeon_feature_type grid_secret_door_appearance(const coord_def &where) { dungeon_feature_type feat; find_secret_door_info(where, &feat, NULL); - return (feat); + return feat; } coord_def get_random_stair() @@ -657,8 +657,8 @@ bool slime_wall_neighbour(const coord_def& c) for (adjacent_iterator ai(c); ai; ++ai) if (env.grid(*ai) == DNGN_SLIMY_WALL) - return (true); - return (false); + return true; + return false; } bool feat_destroys_item(dungeon_feature_type feat, const item_def &item, @@ -670,15 +670,15 @@ bool feat_destroys_item(dungeon_feature_type feat, const item_def &item, case DNGN_DEEP_WATER: if (noisy) mprf(MSGCH_SOUND, "You hear a splash."); - return (false); + return false; case DNGN_LAVA: if (noisy) mprf(MSGCH_SOUND, "You hear a sizzling splash."); - return (true); + return true; default: - return (false); + return false; } } @@ -692,20 +692,20 @@ bool feat_virtually_destroys_item(dungeon_feature_type feat, const item_def &ite case DNGN_SHALLOW_WATER: if (noisy) mprf(MSGCH_SOUND, "You hear a splash."); - return (false); + return false; case DNGN_DEEP_WATER: if (noisy) mprf(MSGCH_SOUND, "You hear a splash."); - return (true); + return true; case DNGN_LAVA: if (noisy) mprf(MSGCH_SOUND, "You hear a sizzling splash."); - return (true); + return true; default: - return (false); + return false; } } @@ -729,7 +729,7 @@ static coord_def _dgn_find_nearest_square( const coord_def &p = *i; if (p != pos && acceptable(p, thing)) - return (p); + return p; travel_point_distance[p.x][p.y] = 1; for (int yi = -1; yi <= 1; ++yi) @@ -754,7 +754,7 @@ static coord_def _dgn_find_nearest_square( } coord_def unfound; - return (unfound); + return unfound; } static bool _item_safe_square(const coord_def &pos, void *item) @@ -772,9 +772,9 @@ static bool _dgn_shift_item(const coord_def &pos, item_def &item) { int index = item.index(); move_item_to_grid(&index, np); - return (true); + return true; } - return (false); + return false; } bool is_critical_feature(dungeon_feature_type feat) @@ -954,13 +954,13 @@ static bool _dgn_shift_feature(const coord_def &pos) { const dungeon_feature_type dfeat = grd(pos); if (!is_critical_feature(dfeat) && !env.markers.find(pos, MAT_ANY)) - return (false); + return false; const coord_def dest = _dgn_find_nearest_square(pos, NULL, _is_feature_shift_target); dgn_move_entities_at(pos, dest, false, false, false); - return (true); + return true; } static void _dgn_check_terrain_items(const coord_def &pos, bool preserve_items) @@ -1171,7 +1171,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, ASSERT(pos1 != pos2); if (is_sanctuary(pos1) || is_sanctuary(pos2)) - return (false); + return false; const dungeon_feature_type feat1 = grd(pos1); const dungeon_feature_type feat2 = grd(pos2); @@ -1179,13 +1179,13 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, if (is_notable_terrain(feat1) && !you.see_cell(pos1) && env.map_knowledge(pos1).known()) { - return (false); + return false; } if (is_notable_terrain(feat2) && !you.see_cell(pos2) && env.map_knowledge(pos2).known()) { - return (false); + return false; } const unsigned short col1 = env.grid_colours(pos1); @@ -1226,7 +1226,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, if (!in_bounds(temp)) { mpr("swap_features(): No boring squares on level?", MSGCH_ERROR); - return (false); + return false; } // OK, now we guarantee the move. @@ -1280,7 +1280,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, if (announce) _announce_swap(pos1, pos2); - return (true); + return true; } // Swap items. @@ -1334,7 +1334,7 @@ bool swap_features(const coord_def &pos1, const coord_def &pos2, if (announce) _announce_swap(pos1, pos2); - return (true); + return true; } static bool _ok_dest_cell(const actor* orig_actor, @@ -1344,22 +1344,22 @@ static bool _ok_dest_cell(const actor* orig_actor, const dungeon_feature_type dest_feat = grd(dest_pos); if (orig_feat == dest_feat) - return (false); + return false; if (is_notable_terrain(dest_feat)) - return (false); + return false; if (find_trap(dest_pos)) - return (false); + return false; actor* dest_actor = actor_at(dest_pos); if (orig_actor && !orig_actor->is_habitable_feat(dest_feat)) - return (false); + return false; if (dest_actor && !dest_actor->is_habitable_feat(orig_feat)) - return (false); + return false; - return (true); + return true; } bool slide_feature_over(const coord_def &src, coord_def preferred_dest, @@ -1389,7 +1389,7 @@ bool slide_feature_over(const coord_def &src, coord_def preferred_dest, } if (!in_bounds(preferred_dest)) - return (false); + return false; ASSERT(preferred_dest != src); return swap_features(src, preferred_dest, false, announce); @@ -1406,12 +1406,12 @@ bool fall_into_a_pool(const coord_def& entry, bool allow_shift, if (terrain == DNGN_DEEP_WATER) { if (beogh_water_walk() || form_likes_water()) - return (false); + return false; if (species_likes_water(you.species) && !you.transform_uncancellable) { emergency_untransform(); - return (false); + return false; } } @@ -1496,7 +1496,7 @@ bool fall_into_a_pool(const coord_def& entry, bool allow_shift, if (terrain == DNGN_LAVA) expose_player_to_element(BEAM_LAVA, 14); - return (true); + return true; } } @@ -1515,7 +1515,7 @@ bool fall_into_a_pool(const coord_def& entry, bool allow_shift, else if (terrain == DNGN_DEEP_WATER) ouch(INSTANT_DEATH, NON_MONSTER, KILLED_BY_WATER); - return (false); + return false; } typedef std::map<std::string, dungeon_feature_type> feat_desc_map; @@ -1546,7 +1546,7 @@ dungeon_feature_type feat_by_desc(std::string desc) if (i != feat_desc_cache.end()) return (i->second); - return (DNGN_UNSEEN); + return DNGN_UNSEEN; } // If active is true, the player is just stepping onto the feature, with the @@ -1701,7 +1701,7 @@ dungeon_feature_type dungeon_feature_by_name(const std::string &name) COMPILE_CHECK(ARRAYSZ(dngn_feature_names) == NUM_FEATURES); if (name.empty()) - return (DNGN_UNSEEN); + return DNGN_UNSEEN; for (unsigned i = 0; i < ARRAYSZ(dngn_feature_names); ++i) { @@ -1712,14 +1712,14 @@ dungeon_feature_type dungeon_feature_by_name(const std::string &name) if (feat_is_altar(feat) && is_unavailable_god(feat_altar_god(feat))) { - return (DNGN_FLOOR); + return DNGN_FLOOR; } - return (feat); + return feat; } } - return (DNGN_UNSEEN); + return DNGN_UNSEEN; } std::vector<std::string> dungeon_feature_matches(const std::string &name) @@ -1728,13 +1728,13 @@ std::vector<std::string> dungeon_feature_matches(const std::string &name) COMPILE_CHECK(ARRAYSZ(dngn_feature_names) == NUM_FEATURES); if (name.empty()) - return (matches); + return matches; for (unsigned i = 0; i < ARRAYSZ(dngn_feature_names); ++i) if (strstr(dngn_feature_names[i], name.c_str())) matches.push_back(dngn_feature_names[i]); - return (matches); + return matches; } const char *dungeon_feature_name(dungeon_feature_type rfeat) @@ -1742,7 +1742,7 @@ const char *dungeon_feature_name(dungeon_feature_type rfeat) const unsigned feat = rfeat; if (feat >= ARRAYSZ(dngn_feature_names)) - return (NULL); + return NULL; return dngn_feature_names[feat]; } diff --git a/crawl-ref/source/throw.cc b/crawl-ref/source/throw.cc index 705487623a..09e4449315 100644 --- a/crawl-ref/source/throw.cc +++ b/crawl-ref/source/throw.cc @@ -219,10 +219,10 @@ command_type fire_target_behaviour::get_command(int key) switch (key) { - case '(': case CONTROL('N'): cycle_fire_item(true); return (CMD_NO_CMD); - case ')': case CONTROL('P'): cycle_fire_item(false); return (CMD_NO_CMD); - case 'i': pick_fire_item_from_inventory(); return (CMD_NO_CMD); - case '?': display_help(); return (CMD_NO_CMD); + case '(': case CONTROL('N'): cycle_fire_item(true); return CMD_NO_CMD; + case ')': case CONTROL('P'): cycle_fire_item(false); return CMD_NO_CMD; + case 'i': pick_fire_item_from_inventory(); return CMD_NO_CMD; + case '?': display_help(); return CMD_NO_CMD; case CMD_TARGET_CANCEL: chosen_ammo = false; break; } @@ -252,7 +252,7 @@ static bool _fire_choose_item_and_target(int& slot, dist& target, if (!_fire_validate_item(slot, warn)) { mpr(warn.c_str()); - return (false); + return false; } // Force item to be the prechosen one. beh.m_slot = slot; @@ -268,20 +268,20 @@ static bool _fire_choose_item_and_target(int& slot, dist& target, if (!beh.active_item()) { canned_msg(MSG_OK); - return (false); + return false; } if (!target.isValid) { if (target.isCancel) canned_msg(MSG_OK); - return (false); + return false; } you.m_quiver->on_item_fired(*beh.active_item(), beh.chosen_ammo); you.redraw_quiver = true; slot = beh.m_slot; - return (true); + return true; } // Bring up an inventory screen and have user choose an item. @@ -311,19 +311,19 @@ static bool _fire_validate_item(int slot, std::string &err) && you.inv[slot].cursed()) { err = "That weapon is stuck to your " + you.hand_name(false) + "!"; - return (false); + return false; } else if (item_is_worn(slot)) { err = "You are wearing that object!"; - return (false); + return false; } else if (you.inv[slot].base_type == OBJ_ORBS) { err = "You don't feel like leaving the orb behind!"; - return (false); + return false; } - return (true); + return true; } // Returns true if warning is given. @@ -333,7 +333,7 @@ bool fire_warn_if_impossible(bool silent) { if (!silent) mpr("You can't grasp things well enough to throw them."); - return (true); + return true; } // If you can't wield it, you can't throw it. @@ -341,7 +341,7 @@ bool fire_warn_if_impossible(bool silent) { if (!silent) canned_msg(MSG_PRESENT_FORM); - return (true); + return true; } if (you.attribute[ATTR_HELD]) @@ -351,14 +351,14 @@ bool fire_warn_if_impossible(bool silent) { if (!silent) mprf("You cannot throw anything while %s.", held_status()); - return (true); + return true; } else if (weapon->sub_type != WPN_BLOWGUN) { if (!silent) mprf("You cannot shoot with your %s while %s.", weapon->name(DESC_BASENAME).c_str(), held_status()); - return (true); + return true; } // Else shooting is possible. } @@ -366,9 +366,9 @@ bool fire_warn_if_impossible(bool silent) { if (!silent) canned_msg(MSG_TOO_BERSERK); - return (true); + return true; } - return (false); + return false; } static bool _autoswitch_to_ranged() @@ -420,7 +420,7 @@ int get_ammo_to_shoot(int item, dist &target, bool teleport) mpr(warn.c_str()); return (-1); } - return (item); + return item; } // If item == -1, prompt the user. @@ -482,7 +482,7 @@ static int _launcher_shield_slowdown(const item_def &launcher, { int speed_adjust = 100; if (!shield) - return (speed_adjust); + return speed_adjust; const int shield_type = shield->sub_type; hands_reqd_type hands = hands_reqd(launcher, you.body_size()); @@ -510,7 +510,7 @@ static int _launcher_shield_slowdown(const item_def &launcher, if (speed_adjust > 100) speed_adjust -= you.skill_rdiv(SK_SHIELDS, speed_adjust - 100, 27 * 2); - return (speed_adjust); + return speed_adjust; } // Returns the attack cost of using the launcher, taking skill and shields @@ -573,7 +573,7 @@ int launcher_final_speed(const item_def &launcher, const item_def *shield, bool speed /= 2; } - return (speed); + return speed; } // Determines if the combined launcher + ammo brands produce a @@ -583,12 +583,12 @@ static bool _elemental_missile_beam(int launcher_brand, int ammo_brand) if (launcher_brand == SPWPN_FLAME && ammo_brand == SPMSL_FROST || launcher_brand == SPWPN_FROST && ammo_brand == SPMSL_FLAME) { - return (false); + return false; } if (ammo_brand == SPMSL_CHAOS || ammo_brand == SPMSL_FROST || ammo_brand == SPMSL_FLAME) - return (true); + return true; if (ammo_brand != SPMSL_NORMAL) - return (false); + return false; return (launcher_brand == SPWPN_CHAOS || launcher_brand == SPWPN_FROST || launcher_brand == SPWPN_FLAME); } @@ -596,10 +596,10 @@ static bool _elemental_missile_beam(int launcher_brand, int ammo_brand) static bool _poison_hit_victim(bolt& beam, actor* victim, int dmg) { if (!victim->alive() || victim->res_poison() > 0) - return (false); + return false; if (beam.is_tracer) - return (true); + return true; int levels = 0; @@ -612,21 +612,21 @@ static bool _poison_hit_victim(bolt& beam, actor* victim, int dmg) } if (levels <= 0) - return (false); + return false; victim->poison(agent, levels); - return (true); + return true; } static bool _item_penetrates_victim(const bolt &beam, int &used) { if (beam.aimed_at_feet) - return (false); + return false; used = 0; - return (true); + return true; } static bool _silver_damages_victim(bolt &beam, actor* victim, int &dmg, @@ -657,12 +657,12 @@ static bool _silver_damages_victim(bolt &beam, actor* victim, int &dmg, dmg = (dmg * multiplier) / 100; } else - return (false); + return false; if (!beam.is_tracer && you.can_see(victim)) dmg_msg = "The silver sears " + victim->name(DESC_THE) + "!"; - return (false); + return false; } static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg) @@ -670,16 +670,16 @@ static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg) const actor* agent = beam.agent(); if (!victim->alive() || victim == agent || dmg == 0) - return (false); + return false; if (beam.is_tracer) - return (true); + return true; if (victim->no_tele(true, true)) { if (victim->is_player()) canned_msg(MSG_STRANGE_STASIS); - return (false); + return false; } const bool was_seen = you.can_see(victim); @@ -693,13 +693,13 @@ static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg) if (!random_near_space(victim->pos(), pos, false, true, false, no_sanct)) { - return (false); + return false; } } while (!victim->is_habitable(pos) && tries++ < 100); if (!victim->is_habitable(pos)) - return (false); + return false; tries = 0; do @@ -707,7 +707,7 @@ static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg) while (!victim->is_habitable(pos2) && tries++ < 100); if (!victim->is_habitable(pos2)) - return (false); + return false; // Pick the square further away from the agent. const coord_def from = agent->pos(); @@ -718,7 +718,7 @@ static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg) } if (pos == victim->pos()) - return (false); + return false; const coord_def oldpos = victim->pos(); victim->clear_clinging(); @@ -756,14 +756,14 @@ static bool _dispersal_hit_victim(bolt& beam, actor* victim, int dmg) mprf("%s vanishes!", name.c_str()); } - return (true); + return true; } static bool _charged_damages_victim(bolt &beam, actor* victim, int &dmg, std::string &dmg_msg) { if (victim->airborne() || victim->res_elec() > 0 || !one_chance_in(3)) - return (false); + return false; // A hack and code duplication, but that's easier than adding accounting // for each of multiple brands. @@ -777,7 +777,7 @@ static bool _charged_damages_victim(bolt &beam, actor* victim, int &dmg, dmg += 10 + random2(15); if (beam.is_tracer) - return (false); + return false; if (you.can_see(victim)) { @@ -795,7 +795,7 @@ static bool _charged_damages_victim(bolt &beam, actor* victim, int &dmg, victim->pos(), 0); } - return (false); + return false; } static bool _blessed_damages_victim(bolt &beam, actor* victim, int &dmg, @@ -810,7 +810,7 @@ static bool _blessed_damages_victim(bolt &beam, actor* victim, int &dmg, + victim->conj_verb("convulse") + "!"; } - return (false); + return false; } static int _blowgun_power_roll(bolt &beam) @@ -851,13 +851,13 @@ static bool _blowgun_check(bolt &beam, actor* victim, bool message = true) simple_monster_message(victim->as_monster(), " is unaffected."); else canned_msg(MSG_YOU_UNAFFECTED); - return (false); + return false; } actor* agent = beam.agent(); if (!agent || agent->is_monster() || beam.reflections > 0) - return (true); + return true; const int skill = you.skill_rdiv(SK_THROWING); const item_def* wp = agent->weapon(); @@ -867,7 +867,7 @@ static bool _blowgun_check(bolt &beam, actor* victim, bool message = true) // You have a really minor chance of hitting with no skills or good // enchants. if (victim->get_experience_level() < 15 && random2(100) <= 2) - return (true); + return true; const int resist_roll = 2 + random2(4 + skill + enchantment); @@ -880,91 +880,91 @@ static bool _blowgun_check(bolt &beam, actor* victim, bool message = true) simple_monster_message(victim->as_monster(), " resists."); else canned_msg(MSG_YOU_RESIST); - return (false); + return false; } - return (true); + return true; } static bool _paralysis_hit_victim(bolt& beam, actor* victim, int dmg) { if (beam.is_tracer) - return (false); + return false; if (!_blowgun_check(beam, victim)) - return (false); + return false; int blowgun_power = _blowgun_power_roll(beam); victim->paralyse(beam.agent(), 5 + random2(blowgun_power)); - return (true); + return true; } static bool _sleep_hit_victim(bolt& beam, actor* victim, int dmg) { if (beam.is_tracer) - return (false); + return false; if (!_blowgun_check(beam, victim)) - return (false); + return false; int blowgun_power = _blowgun_power_roll(beam); victim->put_to_sleep(beam.agent(), 5 + random2(blowgun_power)); - return (true); + return true; } static bool _confusion_hit_victim(bolt &beam, actor* victim, int dmg) { if (beam.is_tracer) - return (false); + return false; if (!_blowgun_check(beam, victim)) - return (false); + return false; int blowgun_power = _blowgun_power_roll(beam); victim->confuse(beam.agent(), 5 + random2(blowgun_power)); - return (true); + return true; } static bool _slow_hit_victim(bolt &beam, actor* victim, int dmg) { if (beam.is_tracer) - return (false); + return false; if (!_blowgun_check(beam, victim)) - return (false); + return false; int blowgun_power = _blowgun_power_roll(beam); victim->slow_down(beam.agent(), 5 + random2(blowgun_power)); - return (true); + return true; } static bool _sickness_hit_victim(bolt &beam, actor* victim, int dmg) { if (beam.is_tracer) - return (false); + return false; if (!_blowgun_check(beam, victim)) - return (false); + return false; int blowgun_power = _blowgun_power_roll(beam); victim->sicken(40 + random2(blowgun_power)); - return (true); + return true; } static bool _rage_hit_victim(bolt &beam, actor* victim, int dmg) { if (beam.is_tracer) - return (false); + return false; if (!_blowgun_check(beam, victim)) - return (false); + return false; if (victim->is_monster()) victim->as_monster()->go_frenzy(); else victim->go_berserk(false); - return (true); + return true; } bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item, @@ -1077,9 +1077,9 @@ bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item, case SM_CONTINUE: break; case SM_FINISHED: - return (false); + return false; case SM_CANCEL: - return (true); + return true; } } @@ -1275,7 +1275,7 @@ bool setup_missile_beam(const actor *agent, bolt &beam, item_def &item, else ammo_name = "the " + ammo_name; - return (false); + return false; } static int stat_adjust(int value, int stat, int statbase, @@ -1292,7 +1292,7 @@ static int stat_adjust(int value, int stat, int statbase, else if (multiplier < 100) value = value * (100 - random2avg(100 - multiplier, 2)) / 100; - return (value); + return value; } static int str_adjust_thrown_damage(int dam) @@ -1394,7 +1394,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, if (thr.isCancel) canned_msg(MSG_OK); - return (false); + return false; } } pbolt.set_target(thr); @@ -1424,7 +1424,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, if (setup_missile_beam(&you, pbolt, item, ammo_name, returning)) { you.turn_is_over = false; - return (false); + return false; } // Did we know the ammo's brand before throwing it? @@ -1497,7 +1497,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, you.turn_is_over = false; if (pbolt.special_explosion != NULL) delete pbolt.special_explosion; - return (false); + return false; } pbolt.hit = 0; pbolt.damage = dice_def(); @@ -1512,7 +1512,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, if (throw_2 == you.equip[EQ_WEAPON] && thrown.quantity == 1) { if (!wield_weapon(true, SLOT_BARE_HANDS, true, false, false)) - return (false); + return false; unwielded = true; } @@ -2063,7 +2063,7 @@ bool throw_it(bolt &pbolt, int throw_2, bool teleport, int acc_bonus, if (pbolt.special_explosion != NULL) delete pbolt.special_explosion; - return (hit); + return hit; } void setup_monster_throw_beam(monster* mons, struct bolt &beam) @@ -2120,7 +2120,7 @@ bool mons_throw(monster* mons, struct bolt &beam, int msl) beam.range = you.current_vision; if (setup_missile_beam(mons, beam, item, ammo_name, returning)) - return (false); + return false; beam.aimed_at_spot = returning; @@ -2470,7 +2470,7 @@ bool mons_throw(monster* mons, struct bolt &beam, int msl) if (beam.special_explosion != NULL) delete beam.special_explosion; - return (true); + return true; } bool thrown_object_destroyed(item_def *item, const coord_def& where) @@ -2480,15 +2480,15 @@ bool thrown_object_destroyed(item_def *item, const coord_def& where) std::string name = item->name(DESC_PLAIN, false, true, false); if (item->base_type != OBJ_MISSILES) - return (false); + return false; int brand = get_ammo_brand(*item); if (brand == SPMSL_CHAOS || brand == SPMSL_DISPERSAL || brand == SPMSL_EXPLODING) - return (true); + return true; // Nets don't get destroyed by throwing. if (item->sub_type == MI_THROWING_NET) - return (false); + return false; int chance; diff --git a/crawl-ref/source/tilecell.cc b/crawl-ref/source/tilecell.cc index 10fc5dfb57..1bbf380fe6 100644 --- a/crawl-ref/source/tilecell.cc +++ b/crawl-ref/source/tilecell.cc @@ -271,7 +271,7 @@ static void _pack_shoal_waves(const coord_def &gc, packed_cell *cell) static dungeon_feature_type _safe_feat(coord_def gc) { if (!map_bounds(gc)) - return (DNGN_UNSEEN); + return DNGN_UNSEEN; return (env.map_knowledge(gc).feat()); } diff --git a/crawl-ref/source/tiledoll.cc b/crawl-ref/source/tiledoll.cc index 96b52e7369..d237edd754 100644 --- a/crawl-ref/source/tiledoll.cc +++ b/crawl-ref/source/tiledoll.cc @@ -91,10 +91,10 @@ bool save_doll_data(int mode, int num, const dolls_data* dolls) } fclose(fp); - return (true); + return true; } - return (false); + return false; } bool load_doll_data(const char *fn, dolls_data *dolls, int max, @@ -119,7 +119,7 @@ bool load_doll_data(const char *fn, dolls_data *dolls, int max, { // File doesn't exist. By default, use equipment settings. *mode = TILEP_MODE_EQUIP; - return (false); + return false; } else { @@ -154,7 +154,7 @@ bool load_doll_data(const char *fn, dolls_data *dolls, int max, // If we don't need to load a doll, return now. fclose(fp); - return (true); + return true; } int count = 0; @@ -184,7 +184,7 @@ bool load_doll_data(const char *fn, dolls_data *dolls, int max, } fclose(fp); - return (true); + return true; } } diff --git a/crawl-ref/source/tilemcache.cc b/crawl-ref/source/tilemcache.cc index 7e1f9c8bf4..af50769019 100644 --- a/crawl-ref/source/tilemcache.cc +++ b/crawl-ref/source/tilemcache.cc @@ -192,13 +192,13 @@ mcache_entry *mcache_manager::get(tileidx_t tile) { tileidx_t idx = tile & TILE_FLAG_MASK; if (idx < TILEP_MCACHE_START) - return (NULL); + return NULL; if (idx >= TILEP_MCACHE_START + m_entries.size()) - return (NULL); + return NULL; mcache_entry *entry = m_entries[idx - TILEP_MCACHE_START]; - return (entry); + return entry; } ///////////////////////////////////////////////////////////////////////////// @@ -453,10 +453,10 @@ bool mcache_monster::get_weapon_offset(tileidx_t mon_tile, break; default: // This monster cannot be displayed with a weapon. - return (false); + return false; } - return (true); + return true; } int mcache_monster::info(tile_draw_info *dinfo) const @@ -491,13 +491,13 @@ int mcache_monster::info(tile_draw_info *dinfo) const dinfo[count++].set(eq2, -ofs_x, ofs_y); } - return (count); + return count; } bool mcache_monster::valid(const monster_info& mon) { if (mon.inv[MSLOT_WEAPON].get() == NULL) - return (false); + return false; tileidx_t mon_tile = tileidx_monster(mon) & TILE_FLAG_MASK; @@ -681,7 +681,7 @@ bool mcache_ghost::valid(const monster_info& mon) bool mcache_ghost::transparent() const { - return (true); + return true; } ///////////////////////////////////////////////////////////////////////////// diff --git a/crawl-ref/source/tilepick-p.cc b/crawl-ref/source/tilepick-p.cc index 65359a7f98..534a51977a 100644 --- a/crawl-ref/source/tilepick-p.cc +++ b/crawl-ref/source/tilepick-p.cc @@ -441,31 +441,31 @@ static int _draconian_colour(int race, int level) { switch (race) { - case MONS_DRACONIAN: return (0); - case MONS_BLACK_DRACONIAN: return (1); - case MONS_YELLOW_DRACONIAN: return (2); - case MONS_GREY_DRACONIAN: return (3); - case MONS_GREEN_DRACONIAN: return (4); - case MONS_MOTTLED_DRACONIAN:return (5); - case MONS_PALE_DRACONIAN: return (6); - case MONS_PURPLE_DRACONIAN: return (7); - case MONS_RED_DRACONIAN: return (8); - case MONS_WHITE_DRACONIAN: return (9); + case MONS_DRACONIAN: return 0; + case MONS_BLACK_DRACONIAN: return 1; + case MONS_YELLOW_DRACONIAN: return 2; + case MONS_GREY_DRACONIAN: return 3; + case MONS_GREEN_DRACONIAN: return 4; + case MONS_MOTTLED_DRACONIAN:return 5; + case MONS_PALE_DRACONIAN: return 6; + case MONS_PURPLE_DRACONIAN: return 7; + case MONS_RED_DRACONIAN: return 8; + case MONS_WHITE_DRACONIAN: return 9; } } switch (race) { - case SP_BLACK_DRACONIAN: return (1); - case SP_YELLOW_DRACONIAN: return (2); - case SP_GREY_DRACONIAN: return (3); - case SP_GREEN_DRACONIAN: return (4); - case SP_MOTTLED_DRACONIAN: return (5); - case SP_PALE_DRACONIAN: return (6); - case SP_PURPLE_DRACONIAN: return (7); - case SP_RED_DRACONIAN: return (8); - case SP_WHITE_DRACONIAN: return (9); + case SP_BLACK_DRACONIAN: return 1; + case SP_YELLOW_DRACONIAN: return 2; + case SP_GREY_DRACONIAN: return 3; + case SP_GREEN_DRACONIAN: return 4; + case SP_MOTTLED_DRACONIAN: return 5; + case SP_PALE_DRACONIAN: return 6; + case SP_PURPLE_DRACONIAN: return 7; + case SP_RED_DRACONIAN: return 8; + case SP_WHITE_DRACONIAN: return 9; } - return (0); + return 0; } tileidx_t tilep_species_to_base_tile(int sp, int level) diff --git a/crawl-ref/source/tilepick.cc b/crawl-ref/source/tilepick.cc index 7c6cbc9f5b..92089c0403 100644 --- a/crawl-ref/source/tilepick.cc +++ b/crawl-ref/source/tilepick.cc @@ -67,11 +67,11 @@ TextureID get_dngn_tex(tileidx_t idx) { assert(idx < TILE_FEAT_MAX); if (idx < TILE_FLOOR_MAX) - return (TEX_FLOOR); + return TEX_FLOOR; else if (idx < TILE_WALL_MAX) - return (TEX_WALL); + return TEX_WALL; else - return (TEX_FEAT); + return TEX_FEAT; } #ifdef USE_TILE @@ -390,7 +390,7 @@ tileidx_t tileidx_feature(const coord_def &gc) && feat != DNGN_FLOOR && feat != DNGN_UNSEEN; if (override && can_override) - return (override); + return override; const monster_info* mimic = env.map_knowledge(gc).monsterinfo(); if (mimic && mons_is_feat_mimic(mimic->type)) @@ -467,12 +467,12 @@ tileidx_t tileidx_feature(const coord_def &gc) if (env.map_knowledge(gc).feat_colour() == GREEN || env.map_knowledge(gc).feat_colour() == LIGHTGREEN) { - return (TILE_DNGN_DEEP_WATER_MURKY); + return TILE_DNGN_DEEP_WATER_MURKY; } else if (player_in_branch(BRANCH_SHOALS)) - return (TILE_SHOALS_DEEP_WATER); + return TILE_SHOALS_DEEP_WATER; - return (TILE_DNGN_DEEP_WATER); + return TILE_DNGN_DEEP_WATER; case DNGN_SHALLOW_WATER: { tileidx_t t = TILE_DNGN_SHALLOW_WATER; @@ -490,7 +490,7 @@ tileidx_t tileidx_feature(const coord_def &gc) t += tile_dngn_count(t); } - return (t); + return t; } default: return (_tileidx_feature_base(feat)); @@ -794,7 +794,7 @@ static tileidx_t _tileidx_monster_zombified(const monster_info& mon) || z_type == MONS_SIMULACRUM_LARGE) z_tile = _zombie_tile_to_simulacrum(z_tile); - return (z_tile); + return z_tile; } // Special case for *taurs which have a different tile @@ -802,16 +802,16 @@ static tileidx_t _tileidx_monster_zombified(const monster_info& mon) static int _bow_offset(const monster_info& mon) { if (!mon.inv[MSLOT_WEAPON].get()) - return (1); + return 1; switch (mon.inv[MSLOT_WEAPON]->sub_type) { case WPN_BOW: case WPN_LONGBOW: case WPN_CROSSBOW: - return (0); + return 0; default: - return (1); + return 1; } } @@ -2676,14 +2676,14 @@ tileidx_t tileidx_draco_job(const monster_info& mon) { switch (mon.type) { - case MONS_DRACONIAN_CALLER: return (TILEP_DRACO_CALLER); - case MONS_DRACONIAN_MONK: return (TILEP_DRACO_MONK); - case MONS_DRACONIAN_ZEALOT: return (TILEP_DRACO_ZEALOT); - case MONS_DRACONIAN_SHIFTER: return (TILEP_DRACO_SHIFTER); - case MONS_DRACONIAN_ANNIHILATOR: return (TILEP_DRACO_ANNIHILATOR); - case MONS_DRACONIAN_KNIGHT: return (TILEP_DRACO_KNIGHT); - case MONS_DRACONIAN_SCORCHER: return (TILEP_DRACO_SCORCHER); - default: return (0); + case MONS_DRACONIAN_CALLER: return TILEP_DRACO_CALLER; + case MONS_DRACONIAN_MONK: return TILEP_DRACO_MONK; + case MONS_DRACONIAN_ZEALOT: return TILEP_DRACO_ZEALOT; + case MONS_DRACONIAN_SHIFTER: return TILEP_DRACO_SHIFTER; + case MONS_DRACONIAN_ANNIHILATOR: return TILEP_DRACO_ANNIHILATOR; + case MONS_DRACONIAN_KNIGHT: return TILEP_DRACO_KNIGHT; + case MONS_DRACONIAN_SCORCHER: return TILEP_DRACO_SCORCHER; + default: return 0; } } @@ -4138,7 +4138,7 @@ tileidx_t tileidx_known_base_item(tileidx_t label) } if (label >= TILE_SCR_ID_FIRST && label <= TILE_SCR_ID_LAST) - return (TILE_SCROLL); + return TILE_SCROLL; if (label >= TILE_WAND_ID_FIRST && label <= TILE_WAND_ID_LAST) { @@ -4163,7 +4163,7 @@ tileidx_t tileidx_known_base_item(tileidx_t label) return (TILE_STAFF_OFFSET + desc); } - return (0); + return 0; } tileidx_t tileidx_cloud(const cloud_info &cl, bool disturbance) @@ -4719,7 +4719,7 @@ tileidx_t tileidx_known_brand(const item_def &item) tileidx_t tileidx_corpse_brand(const item_def &item) { if (item.base_type != OBJ_CORPSES || item.sub_type != CORPSE_BODY) - return (0); + return 0; const bool fulsome_dist = you.has_spell(SPELL_FULSOME_DISTILLATION); const bool rotten = food_is_rotten(item); @@ -4728,7 +4728,7 @@ tileidx_t tileidx_corpse_brand(const item_def &item) // Brands are mostly meaningless to herbivores. // Could still be interesting for Fulsome Distillation, though. if (fulsome_dist && player_mutation_level(MUT_HERBIVOROUS) == 3) - return (0); + return 0; // Vampires are only interested in fresh blood. if (you.species == SP_VAMPIRE @@ -4785,17 +4785,17 @@ tileidx_t get_clean_map_idx(tileidx_t tile_idx, bool mon_only) tileidx_t tileidx_unseen_flag(const coord_def &gc) { if (!map_bounds(gc)) - return (TILE_FLAG_UNSEEN); + return TILE_FLAG_UNSEEN; else if (env.map_knowledge(gc).known() && !env.map_knowledge(gc).seen() || env.map_knowledge(gc).detected_item() || env.map_knowledge(gc).detected_monster() ) { - return (TILE_FLAG_MM_UNSEEN); + return TILE_FLAG_MM_UNSEEN; } else - return (TILE_FLAG_UNSEEN); + return TILE_FLAG_UNSEEN; } int enchant_to_int(const item_def &item) @@ -4833,7 +4833,7 @@ tileidx_t tileidx_enchant_equ(const item_def &item, tileidx_t tile) tile += etable[idx][etype]; - return (tile); + return tile; } std::string tile_debug_string(tileidx_t fg, tileidx_t bg, char prefix) @@ -4886,7 +4886,7 @@ std::string tile_debug_string(tileidx_t fg, tileidx_t bg, char prefix) bg & ~TILE_FLAG_MASK, tile_dngn_name(bg_idx)); - return (tile_string); + return tile_string; } #endif diff --git a/crawl-ref/source/tilereg-cmd.cc b/crawl-ref/source/tilereg-cmd.cc index 4aaabe206d..d1217d7180 100644 --- a/crawl-ref/source/tilereg-cmd.cc +++ b/crawl-ref/source/tilereg-cmd.cc @@ -49,7 +49,7 @@ int CommandRegion::handle_mouse(MouseEvent &event) { unsigned int item_idx; if (!place_cursor(event, item_idx)) - return (0); + return 0; if (event.button == MouseEvent::LEFT) { @@ -58,7 +58,7 @@ int CommandRegion::handle_mouse(MouseEvent &event) process_command(cmd); return CK_MOUSE_CMD; } - return (0); + return 0; } bool CommandRegion::update_tab_tip_text(std::string &tip, bool active) @@ -68,17 +68,17 @@ bool CommandRegion::update_tab_tip_text(std::string &tip, bool active) tip = make_stringf("%s%s", prefix, "Execute commands"); - return (true); + return true; } bool CommandRegion::update_tip_text(std::string& tip) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; const command_type cmd = (command_type) m_items[item_idx].idx; tip = make_stringf("[L-Click] %s", @@ -92,22 +92,22 @@ bool CommandRegion::update_tip_text(std::string& tip) // tip += "\n[R-Click] Describe"; - return (true); + return true; } bool CommandRegion::update_alt_text(std::string &alt) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; if (m_last_clicked_item >= 0 && item_idx == (unsigned int) m_last_clicked_item) { - return (false); + return false; } int idx = m_items[item_idx].idx; @@ -116,7 +116,7 @@ bool CommandRegion::update_alt_text(std::string &alt) const std::string desc = get_command_description(cmd, false); if (desc.empty()) - return (false); + return false; describe_info inf; inf.body << desc; @@ -125,7 +125,7 @@ bool CommandRegion::update_alt_text(std::string &alt) process_description<alt_desc_proc>(proc, inf); proc.get_string(alt); - return (true); + return true; } void CommandRegion::pack_buffers() @@ -172,7 +172,7 @@ static bool _command_not_applicable(const command_type cmd, bool safe) case CMD_USE_ABILITY: return (your_talents(false).empty()); default: - return (false); + return false; } } diff --git a/crawl-ref/source/tilereg-dgn.cc b/crawl-ref/source/tilereg-dgn.cc index d4cb1483af..558a7cdca9 100644 --- a/crawl-ref/source/tilereg-dgn.cc +++ b/crawl-ref/source/tilereg-dgn.cc @@ -395,7 +395,7 @@ static const bool _is_appropriate_spell(spell_type spell, // We don't handle grid targeted spells yet. if (flags & SPFLAG_GRID) - return (false); + return false; // Most spells are blocked by transparent walls. if (targeted && !you.see_cell_no_trans(target->pos())) @@ -410,7 +410,7 @@ static const bool _is_appropriate_spell(spell_type spell, break; default: - return (false); + return false; } } @@ -419,17 +419,17 @@ static const bool _is_appropriate_spell(spell_type spell, if (target->is_player()) { if (flags & SPFLAG_NOT_SELF) - return (false); + return false; return ((flags & (SPFLAG_HELPFUL | SPFLAG_ESCAPE | SPFLAG_RECOVERY)) || !targeted); } if (!targeted) - return (false); + return false; if (flags & SPFLAG_NEUTRAL) - return (false); + return false; bool friendly = target->as_monster()->wont_attack(); @@ -440,23 +440,23 @@ static const bool _is_appropriate_evokable(const item_def& item, const actor* target) { if (!item_is_evokable(item, false, false, true)) - return (false); + return false; // Only wands for now. if (item.base_type != OBJ_WANDS) - return (false); + return false; // Aren't yet any wands that can go through transparent walls. if (!you.see_cell_no_trans(target->pos())) - return (false); + return false; // We don't know what it is, so it *might* be appropriate. if (!item_type_known(item)) - return (true); + return true; // Random effects are always (in)apropriate for all targets. if (item.sub_type == WAND_RANDOM_EFFECTS) - return (true); + return true; spell_type spell = zap_type_to_spell(item.zap()); if (spell == SPELL_TELEPORT_OTHER && target->is_player()) @@ -469,7 +469,7 @@ static const bool _have_appropriate_evokable(const actor* target) { // Felids cannot use wands. if (you.species == SP_FELID) - return (false); + return false; for (int i = 0; i < ENDOFPACK; i++) { @@ -479,10 +479,10 @@ static const bool _have_appropriate_evokable(const actor* target) continue; if (_is_appropriate_evokable(item, target)) - return (true); + return true; } - return (false); + return false; } static item_def* _get_evokable_item(const actor* target) @@ -514,7 +514,7 @@ static item_def* _get_evokable_item(const actor* target) redraw_screen(); if (sel.empty()) - return (NULL); + return NULL; return (const_cast<item_def*>(sel[0].item)); } @@ -530,7 +530,7 @@ static bool _evoke_item_on_target(actor* target) } if (item == NULL) - return (false); + return false; if (item->base_type == OBJ_WANDS) { @@ -538,20 +538,20 @@ static bool _evoke_item_on_target(actor* target) || item_type_known(*item) && item->plus <= 0) { mpr("That wand is empty."); - return (false); + return false; } } macro_buf_add_cmd(CMD_EVOKE); macro_buf_add(index_to_letter(item->link)); // Inventory letter. _add_targetting_commands(target->pos()); - return (true); + return true; } static bool _spell_in_range(spell_type spell, actor* target) { if (!(get_spell_flags(spell) & SPFLAG_TARGETTING_MASK)) - return (true); + return true; int range = calc_spell_range(spell); @@ -604,7 +604,7 @@ static bool _cast_spell_on_target(actor* target) _spell_target = NULL; if (letter == 0) - return (false); + return false; spell = get_spell_by_letter(letter); } @@ -616,13 +616,13 @@ static bool _cast_spell_on_target(actor* target) { mprf("%s is out of range for that spell.", target->name(DESC_THE).c_str()); - return (true); + return true; } if (spell_mana(spell) > you.magic_points) { mpr("You don't have enough mana to cast that spell."); - return (true); + return true; } int item_slot = -1; @@ -632,11 +632,11 @@ static bool _cast_spell_on_target(actor* target) OBJ_POTIONS); if (prompt_failed(pot)) - return (false); + return false; else if (you.inv[pot].base_type != OBJ_POTIONS) { mpr("This spell works only on potions!"); - return (false); + return false; } item_slot = you.inv[pot].slot; } @@ -649,7 +649,7 @@ static bool _cast_spell_on_target(actor* target) if (get_spell_flags(spell) & SPFLAG_TARGETTING_MASK) _add_targetting_commands(target->pos()); - return (true); + return true; } static const bool _have_appropriate_spell(const actor* target) @@ -662,9 +662,9 @@ static const bool _have_appropriate_spell(const actor* target) continue; if (_is_appropriate_spell(spell, target)) - return (true); + return true; } - return (false); + return false; } static bool _can_fire_item() @@ -691,7 +691,7 @@ static bool _handle_distant_monster(monster* mon, unsigned char mod) { macro_buf_add_cmd(CMD_FIRE); _add_targetting_commands(mon->pos()); - return (true); + return true; } // Handle casting spells at monster. @@ -707,11 +707,11 @@ static bool _handle_distant_monster(monster* mon, unsigned char mod) { macro_buf_add_cmd(CMD_EVOKE_WIELDED); _add_targetting_commands(mon->pos()); - return (true); + return true; } } - return (false); + return false; } static bool _handle_zap_player(MouseEvent &event) @@ -726,7 +726,7 @@ static bool _handle_zap_player(MouseEvent &event) if (ctrl && _have_appropriate_spell(&you)) return _cast_spell_on_target(&you); - return (false); + return false; } int DungeonRegion::handle_mouse(MouseEvent &event) @@ -879,7 +879,7 @@ int tile_click_cell(const coord_def &gc, unsigned char mod) if (mon && you.can_see(mon)) { if (_handle_distant_monster(mon, mod)) - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; } if ((mod & MOD_CTRL) && adjacent(you.pos(), gc)) @@ -888,19 +888,19 @@ int tile_click_cell(const coord_def &gc, unsigned char mod) if (cmd != CK_MOUSE_CMD) process_command((command_type) cmd); - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; } // Don't move if we've tried to fire/cast/evoke when there's nothing // available. if (mod & (MOD_SHIFT | MOD_CTRL | MOD_ALT)) - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; const int cmd = click_travel(gc, mod & MOD_CTRL); if (cmd != CK_MOUSE_CMD) process_command((command_type) cmd); - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; } void DungeonRegion::to_screen_coords(const coord_def &gc, coord_def *pc) const @@ -963,12 +963,12 @@ bool DungeonRegion::update_tip_text(std::string &tip) // and some parsing of formatting to get that to work. if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (false); + return false; if (m_cursor[CURSOR_MOUSE] == NO_CURSOR) - return (false); + return false; if (!map_bounds(m_cursor[CURSOR_MOUSE])) - return (false); + return false; const coord_def gc = m_cursor[CURSOR_MOUSE]; bool ret = (tile_dungeon_tip(gc, tip)); @@ -1015,7 +1015,7 @@ bool DungeonRegion::update_tip_text(std::string &tip) } #endif - return (ret); + return ret; } static std::string _check_spell_evokable(const actor* target, @@ -1178,24 +1178,24 @@ bool tile_dungeon_tip(const coord_def &gc, std::string &tip) if (!tip.empty()) insert_commands(tip, cmd, false); - return (true); + return true; } bool DungeonRegion::update_alt_text(std::string &alt) { if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (false); + return false; const coord_def &gc = m_cursor[CURSOR_MOUSE]; if (gc == NO_CURSOR) - return (false); + return false; if (!map_bounds(gc)) - return (false); + return false; if (!env.map_knowledge(gc).seen()) - return (false); + return false; if (m_last_clicked_grid == gc) - return (false); + return false; describe_info inf; if (you.see_cell(gc)) @@ -1223,9 +1223,9 @@ bool DungeonRegion::update_alt_text(std::string &alt) if (alt == "Floor.") { alt.clear(); - return (false); + return false; } - return (true); + return true; } void DungeonRegion::clear_text_tags(text_tag_type type) diff --git a/crawl-ref/source/tilereg-grid.cc b/crawl-ref/source/tilereg-grid.cc index b9cdf82af7..3a503dc48b 100644 --- a/crawl-ref/source/tilereg-grid.cc +++ b/crawl-ref/source/tilereg-grid.cc @@ -109,23 +109,23 @@ bool GridRegion::place_cursor(MouseEvent &event, unsigned int &item_idx) if (!mouse_pos(event.px, event.py, cx, cy)) { place_cursor(NO_CURSOR); - return (false); + return false; } const coord_def cursor(cx, cy); place_cursor(cursor); if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (false); + return false; if (event.event != MouseEvent::PRESS) - return (false); + return false; item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; - return (true); + return true; } void GridRegion::add_quad_char(char c, int x, int y, diff --git a/crawl-ref/source/tilereg-inv.cc b/crawl-ref/source/tilereg-inv.cc index 7adc5b43bb..e36af9f444 100644 --- a/crawl-ref/source/tilereg-inv.cc +++ b/crawl-ref/source/tilereg-inv.cc @@ -117,7 +117,7 @@ int InventoryRegion::handle_mouse(MouseEvent &event) { unsigned int item_idx; if (!place_cursor(event, item_idx)) - return (0); + return 0; int idx = m_items[item_idx].idx; @@ -197,7 +197,7 @@ static bool _can_use_item(const item_def &item, bool equipped) { // There's nothing you can do with an empty box if you can't unwield it. if (!equipped && item.sub_type == MISC_EMPTY_EBONY_CASKET) - return (false); + return false; // Vampires can drain corpses. if (item.base_type == OBJ_CORPSES) @@ -212,7 +212,7 @@ static bool _can_use_item(const item_def &item, bool equipped) { // Misc. items/rods can always be evoked, cursed or not. if (item_is_evokable(item)) - return (true); + return true; // You can't unwield/fire a wielded cursed weapon/staff // but cursed armour and rings can be unwielded without problems. @@ -224,7 +224,7 @@ static bool _can_use_item(const item_def &item, bool equipped) return (item.base_type != OBJ_POTIONS && item.base_type != OBJ_FOOD); // In all other cases you can use the item in some way. - return (true); + return true; } static void _handle_wield_tip(std::string &tip, std::vector<command_type> &cmd, @@ -248,17 +248,17 @@ bool InventoryRegion::update_tab_tip_text(std::string &tip, bool active) prefix1, "Display inventory", prefix2, "Use items"); - return (true); + return true; } bool InventoryRegion::update_tip_text(std::string& tip) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; int idx = m_items[item_idx].idx; @@ -274,7 +274,7 @@ bool InventoryRegion::update_tip_text(std::string& tip) const item_def &item = mitm[idx]; if (!item.defined()) - return (false); + return false; tip = ""; if (m_items[item_idx].key) @@ -286,7 +286,7 @@ bool InventoryRegion::update_tip_text(std::string& tip) tip += item.name(DESC_A); if (!display_actions) - return (true); + return true; tip += "\n[L-Click] Pick up (%)"; cmd.push_back(CMD_PICKUP); @@ -325,12 +325,12 @@ bool InventoryRegion::update_tip_text(std::string& tip) { const item_def &item = you.inv[idx]; if (!item.defined()) - return (false); + return false; tip = item.name(DESC_INVENTORY_EQUIP); if (!display_actions) - return (true); + return true; int type = item.base_type; const bool equipped = m_items[item_idx].flag & TILEI_FLAG_EQUIP; @@ -527,22 +527,22 @@ bool InventoryRegion::update_tip_text(std::string& tip) } insert_commands(tip, cmd); - return (true); + return true; } bool InventoryRegion::update_alt_text(std::string &alt) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; if (m_last_clicked_item >= 0 && item_idx == (unsigned int) m_last_clicked_item) { - return (false); + return false; } int idx = m_items[item_idx].idx; @@ -554,7 +554,7 @@ bool InventoryRegion::update_alt_text(std::string &alt) item = &you.inv[idx]; if (!item->defined()) - return (false); + return false; describe_info inf; get_item_desc(*item, inf, true); @@ -564,7 +564,7 @@ bool InventoryRegion::update_alt_text(std::string &alt) proc.get_string(alt); - return (true); + return true; } void InventoryRegion::draw_tag() diff --git a/crawl-ref/source/tilereg-map.cc b/crawl-ref/source/tilereg-map.cc index a1c87ff03a..ed28e90b47 100644 --- a/crawl-ref/source/tilereg-map.cc +++ b/crawl-ref/source/tilereg-map.cc @@ -272,7 +272,7 @@ int MapRegion::handle_mouse(MouseEvent &event) { // Start autotravel, or give an appropriate message. do_explore_cmd(); - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; } else { @@ -280,7 +280,7 @@ int MapRegion::handle_mouse(MouseEvent &event) if (cmd != CK_MOUSE_CMD) process_command((command_type) cmd); - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; } } else if (event.button == MouseEvent::RIGHT) @@ -295,16 +295,16 @@ int MapRegion::handle_mouse(MouseEvent &event) m_far_view = false; tiles.load_dungeon(crawl_view.vgrdc); } - return (0); + return 0; default: - return (0); + return 0; } } bool MapRegion::update_tip_text(std::string& tip) { if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (false); + return false; tip = "[L-Click] Travel / [R-Click] View"; if (!player_in_branch(BRANCH_LABYRINTH) @@ -313,7 +313,7 @@ bool MapRegion::update_tip_text(std::string& tip) { tip += "\n[Shift + L-Click] Autoexplore"; } - return (true); + return true; } #endif diff --git a/crawl-ref/source/tilereg-mem.cc b/crawl-ref/source/tilereg-mem.cc index f78697bb84..8203743aef 100644 --- a/crawl-ref/source/tilereg-mem.cc +++ b/crawl-ref/source/tilereg-mem.cc @@ -56,7 +56,7 @@ int MemoriseRegion::handle_mouse(MouseEvent &event) { unsigned int item_idx; if (!place_cursor(event, item_idx)) - return (0); + return 0; const spell_type spell = (spell_type) m_items[item_idx].idx; if (event.button == MouseEvent::LEFT) @@ -75,7 +75,7 @@ int MemoriseRegion::handle_mouse(MouseEvent &event) redraw_screen(); return CK_MOUSE_CMD; } - return (0); + return 0; } bool MemoriseRegion::update_tab_tip_text(std::string &tip, bool active) @@ -87,17 +87,17 @@ bool MemoriseRegion::update_tab_tip_text(std::string &tip, bool active) prefix1, "Display spells in carried books", prefix2, "Memorise spells"); - return (true); + return true; } bool MemoriseRegion::update_tip_text(std::string& tip) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; int flag = m_items[item_idx].flag; std::vector<command_type> cmd; @@ -112,7 +112,7 @@ bool MemoriseRegion::update_tip_text(std::string& tip) tip += "\n[R-Click] Describe"; insert_commands(tip, cmd); - return (true); + return true; } void MemoriseRegion::update() diff --git a/crawl-ref/source/tilereg-menu.cc b/crawl-ref/source/tilereg-menu.cc index 6917356e99..c4eb265787 100644 --- a/crawl-ref/source/tilereg-menu.cc +++ b/crawl-ref/source/tilereg-menu.cc @@ -361,8 +361,8 @@ int MenuRegion::maxpagesize() const // Non-inventory menus only have one column and need // *really* big screens to cover more than 52 lines. if (pagesize > 52) - return (52); - return (pagesize); + return 52; + return pagesize; } void MenuRegion::set_offset(int lines) diff --git a/crawl-ref/source/tilereg-mon.cc b/crawl-ref/source/tilereg-mon.cc index 9eef0329a3..a8398d30a5 100644 --- a/crawl-ref/source/tilereg-mon.cc +++ b/crawl-ref/source/tilereg-mon.cc @@ -55,26 +55,26 @@ int MonsterRegion::handle_mouse(MouseEvent &event) if (!mouse_pos(event.px, event.py, cx, cy)) { place_cursor(NO_CURSOR); - return (0); + return 0; } const coord_def cursor(cx, cy); place_cursor(cursor); if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (0); + return 0; unsigned int item_idx = cursor_index(); const monster_info* mon = get_monster(item_idx); if (!mon) - return (0); + return 0; const coord_def &gc = mon->pos; tiles.place_cursor(CURSOR_MOUSE, gc); if (event.event != MouseEvent::PRESS) - return (0); + return 0; if (event.button == MouseEvent::LEFT) { @@ -85,51 +85,51 @@ int MonsterRegion::handle_mouse(MouseEvent &event) { full_describe_square(gc); redraw_screen(); - return (CK_MOUSE_CMD); + return CK_MOUSE_CMD; } - return (0); + return 0; } bool MonsterRegion::update_tip_text(std::string &tip) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); const monster_info* mon = get_monster(item_idx); if (!mon) - return (false); + return false; return (tile_dungeon_tip(mon->pos, tip)); } bool MonsterRegion::update_tab_tip_text(std::string &tip, bool active) { - return (false); + return false; } bool MonsterRegion::update_alt_text(std::string &alt) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (m_last_clicked_item >= 0 && item_idx == (unsigned int) m_last_clicked_item) { - return (false); + return false; } const monster_info* mon = get_monster(item_idx); if (!mon) - return (false); + return false; const coord_def &gc = mon->pos; describe_info inf; if (!you.see_cell(gc)) - return (false); + return false; get_square_desc(gc, inf, true, false); @@ -138,17 +138,17 @@ bool MonsterRegion::update_alt_text(std::string &alt) proc.get_string(alt); - return (true); + return true; } const monster_info* MonsterRegion::get_monster(unsigned int idx) const { if (idx >= m_items.size()) - return (NULL); + return NULL; const InventoryTile &item = m_items[idx]; if (item.idx >= static_cast<int>(m_mon_info.size())) - return (NULL); + return NULL; return &(m_mon_info[item.idx]); } diff --git a/crawl-ref/source/tilereg-msg.cc b/crawl-ref/source/tilereg-msg.cc index d79f06ccda..4d47d25c66 100644 --- a/crawl-ref/source/tilereg-msg.cc +++ b/crawl-ref/source/tilereg-msg.cc @@ -37,10 +37,10 @@ int MessageRegion::handle_mouse(MouseEvent &event) bool MessageRegion::update_tip_text(std::string& tip) { if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (false); + return false; tip = "[L-Click] Browse message history"; - return (true); + return true; } void MessageRegion::set_overlay(bool is_overlay) diff --git a/crawl-ref/source/tilereg-skl.cc b/crawl-ref/source/tilereg-skl.cc index 21b85f6943..1e3592f317 100644 --- a/crawl-ref/source/tilereg-skl.cc +++ b/crawl-ref/source/tilereg-skl.cc @@ -57,7 +57,7 @@ int SkillRegion::handle_mouse(MouseEvent &event) { unsigned int item_idx; if (!place_cursor(event, item_idx)) - return (0); + return 0; const skill_type skill = (skill_type) m_items[item_idx].idx; if (event.button == MouseEvent::LEFT) @@ -92,7 +92,7 @@ int SkillRegion::handle_mouse(MouseEvent &event) redraw_screen(); return CK_MOUSE_CMD; } - return (0); + return 0; } bool SkillRegion::update_tab_tip_text(std::string &tip, bool active) @@ -101,17 +101,17 @@ bool SkillRegion::update_tab_tip_text(std::string &tip, bool active) tip = make_stringf("%s%s", prefix, "Manage skills"); - return (true); + return true; } bool SkillRegion::update_tip_text(std::string& tip) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; const int flag = m_items[item_idx].flag; if (flag & TILEI_FLAG_INVALID) @@ -133,22 +133,22 @@ bool SkillRegion::update_tip_text(std::string& tip) tip += "\n[R-Click] Describe"; - return (true); + return true; } bool SkillRegion::update_alt_text(std::string &alt) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; if (m_last_clicked_item >= 0 && item_idx == (unsigned int) m_last_clicked_item) { - return (false); + return false; } int idx = m_items[item_idx].idx; @@ -163,7 +163,7 @@ bool SkillRegion::update_alt_text(std::string &alt) process_description<alt_desc_proc>(proc, inf); proc.get_string(alt); - return (true); + return true; } static int _get_aptitude_tile(const int apt) diff --git a/crawl-ref/source/tilereg-spl.cc b/crawl-ref/source/tilereg-spl.cc index 1acf90d2d3..30a54aec89 100644 --- a/crawl-ref/source/tilereg-spl.cc +++ b/crawl-ref/source/tilereg-spl.cc @@ -56,7 +56,7 @@ int SpellRegion::handle_mouse(MouseEvent &event) { unsigned int item_idx; if (!place_cursor(event, item_idx)) - return (0); + return 0; const spell_type spell = (spell_type) m_items[item_idx].idx; if (event.button == MouseEvent::LEFT) @@ -73,7 +73,7 @@ int SpellRegion::handle_mouse(MouseEvent &event) redraw_screen(); return CK_MOUSE_CMD; } - return (0); + return 0; } bool SpellRegion::update_tab_tip_text(std::string &tip, bool active) @@ -85,17 +85,17 @@ bool SpellRegion::update_tab_tip_text(std::string &tip, bool active) prefix1, "Display memorised spells", prefix2, "Cast spells"); - return (true); + return true; } bool SpellRegion::update_tip_text(std::string& tip) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; int flag = m_items[item_idx].flag; std::vector<command_type> cmd; @@ -111,22 +111,22 @@ bool SpellRegion::update_tip_text(std::string& tip) cmd.push_back(CMD_DISPLAY_SPELLS); insert_commands(tip, cmd); - return (true); + return true; } bool SpellRegion::update_alt_text(std::string &alt) { if (m_cursor == NO_CURSOR) - return (false); + return false; unsigned int item_idx = cursor_index(); if (item_idx >= m_items.size() || m_items[item_idx].empty()) - return (false); + return false; if (m_last_clicked_item >= 0 && item_idx == (unsigned int) m_last_clicked_item) { - return (false); + return false; } int idx = m_items[item_idx].idx; @@ -141,12 +141,12 @@ bool SpellRegion::update_alt_text(std::string &alt) proc.get_string(alt); - return (true); + return true; } int SpellRegion::get_max_slots() { - return (MAX_KNOWN_SPELLS); + return MAX_KNOWN_SPELLS; } void SpellRegion::pack_buffers() diff --git a/crawl-ref/source/tilereg-stat.cc b/crawl-ref/source/tilereg-stat.cc index e46dc95c1d..3458f8de95 100644 --- a/crawl-ref/source/tilereg-stat.cc +++ b/crawl-ref/source/tilereg-stat.cc @@ -29,10 +29,10 @@ int StatRegion::handle_mouse(MouseEvent &event) bool StatRegion::update_tip_text(std::string& tip) { if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (false); + return false; tip = "[L-Click] Rest / Search for a while"; - return (true); + return true; } #endif diff --git a/crawl-ref/source/tilereg-tab.cc b/crawl-ref/source/tilereg-tab.cc index 68bb46c61e..8b74a7028b 100644 --- a/crawl-ref/source/tilereg-tab.cc +++ b/crawl-ref/source/tilereg-tab.cc @@ -92,7 +92,7 @@ void TabbedRegion::set_tab_region(int idx, GridRegion *reg, tileidx_t tile_tab) GridRegion *TabbedRegion::get_tab_region(int idx) { if (invalid_index(idx)) - return (NULL); + return NULL; return (m_tabs[idx].reg); } @@ -100,7 +100,7 @@ GridRegion *TabbedRegion::get_tab_region(int idx) tileidx_t TabbedRegion::get_tab_tile(int idx) { if (invalid_index(idx)) - return (0); + return 0; return (m_tabs[idx].tile_tab); } @@ -129,7 +129,7 @@ void TabbedRegion::activate_tab(int idx) int TabbedRegion::active_tab() const { - return (m_active); + return m_active; } int TabbedRegion::num_tabs() const @@ -175,13 +175,13 @@ void TabbedRegion::disable_tab(int idx) bool TabbedRegion::active_is_valid() const { if (invalid_index(m_active)) - return (false); + return false; if (!m_tabs[m_active].enabled) - return (false); + return false; if (!m_tabs[m_active].reg) - return (false); + return false; - return (true); + return true; } void TabbedRegion::update() @@ -287,7 +287,7 @@ int TabbedRegion::get_mouseover_tab(MouseEvent &event) const for (int i = 0; i < (int)m_tabs.size(); ++i) { if (y >= m_tabs[i].min_y && y <= m_tabs[i].max_y) - return (i); + return i; } return (-1); } @@ -295,7 +295,7 @@ int TabbedRegion::get_mouseover_tab(MouseEvent &event) const int TabbedRegion::handle_mouse(MouseEvent &event) { if (mouse_control::current_mode() != MOUSE_MODE_COMMAND) - return (0); + return 0; int mouse_tab = get_mouseover_tab(event); if (mouse_tab != m_mouse_tab) @@ -310,26 +310,26 @@ int TabbedRegion::handle_mouse(MouseEvent &event) if (event.event == MouseEvent::PRESS) { activate_tab(m_mouse_tab); - return (0); + return 0; } } // Otherwise, pass input to the active tab. if (!active_is_valid()) - return (0); + return 0; return (get_tab_region(active_tab())->handle_mouse(event)); } bool TabbedRegion::update_tab_tip_text(std::string &tip, bool active) { - return (false); + return false; } bool TabbedRegion::update_tip_text(std::string &tip) { if (!active_is_valid()) - return (false); + return false; if (m_mouse_tab != -1) { @@ -344,7 +344,7 @@ bool TabbedRegion::update_tip_text(std::string &tip) bool TabbedRegion::update_alt_text(std::string &alt) { if (!active_is_valid()) - return (false); + return false; return (get_tab_region(active_tab())->update_alt_text(alt)); } diff --git a/crawl-ref/source/tilesdl.cc b/crawl-ref/source/tilesdl.cc index 6f7d426a3d..ab279f8519 100644 --- a/crawl-ref/source/tilesdl.cc +++ b/crawl-ref/source/tilesdl.cc @@ -288,11 +288,11 @@ bool TilesFramework::initialise() // Create an instance of UIWrapper for the library we were compiled for WindowManager::create(); if (!wm) - return (false); + return false; // Initialize the wrapper if (!wm->init(&m_windowsz)) - return (false); + return false; wm->set_window_title(title.c_str()); wm->set_window_icon(icon_name); @@ -310,7 +310,7 @@ bool TilesFramework::initialise() // as this appears to make things blurry on some users machines. bool need_mips = (m_windowsz.y < 32 * VIEW_MIN_HEIGHT); if (!m_image->load_textures(need_mips)) - return (false); + return false; calculate_default_options(); @@ -328,7 +328,7 @@ bool TilesFramework::initialise() if (m_crt_font == -1 || m_msg_font == -1 || stat_font == -1 || m_tip_font == -1 || m_lbl_font == -1) { - return (false); + return false; } m_init = TileRegionInit(m_image, m_fonts[m_lbl_font].font, TILE_X, TILE_Y); @@ -367,7 +367,7 @@ bool TilesFramework::initialise() resize(); - return (true); + return true; } int TilesFramework::load_font(const char *font_file, int font_size, @@ -498,7 +498,7 @@ static unsigned int _timer_callback(unsigned int ticks) wm->raise_custom_event(); unsigned int res = Options.tile_tooltip_ms; - return (res); + return res; } int TilesFramework::getch_ck() @@ -1113,14 +1113,14 @@ void TilesFramework::cgotoxy(int x, int y, GotoRegion region) GotoRegion TilesFramework::get_cursor_region() const { if (TextRegion::text_mode == m_region_crt) - return (GOTO_CRT); + return GOTO_CRT; if (TextRegion::text_mode == m_region_msg) - return (GOTO_MSG); + return GOTO_MSG; if (TextRegion::text_mode == m_region_stat) - return (GOTO_STAT); + return GOTO_STAT; die("Bogus region"); - return (GOTO_CRT); + return GOTO_CRT; } // #define DEBUG_TILES_REDRAW diff --git a/crawl-ref/source/tiletex.cc b/crawl-ref/source/tiletex.cc index 478af454b1..12235721e5 100644 --- a/crawl-ref/source/tiletex.cc +++ b/crawl-ref/source/tiletex.cc @@ -43,7 +43,7 @@ bool GenericTexture::load_texture(const char *filename, success = wm->load_texture(this, filename, mip_opt, m_orig_width, m_orig_height, proc, force_power_of_two); - return (success); + return success; } bool GenericTexture::load_texture(unsigned char *pixels, unsigned int new_width, @@ -51,7 +51,7 @@ bool GenericTexture::load_texture(unsigned char *pixels, unsigned int new_width, MipMapOptions mip_opt) { if (!pixels || !new_width || !new_height) - return (false); + return false; m_width = new_width; m_height = new_height; @@ -60,7 +60,7 @@ bool GenericTexture::load_texture(unsigned char *pixels, unsigned int new_width, bind(); glmanager->load_texture(pixels, m_width, m_height, mip_opt); - return (true); + return true; } void GenericTexture::bind() const @@ -110,7 +110,7 @@ bool ImageManager::load_textures(bool need_mips) for (size_t i = 0; i < ARRAYSZ(_filenames); ++i) { if (!m_textures[i].load_texture(_filenames[i], mip)) - return (false); + return false; } m_textures[TEX_FLOOR].set_info(TILE_FLOOR_MAX, &tile_floor_info); @@ -121,7 +121,7 @@ bool ImageManager::load_textures(bool need_mips) m_textures[TEX_GUI].set_info(TILEG_GUI_MAX, &tile_gui_info); m_textures[TEX_ICONS].set_info(TILEI_ICONS_MAX, &tile_icons_info); - return (true); + return true; } void ImageManager::unload_textures() diff --git a/crawl-ref/source/tiletex.h b/crawl-ref/source/tiletex.h index acda739fab..f150a5b2d4 100644 --- a/crawl-ref/source/tiletex.h +++ b/crawl-ref/source/tiletex.h @@ -102,7 +102,7 @@ inline bool TilesTexture::get_coords(tileidx_t idx, int ofs_x, int ofs_y, // Nothing to draw. if (sy >= ey) - return (false); + return false; pos_sx += (ofs_x + inf.offset_x + size_ox) / tile_x; pos_sy += sy / tile_y; @@ -114,7 +114,7 @@ inline bool TilesTexture::get_coords(tileidx_t idx, int ofs_x, int ofs_y, tex_ex = inf.ex / fwidth; tex_ey = (inf.ey + ey - pos_ey_adjust) / fheight; - return (true); + return true; } class ImageManager diff --git a/crawl-ref/source/tileview.cc b/crawl-ref/source/tileview.cc index 6f81704dbf..4ea73dd2a7 100644 --- a/crawl-ref/source/tileview.cc +++ b/crawl-ref/source/tileview.cc @@ -307,7 +307,7 @@ static tileidx_t _pick_random_dngn_tile(tileidx_t idx, int value = -1) ASSERT(idx >= 0 && idx < TILE_DNGN_MAX); const int count = tile_dngn_count(idx); if (count == 1) - return (idx); + return idx; const int total = tile_dngn_probs(idx + count - 1); const int rand = (value == -1 ? random2(total) : value % total); @@ -316,10 +316,10 @@ static tileidx_t _pick_random_dngn_tile(tileidx_t idx, int value = -1) { tileidx_t curr = idx + i; if (rand < tile_dngn_probs(curr)) - return (curr); + return curr; } - return (idx); + return idx; } void tile_init_flavour(const coord_def &gc) @@ -418,10 +418,10 @@ static bool _adjacent_target(dungeon_feature_type target, int x, int y) if (!map_bounds(*ai)) continue; if (grd(*ai) == target) - return (true); + return true; } - return (false); + return false; } void tile_floor_halo(dungeon_feature_type target, tileidx_t tile) @@ -941,24 +941,24 @@ static bool _suppress_blood(const map_cell& mc) { const dungeon_feature_type feat = mc.feat(); if (feat == DNGN_TREE || feat == DNGN_MANGROVE) - return (true); + return true; if (feat >= DNGN_FOUNTAIN_BLUE && feat <= DNGN_PERMADRY_FOUNTAIN) - return (true); + return true; if (feat_is_altar(feat)) - return (true); + return true; if (feat_stair_direction(feat) != CMD_NO_CMD) - return (true); + return true; if (feat == DNGN_MALIGN_GATEWAY) - return (true); + return true; if (mc.trap() == TRAP_SHAFT) - return (true); + return true; - return (false); + return false; } static bool _suppress_blood(tileidx_t bg_idx) diff --git a/crawl-ref/source/tileweb.cc b/crawl-ref/source/tileweb.cc index 37e473ebe4..30f5135036 100644 --- a/crawl-ref/source/tileweb.cc +++ b/crawl-ref/source/tileweb.cc @@ -144,7 +144,7 @@ bool TilesFramework::initialise() // Initially, switch to CRT. cgotoxy(1, 1, GOTO_CRT); - return (true); + return true; } void TilesFramework::write_message() diff --git a/crawl-ref/source/transform.cc b/crawl-ref/source/transform.cc index fe138cdecc..f3cfd4f88d 100644 --- a/crawl-ref/source/transform.cc +++ b/crawl-ref/source/transform.cc @@ -73,7 +73,7 @@ bool form_can_fly(transformation_type form) if (you.species == SP_TENGU && (you.experience_level >= 15 || you.airborne())) { - return (true); + return true; } return (form == TRAN_DRAGON || form == TRAN_BAT); } @@ -82,13 +82,13 @@ bool form_can_swim(transformation_type form) { // Ice floats. if (form == TRAN_ICE_BEAST) - return (true); + return true; if (you.species == SP_MERFOLK && !form_changed_physiology(form)) - return (true); + return true; if (you.species == SP_OCTOPODE) - return (true); + return true; size_type size = you.transform_size(form, PSIZE_BODY); if (size == SIZE_CHARACTER) @@ -205,7 +205,7 @@ _init_equipment_removal(transformation_type form) else if (!form_can_wear_item(*pitem, form)) result.insert(eq); } - return (result); + return result; } static void _remove_equipment(const std::set<equipment_type>& removed, @@ -268,7 +268,7 @@ static bool _mutations_prevent_wearing(const item_def& item) || player_mutation_level(MUT_ANTENNAE) || player_mutation_level(MUT_BEAK))) { - return (true); + return true; } // Barding is excepted here. @@ -276,19 +276,19 @@ static bool _mutations_prevent_wearing(const item_def& item) && (player_mutation_level(MUT_HOOVES) >= 3 || player_mutation_level(MUT_TALONS) >= 3)) { - return (true); + return true; } if (eqslot == EQ_GLOVES && player_mutation_level(MUT_CLAWS) >= 3) - return (true); + return true; if (eqslot == EQ_HELMET && (player_mutation_level(MUT_HORNS) == 3 || player_mutation_level(MUT_ANTENNAE) == 3)) { - return (true); + return true; } - return (false); + return false; } static void _unmeld_equipment_type(equipment_type e) @@ -386,9 +386,9 @@ static bool _abort_or_fizzle(bool just_check) { canned_msg(MSG_SPELL_FIZZLES); move_player_to_grid(you.pos(), false, true); - return (true); // pay the necessary costs + return true; // pay the necessary costs } - return (false); // SPRET_ABORT + return false; // SPRET_ABORT } monster_type transform_mons() @@ -506,19 +506,19 @@ bool feat_dangerous_for_form(transformation_type which_trans, { // Everything is okay if we can fly. if (form_can_fly(which_trans) || _levitating_in_new_form(which_trans)) - return (false); + return false; // We can only cling for safety if we're already doing so. if (which_trans == TRAN_SPIDER && you.is_wall_clinging()) - return (false); + return false; if (feat == DNGN_LAVA) - return (true); + return true; if (feat == DNGN_DEEP_WATER) return (!form_likes_water(which_trans) && !beogh_water_walk()); - return (false); + return false; } static mutation_type appendages[] = @@ -583,14 +583,14 @@ static bool _transformation_is_safe(transformation_type which_trans, dungeon_feature_type feat, bool quiet) { if (!feat_dangerous_for_form(which_trans, feat)) - return (true); + return true; if (!quiet) { mprf("You would %s in your new form.", feat == DNGN_DEEP_WATER ? "drown" : "burn"); } - return (false); + return false; } static int _transform_duration(transformation_type which_trans, int pow) @@ -634,7 +634,7 @@ bool transform(int pow, transformation_type which_trans, bool force, && x_chance_in_y(you.piety, MAX_PIETY) && which_trans != TRAN_NONE) { simple_god_message(" protects your body from unnatural transformation!"); - return (false); + return false; } if (!force && crawl_state.is_god_acting()) @@ -645,11 +645,11 @@ bool transform(int pow, transformation_type which_trans, bool force, // Jiyva's wrath-induced transformation is blocking the attempt. // May need to be updated if transform_uncancellable is used for // other uses. - return (false); + return false; } if (!_transformation_is_safe(which_trans, env.grid(you.pos()), force)) - return (false); + return false; // This must occur before the untransform() and the is_undead check. if (previous_trans == which_trans) @@ -658,7 +658,7 @@ bool transform(int pow, transformation_type which_trans, bool force, if (you.duration[DUR_TRANSFORMATION] < dur * BASELINE_DELAY) { if (just_check) - return (true); + return true; if (which_trans == TRAN_PIG) mpr("You feel you'll be a pig longer."); @@ -666,13 +666,13 @@ bool transform(int pow, transformation_type which_trans, bool force, mpr("You extend your transformation's duration."); you.duration[DUR_TRANSFORMATION] = dur * BASELINE_DELAY; - return (true); + return true; } else { if (!force && which_trans != TRAN_PIG && which_trans != TRAN_NONE) mpr("You fail to extend your transformation any further."); - return (false); + return false; } } @@ -832,7 +832,7 @@ bool transform(int pow, transformation_type which_trans, bool force, // If we're just pretending return now. if (just_check) - return (true); + return true; // Switching between forms takes a bit longer. if (!force && previous_trans != TRAN_NONE && previous_trans != which_trans) @@ -991,7 +991,7 @@ bool transform(int pow, transformation_type which_trans, bool force, move_player_to_grid(you.pos(), false, true); } - return (true); + return true; } void untransform(bool skip_wielding, bool skip_move) diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index 401b803114..02c907f720 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -63,11 +63,11 @@ bool trap_def::type_has_ammo() const { case TRAP_DART: case TRAP_ARROW: case TRAP_BOLT: case TRAP_NEEDLE: case TRAP_SPEAR: - return (true); + return true; default: break; } - return (false); + return false; } void trap_def::disarm() @@ -170,7 +170,7 @@ std::string trap_def::name(description_level_type desc) const else if (desc == DESC_THE) return (std::string("the ") + basename); else // everything else - return (basename); + return basename; } bool trap_def::is_known(const actor* act) const @@ -178,7 +178,7 @@ bool trap_def::is_known(const actor* act) const const bool player_knows = (grd(pos) != DNGN_UNDISCOVERED_TRAP); if (act == NULL || act->is_player()) - return (player_knows); + return player_knows; else if (act->is_monster()) { const monster* mons = act->as_monster(); @@ -286,7 +286,7 @@ int get_trapping_net(const coord_def& where, bool trapped) return (si->index()); } } - return (NON_ITEM); + return NON_ITEM; } // If there are more than one net on this square @@ -388,12 +388,12 @@ void monster_caught_in_net(monster* mon, bolt &pbolt) bool player_caught_in_net() { if (you.body_size(PSIZE_BODY) >= SIZE_GIANT) - return (false); + return false; if (you.flight_mode() == FL_FLY && (!you.confused() || one_chance_in(3))) { mpr("You dart out from under the net!"); - return (false); + return false; } if (!you.attribute[ATTR_HELD]) @@ -412,9 +412,9 @@ bool player_caught_in_net() stop_delay(true); // even stair delays redraw_screen(); // Account for changes in display. - return (true); + return true; } - return (false); + return false; } void check_net_will_hold_monster(monster* mons) @@ -467,7 +467,7 @@ static bool _player_caught_in_web() you.attribute[ATTR_HELD] = 10; // No longer stop_running() and stop_delay(). redraw_screen(); // Account for changes in display. - return (true); + return true; } std::vector<coord_def> find_golubria_on_level() @@ -1049,7 +1049,7 @@ int trap_def::max_damage(const actor& act) default: return 0; } - return (0); + return 0; } int trap_def::shot_damage(actor& act) @@ -1113,7 +1113,7 @@ int reveal_traps(const int range) } } - return (traps_found); + return traps_found; } void destroy_trap(const coord_def& pos) @@ -1125,7 +1125,7 @@ void destroy_trap(const coord_def& pos) trap_def* find_trap(const coord_def& pos) { if (!feat_is_trap(grd(pos), true)) - return (NULL); + return NULL; unsigned short t = env.tgrid(pos); @@ -1140,7 +1140,7 @@ trap_type get_trap_type(const coord_def& pos) if (trap_def* ptrap = find_trap(pos)) return (ptrap->type); - return (TRAP_UNASSIGNED); + return TRAP_UNASSIGNED; } static bool _disarm_is_deadly(trap_def& trap) @@ -1376,7 +1376,7 @@ static int damage_or_escape_net(int hold) if (damage >= escape) return (-damage); // negate value - return (escape); + return escape; } // Calls the above function to decide on how to get free. @@ -1696,15 +1696,15 @@ dungeon_feature_type trap_category(trap_type type) switch (type) { case TRAP_WEB: - return (DNGN_TRAP_WEB); + return DNGN_TRAP_WEB; case TRAP_SHAFT: - return (DNGN_TRAP_NATURAL); + return DNGN_TRAP_NATURAL; case TRAP_TELEPORT: case TRAP_ALARM: case TRAP_ZOT: case TRAP_GOLUBRIA: - return (DNGN_TRAP_MAGICAL); + return DNGN_TRAP_MAGICAL; case TRAP_DART: case TRAP_ARROW: @@ -1715,7 +1715,7 @@ dungeon_feature_type trap_category(trap_type type) case TRAP_NET: case TRAP_GAS: case TRAP_PLATE: - return (DNGN_TRAP_MECHANICAL); + return DNGN_TRAP_MECHANICAL; default: die("placeholder trap type %d used", type); @@ -1728,16 +1728,16 @@ bool is_valid_shaft_level(const level_id &place) || crawl_state.game_is_sprint() || crawl_state.game_is_zotdef()) { - return (false); + return false; } if (!is_connected_branch(place)) - return (false); + return false; // Shafts are now allowed on the first two levels, as they have a // good chance of being detected. You'll also fall less deep. /* if (place == BRANCH_MAIN_DUNGEON && you.depth < 3) - return (false); */ + return false; */ // Don't generate shafts in branches where teleport control // is prevented. Prevents player from going down levels without @@ -1745,7 +1745,7 @@ bool is_valid_shaft_level(const level_id &place) // on lower levels with the innability to use teleport control to // get back up. if (testbits(env.level_flags, LFLAG_NO_TELE_CONTROL)) - return (false); + return false; const Branch &branch = branches[place.branch]; @@ -1905,7 +1905,7 @@ static trap_type _random_trap_slime(int level_number) if (one_chance_in(10)) type = TRAP_ALARM; - return (type); + return type; } static trap_type _random_trap_default(int level_number) @@ -1944,7 +1944,7 @@ static trap_type _random_trap_default(int level_number) if (one_chance_in(40)) type = TRAP_ALARM; - return (type); + return type; } trap_type random_trap_for_place() diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 7d32253022..73f56d6a37 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -158,7 +158,7 @@ bool deviant_route_warning::warn_continue_travel( { // We've already prompted, don't ask again, on the player's head be it. if (target == dest && warned) - return (true); + return true; target = dest; const std::string prompt = @@ -196,7 +196,7 @@ static inline bool _is_safe_cloud(const coord_def& c) { const int cloud = env.cgrid(c); if (cloud == EMPTY_CLOUD) - return (true); + return true; // We can also safely run through smoke. const cloud_type ctype = env.cloud[cloud].type; @@ -231,11 +231,11 @@ bool feat_is_traversable_now(dungeon_feature_type grid) { // If the feature is in travel_avoid_terrain, respect that. if (forbidden_terrain[grid]) - return (false); + return false; // Swimmers get deep water. if (grid == DNGN_DEEP_WATER && player_likes_water(true)) - return (true); + return true; // Permanently levitating players can cross most hostile terrain. if (grid == DNGN_DEEP_WATER || grid == DNGN_LAVA @@ -289,7 +289,7 @@ uint8_t is_waypoint(const coord_def &p) inline bool is_stash(const LevelStashes *ls, const coord_def& p) { if (!ls) - return (false); + return false; const Stash *s = ls->find_stash(p); return s && s->enabled; @@ -319,7 +319,7 @@ static bool _monster_blocks_travel(const monster_info *mons) static bool _is_reseedable(const coord_def& c, bool ignore_danger = false) { if (!ignore_danger && is_excluded(c)) - return (true); + return true; map_cell &cell(env.map_knowledge(c)); const dungeon_feature_type grid = cell.feat(); @@ -382,7 +382,7 @@ public: bool is_stair_exclusion(const coord_def &p) { if (feat_stair_direction(env.map_knowledge(p).feat()) == CMD_NO_CMD) - return (false); + return false; return (get_exclusion_radius(p) == 1); } @@ -394,7 +394,7 @@ static bool _is_travelsafe_square(const coord_def& c, bool ignore_hostile, bool ignore_danger) { if (!in_bounds(c)) - return (false); + return false; if (_travel_safe_grid.get()) { @@ -404,7 +404,7 @@ static bool _is_travelsafe_square(const coord_def& c, bool ignore_hostile, } if (!env.map_knowledge(c).known()) - return (false); + return false; const dungeon_feature_type grid = env.map_knowledge(c).feat(); @@ -418,23 +418,23 @@ static bool _is_travelsafe_square(const coord_def& c, bool ignore_hostile, { const monster_info *minfo = levelmap_cell.monsterinfo(); if (minfo && _monster_blocks_travel(minfo)) - return (false); + return false; } // If 'ignore_hostile' is true, we're ignoring hazards that can be // navigated over if the player is willing to take damage, or levitate. if (ignore_hostile && _is_reseedable(c, true)) - return (true); + return true; // Excluded squares are only safe if marking stairs, i.e. another level. if (!ignore_danger && is_excluded(c) && !is_stair_exclusion(c)) - return (false); + return false; if (g_Slime_Wall_Check && slime_wall_neighbour(c)) - return (false); + return false; if (!_is_safe_cloud(c)) - return (false); + return false; if (is_trap(c)) { @@ -464,7 +464,7 @@ static bool _is_safe_move(const coord_def& c) && !fedhas_passthrough(mon) && !travel_kill_monster(mon->type)) { - return (false); + return false; } // If this is any *other* monster, it'll be visible and @@ -508,9 +508,9 @@ void travel_init_new_level() static int _get_feature_type(const std::string &feature) { if (feature.find("deep water") != std::string::npos) - return (DNGN_DEEP_WATER); + return DNGN_DEEP_WATER; if (feature.find("shallow water") != std::string::npos) - return (DNGN_SHALLOW_WATER); + return DNGN_SHALLOW_WATER; return -1; } @@ -605,7 +605,7 @@ static bool _is_valid_explore_target(const coord_def& where) los.update(); for (radius_iterator ri(&los, true); ri; ++ri) if (!env.map_knowledge(*ri).seen()) - return (true); + return true; if (you.running == RMODE_EXPLORE_GREEDY) { @@ -613,7 +613,7 @@ static bool _is_valid_explore_target(const coord_def& where) return (lev && lev->needs_visit(where)); } - return (false); + return false; } enum explore_status_type @@ -641,7 +641,7 @@ static int _find_explore_status(const travel_pathfind &tp) if (unexplored.x || unexplored.y || !tp.get_unreachables().empty()) explore_status |= EST_PARTLY_EXPLORED; - return (explore_status); + return explore_status; } static int prev_travel_moves[2] = {-1, -1}; @@ -876,7 +876,7 @@ command_type travel() if (lev && lev->shop_needs_visit(you.pos())) { you.running = 0; - return (CMD_GO_UPSTAIRS); + return CMD_GO_UPSTAIRS; } } @@ -971,7 +971,7 @@ command_type travel() // notify Lua hooks if you.running == 0. you.running = runmode; stop_running(); - return (CMD_NO_CMD); + return CMD_NO_CMD; } // Check for entrance-only thang. If we've reached the @@ -986,7 +986,7 @@ command_type travel() { you.running = runmode; stop_running(); - return (CMD_NO_CMD); + return CMD_NO_CMD; } } @@ -1151,7 +1151,7 @@ void travel_pathfind::set_feature_vector(std::vector<coord_def> *feats) const coord_def travel_pathfind::travel_move() const { - return (next_travel_move); + return next_travel_move; } const coord_def travel_pathfind::explore_target() const @@ -1162,21 +1162,21 @@ const coord_def travel_pathfind::explore_target() const : greedy_place); } else if (unexplored_dist != UNFOUND_DIST) - return (unexplored_place); + return unexplored_place; else if (greedy_dist != UNFOUND_DIST) - return (greedy_place); + return greedy_place; return coord_def(0, 0); } const coord_def travel_pathfind::greedy_square() const { - return (greedy_place); + return greedy_place; } const coord_def travel_pathfind::unexplored_square() const { - return (unexplored_place); + return unexplored_place; } // The travel algorithm is based on the NetHack travel code written by Warwick @@ -1242,7 +1242,7 @@ coord_def travel_pathfind::pathfind(run_mode_type rmode) // Nothing to do? if (!floodout && start == dest) - return (start); + return start; unwind_bool slime_wall_check(g_Slime_Wall_Check, !actor_slime_wall_immune(&you)); @@ -1421,10 +1421,10 @@ bool travel_pathfind::square_slows_movement(const coord_def &c) && point_distance[c.x][c.y] > traveled_distance - feat_cost) { circumference[!circ_index][next_iter_points++] = c; - return (true); + return true; } - return (false); + return false; } void travel_pathfind::check_square_greed(const coord_def &c) @@ -1452,7 +1452,7 @@ void travel_pathfind::check_square_greed(const coord_def &c) bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) { if (!in_bounds(dc) || unreachables.count(dc)) - return (false); + return false; if (floodout && (runmode == RMODE_EXPLORE || runmode == RMODE_EXPLORE_GREEDY)) @@ -1480,7 +1480,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) if (unexplored_dist == 1) { _set_target_square(unexplored_place); - return (true); + return true; } } @@ -1549,7 +1549,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) // greedy_dist is only ever set in greedy-explore so this check // implies greedy-explore. if (unexplored_dist != UNFOUND_DIST && greedy_dist != UNFOUND_DIST) - return (true); + return true; } if (dc == dest) @@ -1558,7 +1558,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) if (_is_safe_move(c)) next_travel_move = c; - return (true); + return true; } else if (!_is_travelsafe_square(dc, ignore_hostile, ignore_danger)) { @@ -1582,7 +1582,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) !_is_safe_cloud(dc) ? PD_CLOUD : PD_TRAP; } - return (false); + return false; } if (!point_distance[dc.x][dc.y]) @@ -1622,7 +1622,7 @@ bool travel_pathfind::path_flood(const coord_def &c, const coord_def &dc) features->push_back(dc); } - return (false); + return false; } void travel_pathfind::good_square(const coord_def &c) @@ -1638,14 +1638,14 @@ void travel_pathfind::good_square(const coord_def &c) bool travel_pathfind::point_traverse_delay(const coord_def &c) { if (square_slows_movement(c)) - return (true); + return true; // Greedy explore check should happen on (x,y), not (dx,dy) as for // regular explore. if (need_for_greed) check_square_greed(c); - return (false); + return false; } // Checks all neighbours of c, adds them to next round's list of points @@ -1655,10 +1655,10 @@ bool travel_pathfind::path_examine_point(const coord_def &c) { // If we've run off the map, or are pathfinding from nowhere in particular if (!in_bounds(c)) - return (false); + return false; if (point_traverse_delay(c)) - return (false); + return false; bool found_target = false; @@ -1669,7 +1669,7 @@ bool travel_pathfind::path_examine_point(const coord_def &c) if (path_flood(c, c + Compass[dir])) found_target = true; - return (found_target); + return found_target; } ///////////////////////////////////////////////////////////////////////////// @@ -1953,11 +1953,11 @@ static bool _is_known_branch_id(branch_type branch) { // The main dungeon is always known if (branch == root_branch) - return (true); + return true; // If we're in the branch, it darn well is known. if (you.where_are_you == branch) - return (true); + return true; // The Vestibule is special: there are no stairs to it, just a // portal. @@ -2076,13 +2076,13 @@ static int _prompt_travel_branch(int prompt_flags, bool* to_entrance) switch (keyin) { CASE_ESCAPE - return (ID_CANCEL); + return ID_CANCEL; case '?': show_interlevel_travel_branch_help(); redraw_screen(); break; case '\n': case '\r': - return (ID_REPEAT); + return ID_REPEAT; case '<': return (allow_updown? ID_UP : ID_CANCEL); case '>': @@ -2097,7 +2097,7 @@ static int _prompt_travel_branch(int prompt_flags, bool* to_entrance) break; case '^': if (*to_entrance) - return (ID_CANCEL); + return ID_CANCEL; else { *to_entrance = true; @@ -2130,7 +2130,7 @@ static int _prompt_travel_branch(int prompt_flags, bool* to_entrance) { msg += "Go there anyway?"; if (!yesno(msg.c_str(), true)) - return (ID_CANCEL); + return ID_CANCEL; } #endif return (br[i]); @@ -2141,7 +2141,7 @@ static int _prompt_travel_branch(int prompt_flags, bool* to_entrance) if (allow_waypoints && keyin >= '0' && keyin <= '9') return (-1 - (keyin - '0')); - return (ID_CANCEL); + return ID_CANCEL; } } } @@ -2161,17 +2161,17 @@ level_id find_up_level(level_id curr, bool up_branch) _find_parent_branch(curr.branch, curr.depth, &parent.branch, &parent.depth); if (parent.depth > 0) - return (parent); + return parent; else if (curr.branch == BRANCH_VESTIBULE_OF_HELL) { parent = level_id(you.hell_branch, you.hell_exit); - return (parent); + return parent; } } return level_id(); } - return (curr); + return curr; } static level_id _find_up_level() @@ -2183,7 +2183,7 @@ level_id find_down_level(level_id curr) { if (curr.depth < brdepth[curr.branch]) ++curr.depth; - return (curr); + return curr; } level_id find_deepest_explored(level_id curr) @@ -2195,16 +2195,16 @@ level_id find_deepest_explored(level_id curr) const level_id lid(curr.branch, i); LevelInfo *linf = travel_cache.find_level_info(lid); if (linf && !linf->empty()) - return (lid); + return lid; } // If the player's currently in the same place, report their current // level_id if the travel cache hasn't been updated. const level_id player_level = level_id::current(); if (player_level == curr.branch) - return (player_level); + return player_level; - return (curr); + return curr; } bool branch_entered(branch_type branch) @@ -2230,7 +2230,7 @@ static int _travel_depth_keyfilter(int &c) c = '-'; // Make uniform. return (-1); default: - return (1); + return 1; } } @@ -2256,7 +2256,7 @@ static travel_target _parse_travel_target(std::string s, travel_target &targ) targ.entrance_only = true; } - return (targ); + return targ; } static void _travel_depth_munge(int munge_method, const std::string &s, @@ -2326,10 +2326,10 @@ static travel_target _prompt_travel_depth(const level_id &id, bool travel_kill_monster(monster_type mons) { if (mons != MONS_TOADSTOOL) - return (false); + return false; if (!wielded_weapon_check(you.weapon(), true)) - return (false); + return false; // Don't auto-kill things with berserkitis or *rage. if (player_mutation_level(MUT_BERSERK) @@ -2340,15 +2340,15 @@ bool travel_kill_monster(monster_type mons) || you.is_undead == US_UNDEAD || you.is_undead == US_HUNGRY_DEAD) { - return (true); + return true; } else { - return (false); + return false; } } - return (true); + return true; } travel_target prompt_translevel_target(int prompt_flags, @@ -2360,18 +2360,18 @@ travel_target prompt_translevel_target(int prompt_flags, const bool remember_targ = (prompt_flags & TPF_REMEMBER_TARGET); if (branch == ID_CANCEL) - return (target); + return target; // If user chose to repeat last travel, return that. if (branch == ID_REPEAT) - return (level_target); + return level_target; if (branch == ID_UP) { target.p = _find_up_level(); if (target.p.id.depth > 0 && remember_targ) dest_name = _get_trans_travel_dest(target); - return (target); + return target; } if (branch == ID_DOWN) @@ -2379,7 +2379,7 @@ travel_target prompt_translevel_target(int prompt_flags, target.p = _find_down_level(); if (target.p.id.depth > 0 && remember_targ) dest_name = _get_trans_travel_dest(target); - return (target); + return target; } if (branch < 0) @@ -2387,7 +2387,7 @@ travel_target prompt_translevel_target(int prompt_flags, target = travel_cache.get_waypoint(-branch - 1); if (target.p.id.depth > 0 && remember_targ) dest_name = _get_trans_travel_dest(target); - return (target); + return target; } target.p.id.branch = static_cast<branch_type>(branch); @@ -2740,7 +2740,7 @@ static bool _loadlev_populate_stair_distances(const level_pos &target) level_excursion excursion; excursion.go_to(target.id); _populate_stair_distances(target); - return (true); + return true; } static void _populate_stair_distances(const level_pos &target) @@ -2811,13 +2811,13 @@ static bool _find_transtravel_square(const level_pos &target, bool verbose) level_target, dest_stair->destination.id)) { - return (false); + return false; } } } you.running.pos = best_stair; - return (true); + return true; } else if (best_level_distance != -1 && closest_level != current && target.pos.x == -1) @@ -2841,7 +2841,7 @@ static bool _find_transtravel_square(const level_pos &target, bool verbose) } } - return (false); + return false; } void start_travel(const coord_def& p) @@ -3011,7 +3011,7 @@ level_id level_id::from_packed_place(unsigned short place) id.branch = (branch_type) place_branch(place); id.depth = place_depth(place); - return (id); + return id; } void level_id::save(writer& outf) const @@ -3272,7 +3272,7 @@ bool LevelInfo::know_stair(const coord_def &c) const { const int index = get_stair_index(c); if (index == -1) - return (false); + return false; const level_pos &lp = stairs[index].destination; return (lp.is_valid()); @@ -3408,9 +3408,9 @@ bool LevelInfo::is_known_branch(uint8_t branch) const { for (int i = 0, count = stairs.size(); i < count; ++i) if (stairs[i].destination.id.branch == branch) - return (true); + return true; - return (false); + return false; } void LevelInfo::save(writer& outf) const @@ -3682,9 +3682,9 @@ bool TravelCache::is_known_branch(uint8_t branch) const std::map<level_id, LevelInfo>::const_iterator i = levels.begin(); for (; i != levels.end(); ++i) if (i->second.is_known_branch(branch)) - return (true); + return true; - return (false); + return false; } void TravelCache::save(writer& outf) const @@ -3769,7 +3769,7 @@ unsigned int TravelCache::query_da_counter(daction_type c) for (; i != levels.end(); ++i) sum += i->second.da_counters[c]; - return (sum); + return sum; } void TravelCache::clear_da_counter(daction_type c) @@ -3794,7 +3794,7 @@ std::vector<level_id> TravelCache::known_levels() const for (; i != levels.end(); ++i) levs.push_back(i->first); - return (levs); + return levs; } bool can_travel_to(const level_id &id) @@ -3854,7 +3854,7 @@ void runrest::initialise(int dir, int mode) runrest::operator int () const { - return (runmode); + return runmode; } const runrest &runrest::operator = (int newrunmode) @@ -3867,9 +3867,9 @@ static dungeon_feature_type _base_feat_type(dungeon_feature_type grid) { // Merge walls. if (feat_is_wall(grid)) - return (DNGN_ROCK_WALL); + return DNGN_ROCK_WALL; - return (grid); + return grid; } void runrest::set_run_check(int index, int dir) @@ -3885,9 +3885,9 @@ bool runrest::check_stop_running() if (runmode > 0 && runmode != RMODE_START && run_should_stop()) { stop(); - return (true); + return true; } - return (false); + return false; } // This function creates "equivalence classes" so that changes @@ -3898,7 +3898,7 @@ bool runrest::run_should_stop() const const map_cell& tcell = env.map_knowledge(targ); if (tcell.cloud() != CLOUD_NONE) - return (true); + return true; if (is_excluded(targ)) { @@ -3906,16 +3906,16 @@ bool runrest::run_should_stop() const // XXX: Remove this once exclusions are visible. mprf(MSGCH_WARN, "Stopped running for exclusion."); #endif - return (true); + return true; } const monster_info* mon = tcell.monsterinfo(); if (mon && !fedhas_passthrough(tcell.monsterinfo())) - return (true); + return true; for (adjacent_iterator ai(targ); ai; ++ai) if (env.grid(*ai) == DNGN_SLIMY_WALL) - return (true); + return true; for (int i = 0; i < 3; i++) { @@ -3924,10 +3924,10 @@ bool runrest::run_should_stop() const _base_feat_type(env.map_knowledge(p).feat()); if (run_check[i].grid != feat) - return (true); + return true; } - return (false); + return false; } void runrest::stop() @@ -3970,9 +3970,9 @@ bool runrest::is_any_travel() const case RMODE_EXPLORE_GREEDY: case RMODE_EXPLORE: case RMODE_TRAVEL: - return (true); + return true; default: - return (false); + return false; } } @@ -4028,7 +4028,7 @@ std::string explore_discoveries::cleaned_feature_description( s = s.substr(2); else if (s.find("an ") != std::string::npos) s = s.substr(3); - return (s); + return s; } bool explore_discoveries::merge_feature( @@ -4039,10 +4039,10 @@ bool explore_discoveries::merge_feature( if (feat == v[i]) { ++v[i].thing; - return (true); + return true; } - return (false); + return false; } void explore_discoveries::found_feature(const coord_def &pos, @@ -4200,10 +4200,10 @@ template <class citer> bool explore_discoveries::has_duplicates( for (citer z = s + 1; z != end; ++z) { if (*s == *z) - return (true); + return true; } - return (false); + return false; } template <class C> void explore_discoveries::say_any( @@ -4255,7 +4255,7 @@ std::vector<std::string> explore_discoveries::apply_quantities( + pluralise(nt.name, feature_plural_qualifiers)); } } - return (things); + return things; } bool explore_discoveries::prompt_stop() const @@ -4269,7 +4269,7 @@ bool explore_discoveries::prompt_stop() const mprf("Found %s", marked_feats[i].c_str()); if (!es_flags) - return (marker_stop); + return marker_stop; say_any(items, "item"); say_any(shops, "shop"); diff --git a/crawl-ref/source/version.cc b/crawl-ref/source/version.cc index c4de86dbaa..5b7907322d 100644 --- a/crawl-ref/source/version.cc +++ b/crawl-ref/source/version.cc @@ -83,5 +83,5 @@ std::string compilation_info() out += make_stringf("CLFAGS: %s\n", Version::CFLAGS().c_str()); out += make_stringf("LDFLAGS: %s\n", Version::LDFLAGS().c_str()); - return (out); + return out; } diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 263cf8da83..197211937e 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -458,7 +458,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, if (!suppress_msg) canned_msg(MSG_DISORIENTED); - return (false); + return false; } const bool wizard_map = (you.wizard && map_radius == 1000); @@ -588,7 +588,7 @@ bool magic_mapping(int map_radius, int proportion, bool suppress_msg, mpr_comma_separated_list("You sensed ", sensed); } - return (did_map); + return did_map; } void fully_map_level() @@ -614,7 +614,7 @@ void fully_map_level() bool mons_near(const monster* mons) { if (crawl_state.game_is_arena() || crawl_state.arena_suspended) - return (true); + return true; return (you.see_cell(mons->pos())); } @@ -622,13 +622,13 @@ bool mon_enemies_around(const monster* mons) { // If the monster has a foe, return true. if (mons->foe != MHITNOT && mons->foe != MHITYOU) - return (true); + return true; if (crawl_state.game_is_arena()) { // If the arena-mode code in _handle_behaviour() hasn't set a foe then // we don't have one. - return (false); + return false; } else if (mons->wont_attack()) { @@ -698,11 +698,11 @@ std::string screenshot() int viewmap_flash_colour() { if (you.attribute[ATTR_SHADOWS]) - return (LIGHTGREY); + return LIGHTGREY; else if (you.berserk()) - return (RED); + return RED; - return (BLACK); + return BLACK; } // Updates one square of the view area. Should only be called for square @@ -770,9 +770,9 @@ bool view_update() if (you.num_turns > you.last_view_update) { viewwindow(); - return (true); + return true; } - return (false); + return false; } void flash_view(colour_t colour, targetter *where) @@ -900,7 +900,7 @@ static int player_view_update_at(const coord_def &gc) env.tile_bk_bg(gc) = env.tile_bg(ep); #endif - return (ret); + return ret; } static void player_view_update() diff --git a/crawl-ref/source/viewchar.cc b/crawl-ref/source/viewchar.cc index 884fb89966..36c3cee4a1 100644 --- a/crawl-ref/source/viewchar.cc +++ b/crawl-ref/source/viewchar.cc @@ -108,7 +108,7 @@ dungeon_char_type dchar_by_name(const std::string &name) if (dchar_names[i] == name) return dungeon_char_type(i); - return (NUM_DCHAR_TYPES); + return NUM_DCHAR_TYPES; } void init_char_table(char_set_type set) @@ -131,7 +131,7 @@ ucs_t dchar_glyph(dungeon_char_type dchar) if (dchar >= 0 && dchar < NUM_DCHAR_TYPES) return (Options.char_table[dchar]); else - return (0); + return 0; } std::string stringize_glyph(ucs_t glyph) diff --git a/crawl-ref/source/viewgeom.cc b/crawl-ref/source/viewgeom.cc index 77f0b724ad..1ae15d934e 100644 --- a/crawl-ref/source/viewgeom.cc +++ b/crawl-ref/source/viewgeom.cc @@ -95,7 +95,7 @@ class _inline_layout : public _layout { // x: View gets leftover; then mlist; then hud gutter if (leftover_x() < 0) - return (false); + return false; _increment(viewsz.x, leftover_x(), Options.view_max_width); @@ -113,7 +113,7 @@ class _inline_layout : public _layout // msg expands as much as it wants. // mlist gets any leftovers. if (leftover_y() < 0) - return (false); + return false; _increment(viewsz.y, leftover_leftcol_y(), Options.view_max_height); if ((viewsz.y % 2) != 1) @@ -139,7 +139,7 @@ class _inline_layout : public _layout mlistp = hudp + coord_def(0, hudsz.y); _assert_validity(); - return (true); + return true; } int leftover_x() const @@ -173,7 +173,7 @@ class _mlist_col_layout : public _layout // x: View and mlist share leftover; then hud gutter. if (leftover_x() < 0) - return (false); + return false; _increment(mlistsz.x, leftover_x()/2, MLIST_MAX_WIDTH); _increment(viewsz.x, leftover_x(), Options.view_max_width); @@ -187,7 +187,7 @@ class _mlist_col_layout : public _layout // y: View gets leftover; then message. if (leftover_y() < 0) - return (false); + return false; _increment(viewsz.y, leftover_y(), Options.view_max_height); @@ -204,7 +204,7 @@ class _mlist_col_layout : public _layout hudp = viewp + coord_def(viewsz.x+hud_gutter, 0); _assert_validity(); - return (true); + return true; } private: int leftover_x() const diff --git a/crawl-ref/source/viewgeom.h b/crawl-ref/source/viewgeom.h index 9da575ccae..c0eeb094c9 100644 --- a/crawl-ref/source/viewgeom.h +++ b/crawl-ref/source/viewgeom.h @@ -24,8 +24,8 @@ public: void resize(const coord_def &sz); bool empty() const; - operator screen_cell_t * () { return (m_buffer); } - operator const screen_cell_t * () const { return (m_buffer); } + operator screen_cell_t * () { return m_buffer; } + operator const screen_cell_t * () const { return m_buffer; } const crawl_view_buffer & operator = (const crawl_view_buffer &rhs); void clear(); diff --git a/crawl-ref/source/viewmap.cc b/crawl-ref/source/viewmap.cc index a3987c683c..7639a50dde 100644 --- a/crawl-ref/source/viewmap.cc +++ b/crawl-ref/source/viewmap.cc @@ -48,7 +48,7 @@ static unsigned _get_travel_colour(const coord_def& p) { #ifdef WIZARD if (you.wizard && testbits(env.pgrid(p), FPROP_HIGHLIGHT)) - return (LIGHTGREEN); + return LIGHTGREEN; #endif if (is_waypoint(p)) @@ -69,10 +69,10 @@ static bool _travel_colour_override(const coord_def& p) { if (is_waypoint(p) || is_stair_exclusion(p) || travel_point_distance[p.x][p.y] == PD_EXCLUDED) - return (true); + return true; #ifdef WIZARD if (you.wizard && testbits(env.pgrid(p), FPROP_HIGHLIGHT)) - return (true); + return true; #endif // [ds] Elaborate dance to get map colouring right if @@ -141,7 +141,7 @@ static ucs_t _get_magicmap_char(dungeon_feature_type feat) bool is_feature(ucs_t feature, const coord_def& where) { if (!env.map_knowledge(where).known() && !you.see_cell(where)) - return (false); + return false; dungeon_feature_type grid = grid_appearance(where); @@ -175,9 +175,9 @@ bool is_feature(ucs_t feature, const coord_def& where) case DNGN_ALTAR_FEDHAS: case DNGN_ALTAR_CHEIBRIADOS: case DNGN_ALTAR_ASHENZARI: - return (true); + return true; default: - return (false); + return false; } case '\t': case '\\': @@ -201,9 +201,9 @@ bool is_feature(ucs_t feature, const coord_def& where) case DNGN_TRANSIT_PANDEMONIUM: case DNGN_ENTER_ZOT: case DNGN_RETURN_FROM_ZOT: - return (true); + return true; default: - return (false); + return false; } case '<': switch (grid) @@ -229,9 +229,9 @@ bool is_feature(ucs_t feature, const coord_def& where) case DNGN_RETURN_FROM_SPIDER_NEST: case DNGN_RETURN_FROM_FOREST: case DNGN_EXIT_PORTAL_VAULT: - return (true); + return true; default: - return (false); + return false; } case '>': switch (grid) @@ -255,9 +255,9 @@ bool is_feature(ucs_t feature, const coord_def& where) case DNGN_ENTER_SHOALS: case DNGN_ENTER_SPIDER_NEST: case DNGN_ENTER_FOREST: - return (true); + return true; default: - return (false); + return false; } case '^': switch (grid) @@ -266,9 +266,9 @@ bool is_feature(ucs_t feature, const coord_def& where) case DNGN_TRAP_MAGICAL: case DNGN_TRAP_NATURAL: case DNGN_TRAP_WEB: - return (true); + return true; default: - return (false); + return false; } default: return get_cell_glyph(where).ch == feature; @@ -278,10 +278,10 @@ bool is_feature(ucs_t feature, const coord_def& where) static bool _is_feature_fudged(ucs_t feature, const coord_def& where) { if (!env.map_knowledge(where).known()) - return (false); + return false; if (is_feature(feature, where)) - return (true); + return true; if (feature == '<') { @@ -292,9 +292,9 @@ static bool _is_feature_fudged(ucs_t feature, const coord_def& where) case DNGN_EXIT_ABYSS: case DNGN_EXIT_PANDEMONIUM: case DNGN_RETURN_FROM_ZOT: - return (true); + return true; default: - return (false); + return false; } } else if (feature == '>') @@ -307,13 +307,13 @@ static bool _is_feature_fudged(ucs_t feature, const coord_def& where) case DNGN_ENTER_TARTARUS: case DNGN_TRANSIT_PANDEMONIUM: case DNGN_ENTER_ZOT: - return (true); + return true; default: - return (false); + return false; } } - return (false); + return false; } static int _find_feature(ucs_t feature, int curs_x, int curs_y, @@ -1279,7 +1279,7 @@ bool show_map(level_pos &lpos, #endif redraw_screen(); - return (chose); + return chose; } bool emphasise(const coord_def& where) diff --git a/crawl-ref/source/windowmanager-sdl.cc b/crawl-ref/source/windowmanager-sdl.cc index 90475704f0..c93937d9d1 100644 --- a/crawl-ref/source/windowmanager-sdl.cc +++ b/crawl-ref/source/windowmanager-sdl.cc @@ -41,18 +41,18 @@ static unsigned char _get_modifiers(SDL_keysym &keysym) { case SDLK_LSHIFT: case SDLK_RSHIFT: - return (MOD_SHIFT); + return MOD_SHIFT; break; case SDLK_LCTRL: case SDLK_RCTRL: - return (MOD_CTRL); + return MOD_CTRL; break; case SDLK_LALT: case SDLK_RALT: - return (MOD_ALT); + return MOD_ALT; break; default: - return (0); + return 0; } } @@ -110,7 +110,7 @@ static int _translate_keysym(SDL_keysym &keysym) case SDLK_MODE: case SDLK_COMPOSE: // Don't handle these. - return (0); + return 0; case SDLK_F1: case SDLK_F2: @@ -245,7 +245,7 @@ int SDLWrapper::init(coord_def *m_windowsz) if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) != 0) { printf("Failed to initialise SDL: %s\n", SDL_GetError()); - return (false); + return false; } video_info = SDL_GetVideoInfo(); @@ -307,10 +307,10 @@ int SDLWrapper::init(coord_def *m_windowsz) if (!m_context) { printf("Failed to set video mode: %s\n", SDL_GetError()); - return (false); + return false; } - return (true); + return true; } int SDLWrapper::screen_width() const @@ -325,12 +325,12 @@ int SDLWrapper::screen_height() const int SDLWrapper::desktop_width() const { - return (_desktop_width); + return _desktop_width; } int SDLWrapper::desktop_height() const { - return (_desktop_height); + return _desktop_height; } void SDLWrapper::set_window_title(const char *title) @@ -344,11 +344,11 @@ bool SDLWrapper::set_window_icon(const char* icon_name) if (!surf) { printf("Failed to load icon: %s\n", SDL_GetError()); - return (false); + return false; } SDL_WM_SetIcon(surf, NULL); SDL_FreeSurface(surf); - return (true); + return true; } #ifdef TARGET_OS_WINDOWS @@ -466,7 +466,7 @@ int SDLWrapper::wait_event(wm_event *event) { SDL_Event sdlevent; if (!SDL_WaitEvent(&sdlevent)) - return (0); + return 0; // translate the SDL_Event into the almost-analogous wm_event switch (sdlevent.type) @@ -530,7 +530,7 @@ int SDLWrapper::wait_event(wm_event *event) break; } - return (1); + return 1; } void SDLWrapper::set_timer(unsigned int interval, wm_timer_callback callback) @@ -603,7 +603,7 @@ unsigned int SDLWrapper::get_event_count(wm_event_type type) default: // Error - return (0); + return 0; } SDL_Event store; @@ -628,7 +628,7 @@ bool SDLWrapper::load_texture(GenericTexture *tex, const char *filename, if (tex_path.c_str()[0] == 0) { fprintf(stderr, "Couldn't find texture '%s'.\n", filename); - return (false); + return false; } SDL_Surface *img = load_image(tex_path.c_str()); @@ -636,7 +636,7 @@ bool SDLWrapper::load_texture(GenericTexture *tex, const char *filename, if (!img) { fprintf(stderr, "Couldn't load texture '%s'.\n", tex_path.c_str()); - return (false); + return false; } unsigned int bpp = img->format->BytesPerPixel; @@ -774,7 +774,7 @@ bool SDLWrapper::load_texture(GenericTexture *tex, const char *filename, { printf("Warning: unsupported format, bpp = %d for '%s'\n", bpp, acBuffer); - return (false); + return false; } bool success = false; @@ -790,14 +790,14 @@ bool SDLWrapper::load_texture(GenericTexture *tex, const char *filename, SDL_FreeSurface(img); - return (success); + return success; } int SDLWrapper::byte_order() { if (SDL_BYTEORDER == SDL_BIG_ENDIAN) - return (WM_BIG_ENDIAN); - return (WM_LIL_ENDIAN); + return WM_BIG_ENDIAN; + return WM_LIL_ENDIAN; } SDL_Surface *SDLWrapper::load_image(const char *file) const @@ -816,9 +816,9 @@ SDL_Surface *SDLWrapper::load_image(const char *file) const } if (!surf) - return (NULL); + return NULL; - return (surf); + return surf; } #endif // USE_SDL diff --git a/crawl-ref/source/wiz-dgn.cc b/crawl-ref/source/wiz-dgn.cc index 4574959c0c..7ae857227a 100644 --- a/crawl-ref/source/wiz-dgn.cc +++ b/crawl-ref/source/wiz-dgn.cc @@ -71,7 +71,7 @@ static dungeon_feature_type _find_appropriate_stairs(bool down) mpr("This branch has no exit stairs defined."); return DNGN_UNSEEN; } - return (stairs); + return stairs; } // Branch non-edge cases else if (depth >= 1) @@ -415,7 +415,7 @@ static int find_trap_slot() { for (int i = 0; i < MAX_TRAPS; ++i) if (env.trap[i].type == TRAP_UNASSIGNED) - return (i); + return i; return (-1); } diff --git a/crawl-ref/source/wiz-mon.cc b/crawl-ref/source/wiz-mon.cc index 70fbb22fc7..5af08706c7 100644 --- a/crawl-ref/source/wiz-mon.cc +++ b/crawl-ref/source/wiz-mon.cc @@ -162,7 +162,7 @@ static int _make_mimic_item(object_class_type type) item_colour(item); // also sets special vals for scrolls/potions - return (it); + return it; } // Creates a specific monster by name. Uses the same patterns as @@ -362,7 +362,7 @@ static bool _sort_monster_list(int a, int b) if (m1->type == m2->type) { if (!m1->alive() || !m2->alive()) - return (false); + return false; return (m1->name(DESC_PLAIN, true) < m2->name(DESC_PLAIN, true)); } diff --git a/crawl-ref/source/wiz-you.cc b/crawl-ref/source/wiz-you.cc index 2b14cdd180..c4d8947369 100644 --- a/crawl-ref/source/wiz-you.cc +++ b/crawl-ref/source/wiz-you.cc @@ -537,7 +537,7 @@ bool wizard_add_mutation() if (answer == -1) { canned_msg(MSG_OK); - return (false); + return false; } const bool force = (answer == 1); @@ -545,14 +545,14 @@ bool wizard_add_mutation() { mpr("Can't mutate when immune to mutations without forcing it."); crawl_state.cancel_cmd_repeat(); - return (false); + return false; } answer = yesnoquit("Treat mutation as god gift?", true, 'n'); if (answer == -1) { canned_msg(MSG_OK); - return (false); + return false; } const bool god_gift = (answer == 1); @@ -561,7 +561,7 @@ bool wizard_add_mutation() specs, sizeof(specs)); if (specs[0] == '\0') - return (false); + return false; std::string spec = lowercase_string(specs); @@ -590,7 +590,7 @@ bool wizard_add_mutation() crawl_state.cancel_cmd_repeat("Your mutation resistance has " "increased."); } - return (success); + return success; } std::vector<mutation_type> partial_matches; @@ -638,7 +638,7 @@ bool wizard_add_mutation() MSGCH_DIAGNOSTICS); } - return (false); + return false; } else { @@ -669,7 +669,7 @@ bool wizard_add_mutation() } } - return (success); + return success; } #endif diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index ed936f895f..9a148b4d5f 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -155,7 +155,7 @@ const std::string describe_xom_favour() else favour = describe_xom_mood(); - return (favour); + return favour; } static std::string _get_xom_speech(const std::string key) @@ -168,7 +168,7 @@ static std::string _get_xom_speech(const std::string key) if (result.empty()) return ("Xom makes something happen."); - return (result); + return result; } static bool _xom_is_bored() @@ -186,13 +186,13 @@ static bool _xom_feels_nasty() bool xom_is_nice(int tension) { if (you.penance[GOD_XOM]) - return (false); + return false; if (you.religion == GOD_XOM) { // If you.gift_timeout is 0, then Xom is BORED. He HATES that. if (!you.gift_timeout) - return (false); + return false; // At high tension Xom is more likely to be nice, at zero // tension the opposite. @@ -441,12 +441,12 @@ static int _exploration_estimate(bool seen_only = false, bool debug = false) // If we didn't get any qualifying grids, there are probably so few // of them you've already seen them all. if (total == 0) - return (100); + return 100; if (total < 100) seen *= 100 / total; - return (seen); + return seen; } static bool _spell_weapon_check(const spell_type spell) @@ -464,7 +464,7 @@ static bool _spell_weapon_check(const spell_type spell) case SPELL_WARP_BRAND: { if (!player_weapon_wielded()) - return (false); + return false; // The wielded weapon must be a non-branded non-launcher // non-artefact! @@ -473,7 +473,7 @@ static bool _spell_weapon_check(const spell_type spell) && get_weapon_brand(weapon) == SPWPN_NORMAL); } default: - return (true); + return true; } } @@ -488,7 +488,7 @@ static bool _teleportation_check(const spell_type spell = SPELL_TELEPORT_SELF) case SPELL_TELEPORT_SELF: return !item_blocks_teleport(false, false); default: - return (true); + return true; } } @@ -520,7 +520,7 @@ static bool _transformation_check(const spell_type spell) } if (tran == TRAN_NONE) - return (true); + return true; // Check whether existing enchantments/transformations, cursed // equipment or potential stat loss interfere with this @@ -546,7 +546,7 @@ static int _xom_makes_you_cast_random_spell(int sever, int tension, // You may still get results such as "The spell fizzles" or // "Nothing appears to happen", but those should be rarer now. if (!_spell_weapon_check(spell)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } else { @@ -557,23 +557,23 @@ static int _xom_makes_you_cast_random_spell(int sever, int tension, // Don't attempt to cast spells the undead cannot memorise. if (you_cannot_memorise(spell)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // Don't attempt to teleport the player if the teleportation will // fail. if (!_teleportation_check(spell)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // Don't attempt to transform the player if the transformation will // fail. if (!_transformation_check(spell)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; const int result = (tension > 0 ? XOM_GOOD_SPELL_TENSION : XOM_GOOD_SPELL_CALM); if (debug) - return (result); + return result; god_speaks(GOD_XOM, _get_xom_speech("spell effect").c_str()); @@ -589,7 +589,7 @@ static int _xom_makes_you_cast_random_spell(int sever, int tension, take_note(Note(NOTE_XOM_EFFECT, you.piety, tension, spell_buf), true); your_spells(spell, sever, false); - return (result); + return result; } static int _xom_magic_mapping(int sever, int tension, bool debug = false) @@ -597,10 +597,10 @@ static int _xom_magic_mapping(int sever, int tension, bool debug = false) // If the level is already mostly explored, try something else. const int explored = _exploration_estimate(false, debug); if (explored > 80 && x_chance_in_y(explored, 100)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_GOOD_DIVINATION); + return XOM_GOOD_DIVINATION; god_speaks(GOD_XOM, _get_xom_speech("divination").c_str()); @@ -610,7 +610,7 @@ static int _xom_magic_mapping(int sever, int tension, bool debug = false) const int power = stepdown_value(sever, 10, 10, 40, 45); magic_mapping(5 + power, 50 + random2avg(power * 2, 2), false); - return (XOM_GOOD_DIVINATION); + return XOM_GOOD_DIVINATION; } static int _xom_detect_items(int sever, int tension, bool debug = false) @@ -618,10 +618,10 @@ static int _xom_detect_items(int sever, int tension, bool debug = false) // If the level is already mostly explored, try something else. const int explored = _exploration_estimate(false, debug); if (explored > 80 && x_chance_in_y(explored, 100)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_GOOD_DIVINATION); + return XOM_GOOD_DIVINATION; god_speaks(GOD_XOM, _get_xom_speech("divination").c_str()); @@ -633,13 +633,13 @@ static int _xom_detect_items(int sever, int tension, bool debug = false) else mpr("You detect items!"); - return (XOM_GOOD_DIVINATION); + return XOM_GOOD_DIVINATION; } static int _xom_detect_creatures(int sever, int tension, bool debug = false) { if (debug) - return (XOM_GOOD_DIVINATION); + return XOM_GOOD_DIVINATION; god_speaks(GOD_XOM, _get_xom_speech("divination").c_str()); @@ -663,7 +663,7 @@ static int _xom_detect_creatures(int sever, int tension, bool debug = false) else mpr("You detect creatures!"); - return (XOM_GOOD_DIVINATION); + return XOM_GOOD_DIVINATION; } static int _xom_do_divination(int sever, int tension, bool debug = false) @@ -680,7 +680,7 @@ static int _xom_do_divination(int sever, int tension, bool debug = false) return (_xom_detect_creatures(sever, tension, debug)); } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static void _try_brand_switch(const int item_index) @@ -797,7 +797,7 @@ static int _xom_give_item(int power, bool debug = false) if (x_chance_in_y(power, 201)) { if (debug) - return (XOM_GOOD_ACQUIREMENT); + return XOM_GOOD_ACQUIREMENT; const object_class_type types[] = { OBJ_WEAPONS, OBJ_ARMOUR, OBJ_JEWELLERY, OBJ_BOOKS, @@ -810,14 +810,14 @@ static int _xom_give_item(int power, bool debug = false) else { if (debug) - return (XOM_GOOD_RANDOM_ITEM); + return XOM_GOOD_RANDOM_ITEM; // Random-type random object. _xom_make_item(OBJ_RANDOM, OBJ_RANDOM, power * 3); } more(); - return (XOM_GOOD_RANDOM_ITEM); + return XOM_GOOD_RANDOM_ITEM; } static bool _choose_mutatable_monster(const monster* mon) @@ -832,21 +832,21 @@ static bool _is_chaos_upgradeable(const item_def &item, // Since Xom is a god, he is capable of changing randarts, but not // other artefacts. if (is_unrandom_artefact(item)) - return (false); + return false; // Staves and rods can't be changed either, since they don't have brands // in the way other weapons do. if (item.base_type == OBJ_STAVES || item.base_type == OBJ_RODS) - return (false); + return false; // Only upgrade permanent items, since the player should get a // chance to use the item if he or she can defeat the monster. if (item.flags & ISFLAG_SUMMONED) - return (false); + return false; // Blessed weapons are protected, being gifts from good gods. if (is_blessed(item)) - return (false); + return false; // God gifts from good gods are protected. Also, Beogh hates all // the other gods, so he'll protect his gifts as well. @@ -856,7 +856,7 @@ static bool _is_chaos_upgradeable(const item_def &item, if (iorig > GOD_NO_GOD && iorig < NUM_GODS && (is_good_god(iorig) || iorig == GOD_BEOGH)) { - return (false); + return false; } } @@ -868,11 +868,11 @@ static bool _is_chaos_upgradeable(const item_def &item, if (item.sub_type == MI_LARGE_ROCK || item.sub_type == MI_THROWING_NET) { - return (false); + return false; } if (get_ammo_brand(item) == SPMSL_NORMAL) - return (true); + return true; } else { @@ -883,14 +883,14 @@ static bool _is_chaos_upgradeable(const item_def &item, && (mon->inv[MSLOT_MISSILE] == NON_ITEM || !has_launcher(mitm[mon->inv[MSLOT_MISSILE]]))) { - return (false); + return false; } if (get_weapon_brand(item) == SPWPN_NORMAL) - return (true); + return true; } - return (false); + return false; } static bool _choose_chaos_upgrade(const monster* mon) @@ -899,29 +899,29 @@ static bool _choose_chaos_upgrade(const monster* mon) if (!mon->alive() || mons_attitude(mon) != ATT_HOSTILE || mons_is_fleeing(mon) || mons_is_panicking(mon)) { - return (false); + return false; } if (mons_itemuse(mon) < MONUSE_STARTING_EQUIPMENT) - return (false); + return false; // Holy beings are presumably protected by another god, unless // they're gifts from a chaotic god. if (mon->is_holy() && !is_chaotic_god(mon->god)) - return (false); + return false; // God gifts from good gods will be protected by their god from // being given chaos weapons, while other gods won't mind the help // in their servants' killing the player. if (is_good_god(mon->god)) - return (false); + return false; // Beogh presumably doesn't want Xom messing with his orcs, even if // it would give them a better weapon. if (mons_genus(mon->type) == MONS_ORC && (mon->is_priest() || coinflip())) { - return (false); + return false; } mon_inv_type slots[] = {MSLOT_WEAPON, MSLOT_ALT_WEAPON, MSLOT_MISSILE}; @@ -941,18 +941,18 @@ static bool _choose_chaos_upgrade(const monster* mon) // The monster already has a chaos weapon. Give the upgrade to // a different monster. if (is_chaotic_item(item)) - return (false); + return false; if (_is_chaos_upgradeable(item, mon)) { if (item.base_type != OBJ_MISSILES) - return (true); + return true; // If, for some weird reason, a monster is carrying a bow // and javelins, then branding the javelins is okay, since // they won't be fired by the bow. if (!special_launcher || !has_launcher(item)) - return (true); + return true; } if (is_range_weapon(item)) @@ -968,7 +968,7 @@ static bool _choose_chaos_upgrade(const monster* mon) } } - return (false); + return false; } static void _do_chaos_upgrade(item_def &item, const monster* mon) @@ -1051,7 +1051,7 @@ static monster_type _xom_random_demon(int sever, bool use_greater_demons = true) demon = summon_any_demon(dct2); } - return (demon); + return demon; } static bool _player_is_dead() @@ -1064,7 +1064,7 @@ static bool _player_is_dead() static int _xom_do_potion(bool debug = false) { if (debug) - return (XOM_GOOD_POTION); + return XOM_GOOD_POTION; potion_type pot = POT_CURING; while (true) @@ -1135,7 +1135,7 @@ static int _xom_do_potion(bool debug = false) potion_effect(pot, 150, false, false, false); level_change(); // potion_effect() doesn't do this anymore - return (XOM_GOOD_POTION); + return XOM_GOOD_POTION; } static int _xom_confuse_monsters(int sever, bool debug = false) @@ -1151,7 +1151,7 @@ static int _xom_confuse_monsters(int sever, bool debug = false) } if (debug) - return (XOM_GOOD_CONFUSION); + return XOM_GOOD_CONFUSION; if (mi->check_clarity(false)) { @@ -1176,15 +1176,15 @@ static int _xom_confuse_monsters(int sever, bool debug = false) { take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "confuse monster(s)"), true); - return (XOM_GOOD_CONFUSION); + return XOM_GOOD_CONFUSION; } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static int _xom_send_allies(int sever, bool debug = false) { if (debug) - return (XOM_GOOD_ALLIES); + return XOM_GOOD_ALLIES; // The number of allies is dependent on severity, though heavily // randomised. @@ -1299,16 +1299,16 @@ static int _xom_send_allies(int sever, bool debug = false) take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true); - return (XOM_GOOD_ALLIES); + return XOM_GOOD_ALLIES; } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static int _xom_send_one_ally(int sever, bool debug = false) { if (debug) - return (XOM_GOOD_SINGLE_ALLY); + return XOM_GOOD_SINGLE_ALLY; const monster_type mon_type = _xom_random_demon(sever); const bool is_demonic = (mons_class_holiness(mon_type) == MH_DEMONIC); @@ -1344,10 +1344,10 @@ static int _xom_send_one_ally(int sever, bool debug = false) summons->name(DESC_PLAIN).c_str()); take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, summ_buf), true); - return (XOM_GOOD_SINGLE_ALLY); + return XOM_GOOD_SINGLE_ALLY; } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static int _xom_polymorph_nearby_monster(bool helpful, bool debug = false) @@ -1411,7 +1411,7 @@ static int _xom_polymorph_nearby_monster(bool helpful, bool debug = false) } } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static void _confuse_monster(monster* mons, int sever) @@ -1445,7 +1445,7 @@ static bool _swap_monsters(monster* m1, monster* m2) const coord_def mon2_pos = mon2.pos(); if (!mon2.is_habitable(mon1_pos) || !mon1.is_habitable(mon2_pos)) - return (false); + return false; // Make submerged monsters unsubmerge. mon1.del_ench(ENCH_SUBMERGED); @@ -1468,7 +1468,7 @@ static bool _swap_monsters(monster* m1, monster* m2) mon2.del_ench(ENCH_HELD, true); } - return (true); + return true; } static bool _art_is_safe(item_def item) @@ -1483,19 +1483,19 @@ static bool _art_is_safe(item_def item) static int _xom_swap_weapons(bool debug = false) { if (player_stair_delay()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; item_def *wpn = you.weapon(); if (!wpn) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (you.berserk() || wpn->base_type != OBJ_WEAPONS || get_weapon_brand(*wpn) == SPWPN_DISTORTION || !safe_to_remove(*wpn, true)) { - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } std::vector<monster* > mons_wpn; @@ -1527,10 +1527,10 @@ static int _xom_swap_weapons(bool debug = false) } } if (mons_wpn.empty()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_BAD_SWAP_WEAPONS); + return XOM_BAD_SWAP_WEAPONS; god_speaks(GOD_XOM, _get_xom_speech("swap weapons").c_str()); @@ -1550,7 +1550,7 @@ static int _xom_swap_weapons(bool debug = false) int index = get_mitm_slot(10); if (index == NON_ITEM) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // Move monster's old item to player's inventory as last step. mon->unequip(*(mon->mslot_item(MSLOT_WEAPON)), MSLOT_WEAPON, 0, true); @@ -1565,7 +1565,7 @@ static int _xom_swap_weapons(bool debug = false) mon->equip(mitm[monwpn], MSLOT_WEAPON, 0); unlink_item(index); destroy_item(myweapon); - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } // Mark the weapon as thrown, so that we'll autograb it once the // monster is dead. @@ -1587,7 +1587,7 @@ static int _xom_swap_weapons(bool debug = false) || you.inv[freeslot].defined()) { // Something is terribly wrong. - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } item_def &myitem = you.inv[freeslot]; @@ -1616,7 +1616,7 @@ static int _xom_swap_weapons(bool debug = false) you.wield_change = true; you.m_quiver->on_weapon_changed(); - return (XOM_BAD_SWAP_WEAPONS); + return XOM_BAD_SWAP_WEAPONS; } // Swap places with a random monster and, depending on severity, also @@ -1625,17 +1625,17 @@ static int _xom_swap_weapons(bool debug = false) static int _xom_rearrange_pieces(int sever, bool debug = false) { if (player_stair_delay()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; std::vector<monster* > mons; for (monster_iterator mi(&you); mi; ++mi) mons.push_back(*mi); if (mons.empty()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_GOOD_SWAP_MONSTERS); + return XOM_GOOD_SWAP_MONSTERS; god_speaks(GOD_XOM, _get_xom_speech("rearrange the pieces").c_str()); @@ -1677,7 +1677,7 @@ static int _xom_rearrange_pieces(int sever, bool debug = false) } take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "swap monsters"), true); - return (XOM_GOOD_SWAP_MONSTERS); + return XOM_GOOD_SWAP_MONSTERS; } static int _xom_random_stickable(const int HD) @@ -1722,7 +1722,7 @@ static int _xom_snakes_to_sticks(int sever, bool debug = false) if (!action) { if (debug) - return (XOM_GOOD_SNAKES); + return XOM_GOOD_SNAKES; take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "snakes to sticks"), true); @@ -1762,9 +1762,9 @@ static int _xom_snakes_to_sticks(int sever, bool debug = false) } if (action) - return (XOM_GOOD_SNAKES); + return XOM_GOOD_SNAKES; - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static int _xom_animate_monster_weapon(int sever, bool debug = false) @@ -1796,10 +1796,10 @@ static int _xom_animate_monster_weapon(int sever, bool debug = false) } } if (mons_wpn.empty()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_GOOD_ANIMATE_MON_WPN); + return XOM_GOOD_ANIMATE_MON_WPN; god_speaks(GOD_XOM, _get_xom_speech("animate monster weapon").c_str()); @@ -1822,7 +1822,7 @@ static int _xom_animate_monster_weapon(int sever, bool debug = false) monster *dancing = create_monster(mg); if (!dancing) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // Make the monster unwield its weapon. mon->unequip(*(mon->mslot_item(MSLOT_WEAPON)), MSLOT_WEAPON, 0, true); @@ -1838,7 +1838,7 @@ static int _xom_animate_monster_weapon(int sever, bool debug = false) mitm[wpn].set_holding_monster(dancing->mindex()); dancing->colour = mitm[wpn].colour; - return (XOM_GOOD_ANIMATE_MON_WPN); + return XOM_GOOD_ANIMATE_MON_WPN; } static int _xom_give_mutations(bool good, bool debug = false) @@ -1888,13 +1888,13 @@ static int _xom_give_mutations(bool good, bool debug = false) if (rc) return (good ? XOM_GOOD_MUTATION : XOM_BAD_MUTATION); - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static int _xom_throw_divine_lightning(bool debug = false) { if (!player_in_a_dangerous_place()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // Make sure there's at least one enemy within the lightning radius. bool found_hostile = false; @@ -1912,10 +1912,10 @@ static int _xom_throw_divine_lightning(bool debug = false) // No hostiles within radius. if (!found_hostile) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_GOOD_LIGHTNING); + return XOM_GOOD_LIGHTNING; bool protection = false; if (you.hp <= random2(201)) @@ -1962,7 +1962,7 @@ static int _xom_throw_divine_lightning(bool debug = false) "divine lightning%s", protection ? " (protected)" : ""); take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, lightning_buf), true); - return (XOM_GOOD_LIGHTNING); + return XOM_GOOD_LIGHTNING; } static int _xom_change_scenery(bool debug = false) @@ -2060,7 +2060,7 @@ static int _xom_change_scenery(bool debug = false) if (candidates.empty()) { if (!one_chance_in(8)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // Place one or more altars to Xom. coord_def place; @@ -2073,7 +2073,7 @@ static int _xom_change_scenery(bool debug = false) && grd(place) == DNGN_FLOOR && you.see_cell(place)) { if (debug) - return (XOM_GOOD_SCENERY); + return XOM_GOOD_SCENERY; grd(place) = DNGN_ALTAR_XOM; success = true; @@ -2085,13 +2085,13 @@ static int _xom_change_scenery(bool debug = false) take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "scenery: create altars"), true); god_speaks(GOD_XOM, speech.c_str()); - return (XOM_GOOD_SCENERY); + return XOM_GOOD_SCENERY; } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } if (debug) - return (XOM_GOOD_SCENERY); + return XOM_GOOD_SCENERY; const int fountain_diff = (DNGN_DRY_FOUNTAIN_BLUE - DNGN_FOUNTAIN_BLUE); @@ -2145,7 +2145,7 @@ static int _xom_change_scenery(bool debug = false) } } if (!doors_open && !doors_close && !fountains_flow && !fountains_blood) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; god_speaks(GOD_XOM, speech.c_str()); @@ -2225,7 +2225,7 @@ static int _xom_change_scenery(bool debug = false) if (doors_open || doors_close) noisy(10, you.pos()); - return (XOM_GOOD_SCENERY); + return XOM_GOOD_SCENERY; } static int _xom_inner_flame(bool debug = false) @@ -2237,7 +2237,7 @@ static int _xom_inner_flame(bool debug = false) continue; if (debug) - return (XOM_GOOD_INNER_FLAME); + return XOM_GOOD_INNER_FLAME; if (mi->add_ench(mon_enchant(ENCH_INNER_FLAME, 0, &menv[ANON_FRIENDLY_MONSTER]))) @@ -2257,9 +2257,9 @@ static int _xom_inner_flame(bool debug = false) { take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "inner flame monster(s)"), true); - return (XOM_GOOD_INNER_FLAME); + return XOM_GOOD_INNER_FLAME; } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } // The nicer stuff. Note: these things are not necessarily nice. @@ -2269,7 +2269,7 @@ static int _xom_is_good(int sever, int tension, bool debug = false) // Did Xom (already) kill the player? if (_player_is_dead()) - return (XOM_PLAYER_DEAD); + return XOM_PLAYER_DEAD; god_acting gdact(GOD_XOM); @@ -2314,17 +2314,17 @@ static int _xom_is_good(int sever, int tension, bool debug = false) { // Try something else if teleportation is impossible. if (!_teleportation_check()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // This is not very interesting if the level is already fully // explored (presumably cleared). Even then, it may // occasionally happen. const int explored = _exploration_estimate(true, debug); if (explored >= 80 && x_chance_in_y(explored, 120)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_GOOD_TELEPORT); + return XOM_GOOD_TELEPORT; // The Xom teleportation train takes you on instant // teleportation to a few random areas, stopping randomly but @@ -2356,7 +2356,7 @@ static int _xom_is_good(int sever, int tension, bool debug = false) else if (random2(tension) < 5 && x_chance_in_y(16, sever)) { if (debug) - return (XOM_GOOD_VITRIFY); + return XOM_GOOD_VITRIFY; // This can fail with radius 1, or in open areas. if (vitrify_area(random2avg(sever / 4, 2) + 1)) @@ -2375,14 +2375,14 @@ static int _xom_is_good(int sever, int tension, bool debug = false) else if (tension > 0 && x_chance_in_y(18, sever)) done = _xom_throw_divine_lightning(debug); - return (done); + return done; } // Is the equipment type usable, and is the slot empty? static bool _could_wear_eq(equipment_type eq) { if (!you_tran_can_wear(eq, true)) - return (false); + return false; return (!you.slot_item(eq, true)); } @@ -2392,7 +2392,7 @@ static item_def* _tran_get_eq(equipment_type eq) if (you_tran_can_wear(eq, true)) return (you.slot_item(eq, true)); - return (NULL); + return NULL; } // Which types of dungeon features are in view? @@ -2790,10 +2790,10 @@ static int _xom_miscast(const int max_level, const bool nasty, { switch (level) { - case 0: return (XOM_BAD_MISCAST_PSEUDO); - case 1: return (XOM_BAD_MISCAST_MINOR); - case 2: return (XOM_BAD_MISCAST_MAJOR); - case 3: return (XOM_BAD_MISCAST_NASTY); + case 0: return XOM_BAD_MISCAST_PSEUDO; + case 1: return XOM_BAD_MISCAST_MINOR; + case 2: return XOM_BAD_MISCAST_MAJOR; + case 3: return XOM_BAD_MISCAST_NASTY; } } @@ -2811,7 +2811,7 @@ static int _xom_miscast(const int max_level, const bool nasty, { god_speaks(GOD_XOM, _get_xom_speech(speech_str).c_str()); _xom_zero_miscast(); - return (XOM_BAD_MISCAST_PSEUDO); + return XOM_BAD_MISCAST_PSEUDO; } std::string hand_str; @@ -2829,13 +2829,13 @@ static int _xom_miscast(const int max_level, const bool nasty, lethality_margin, hand_str, can_plural); // Not worth distinguishing unless debugging. - return (XOM_BAD_MISCAST_MAJOR); + return XOM_BAD_MISCAST_MAJOR; } static int _xom_lose_stats(bool debug = false) { if (debug) - return (XOM_BAD_STATLOSS); + return XOM_BAD_STATLOSS; stat_type stat = static_cast<stat_type>(random2(NUM_STATS)); int max = 2; // was 3 @@ -2862,7 +2862,7 @@ static int _xom_lose_stats(bool debug = false) while (max < 1 && (++tries < 30)); if (tries >= 30) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } god_speaks(GOD_XOM, _get_xom_speech("lose stats").c_str()); @@ -2877,7 +2877,7 @@ static int _xom_lose_stats(bool debug = false) take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, stat_buf), true); - return (XOM_BAD_STATLOSS); + return XOM_BAD_STATLOSS; } static int _xom_chaos_upgrade_nearby_monster(bool debug = false) @@ -2885,10 +2885,10 @@ static int _xom_chaos_upgrade_nearby_monster(bool debug = false) monster* mon = choose_random_nearby_monster(0, _choose_chaos_upgrade); if (!mon) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_BAD_CHAOS_UPGRADE); + return XOM_BAD_CHAOS_UPGRADE; god_speaks(GOD_XOM, _get_xom_speech("chaos upgrade").c_str()); @@ -2912,10 +2912,10 @@ static int _xom_chaos_upgrade_nearby_monster(bool debug = false) if (rc) { take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "chaos upgrade"), true); - return (XOM_BAD_CHAOS_UPGRADE); + return XOM_BAD_CHAOS_UPGRADE; } - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } static int _xom_player_confusion_effect(int sever, bool debug = false) @@ -2926,11 +2926,11 @@ static int _xom_player_confusion_effect(int sever, bool debug = false) for (adjacent_iterator ai(you.pos()); ai; ++ai) if (in_bounds(*ai) && is_feat_dangerous(grd(*ai)) && !you.can_cling_to(*ai)) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } if (debug) - return (XOM_BAD_CONFUSION); + return XOM_BAD_CONFUSION; bool rc = false; @@ -2978,7 +2978,7 @@ static int _xom_player_confusion_effect(int sever, bool debug = false) static bool _valid_floor_grid(coord_def pos) { if (!in_bounds(pos)) - return (false); + return false; return (grd(pos) == DNGN_FLOOR); } @@ -3021,10 +3021,10 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) } if (new_pos == stair_pos) - return (false); + return false; if (!slide_feature_over(stair_pos, new_pos)) - return (false); + return false; stair_pos = new_pos; stairs_moved = true; @@ -3037,7 +3037,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) { // Can't move towards player if it's already adjacent. if (adjacent(you.pos(), stair_pos)) - return (false); + return false; begin = stair_pos; towards = you.pos(); @@ -3047,7 +3047,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) if (!find_ray(begin, towards, ray, opc_solid_see)) { mpr("Couldn't find ray between player and stairs.", MSGCH_ERROR); - return (stairs_moved); + return stairs_moved; } // Don't start off under the player. @@ -3070,7 +3070,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) if (!away && cell_is_solid(ray.pos())) { // Transparent wall between stair and player. - return (stairs_moved); + return stairs_moved; } if (away && !found_stairs) @@ -3078,7 +3078,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) if (cell_is_solid(ray.pos())) { // Transparent wall between stair and player. - return (stairs_moved); + return stairs_moved; } mpr("Ray didn't cross stairs.", MSGCH_ERROR); @@ -3087,7 +3087,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) if (away && past_stairs <= 0) { // Stairs already at edge, can't move further away. - return (stairs_moved); + return stairs_moved; } if (!in_bounds(ray.pos()) || ray.pos() == you.pos()) @@ -3100,7 +3100,7 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) || ray.pos() == stair_pos) { // No squares in path are a plain floor. - return (stairs_moved); + return stairs_moved; } } @@ -3136,10 +3136,10 @@ bool move_stair(coord_def stair_pos, bool away, bool allow_under) { mprf(MSGCH_ERROR, "_move_stair(): failed to move %s", stair_str.c_str()); - return (stairs_moved); + return stairs_moved; } - return (true); + return true; } static int _xom_repel_stairs(bool debug = false) @@ -3148,7 +3148,7 @@ static int _xom_repel_stairs(bool debug = false) if (you.duration[DUR_REPEL_STAIRS_MOVE] || you.duration[DUR_REPEL_STAIRS_CLIMB]) { - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; } std::vector<coord_def> stairs_avail; @@ -3167,10 +3167,10 @@ static int _xom_repel_stairs(bool debug = false) // Should only happen if there are stairs in view. if (stairs_avail.empty()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_BAD_STAIRS); + return XOM_BAD_STAIRS; // Don't mention staircases if there aren't any nearby. std::string stair_msg = _get_xom_speech("repel stairs"); @@ -3216,16 +3216,16 @@ static int _xom_repel_stairs(bool debug = false) else take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "repel stairs"), true); - return (XOM_BAD_STAIRS); + return XOM_BAD_STAIRS; } static int _xom_colour_smoke_trail(bool debug = false) { if (you.duration[DUR_COLOUR_SMOKE_TRAIL]) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) - return (XOM_BAD_COLOUR_SMOKE_TRAIL); + return XOM_BAD_COLOUR_SMOKE_TRAIL; you.duration[DUR_COLOUR_SMOKE_TRAIL] = random_range(60, 120); @@ -3234,7 +3234,7 @@ static int _xom_colour_smoke_trail(bool debug = false) const std::string speech = _get_xom_speech("colour smoke trail"); god_speaks(GOD_XOM, speech.c_str()); - return (XOM_BAD_COLOUR_SMOKE_TRAIL); + return XOM_BAD_COLOUR_SMOKE_TRAIL; } static int _xom_draining_torment_effect(int sever, bool debug = false) @@ -3249,7 +3249,7 @@ static int _xom_draining_torment_effect(int sever, bool debug = false) if (player_prot_life() < 3 && (nasty || you.experience > 0)) { if (debug) - return (XOM_BAD_DRAINING); + return XOM_BAD_DRAINING; god_speaks(GOD_XOM, speech.c_str()); drain_exp(); @@ -3259,7 +3259,7 @@ static int _xom_draining_torment_effect(int sever, bool debug = false) drain_exp(); take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, "draining"), true); - return (XOM_BAD_DRAINING); + return XOM_BAD_DRAINING; } } else @@ -3268,7 +3268,7 @@ static int _xom_draining_torment_effect(int sever, bool debug = false) if (!player_res_torment()) { if (debug) - return (XOM_BAD_TORMENT); + return XOM_BAD_TORMENT; god_speaks(GOD_XOM, speech.c_str()); torment_player(0, TORMENT_XOM); @@ -3279,16 +3279,16 @@ static int _xom_draining_torment_effect(int sever, bool debug = false) "torment (%d/%d hp)", you.hp, you.hp_max); take_note(Note(NOTE_XOM_EFFECT, you.piety, -1, torment_buf), true); - return (XOM_BAD_TORMENT); + return XOM_BAD_TORMENT; } } - return (rc); + return rc; } static bool _has_min_animated_weapon_level() { if (you.penance[GOD_XOM]) - return (true); + return true; if (_xom_is_bored()) return (you.experience_level >= 4); @@ -3308,7 +3308,7 @@ static int _xom_summon_hostiles(int sever, bool debug = false) && one_chance_in(4)) { if (debug) - return (XOM_BAD_ANIMATE_WPN); + return XOM_BAD_ANIMATE_WPN; const item_def& weapon = *you.weapon(); const std::string wep_name = weapon.name(DESC_PLAIN); @@ -3326,7 +3326,7 @@ static int _xom_summon_hostiles(int sever, bool debug = false) else { if (debug) - return (XOM_BAD_SUMMON_DEMONS); + return XOM_BAD_SUMMON_DEMONS; // The number of demons is dependent on severity, though heavily // randomised. @@ -3372,7 +3372,7 @@ static int _xom_summon_hostiles(int sever, bool debug = false) if (rc) god_speaks(GOD_XOM, speech.c_str()); - return (result); + return result; } static bool _has_min_banishment_level() @@ -3392,7 +3392,7 @@ static bool _allow_xom_banishment() { // Always allowed if under penance. if (you.penance[GOD_XOM]) - return (true); + return true; // If Xom is bored, banishment becomes viable earlier. if (_xom_is_bored()) @@ -3403,14 +3403,14 @@ static bool _allow_xom_banishment() { // Allow banishment; it will be retracted right away. if (one_chance_in(5) && x_chance_in_y(you.piety, 1000)) - return (true); + return true; else - return (false); + return false; } else if (_will_not_banish()) - return (false); + return false; - return (true); + return true; } static int _xom_maybe_reverts_banishment(bool debug = false) @@ -3439,7 +3439,7 @@ static int _xom_maybe_reverts_banishment(bool debug = false) static int _xom_do_banishment(bool debug = false) { if (!_allow_xom_banishment()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; if (debug) return _xom_maybe_reverts_banishment(debug); @@ -3450,7 +3450,7 @@ static int _xom_do_banishment(bool debug = false) banished("Xom"); const int result = _xom_maybe_reverts_banishment(debug); - return (result); + return result; } static int _xom_is_bad(int sever, int tension, bool debug = false) @@ -3467,7 +3467,7 @@ static int _xom_is_bad(int sever, int tension, bool debug = false) { // Did Xom kill the player? if (_player_is_dead()) - return (XOM_PLAYER_DEAD); + return XOM_PLAYER_DEAD; if (!nasty && x_chance_in_y(3, sever)) done = _xom_miscast(0, nasty, debug); @@ -3502,7 +3502,7 @@ static int _xom_is_bad(int sever, int tension, bool debug = false) { // Try something else if teleportation is impossible. if (!_teleportation_check()) - return (XOM_DID_NOTHING); + return XOM_DID_NOTHING; // This is not particularly exciting if the level is already // fully explored (presumably cleared). If Xom is feeling @@ -3517,7 +3517,7 @@ static int _xom_is_bad(int sever, int tension, bool debug = false) } if (debug) - return (XOM_BAD_TELEPORT); + return XOM_BAD_TELEPORT; // The Xom teleportation train takes you on instant // teleportation to a few random areas, stopping if either @@ -3600,7 +3600,7 @@ static int _xom_is_bad(int sever, int tension, bool debug = false) badness, you.gift_timeout); #endif } - return (done); + return done; } static void _handle_accidental_death(const int orig_hp, @@ -3755,7 +3755,7 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) mpr("Player is already dead, skipping Xom act.", MSGCH_DIAGNOSTICS); } - return (XOM_PLAYER_DEAD); + return XOM_PLAYER_DEAD; } #else ASSERT(!_player_is_dead()); @@ -3827,7 +3827,7 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) result = _xom_is_good(sever, tension, debug); if (debug) - return (result); + return result; } else { @@ -3859,7 +3859,7 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) result = _xom_is_bad(sever, tension, debug); if (debug) - return (result); + return result; } _handle_accidental_death(orig_hp, orig_stat_loss, orig_mutation); @@ -3889,7 +3889,7 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) } // Not true, but also not important now. - return (result); + return result; } void xom_check_lost_item(const item_def& item) @@ -3942,10 +3942,10 @@ static bool _death_is_funny(const kill_method_type killed_by) case KILLED_BY_SELF_AIMED: case KILLED_BY_SOMETHING: case KILLED_BY_TRAP: - return (false); + return false; default: // All others are fun (says Xom). - return (true); + return true; } } @@ -3994,7 +3994,7 @@ static int _death_is_worth_saving(const kill_method_type killed_by, // Don't protect the player from these. case KILLED_BY_SELF_AIMED: case KILLED_BY_TARGETTING: - return (false); + return false; // Only if not caused by equipment. case KILLED_BY_STUPIDITY: @@ -4003,13 +4003,13 @@ static int _death_is_worth_saving(const kill_method_type killed_by, if (strstr(aux, "wielding") == NULL && strstr(aux, "wearing") == NULL && strstr(aux, "removing") == NULL) { - return (true); + return true; } - return (false); + return false; // Everything else is fair game. default: - return (true); + return true; } } @@ -4033,23 +4033,23 @@ bool xom_saves_your_life(const int dam, const int death_source, bool see_source) { if (you.religion != GOD_XOM || _xom_feels_nasty()) - return (false); + return false; // If this happens, don't bother. if (you.hp_max < 1 || you.experience_level < 1) - return (false); + return false; // Generally a rare effect. if (!one_chance_in(20)) - return (false); + return false; if (!_death_is_worth_saving(death_type, aux)) - return (false); + return false; // In addition, the chance depends on the current tension and Xom's mood. const int death_tension = get_tension(GOD_XOM); if (death_tension < random2(5) || !xom_is_nice(death_tension)) - return (false); + return false; // Fake death message. mpr("You die..."); @@ -4084,7 +4084,7 @@ bool xom_saves_your_life(const int dam, const int death_source, if (you.gift_timeout < 10) you.gift_timeout = 10; - return (true); + return true; } #ifdef WIZARD @@ -4139,7 +4139,7 @@ static const std::string _xom_effect_to_name(int effect) } result += _xom_effect_names[effect]; - return (result); + return result; } static char* _list_exploration_estimate() @@ -4158,7 +4158,7 @@ static char* _list_exploration_estimate() "exploration estimate: %d%%\n", mapped, explored); - return (info); + return info; } // Loops over the entire piety spectrum and calls xom_acts() multiple diff --git a/crawl-ref/source/zotdef.cc b/crawl-ref/source/zotdef.cc index 76e84eb361..d2d5cad13e 100644 --- a/crawl-ref/source/zotdef.cc +++ b/crawl-ref/source/zotdef.cc @@ -47,7 +47,7 @@ static int _fuzz_mons_level(int level) const int fuzz = random2avg(9, 2); return (fuzz > 4 ? level + fuzz - 4 : level); } - return (level); + return level; } // Choose a random branch. Which branches may be chosen is a function of @@ -571,7 +571,7 @@ static monster_type _get_zotdef_monster(level_id &place, int power) while (rarity == 0 && count < 2000); if (rarity == 0) - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; // Calculate strength monsterentry *mentry = get_monster_data(mon_type); @@ -647,7 +647,7 @@ static monster_type _get_zotdef_monster(level_id &place, int power) } } - return (MONS_PROGRAM_BUG); + return MONS_PROGRAM_BUG; } static void _zotdef_set_random_branch_wave(int power) @@ -914,13 +914,13 @@ bool create_trap(trap_type spec_type) { if (abild.isCancel) canned_msg(MSG_OK); - return (false); + return false; } // only try to create on floor squares if (grd(abild.target) != DNGN_FLOOR) { mpr("You can't create a trap there!"); - return (false); + return false; } bool result = place_specific_trap(abild.target, spec_type); @@ -1008,16 +1008,16 @@ bool create_zotdef_ally(monster_type mtyp, const char *successmsg) { if (abild.isCancel) canned_msg(MSG_OK); - return (false); + return false; } if (!mons_place(mgen_data(mtyp, BEH_FRIENDLY, &you, 0, 0, abild.target, you.pet_target))) { mpr("You can't create it there!"); - return (false); + return false; } mpr(successmsg); - return (true); + return true; } void zotdef_bosses_check() |