From 54a744df62043fdc9eea179d42baa9b15281f346 Mon Sep 17 00:00:00 2001 From: j-p-e-g Date: Wed, 16 Apr 2008 16:04:02 +0000 Subject: Disallow the Staff of Wucad Mu as a Trog gift. And another of those code cleanups. git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@4259 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/decks.cc | 3 ++- crawl-ref/source/effects.cc | 3 ++- crawl-ref/source/ghost.cc | 22 +++++++++++----------- crawl-ref/source/initfile.cc | 6 +++--- crawl-ref/source/menu.cc | 16 ++++++++++++---- crawl-ref/source/newgame.cc | 6 ++++-- crawl-ref/source/randart.cc | 9 ++++++--- crawl-ref/source/stuff.cc | 14 ++++++++++---- crawl-ref/source/travel.cc | 15 +++++++++------ 9 files changed, 59 insertions(+), 35 deletions(-) diff --git a/crawl-ref/source/decks.cc b/crawl-ref/source/decks.cc index b95b8c68fe..dfd7e0cee8 100644 --- a/crawl-ref/source/decks.cc +++ b/crawl-ref/source/decks.cc @@ -757,7 +757,8 @@ static void _deck_lose_card(item_def& deck) // Seen cards are only half as likely to fall out, // marked cards only one-quarter as likely (note that marked // cards are also seen.) - do { + do + { _shuffle_deck(deck); get_card_and_flags(deck, -1, flags); } diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index c93291bf89..617d785e6f 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -1502,7 +1502,8 @@ bool acquirement(object_class_type class_wanted, int agent, int brand = get_weapon_brand(doodad); if (brand == SPWPN_PAIN || is_fixed_artefact(doodad) - && doodad.special == SPWPN_WRATH_OF_TROG) + && (doodad.special == SPWPN_WRATH_OF_TROG + || doodad.special == SPWPN_STAFF_OF_WUCAD_MU)) { destroy_item(thing_created, true); thing_created = NON_ITEM; diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index b39895755d..c3861ef8a4 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -123,8 +123,6 @@ void ghost_demon::reset() see_invis = false; brand = SPWPN_NORMAL; resists = mon_resist_def(); - // HACKY: demons and ghosts always resist poison -// resists.poison = 1; spellcaster = false; cycle_colours = false; fly = FL_NONE; @@ -174,17 +172,19 @@ void ghost_demon::init_random_demon() if (!one_chance_in(3)) { - do { + do + { brand = static_cast( random2(MAX_PAN_LORD_BRANDS) ); /* some brands inappropriate (e.g. holy wrath) */ - } while (brand == SPWPN_HOLY_WRATH - || (brand == SPWPN_ORC_SLAYING - && you.mons_species() != MONS_ORC) - || (brand == SPWPN_DRAGON_SLAYING - && you.mons_species() != MONS_DRACONIAN) - || brand == SPWPN_PROTECTION - || brand == SPWPN_FLAME - || brand == SPWPN_FROST); + } + while (brand == SPWPN_HOLY_WRATH + || (brand == SPWPN_ORC_SLAYING + && you.mons_species() != MONS_ORC) + || (brand == SPWPN_DRAGON_SLAYING + && you.mons_species() != MONS_DRACONIAN) + || brand == SPWPN_PROTECTION + || brand == SPWPN_FLAME + || brand == SPWPN_FROST); } // is demon a spellcaster? diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 5f5baab92b..05babe80c1 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -1593,11 +1593,11 @@ void game_options::read_option_line(const std::string &str, bool runscript) } while (false) #define CURSES_OPTION(_opt) CURSES_OPTION_NAMED(#_opt, _opt) - std::string key = ""; + std::string key = ""; std::string subkey = ""; - std::string field = ""; + std::string field = ""; - bool plus_equal = false; + bool plus_equal = false; bool minus_equal = false; const int first_equals = str.find('='); diff --git a/crawl-ref/source/menu.cc b/crawl-ref/source/menu.cc index 1a47b5a3a5..2e6e291001 100644 --- a/crawl-ref/source/menu.cc +++ b/crawl-ref/source/menu.cc @@ -1094,18 +1094,26 @@ void slider_menu::new_selection(int nsel) if (nsel < 0) { if ( !is_set(MF_NOWRAP) ) - do { + { + do + { nsel += items.size(); - } while ( nsel < 0 ); + } + while ( nsel < 0 ); + } else nsel = 0; } if (nsel >= static_cast(items.size())) { if ( !is_set(MF_NOWRAP) ) - do { + { + do + { nsel -= items.size(); - } while ( nsel >= static_cast(items.size()) ); + } + while ( nsel >= static_cast(items.size()) ); + } else nsel = items.size() - 1; } diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 71220abc0d..75338d3386 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -3834,7 +3834,8 @@ bool _give_items_skills() : "Random"); } - do { + do + { keyn = c_getch(); switch (keyn) @@ -4436,7 +4437,8 @@ bool _give_items_skills() "Random"); } - do { + do + { keyn = c_getch(); switch (keyn) diff --git a/crawl-ref/source/randart.cc b/crawl-ref/source/randart.cc index 635873953d..8e613cc299 100644 --- a/crawl-ref/source/randart.cc +++ b/crawl-ref/source/randart.cc @@ -200,9 +200,11 @@ static std::string replace_name_parts(const std::string name_in, which_god = god_gift; else { - do { + do + { which_god = static_cast(random2(NUM_GODS)); - } while (!god_fits_artefact(which_god, item)); + } + while (!god_fits_artefact(which_god, item)); } name = replace_all(name, "@god_name@", god_name(which_god, false)); @@ -1672,7 +1674,8 @@ bool make_item_randart( item_def &item, bool randomise ) do { item.special = (random_int() & RANDART_SEED_MASK); - } while (randart_is_bad( item )); + } + while (randart_is_bad( item )); } return (true); diff --git a/crawl-ref/source/stuff.cc b/crawl-ref/source/stuff.cc index 923e415e78..359ff03da3 100644 --- a/crawl-ref/source/stuff.cc +++ b/crawl-ref/source/stuff.cc @@ -148,17 +148,23 @@ bool radius_iterator::on_valid_square() const const radius_iterator& radius_iterator::operator++() { - do { + do + { this->step(); - } while ( !this->done() && !this->on_valid_square() ); + } + while ( !this->done() && !this->on_valid_square() ); + return *this; } const radius_iterator& radius_iterator::operator--() { - do { + do + { this->step_back(); - } while ( !this->done() && !this->on_valid_square() ); + } + while ( !this->done() && !this->on_valid_square() ); + return *this; } diff --git a/crawl-ref/source/travel.cc b/crawl-ref/source/travel.cc index b73b49ecc2..54e4fe8194 100644 --- a/crawl-ref/source/travel.cc +++ b/crawl-ref/source/travel.cc @@ -955,12 +955,14 @@ static void explore_find_target_square() coord_def delta = Compass[anti_zigzag_dir]; dungeon_feature_type feature; - do { + do + { target += delta; feature = grd(target); - } while (is_travelsafe_square(target.x, target.y) - && is_traversable(feature) - && feature_traverse_cost(feature) == 1); + } + while (is_travelsafe_square(target.x, target.y) + && is_traversable(feature) + && feature_traverse_cost(feature) == 1); target -= delta; @@ -1999,13 +2001,14 @@ static int get_nearest_level_depth(unsigned char branch) do { find_parent_branch(id.branch, id.depth, - &id.branch, &id.depth); + &id.branch, &id.depth); if (id.depth && id.branch == branch) { depth = id.depth; break; } - } while (id.depth); + } + while (id.depth); return depth; } -- cgit v1.2.3-54-g00ecf