diff options
author | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-21 12:37:25 -0600 |
---|---|---|
committer | David Lawrence Ramsey <dolorous@users.sourceforge.net> | 2009-11-21 12:37:25 -0600 |
commit | 4277eaea5e02fb69d64193a0395357e2c346afdb (patch) | |
tree | 68806b639fbb4d2e08215b12517c86c2eee0fe94 | |
parent | 505571294e7ca02c0af89ff2b25f3cecde439448 (diff) | |
download | crawl-ref-4277eaea5e02fb69d64193a0395357e2c346afdb.tar.gz crawl-ref-4277eaea5e02fb69d64193a0395357e2c346afdb.zip |
Add formatting fixes.
This mostly puts && and || on the proper lines, per the style guide.
38 files changed, 173 insertions, 146 deletions
diff --git a/crawl-ref/source/actor.cc b/crawl-ref/source/actor.cc index 16e67aed3b..c42c9965d3 100644 --- a/crawl-ref/source/actor.cc +++ b/crawl-ref/source/actor.cc @@ -137,8 +137,8 @@ bool actor::can_hibernate(bool holi_only) const return (false); // The monster has slept recently. - if (atype() == ACT_MONSTER && - static_cast<const monsters*>(this)->has_ench(ENCH_SLEEP_WARY)) + if (atype() == ACT_MONSTER + && static_cast<const monsters*>(this)->has_ench(ENCH_SLEEP_WARY)) { return (false); } diff --git a/crawl-ref/source/artefact.cc b/crawl-ref/source/artefact.cc index fad60e22ef..7fae71a38e 100644 --- a/crawl-ref/source/artefact.cc +++ b/crawl-ref/source/artefact.cc @@ -1665,8 +1665,8 @@ int find_okay_unrandart(unsigned char aclass, unsigned char atype, continue; } - if (specialness != UNRANDSPEC_EITHER && - specialness != get_unrand_specialness(index)) + if (specialness != UNRANDSPEC_EITHER + && specialness != get_unrand_specialness(index)) { continue; } diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index f76b053ffc..e18360be8a 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -4781,8 +4781,8 @@ void bolt::affect_monster(monsters* mon) } // Missiles go past bushes. - if (mon->type == MONS_BUSH && !is_beam && !is_explosion && - (flavour == BEAM_MISSILE || flavour == BEAM_MMISSILE)) + if (mon->type == MONS_BUSH && !is_beam && !is_explosion + && (flavour == BEAM_MISSILE || flavour == BEAM_MMISSILE)) { apply_hit_funcs(mon, 0); return; diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index 0d18caf5cf..46f54fbefb 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -457,8 +457,8 @@ static void _adjust_ability(void) if (keyin == '?' || keyin == '*') selected = choose_ability_menu(talents); - else if (keyin == ESCAPE || keyin == ' ' || - keyin == '\r' || keyin == '\n') + else if (keyin == ESCAPE || keyin == ' ' + || keyin == '\r' || keyin == '\n') { canned_msg(MSG_OK); return; @@ -825,9 +825,10 @@ static void _add_file_to_scroller(FILE* fp, formatted_scroller& m, } m.add_entry(me); // FIXME: There must be a better way to identify sections! - next_is_hotkey = auto_hotkeys && - (strstr(buf, "------------------------------------------" - "------------------------------") == buf); + next_is_hotkey = + (auto_hotkeys + && (strstr(buf, "------------------------------------------" + "------------------------------") == buf)); is_first = false; } } @@ -1333,10 +1334,10 @@ static bool _do_description(std::string key, std::string type, monster_type mon_num = get_monster_by_name(key, true); // Don't attempt to get more information on ghost demon // monsters, as the ghost struct has not been initialised, which - // will cause a crash. Similarly for zombified monsters, since + // will cause a crash. Similarly for zombified monsters, since // they require a base monster. - if (mon_num != MONS_PROGRAM_BUG && !mons_is_ghost_demon(mon_num) && - !mons_class_is_zombified(mon_num)) + if (mon_num != MONS_PROGRAM_BUG && !mons_is_ghost_demon(mon_num) + && !mons_class_is_zombified(mon_num)) { monsters mon; mon.type = mon_num; diff --git a/crawl-ref/source/database.cc b/crawl-ref/source/database.cc index 34cb1cb73a..bb33b44dd0 100644 --- a/crawl-ref/source/database.cc +++ b/crawl-ref/source/database.cc @@ -277,8 +277,8 @@ std::vector<std::string> database_find_bodies(DBM *database, datum dbBody = dbm_fetch(database, dbKey); std::string body((const char *)dbBody.dptr, dbBody.dsize); - if (tpat.matches(body) && - key.find("__") == std::string::npos + if (tpat.matches(body) + && key.find("__") == std::string::npos && (filter == NULL || !(*filter)(key, body))) { matches.push_back(key); diff --git a/crawl-ref/source/delay.cc b/crawl-ref/source/delay.cc index d11b54bc6d..ff8585be12 100644 --- a/crawl-ref/source/delay.cc +++ b/crawl-ref/source/delay.cc @@ -124,9 +124,9 @@ static int _recite_to_monsters(coord_def where, int pow, int, actor *) if (one_chance_in(resist + 1)) return (0); // nothing happens, whew! - if (!one_chance_in(4) && - mon->add_ench(mon_enchant(ENCH_HASTE, 0, KC_YOU, - (16 + random2avg(13, 2)) * 10))) + if (!one_chance_in(4) + && mon->add_ench(mon_enchant(ENCH_HASTE, 0, KC_YOU, + (16 + random2avg(13, 2)) * 10))) { simple_monster_message(mon, " speeds up in annoyance!"); @@ -2008,10 +2008,11 @@ bool interrupt_activity( activity_interrupt_type ai, // so that stop running Lua notifications happen. for (int j = i; j < size; ++j) { - if (is_run_delay( you.delay_queue[j].type )) + if (is_run_delay(you.delay_queue[j].type)) { - was_monst = was_monst || - _monster_warning(ai, at, you.delay_queue[j].type); + was_monst = (was_monst + || _monster_warning(ai, at, + you.delay_queue[j].type)); stop_delay(ai == AI_TELEPORT); if (was_monst) @@ -2021,8 +2022,8 @@ bool interrupt_activity( activity_interrupt_type ai, } // Non-run queued delays can be discarded without any processing. - you.delay_queue.erase( you.delay_queue.begin() + i, - you.delay_queue.end() ); + you.delay_queue.erase(you.delay_queue.begin() + i, + you.delay_queue.end()); if (was_monst) handle_interrupted_swap(false, true); diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index 8549e94f84..bc1972db56 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -6089,9 +6089,9 @@ void spotty_level(bool seeded, int iterations, bool boxy) // Boxy levels have more clearing, so they get fewer iterations. if (l == 0) - l = 200 + random2( (boxy ? 750 : 1500) ); + l = 200 + random2((boxy ? 750 : 1500)); - for (i = 0; i < l; i++) + for (i = 0; i < l; ++i) { do { @@ -6136,24 +6136,24 @@ void spotty_level(bool seeded, int iterations, bool boxy) void smear_feature(int iterations, bool boxy, dungeon_feature_type feature, int x1, int y1, int x2, int y2) { - for (int i = 0; i < iterations; i++) + for (int i = 0; i < iterations; ++i) { int x, y; bool diagonals, straights; do { - x = random_range(x1+1, x2-1); - y = random_range(y1+1, y2-1); + x = random_range(x1 + 1, x2 - 1); + y = random_range(y1 + 1, y2 - 1); - diagonals = grd[x+1][y+1] == feature || - grd[x-1][y+1] == feature || - grd[x-1][y-1] == feature || - grd[x+1][y-1] == feature; + diagonals = grd[x + 1][y + 1] == feature + || grd[x - 1][y + 1] == feature + || grd[x - 1][y - 1] == feature + || grd[x + 1][y - 1] == feature; - straights = grd[x+1][y] == feature || - grd[x-1][y] == feature || - grd[x][y+1] == feature || - grd[x][y-1] == feature; + straights = grd[x + 1][y] == feature + || grd[x - 1][y] == feature + || grd[x][y + 1] == feature + || grd[x][y - 1] == feature; } while (grd[x][y] == feature || !straights && (boxy || !diagonals)); diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 30ade48c03..9a8be9dde2 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -375,8 +375,9 @@ static unsigned curses_attribute(const std::string &field) return CHATTR_REVERSE; else if (field == "dim") return CHATTR_DIM; - else if (field.find("hi:") == 0 || field.find("hilite:") == 0 || - field.find("highlight:") == 0) + else if (field.find("hi:") == 0 + || field.find("hilite:") == 0 + || field.find("highlight:") == 0) { int col = field.find(":"); int colour = str_to_colour(field.substr(col + 1)); @@ -391,7 +392,7 @@ static unsigned curses_attribute(const std::string &field) else if (field != "none") { Options.report_error( - make_stringf( "Bad colour -- %s\n", field.c_str() ) ); + make_stringf("Bad colour -- %s\n", field.c_str())); } return CHATTR_NORMAL; } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 2da1279d17..15fc4e28b5 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -1041,8 +1041,8 @@ bool do_wear_armour(int item, bool quiet) if (slot == EQ_BODY_ARMOUR && you.equip[EQ_CLOAK] != -1 && !cloak_is_being_removed()) { - if (you.equip[EQ_BODY_ARMOUR] != -1 && - item_cursed(you.inv[you.equip[EQ_BODY_ARMOUR]])) + if (you.equip[EQ_BODY_ARMOUR] != -1 + && item_cursed(you.inv[you.equip[EQ_BODY_ARMOUR]])) { if (!quiet) { diff --git a/crawl-ref/source/itemname.cc b/crawl-ref/source/itemname.cc index cd27a52dc5..1c33d271ab 100644 --- a/crawl-ref/source/itemname.cc +++ b/crawl-ref/source/itemname.cc @@ -54,8 +54,7 @@ static char _random_cons(int seed); bool is_vowel( const char chr ) { const char low = tolower( chr ); - return (low == 'a' || low == 'e' || low == 'i' || - low == 'o' || low == 'u'); + return (low == 'a' || low == 'e' || low == 'i' || low == 'o' || low == 'u'); } // quant_name is useful since it prints out a different number of items @@ -1776,16 +1775,18 @@ bool item_type_known( const item_def& item ) if (is_artefact(item)) return (false); - // Poisoned missiles are always identified. Also things made of obvious - // materials (steel, silver) + // Missiles that are poisoned or made of obvious materials (steel, + // silver) are always identified. if (item.base_type == OBJ_MISSILES) { int ammo_brand = get_ammo_brand(item); - if (ammo_brand == SPMSL_POISONED || - ammo_brand == SPMSL_CURARE || - ammo_brand == SPMSL_STEEL || - ammo_brand == SPMSL_SILVER) + if (ammo_brand == SPMSL_POISONED + || ammo_brand == SPMSL_CURARE + || ammo_brand == SPMSL_STEEL + || ammo_brand == SPMSL_SILVER) + { return (true); + } } const item_type_id_type idt = objtype_to_idtype(item.base_type); diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index 7e4c8a8eb6..e2206664fd 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2362,9 +2362,9 @@ static bool _similar_equip(const item_def& pickup_item, return (true); // Launchers of the same type are similar. - if ((pickup_item.sub_type >= WPN_BLOWGUN && - pickup_item.sub_type <= WPN_LONGBOW) - || pickup_item.sub_type == WPN_SLING) + if ((pickup_item.sub_type >= WPN_BLOWGUN + && pickup_item.sub_type <= WPN_LONGBOW) + || pickup_item.sub_type == WPN_SLING) { return (pickup_item.sub_type != inv_item.sub_type); } diff --git a/crawl-ref/source/kills.cc b/crawl-ref/source/kills.cc index 6857c3d82c..fa7e0a3924 100644 --- a/crawl-ref/source/kills.cc +++ b/crawl-ref/source/kills.cc @@ -80,8 +80,8 @@ void KillMaster::load(reader& inf) { unsigned char major = unmarshallByte(inf), minor = unmarshallByte(inf); - if (major != KILLS_MAJOR_VERSION || - (minor != KILLS_MINOR_VERSION && minor > 0)) + if (major != KILLS_MAJOR_VERSION + || (minor != KILLS_MINOR_VERSION && minor > 0)) { return; } @@ -543,16 +543,18 @@ std::string kill_def::info(const kill_monster_desc &md) const if (!mons_is_unique(md.monnum)) { - // Pluralise as needed + // Pluralise as needed. name = n_names(name, kills); - // We brand shapeshifters with the (shapeshifter) qualifier. This - // has to be done after doing pluralise(), else we get very odd plurals - // :) - if (md.modifier == kill_monster_desc::M_SHAPESHIFTER && - md.monnum != MONS_SHAPESHIFTER && - md.monnum != MONS_GLOWING_SHAPESHIFTER) + // We brand shapeshifters with the (shapeshifter) qualifier. + // This has to be done after doing pluralise(), else we get very + // odd plurals :) + if (md.modifier == kill_monster_desc::M_SHAPESHIFTER + && md.monnum != MONS_SHAPESHIFTER + && md.monnum != MONS_GLOWING_SHAPESHIFTER) + { name += " (shapeshifter)"; + } } else if (kills > 1) { @@ -716,11 +718,11 @@ KILLEXP_ACCESS(base_name, string, base_name.c_str()) KILLEXP_ACCESS(desc, string, desc.c_str()) KILLEXP_ACCESS(monnum, number, monnum) KILLEXP_ACCESS(isghost, boolean, - monnum == -1 && - ke->desc.find("The ghost of") != std::string::npos) + monnum == -1 + && ke->desc.find("The ghost of") != std::string::npos) KILLEXP_ACCESS(ispandemon, boolean, - monnum == -1 && - ke->desc.find("The ghost of") == std::string::npos) + monnum == -1 + && ke->desc.find("The ghost of") == std::string::npos) KILLEXP_ACCESS(isunique, boolean, monnum != -1 && mons_is_unique(ke->monnum)) diff --git a/crawl-ref/source/kills.h b/crawl-ref/source/kills.h index 8e0c2a9f1d..812364e4a7 100644 --- a/crawl-ref/source/kills.h +++ b/crawl-ref/source/kills.h @@ -40,11 +40,11 @@ struct kill_monster_desc struct less_than { - bool operator () ( const kill_monster_desc &m1, - const kill_monster_desc &m2) const + bool operator () (const kill_monster_desc &m1, + const kill_monster_desc &m2) const { - return m1.monnum < m2.monnum || - (m1.monnum == m2.monnum && m1.modifier < m2.modifier); + return (m1.monnum < m2.monnum + || (m1.monnum == m2.monnum && m1.modifier < m2.modifier)); } }; }; diff --git a/crawl-ref/source/l_dgnbld.cc b/crawl-ref/source/l_dgnbld.cc index aeaa026d32..fb78e6d15d 100644 --- a/crawl-ref/source/l_dgnbld.cc +++ b/crawl-ref/source/l_dgnbld.cc @@ -599,16 +599,16 @@ LUAFN(dgn_smear_map) while (onto[0] && !strchr(onto, lines(mc))); // Is there a "smear" feature along the diagonal from mc? - diagonals = lines(mc.x+1, mc.y+1) == smear || - lines(mc.x-1, mc.y+1) == smear || - lines(mc.x-1, mc.y-1) == smear || - lines(mc.x+1, mc.y-1) == smear; + diagonals = lines(mc.x + 1, mc.y + 1) == smear + || lines(mc.x - 1, mc.y + 1) == smear + || lines(mc.x - 1, mc.y - 1) == smear + || lines(mc.x + 1, mc.y - 1) == smear; // Is there a "smear" feature up, down, left, or right from mc? - straights = lines(mc.x+1, mc.y) == smear || - lines(mc.x-1, mc.y) == smear || - lines(mc.x, mc.y+1) == smear || - lines(mc.x, mc.y-1) == smear; + straights = lines(mc.x + 1, mc.y) == smear + || lines(mc.x - 1, mc.y) == smear + || lines(mc.x, mc.y + 1) == smear + || lines(mc.x, mc.y - 1) == smear; } while (!straights && (boxy || !diagonals)); diff --git a/crawl-ref/source/l_dgnmon.cc b/crawl-ref/source/l_dgnmon.cc index 7c37b6bdb0..df4e83cc46 100644 --- a/crawl-ref/source/l_dgnmon.cc +++ b/crawl-ref/source/l_dgnmon.cc @@ -49,8 +49,8 @@ static int dgn_set_random_mon_list(lua_State *ls) { // Don't complain if we're being called when the map is being loaded // and validated. - if (you.level_type != LEVEL_PORTAL_VAULT && - !(you.start_time == 0 && !you.entering_level && !Generating_Level)) + if (you.level_type != LEVEL_PORTAL_VAULT + && !(you.start_time == 0 && !you.entering_level && !Generating_Level)) { luaL_error(ls, "Can only be used in portal vaults."); return (0); diff --git a/crawl-ref/source/libutil.cc b/crawl-ref/source/libutil.cc index 7a0726b134..c4988c7656 100644 --- a/crawl-ref/source/libutil.cc +++ b/crawl-ref/source/libutil.cc @@ -163,8 +163,8 @@ std::string &escape_path_spaces(std::string &s) result += *ch; } #elif defined(TARGET_OS_WINDOWS) - if (s.find(" ") != std::string::npos && - s.find("\"") == std::string::npos) + if (s.find(" ") != std::string::npos + && s.find("\"") == std::string::npos) { result = "\"" + s + "\""; } diff --git a/crawl-ref/source/libutil.h b/crawl-ref/source/libutil.h index c9c6c090cf..824b133be9 100644 --- a/crawl-ref/source/libutil.h +++ b/crawl-ref/source/libutil.h @@ -286,8 +286,8 @@ public: bool valid() const { - return isvalid && - (compiled_pattern || (isvalid = compile())); + return isvalid + && (compiled_pattern || (isvalid = compile())); } bool matches(const char *s, int length) const diff --git a/crawl-ref/source/libw32c.cc b/crawl-ref/source/libw32c.cc index a9fff4df09..36cc261851 100644 --- a/crawl-ref/source/libw32c.cc +++ b/crawl-ref/source/libw32c.cc @@ -745,10 +745,12 @@ int vk_translate( WORD VirtCode, CHAR c, DWORD cKeys) bool altDown = !!(cKeys & (LEFT_ALT_PRESSED | RIGHT_ALT_PRESSED)); // step 1 - we don't care about shift or control - if (VirtCode == VK_SHIFT || VirtCode == VK_CONTROL || - VirtCode == VK_MENU || VirtCode == VK_CAPITAL || - VirtCode == VK_NUMLOCK) + if (VirtCode == VK_SHIFT || VirtCode == VK_CONTROL + || VirtCode == VK_MENU || VirtCode == VK_CAPITAL + || VirtCode == VK_NUMLOCK) + { return 0; + } // step 2 - translate the <Esc> key to 0x1b if (VirtCode == VK_ESCAPE) diff --git a/crawl-ref/source/macro.cc b/crawl-ref/source/macro.cc index 60c3e223e3..25e916430f 100644 --- a/crawl-ref/source/macro.cc +++ b/crawl-ref/source/macro.cc @@ -714,8 +714,8 @@ int getch_with_command_macros( void ) */ void flush_input_buffer( int reason ) { - ASSERT(reason != FLUSH_KEY_REPLAY_CANCEL || - crawl_state.is_replaying_keys() || crawl_state.cmd_repeat_start); + ASSERT(reason != FLUSH_KEY_REPLAY_CANCEL + || crawl_state.is_replaying_keys() || crawl_state.cmd_repeat_start); ASSERT(reason != FLUSH_ABORT_MACRO || is_processing_macro()); @@ -725,8 +725,8 @@ void flush_input_buffer( int reason ) macro_keys_left = -1; if (crawl_state.is_replaying_keys() && reason != FLUSH_ABORT_MACRO - && reason != FLUSH_KEY_REPLAY_CANCEL && - reason != FLUSH_REPLAY_SETUP_FAILURE) + && reason != FLUSH_KEY_REPLAY_CANCEL + && reason != FLUSH_REPLAY_SETUP_FAILURE) { return; } diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index b3ace2dfde..d791318c40 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -98,8 +98,8 @@ std::string mapdef_split_key_item(const std::string &s, *key = trimmed_string(s.substr(0, sep)); std::string substitute = trimmed_string(s.substr(sep + 1)); - if (key->empty() || - (key_max_len != -1 && (int) key->length() > key_max_len)) + if (key->empty() + || (key_max_len != -1 && (int) key->length() > key_max_len)) { return make_stringf( "selector '%s' must be <= %d characters in '%s'", diff --git a/crawl-ref/source/mapmark.cc b/crawl-ref/source/mapmark.cc index cf8b378d30..612c0fc8df 100644 --- a/crawl-ref/source/mapmark.cc +++ b/crawl-ref/source/mapmark.cc @@ -823,8 +823,8 @@ bool feature_marker_at(const coord_def &pos, dungeon_feature_type feat) for (int i = 0, size = markers.size(); i < size; ++i) { map_marker *mark = markers[i]; - if (mark->get_type() == MAT_FEATURE && - dynamic_cast<map_feature_marker*>(mark)->feat == feat) + if (mark->get_type() == MAT_FEATURE + && dynamic_cast<map_feature_marker*>(mark)->feat == feat) { return (true); } diff --git a/crawl-ref/source/message.cc b/crawl-ref/source/message.cc index 5a93dece02..5fe386c565 100644 --- a/crawl-ref/source/message.cc +++ b/crawl-ref/source/message.cc @@ -87,8 +87,8 @@ namespace msg std::ostream& streams(msg_channel_type chan) { - ASSERT(chan >= 0 && - static_cast<unsigned int>(chan) < stream_ptrs.size()); + ASSERT(chan >= 0 + && static_cast<unsigned int>(chan) < stream_ptrs.size()); return *stream_ptrs[chan]; } diff --git a/crawl-ref/source/mon-cast.cc b/crawl-ref/source/mon-cast.cc index 30bc323ef5..17d4faa140 100644 --- a/crawl-ref/source/mon-cast.cc +++ b/crawl-ref/source/mon-cast.cc @@ -2075,14 +2075,23 @@ void mons_cast(monsters *monster, bolt &pbolt, spell_type spell_cast, // we can blink away the crowd, but only our allies if (monster_at(*ai) && monster_at(*ai)->attitude != monster->attitude) + { sumcount++; + } + if (grd(*ai) != DNGN_FLOOR && grd(*ai) > DNGN_MAX_NONREACH && !feat_is_trap(grd(*ai))) + { sumcount++; + } } - if (abs(you.pos().x-monster->pos().x)<=1 && - abs(you.pos().y-monster->pos().y)<=1) + + if (abs(you.pos().x - monster->pos().x) <= 1 + && abs(you.pos().y - monster->pos().y) <= 1) + { sumcount++; + } + if (sumcount) { monster->blink(); diff --git a/crawl-ref/source/mon-movetarget.cc b/crawl-ref/source/mon-movetarget.cc index 8bdec65fb4..83c8a12989 100644 --- a/crawl-ref/source/mon-movetarget.cc +++ b/crawl-ref/source/mon-movetarget.cc @@ -721,8 +721,8 @@ static bool _choose_random_patrol_target_grid(monsters *mon) // and the patrol point is out of sight, too. Such a case // will be handled below, though it might take a while until // a monster gets out of a deadlock. (5% chance per turn.) - if (!patrol.see_cell(*ri) && - (!is_smart || !lm.see_cell(*ri))) + if (!patrol.see_cell(*ri) + && (!is_smart || !lm.see_cell(*ri))) { continue; } @@ -733,8 +733,8 @@ static bool _choose_random_patrol_target_grid(monsters *mon) // make sure the new target brings us into reach of it. // This means that the target must be reachable BOTH from // the patrol point AND the current position. - if (!patrol.see_cell(*ri) || - !lm.see_cell(*ri)) + if (!patrol.see_cell(*ri) + || !lm.see_cell(*ri)) { continue; } diff --git a/crawl-ref/source/mon-stuff.cc b/crawl-ref/source/mon-stuff.cc index 86403941cb..45f7dc4777 100644 --- a/crawl-ref/source/mon-stuff.cc +++ b/crawl-ref/source/mon-stuff.cc @@ -3583,8 +3583,8 @@ int dismiss_monsters(std::string pattern) { int ndismissed = 0; for (monster_iterator mi; mi; ++mi) { - if (mi->alive() && - (tpat.empty() || tpat.matches(mi->name(DESC_PLAIN, true)))) + if (mi->alive() + && (tpat.empty() || tpat.matches(mi->name(DESC_PLAIN, true)))) { if (!keep_item) _vanish_orig_eq(*mi); diff --git a/crawl-ref/source/mon-util.cc b/crawl-ref/source/mon-util.cc index 200972c2f4..36301c5ad6 100644 --- a/crawl-ref/source/mon-util.cc +++ b/crawl-ref/source/mon-util.cc @@ -1375,8 +1375,13 @@ monster_type random_draconian_monster_species() // Note: For consistent behavior in player_will_anger_monster(), all // spellbooks a given monster can get here should produce the same -// return values in is_holy_spell(), (is_unholy_spell() || -// is_evil_spell()), and (is_unclean_spell() || is_chaotic_spell()). +// return values in the following: +// +// is_holy_spell() +// +// (is_unholy_spell() || is_evil_spell()) +// +// (is_unclean_spell() || is_chaotic_spell()) // // FIXME: This is not true for one set of spellbooks; MST_WIZARD_IV // contains the unholy Banishment spell, but the other MST_WIZARD-type @@ -3568,9 +3573,9 @@ mon_body_shape get_mon_shape(const int type) // a tail if it has a sting or tail-slap attack. monsterentry *mon_data = get_monster_data(type); bool tailed = false; - for (int i = 0; i < 4; i++) - if (mon_data->attack[i].type == AT_STING || - mon_data->attack[i].type == AT_TAIL_SLAP) + for (int i = 0; i < 4; ++i) + if (mon_data->attack[i].type == AT_STING + || mon_data->attack[i].type == AT_TAIL_SLAP) { tailed = true; break; diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index 68ef785fd8..322c57b2b1 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -1512,18 +1512,19 @@ bool monsters::pickup_armour(item_def &item, int near, bool force) break; // And another hack or two... case ARM_WIZARD_HAT: - if (this->type == MONS_GASTRONOK) + if (type == MONS_GASTRONOK) eq = EQ_BODY_ARMOUR; break; case ARM_CLOAK: - if (this->type == MONS_MAURICE || this->type == MONS_NIKOLA || - this->type == MONS_CRAZY_YIUF) + if (type == MONS_MAURICE + || type == MONS_NIKOLA + || type == MONS_CRAZY_YIUF) { eq = EQ_BODY_ARMOUR; } break; case ARM_GLOVES: - if (this->type == MONS_NIKOLA) + if (type == MONS_NIKOLA) eq = EQ_SHIELD; break; default: @@ -1580,7 +1581,7 @@ bool monsters::pickup_armour(item_def &item, int near, bool force) return (false); } - return pickup(item, mslot, near); + return (pickup(item, mslot, near)); } bool monsters::pickup_weapon(item_def &item, int near, bool force) diff --git a/crawl-ref/source/mutation.cc b/crawl-ref/source/mutation.cc index 153dadbb3c..945259aaba 100644 --- a/crawl-ref/source/mutation.cc +++ b/crawl-ref/source/mutation.cc @@ -2637,8 +2637,8 @@ std::string mutation_name(mutation_type mut, int level, bool colour) std::string result; bool innate = false; - if (mut == MUT_CLAWS && - (you.species == SP_TROLL || you.species == SP_GHOUL)) + if (mut == MUT_CLAWS + && (you.species == SP_TROLL || you.species == SP_GHOUL)) { innate = true; if (you.species == SP_TROLL) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index 73ba895c38..f914de5720 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -852,8 +852,7 @@ int player_equip( equipment_type slot, int sub_type, bool calc_unid ) default: if (you.equip[slot] != -1 && you.inv[you.equip[slot]].sub_type == sub_type - && (calc_unid || - item_type_known(you.inv[you.equip[slot]]))) + && (calc_unid || item_type_known(you.inv[you.equip[slot]]))) { ret++; } @@ -6885,8 +6884,10 @@ bool player::visible_to(const actor *looker) const return (can_see_invisible() || !invisible()); const monsters* mon = dynamic_cast<const monsters*>(looker); - return (!this->invisible() || this->in_water() || - mon->can_see_invisible() || mons_sense_invis(mon)); + return (!invisible() + || in_water() + || mon->can_see_invisible() + || mons_sense_invis(mon)); } bool player::backlit(bool check_haloed) const diff --git a/crawl-ref/source/ray.cc b/crawl-ref/source/ray.cc index e4d8e465ff..6c802f4c6c 100644 --- a/crawl-ref/source/ray.cc +++ b/crawl-ref/source/ray.cc @@ -177,8 +177,8 @@ static bool _advance_from_non_diamond(geom::ray *r) // The ray is in a legal state to be passed around externally. bool ray_def::_valid() const { - return (on_corner && is_corner(r.start) && bad_corner(r) || - !on_corner && in_diamond_int(r.start)); + return (on_corner && is_corner(r.start) && bad_corner(r) + || !on_corner && in_diamond_int(r.start)); } geom::vector _normalize(const geom::vector &v) diff --git a/crawl-ref/source/show.cc b/crawl-ref/source/show.cc index 2836c7ace7..280b83c4a2 100644 --- a/crawl-ref/source/show.cc +++ b/crawl-ref/source/show.cc @@ -157,8 +157,8 @@ static unsigned short _feat_colour(const coord_def &where, if (colour == BLACK && feat == DNGN_TREES) colour = _tree_colour(where); - if (fdef.em_colour && fdef.em_colour != fdef.colour && - emphasise(where)) + if (fdef.em_colour && fdef.em_colour != fdef.colour + && emphasise(where)) { colour = fdef.em_colour; } @@ -324,9 +324,9 @@ void show_def::_update_monster(const monsters* mons) grid(e).colour = ripple_table[base_colour & 0x0f]; } - else if (is_opaque_cloud(env.cgrid(pos)) && - !mons->submerged() && - !mons_is_insubstantial(mons->type)) + else if (is_opaque_cloud(env.cgrid(pos)) + && !mons->submerged() + && !mons_is_insubstantial(mons->type)) { grid(e).cls = SH_INVIS_EXPOSED; grid(e).colour = get_cloud_colour(env.cgrid(pos)); diff --git a/crawl-ref/source/stash.h b/crawl-ref/source/stash.h index abb05d13d8..f455f54f6d 100644 --- a/crawl-ref/source/stash.h +++ b/crawl-ref/source/stash.h @@ -198,11 +198,11 @@ struct stash_search_result { } - bool operator < ( const stash_search_result &ssr ) const + bool operator < (const stash_search_result &ssr) const { - return player_distance < ssr.player_distance || - (player_distance == ssr.player_distance && - matches > ssr.matches); + return (player_distance < ssr.player_distance + || (player_distance == ssr.player_distance + && matches > ssr.matches)); } }; diff --git a/crawl-ref/source/state.cc b/crawl-ref/source/state.cc index 172383cba6..59f5e1188a 100644 --- a/crawl-ref/source/state.cc +++ b/crawl-ref/source/state.cc @@ -338,8 +338,8 @@ void game_state::inc_god_acting(god_type which_god, bool is_retribution) { ASSERT(which_god != GOD_NO_GOD); - if (god_act.which_god != GOD_NO_GOD && - god_act.which_god != which_god) + if (god_act.which_god != GOD_NO_GOD + && god_act.which_god != which_god) { ASSERT(god_act.depth >= 1); diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc index 2c882f9ce9..b941b51e85 100644 --- a/crawl-ref/source/tilereg.cc +++ b/crawl-ref/source/tilereg.cc @@ -1220,8 +1220,8 @@ static const bool _is_appropriate_spell(spell_type spell, if (flags & SPFLAG_NOT_SELF) return (false); - return ((flags & (SPFLAG_HELPFUL | SPFLAG_ESCAPE | SPFLAG_RECOVERY)) || - !targeted); + return ((flags & (SPFLAG_HELPFUL | SPFLAG_ESCAPE | SPFLAG_RECOVERY)) + || !targeted); } if (!targeted) diff --git a/crawl-ref/source/traps.cc b/crawl-ref/source/traps.cc index e20d9ae233..eb509420a3 100644 --- a/crawl-ref/source/traps.cc +++ b/crawl-ref/source/traps.cc @@ -463,8 +463,8 @@ void trap_def::trigger(actor& triggerer, bool flat_footed) } else if (random2(m->ev) > 8 || (trig_knows && random2(m->ev) > 8)) { - if (in_sight && - !simple_monster_message(m, + if (in_sight + && !simple_monster_message(m, " avoids a huge, swinging blade.")) { mpr("A huge blade swings out!"); diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index 335ca85a7e..4a1699d9d0 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -2678,14 +2678,16 @@ static bool _find_transtravel_square(const level_pos &target, bool verbose) { if ((_Src_Dest_Level_Delta < level_distance(dest_stair->destination.id, - level_target.p.id) || - _Src_Dest_Level_Delta < - level_distance(dest_stair->destination.id, - _Src_Level)) + level_target.p.id) + || _Src_Dest_Level_Delta < + level_distance(dest_stair->destination.id, + _Src_Level)) && !_Route_Warning.warn_continue_travel( level_target, dest_stair->destination.id)) + { return (false); + } } } diff --git a/crawl-ref/source/tutorial.cc b/crawl-ref/source/tutorial.cc index e1be483bf9..ac6aa5b6c5 100644 --- a/crawl-ref/source/tutorial.cc +++ b/crawl-ref/source/tutorial.cc @@ -3607,8 +3607,9 @@ void tutorial_describe_item(const item_def &item) ostr << _tut_throw_stuff(item); long_text = true; } - if (!item_type_known(item) && - (is_artefact(item) || get_equip_desc( item ) != ISFLAG_NO_DESC)) + if (!item_type_known(item) + && (is_artefact(item) + || get_equip_desc(item) != ISFLAG_NO_DESC)) { ostr << "\n\nWeapons and armour that have unusual descriptions " << "like this are much more likely to be of higher " diff --git a/crawl-ref/source/view.cc b/crawl-ref/source/view.cc index 1feaeb3a4f..8dfd504f3e 100644 --- a/crawl-ref/source/view.cc +++ b/crawl-ref/source/view.cc @@ -907,8 +907,8 @@ void viewwindow(bool monster_updates, bool show_updates) draw_unseen(&buffy[bufcount], gc); else if (!crawl_view.in_grid_los(gc)) draw_outside_los(&buffy[bufcount], gc); - else if (gc == you.pos() && - !crawl_state.arena && !crawl_state.arena_suspended) + else if (gc == you.pos() + && !crawl_state.arena && !crawl_state.arena_suspended) { draw_player(&buffy[bufcount], gc, ep); } |