From: <gi...@cr...> - 2013-04-29 20:35:11
|
via 1fa10a832ef758a66b86e665082891c47488533e (commit) via df2412e968dd822fb8efa009e3be3c214cc1f324 (commit) via f9d00bba8918b2e5a28dee3ec6c467539d3fb49e (commit) via 320dd8d50dbb442e10760150c52b9bd5c7804e71 (commit) via eadd8043228370f48905fc0d80470e7c6fe235af (commit) via 0c62adc7a15993a77411c596591c9c448db85850 (commit) via 53c6ae379d331a68b46e5dc493cd2b4349f92bb5 (commit) via 07dd405b8d4b3662c771c55c133a0636c6dbc03e (commit) via 55d7b023be6a91ca1baa9af3e17e21cf89987c72 (commit) via 9a587d2ef916d90865a31e1013a09521bb473bfd (commit) via 92a1dd4af9e27a47607af86081a1cf315c6af2e5 (commit) from fc8c391f6ab6c23962f112c78290a5e6f3ff12f7 (commit) ----------------------------------------------------------------------- commit 1fa10a832ef758a66b86e665082891c47488533e Author: Adam Borowski <kil...@an...> Date: Wed Apr 3 13:51:28 2013 +0200 Fix an inoperative battlesphere check. It's redundant now, though, we had to work around this to prevent mysterious crashes. Here's what was the cause. (cherry picked from commit 544981c1f93a8893c702ef8e75c73f7962729d3f) commit df2412e968dd822fb8efa009e3be3c214cc1f324 Author: Adam Borowski <kil...@an...> Date: Mon Apr 29 10:51:23 2013 +0200 Fix a crash if Xom acts when you're at a zero stat. (cherry picked from commit 6ad45a174772cb1ee55a7e15435a648887b71b6e) commit f9d00bba8918b2e5a28dee3ec6c467539d3fb49e Author: Adam Borowski <kil...@an...> Date: Fri Apr 26 17:29:06 2013 +0200 Fix a few "no previous declaration" warnings in tiles. (cherry picked from commit 5c79c9b89532195e06028beba5d38b30a6410a0b) commit 320dd8d50dbb442e10760150c52b9bd5c7804e71 Author: David Lawrence Ramsey <dol...@us...> Date: Fri Apr 26 10:34:02 2013 -0500 Fix warning caused by apparently missing #ifdef. (cherry picked from commit 2552ddc642ee69c9ebc4e994f66f579500b675ea) commit eadd8043228370f48905fc0d80470e7c6fe235af Author: Adam Borowski <kil...@an...> Date: Thu Apr 25 16:59:41 2013 +0200 Fix a "no previous declaration" warning on Windows. (cherry picked from commit 62aa3a732fe1726c6ee2fffde5a83e4be51dec69) commit 0c62adc7a15993a77411c596591c9c448db85850 Author: Adam Borowski <kil...@an...> Date: Wed Apr 24 16:05:25 2013 +0200 Fix a name conflict with std::ignore. Both in new gcc and new clang it causes a warning only with -Wextra, but clearing it costs us nothing. (cherry picked from commit ebf4e2fde760e814249e7c9333fde02ee42ee120) commit 53c6ae379d331a68b46e5dc493cd2b4349f92bb5 Author: Adam Borowski <kil...@an...> Date: Wed Apr 24 15:26:33 2013 +0200 Fix invalid message colour and job names being accepted. (cherry picked from commit 36e1f6c9ed5eebfef931d4438c4667e6870115e2) commit 07dd405b8d4b3662c771c55c133a0636c6dbc03e Author: Adam Borowski <kil...@an...> Date: Wed Apr 24 15:03:45 2013 +0200 Fix a monster_type misbuild with clang-3.3. Again, a magic value of -1. It was also wrongly checked in a few error handling routines, rendering them inoperative even with gcc. (cherry picked from commit 5f493bf4362078a61db8c6a62e16e1faa9a586fe) commit 55d7b023be6a91ca1baa9af3e17e21cf89987c72 Author: Adam Borowski <kil...@an...> Date: Wed Apr 24 13:32:20 2013 +0200 Drop a couple of useless comparisons. GOD_NO_GOD isn't -1 since ages ago, so these were inoperative. I'm afraid of dropping :god=: in logfiles -- should we fix its omission or would it break bots? [Picking into 0.12 to shut up clang's warnings.] (cherry picked from commit 4d69c10402ccda47deefc8ed3482d9764688dc13) commit 9a587d2ef916d90865a31e1013a09521bb473bfd Author: Adam Borowski <kil...@an...> Date: Wed Apr 24 13:16:12 2013 +0200 Fix a misbuild with clang-3.3. Our fault: enum types are not guaranteed to allow storing any values outside defined values, and the compiler is allowed to reduce storage size if it wants to. Since version 3.3, clang prefers unsigned types here. We used -1 and -2 as magic values, which would then fail comparison. I did not preserve the value of PlaceInfo.branch of -2 (ie, uninitialized). The whole branch field is mostly redundant, though, and we can get rid of it once get_all_place_info() is refactored. (cherry picked from commit aefa5b469d9c151cba17c0c9323391a6d15e9673) commit 92a1dd4af9e27a47607af86081a1cf315c6af2e5 Author: Adam Borowski <kil...@an...> Date: Fri Apr 12 13:14:37 2013 +0200 Disallow identifying/enchanting/recharging melded items [reimplemented]. This reverts doing this inside the inventory filter, as that broke all fail messages, and made keyboard flow inconsistent as well. It's ugly, and probably should use some variant of in-filter code with a means to pass failure messages to the caller, but for 0.12, we really shouldn't present new players with "That item can't be selected now.". (cherry picked from commit bcafd50d28ce15105ae43bb6a32cb08d55c30a15) (cherry picked from commit 3d87c34f773afb613986b3343e7cc83a7a09781e) (cherry picked from commit 4cf483e8a257eea3313a1b6c8246f178be63e459) (cherry picked from commit 4b82d48426ea5aa27efb0365d2ba3fcd8e0baf76) (cherry picked from commit b1144867e8f00914599f1a0ba2eddb1fa58d7bcb) ----------------------------------------------------------------------- Summary of changes: crawl-ref/source/abl-show.cc | 2 +- crawl-ref/source/beam.cc | 2 +- crawl-ref/source/command.cc | 2 +- crawl-ref/source/dbg-scan.cc | 2 +- crawl-ref/source/dungeon.cc | 2 +- crawl-ref/source/effects.cc | 2 +- crawl-ref/source/files.cc | 2 +- crawl-ref/source/food.cc | 2 +- crawl-ref/source/hiscores.cc | 14 +++------ crawl-ref/source/initfile.cc | 6 ++-- crawl-ref/source/invent.cc | 20 ++----------- crawl-ref/source/invent.h | 6 +-- crawl-ref/source/item_use.cc | 58 ++++++++++++++++++------------------ crawl-ref/source/itemprop.cc | 2 +- crawl-ref/source/itemprop.h | 3 +- crawl-ref/source/items.cc | 8 ++-- crawl-ref/source/l_dgnmon.cc | 6 ++- crawl-ref/source/mapdef.cc | 4 +- crawl-ref/source/mon-place.cc | 2 +- crawl-ref/source/monster.cc | 2 +- crawl-ref/source/output.cc | 12 ++++---- crawl-ref/source/place-info.cc | 13 ++------ crawl-ref/source/place-info.h | 1 - crawl-ref/source/player.cc | 1 - crawl-ref/source/quiver.cc | 3 +- crawl-ref/source/spl-miscast.cc | 2 +- crawl-ref/source/spl-summoning.cc | 2 +- crawl-ref/source/tags.cc | 8 +++++ crawl-ref/source/throw.cc | 2 +- crawl-ref/source/wcwidth.cc | 2 + crawl-ref/source/wiz-item.cc | 2 +- crawl-ref/source/wiz-mon.cc | 2 +- crawl-ref/source/xom.cc | 17 +++++------ 33 files changed, 99 insertions(+), 115 deletions(-) diff --git a/crawl-ref/source/abl-show.cc b/crawl-ref/source/abl-show.cc index 4ec3efd..e54eda8 100644 --- a/crawl-ref/source/abl-show.cc +++ b/crawl-ref/source/abl-show.cc @@ -1930,7 +1930,7 @@ static bool _do_ability(const ability_def& abil) } case ABIL_RECHARGING: - if (recharge_wand(-1) <= 0) + if (recharge_wand() <= 0) return false; // fail message is already given break; diff --git a/crawl-ref/source/beam.cc b/crawl-ref/source/beam.cc index 0f49160..0f0cc67 100644 --- a/crawl-ref/source/beam.cc +++ b/crawl-ref/source/beam.cc @@ -2846,7 +2846,7 @@ void bolt::affect_place_explosion_clouds() void bolt::internal_ouch(int dam) { monster* monst = NULL; - if (!invalid_monster_index(beam_source) && menv[beam_source].type != -1) + if (!invalid_monster_index(beam_source)) monst = &menv[beam_source]; const char *what = aux_source.empty() ? name.c_str() : aux_source.c_str(); diff --git a/crawl-ref/source/command.cc b/crawl-ref/source/command.cc index d47164b..5b7d90b 100644 --- a/crawl-ref/source/command.cc +++ b/crawl-ref/source/command.cc @@ -2228,7 +2228,7 @@ static void _add_formatted_keyhelp(column_composer &cols) #ifdef USE_TILE_LOCAL _add_command(cols, 0, CMD_EDIT_PLAYER_TILE, "edit player doll", 2); #else -#if USE_TILE_WEB +#ifdef USE_TILE_WEB if (tiles.is_controlled_from_web()) cols.add_formatted(0, "<w>F12</w> : read messages (online play only)", false); diff --git a/crawl-ref/source/dbg-scan.cc b/crawl-ref/source/dbg-scan.cc index 9bfb934..5c5b0f6 100644 --- a/crawl-ref/source/dbg-scan.cc +++ b/crawl-ref/source/dbg-scan.cc @@ -372,7 +372,7 @@ void debug_mons_scan() mprf(MSGCH_WARN, "Also at (%d, %d): %s, midx = %d", pos.x, pos.y, full.c_str(), j); } - else if (m2->type != -1) + else if (m2->type != MONS_NO_MONSTER) { mprf(MSGCH_WARN, "Dead mon also at (%d, %d): %s," "midx = %d", diff --git a/crawl-ref/source/dungeon.cc b/crawl-ref/source/dungeon.cc index c818734..8ca5962 100644 --- a/crawl-ref/source/dungeon.cc +++ b/crawl-ref/source/dungeon.cc @@ -4418,7 +4418,7 @@ monster* dgn_place_monster(mons_spec &mspec, coord_def where, bool force_pos, bool generate_awake, bool patrolling) { #if TAG_MAJOR_VERSION == 34 - if (mspec.type == -1) // or rebuild the des cache + if ((int)mspec.type == -1) // or rebuild the des cache return 0; #endif if (mspec.type == MONS_NO_MONSTER) diff --git a/crawl-ref/source/effects.cc b/crawl-ref/source/effects.cc index fe35efa..291ecdc 100644 --- a/crawl-ref/source/effects.cc +++ b/crawl-ref/source/effects.cc @@ -777,7 +777,7 @@ int recharge_wand(int item_slot, bool known, string *pre_msg) item_def &wand = you.inv[ item_slot ]; - if (!item_is_rechargeable(wand, known, true)) + if (!item_is_rechargeable(wand, known)) { mpr("Choose an item to recharge, or Esc to abort."); if (Options.auto_list) diff --git a/crawl-ref/source/files.cc b/crawl-ref/source/files.cc index afcfb2a..e348649 100644 --- a/crawl-ref/source/files.cc +++ b/crawl-ref/source/files.cc @@ -611,7 +611,7 @@ static void _fill_player_doll(player_save_info &p, package *save) if (!success) // Use default doll instead. { job_type job = get_job_by_name(p.class_name.c_str()); - if (job == -1) + if (job == JOB_UNKNOWN) job = JOB_FIGHTER; tilep_job_default(job, &equip_doll); diff --git a/crawl-ref/source/food.cc b/crawl-ref/source/food.cc index b5b5dc4..f1d1ead 100644 --- a/crawl-ref/source/food.cc +++ b/crawl-ref/source/food.cc @@ -751,7 +751,7 @@ bool prompt_eat_inventory_item(int slot) prompt_invent_item(you.species == SP_VAMPIRE ? "Drain what?" : "Eat which item?", MT_INVLIST, - you.form == TRAN_JELLY ? OSEL_ANY_UNMELDED : + you.form == TRAN_JELLY ? OSEL_ANY : you.species == SP_VAMPIRE ? (int)OSEL_VAMP_EAT : OBJ_FOOD, true, true, true, 0, -1, NULL, diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc index 275289e..091904d 100644 --- a/crawl-ref/source/hiscores.cc +++ b/crawl-ref/source/hiscores.cc @@ -998,12 +998,8 @@ void scorefile_entry::set_base_xlog_fields() const fields->add_field("ev", "%d", ev); fields->add_field("sh", "%d", sh); - // Don't write No God to save some space. - if (god != -1) - { - fields->add_field("god", "%s", god == GOD_NO_GOD? "" : - god_name(god).c_str()); - } + fields->add_field("god", "%s", god == GOD_NO_GOD? "" : + god_name(god).c_str()); if (wiz_mode) fields->add_field("wiz", "%d", wiz_mode); @@ -1164,7 +1160,7 @@ void scorefile_entry::init_death_cause(int dam, int dsrc, || death_type == KILLED_BY_REFLECTION || death_type == KILLED_BY_ROLLING) && !invalid_monster_index(death_source) - && menv[death_source].type != -1) + && menv[death_source].type != MONS_NO_MONSTER) { const monster* mons = &menv[death_source]; @@ -1780,7 +1776,7 @@ scorefile_entry::character_description(death_desc_verbosity verbosity) const desc = _append_sentence_delimiter(desc, "."); desc += _hiscore_newline_string(); - if (race != SP_DEMIGOD && god != -1) + if (race != SP_DEMIGOD && god != GOD_NO_GOD) { if (god == GOD_XOM) { @@ -1790,7 +1786,7 @@ scorefile_entry::character_description(death_desc_verbosity verbosity) const desc += scratch; desc += _hiscore_newline_string(); } - else if (god != GOD_NO_GOD) + else { // Not exactly the same as the religion screen, but // good enough to fill this slot for now. diff --git a/crawl-ref/source/initfile.cc b/crawl-ref/source/initfile.cc index 437011b..3770144 100644 --- a/crawl-ref/source/initfile.cc +++ b/crawl-ref/source/initfile.cc @@ -138,7 +138,7 @@ template<class A, class B> static void _merge_lists(A &dest, const B &src, dest.insert(prepend ? dest.begin() : dest.end(), src.begin(), src.end()); } -// Returns -1 if unmatched else returns 0-15. +// Returns MSGCOL_NONE if unmatched else returns 0-15. static msg_colour_type _str_to_channel_colour(const string &str) { int col = str_to_colour(str); @@ -155,7 +155,7 @@ static msg_colour_type _str_to_channel_colour(const string &str) ret = MSGCOL_ALTERNATE; } else - ret = msg_colour(str_to_colour(str)); + ret = msg_colour(col); return ret; } @@ -2545,7 +2545,7 @@ void game_options::read_option_line(const string &str, bool runscript) const int chnl = str_to_channel(subkey); const msg_colour_type col = _str_to_channel_colour(field); - if (chnl != -1 && col != -1) + if (chnl != -1 && col != MSGCOL_NONE) channels[chnl] = col; else if (chnl == -1) fprintf(stderr, "Bad channel -- %s\n", subkey.c_str()); diff --git a/crawl-ref/source/invent.cc b/crawl-ref/source/invent.cc index f60ff30..e76f486 100644 --- a/crawl-ref/source/invent.cc +++ b/crawl-ref/source/invent.cc @@ -447,7 +447,6 @@ static string _no_selectables_message(int item_selector) switch (item_selector) { case OSEL_ANY: - case OSEL_ANY_UNMELDED: return "You aren't carrying anything."; case OSEL_SCROLL_TARGET: return "You aren't carrying anything you could use a scroll on."; @@ -1144,9 +1143,6 @@ static bool _item_class_selected(const item_def &i, int selector) switch (selector) { - case OSEL_ANY_UNMELDED: - return !item_is_melded(i); - // Combined filter for valid unided scroll targets // TODO: If the player already ided one of the scrolls then we // could filter the list further. That results in the final scroll @@ -1170,8 +1166,7 @@ static bool _item_class_selected(const item_def &i, int selector) return (itype == OBJ_ARMOUR && item_is_equipped(i)); case OSEL_UNIDENT: - return (!fully_identified(i) || (is_deck(i) && !top_card_is_known(i))) - && !item_is_melded(i); + return !fully_identified(i) || (is_deck(i) && !top_card_is_known(i)); case OBJ_MISSILES: return (itype == OBJ_MISSILES || itype == OBJ_WEAPONS); @@ -1852,8 +1847,7 @@ int prompt_invent_item(const char *prompt, int excluded_slot, int *const count, operation_types oper, - bool allow_list_known, - bool accept_any) + bool allow_list_known) { if (!any_items_to_select(type_expect, false, excluded_slot) && type_expect == OSEL_THROWABLE @@ -1978,12 +1972,7 @@ int prompt_invent_item(const char *prompt, if (res != -1) { ret = res; - - if (!(accept_any || you.inv[ret].defined() - && you.inv[ret].link != excluded_slot - && _item_class_selected(you.inv[ret], type_expect))) - mpr("That item can't be selected now."); - else if (check_warning_inscriptions(you.inv[ret], oper)) + if (check_warning_inscriptions(you.inv[ret], oper)) break; } } @@ -2006,9 +1995,6 @@ int prompt_invent_item(const char *prompt, if (must_exist && !you.inv[ret].defined()) mpr("You don't have any such object."); - else if (!(accept_any || you.inv[ret].link != excluded_slot - && _item_class_selected(you.inv[ret], type_expect))) - mpr("That item can't be selected now."); else if (check_warning_inscriptions(you.inv[ret], oper)) break; } diff --git a/crawl-ref/source/invent.h b/crawl-ref/source/invent.h index 193c1dc..b6d9ab3 100644 --- a/crawl-ref/source/invent.h +++ b/crawl-ref/source/invent.h @@ -30,8 +30,7 @@ enum object_selector OSEL_CURSED_WORN = -14, OSEL_UNCURSED_WORN_ARMOUR = -15, OSEL_UNCURSED_WORN_JEWELLERY = -16, - OSEL_ANY_UNMELDED = -17, - OSEL_SCROLL_TARGET = -18, + OSEL_SCROLL_TARGET = -17, }; #define SLOT_BARE_HANDS -2 @@ -192,8 +191,7 @@ int prompt_invent_item(const char *prompt, int excluded_slot = -1, int *const count = NULL, operation_types oper = OPER_ANY, - bool allow_list_known = false, - bool accept_any = false); + bool allow_list_known = false); vector<SelItem> select_items( const vector<const item_def*> &items, diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index 1e1c374..a26ce02 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -299,7 +299,7 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages, item_slot = prompt_invent_item( "Wield which item (- for none, * to show all)?", MT_INVLIST, OSEL_WIELD, - true, true, true, '-', -1, NULL, OPER_WIELD, false, true); + true, true, true, '-', -1, NULL, OPER_WIELD); } else item_slot = SLOT_BARE_HANDS; @@ -2701,9 +2701,9 @@ static bool _scroll_modify_item(item_def scroll) { ASSERT(scroll.base_type == OBJ_SCROLLS); - // Get the slot of the scroll just read. - int item_slot = scroll.link; + int item_slot; +retry: do { // Get the slot of the item the scroll is to be used on. @@ -2727,6 +2727,17 @@ static bool _scroll_modify_item(item_def scroll) item_def &item = you.inv[item_slot]; + if (item_is_melded(you.inv[item_slot])) + { + mpr("This item is melded into your body!"); + if (Options.auto_list) + more(); + goto retry; + } + + bool show_msg = true; + const char* id_prop = nullptr; + switch (scroll.sub_type) { case SCR_IDENTIFY: @@ -2736,26 +2747,15 @@ static bool _scroll_modify_item(item_def scroll) return true; } else - { - you.type_id_props["SCR_ID"] = item.name(DESC_PLAIN, false, - false, false); - } + id_prop = "SCR_ID"; break; + case SCR_RECHARGING: - if (item_is_rechargeable(item, false, true)) - { - if (recharge_wand(item_slot, false)) - return true; - you.type_id_props["SCR_RC"] = item.name(DESC_PLAIN, false, - false, false); - return false; - } - else - { - you.type_id_props["SCR_RC"] = item.name(DESC_PLAIN, false, - false, false); - } + if (item_is_rechargeable(item) && recharge_wand(item_slot, false)) + return true; + id_prop = "SCR_RC"; break; + case SCR_ENCHANT_ARMOUR: if (is_enchantable_armour(item, true)) { @@ -2763,23 +2763,23 @@ static bool _scroll_modify_item(item_def scroll) // (If so, already prints the "Nothing happens" message.) if (_handle_enchant_armour(item_slot) > 0) return true; - you.type_id_props["SCR_EA"] = item.name(DESC_PLAIN, false, - false, false); - return false; - } - else - { - you.type_id_props["SCR_EA"] = item.name(DESC_PLAIN, false, - false, false); + show_msg = false; } + + id_prop = "SCR_EA"; break; + default: mprf("Buggy scroll %d can't modify item!", scroll.sub_type); break; } + if (id_prop) + you.type_id_props[id_prop] = item.name(DESC_PLAIN, false, false, false); + // Oops, wrong item... - canned_msg(MSG_NOTHING_HAPPENS); + if (show_msg) + canned_msg(MSG_NOTHING_HAPPENS); return false; } diff --git a/crawl-ref/source/itemprop.cc b/crawl-ref/source/itemprop.cc index 1ec6b70..15ec80e 100644 --- a/crawl-ref/source/itemprop.cc +++ b/crawl-ref/source/itemprop.cc @@ -1196,7 +1196,7 @@ bool check_armour_size(const item_def &item, size_type size) // Returns whether a wand or rod can be charged. // If hide_charged is true, wands known to be full will return false. // (This distinction is necessary because even full wands/rods give a message.) -bool item_is_rechargeable(const item_def &it, bool hide_charged, bool weapons) +bool item_is_rechargeable(const item_def &it, bool hide_charged) { // These are obvious... if (it.base_type == OBJ_WANDS) diff --git a/crawl-ref/source/itemprop.h b/crawl-ref/source/itemprop.h index 19b4f9b..a249aab 100644 --- a/crawl-ref/source/itemprop.h +++ b/crawl-ref/source/itemprop.h @@ -69,8 +69,7 @@ bool hide2armour(item_def &item); int fit_armour_size(const item_def &item, size_type size) PURE; bool check_armour_size(const item_def &item, size_type size) PURE; -bool item_is_rechargeable(const item_def &it, bool hide_charged = false, - bool weapons = false) PURE; +bool item_is_rechargeable(const item_def &it, bool hide_charged = false) PURE; int wand_charge_value(int type) PURE; int wand_max_charges(int type) PURE; bool is_offensive_wand(const item_def &item) PURE; diff --git a/crawl-ref/source/items.cc b/crawl-ref/source/items.cc index ee444ec..aa2b681 100644 --- a/crawl-ref/source/items.cc +++ b/crawl-ref/source/items.cc @@ -2720,13 +2720,13 @@ static bool _interesting_explore_pickup(const item_def& item) return true; } - vector<text_pattern> &ignore = Options.explore_stop_pickup_ignore; - if (!ignore.empty()) + vector<text_pattern> &ignores = Options.explore_stop_pickup_ignore; + if (!ignores.empty()) { const string name = item.name(DESC_PLAIN); - for (unsigned int i = 0; i < ignore.size(); i++) - if (ignore[i].matches(name)) + for (unsigned int i = 0; i < ignores.size(); i++) + if (ignores[i].matches(name)) return false; } diff --git a/crawl-ref/source/l_dgnmon.cc b/crawl-ref/source/l_dgnmon.cc index 46a6ae5..d6296ad 100644 --- a/crawl-ref/source/l_dgnmon.cc +++ b/crawl-ref/source/l_dgnmon.cc @@ -130,8 +130,10 @@ static int dgn_set_random_mon_list(lua_State *ls) luaL_argerror(ls, list_pos, err.c_str()); return 0; } - if (mon.type == -1) +#if TAG_MAJOR_VERSION == 34 + if ((int)mon.type == -1) mon.type = MONS_PROGRAM_BUG; +#endif if (mon.type == MONS_NO_MONSTER) name = "nothing"; else @@ -180,7 +182,7 @@ static int dgn_mons_from_mid(lua_State *ls) monster* mons = monster_by_mid(mid); - if (mons->type != -1) + if (mons->type != MONS_NO_MONSTER) push_monster(ls, mons); else lua_pushnil(ls); diff --git a/crawl-ref/source/mapdef.cc b/crawl-ref/source/mapdef.cc index 6f63122..1793b11 100644 --- a/crawl-ref/source/mapdef.cc +++ b/crawl-ref/source/mapdef.cc @@ -3466,8 +3466,8 @@ mons_spec mons_list::pick_monster(mons_spec_slot &slot) #if TAG_MAJOR_VERSION == 34 // Force rebuild of the des cache to drop this check. - if (pick.type < -1) - pick = (monster_type)(-100 - pick.type); + if ((int)pick.type < -1) + pick = (monster_type)(-100 - (int)pick.type); #endif if (slot.fix_slot) diff --git a/crawl-ref/source/mon-place.cc b/crawl-ref/source/mon-place.cc index d6a490d..e40532c 100644 --- a/crawl-ref/source/mon-place.cc +++ b/crawl-ref/source/mon-place.cc @@ -3593,7 +3593,7 @@ static void _get_vault_mon_list(vector<mons_spec> &list) mons_spec spec; #if TAG_MAJOR_VERSION == 34 - if (type == -1) + if ((int)type == -1) type = MONS_NO_MONSTER; #endif if (type == MONS_NO_MONSTER && base != MONS_NO_MONSTER) diff --git a/crawl-ref/source/monster.cc b/crawl-ref/source/monster.cc index a8320a0..cc624e6 100644 --- a/crawl-ref/source/monster.cc +++ b/crawl-ref/source/monster.cc @@ -4252,7 +4252,7 @@ int monster::hurt(const actor *agent, int amount, beam_type flavour, behaviour_event(this, ME_HURT); } - if (cleanup_dead && (hit_points <= 0 || hit_dice <= 0) && type != -1) + if (cleanup_dead && (hit_points <= 0 || hit_dice <= 0) && type != MONS_NO_MONSTER) { if (agent == NULL) monster_die(this, KILL_MISC, NON_MONSTER); diff --git a/crawl-ref/source/output.cc b/crawl-ref/source/output.cc index 8aec290..19af1b8 100644 --- a/crawl-ref/source/output.cc +++ b/crawl-ref/source/output.cc @@ -83,9 +83,9 @@ y HPP MPP */ #include <stdarg.h> -#define CGOTOXY cgotoxy_touchui -#define CPRINTF cprintf_touchui -#define NOWRAP_EOL_CPRINTF nowrap_eol_cprintf_touchui +#define CGOTOXY _cgotoxy_touchui +#define CPRINTF _cprintf_touchui +#define NOWRAP_EOL_CPRINTF _nowrap_eol_cprintf_touchui enum touchui_states { @@ -118,7 +118,7 @@ enum touchui_states TOUCH_V_LIGHT = 0x010B, }; touchui_states TOUCH_UI_STATE = TOUCH_S_INIT; -void cgotoxy_touchui(int x, int y, GotoRegion region = GOTO_CRT) +static void _cgotoxy_touchui(int x, int y, GotoRegion region = GOTO_CRT) { // printf("go to (%d,%d): ",x,y); if (tiles.is_using_small_layout()) @@ -200,7 +200,7 @@ void cgotoxy_touchui(int x, int y, GotoRegion region = GOTO_CRT) cgotoxy(x,y,region); } -void cprintf_touchui(const char *format, ...) +static void _cprintf_touchui(const char *format, ...) { va_list args; string buf; @@ -256,7 +256,7 @@ void cprintf_touchui(const char *format, ...) va_end(args); } -void nowrap_eol_cprintf_touchui(const char *format, ...) +static void _nowrap_eol_cprintf_touchui(const char *format, ...) { va_list args; string buf; diff --git a/crawl-ref/source/place-info.cc b/crawl-ref/source/place-info.cc index 647e3cb..d0122e1 100644 --- a/crawl-ref/source/place-info.cc +++ b/crawl-ref/source/place-info.cc @@ -6,7 +6,7 @@ #include "player.h" PlaceInfo::PlaceInfo() - : branch((branch_type)-2), num_visits(0), + : branch(NUM_BRANCHES), num_visits(0), levels_seen(0), mon_kill_exp(0), turns_total(0), turns_explore(0), turns_travel(0), turns_interlevel(0), turns_resting(0), turns_other(0), elapsed_total(0), elapsed_explore(0), @@ -19,12 +19,7 @@ PlaceInfo::PlaceInfo() bool PlaceInfo::is_global() const { - return (branch == -1); -} - -void PlaceInfo::make_global() -{ - branch = (branch_type)-1; + return (branch == NUM_BRANCHES); } void PlaceInfo::assert_validity() const @@ -34,8 +29,8 @@ void PlaceInfo::assert_validity() const ASSERT(num_visits == 0 && levels_seen == 0 || num_visits > 0 && levels_seen > 0); - // global data is -1 - if (branch >= 0 && brdepth[branch] != -1 && is_connected_branch(branch)) + // global data is NUM_BRANCHES + if (branch != NUM_BRANCHES && brdepth[branch] != -1 && is_connected_branch(branch)) ASSERT((int)levels_seen <= brdepth[branch]); ASSERT(turns_total == (turns_explore + turns_travel + turns_interlevel diff --git a/crawl-ref/source/place-info.h b/crawl-ref/source/place-info.h index cab15bf..6a3eed8 100644 --- a/crawl-ref/source/place-info.h +++ b/crawl-ref/source/place-info.h @@ -30,7 +30,6 @@ public: PlaceInfo(); bool is_global() const; - void make_global(); void assert_validity() const; diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index f29afc0..d744a55 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -5593,7 +5593,6 @@ void player::init() vault_list.clear(); global_info = PlaceInfo(); - global_info.make_global(); global_info.assert_validity(); if (m_quiver) diff --git a/crawl-ref/source/quiver.cc b/crawl-ref/source/quiver.cc index 4c9985d..013c6a2 100644 --- a/crawl-ref/source/quiver.cc +++ b/crawl-ref/source/quiver.cc @@ -182,11 +182,12 @@ void choose_item_for_quiver() mpr("You can't grasp things well enough to throw them."); return; } + int slot = prompt_invent_item("Quiver which item? (- for none, * to show all)", MT_INVLIST, OSEL_THROWABLE, true, true, true, '-', you.equip[EQ_WEAPON], NULL, OPER_QUIVER, - false, true); + false); if (prompt_failed(slot)) return; diff --git a/crawl-ref/source/spl-miscast.cc b/crawl-ref/source/spl-miscast.cc index 9db205e..26d3ea4 100644 --- a/crawl-ref/source/spl-miscast.cc +++ b/crawl-ref/source/spl-miscast.cc @@ -161,7 +161,7 @@ void MiscastEffect::init() else if (!invalid_monster_index(kill_source)) { monster* mon_source = &menv[kill_source]; - ASSERT(mon_source->type != -1); + ASSERT(mon_source->type != MONS_NO_MONSTER); act_source = guilty = mon_source; diff --git a/crawl-ref/source/spl-summoning.cc b/crawl-ref/source/spl-summoning.cc index fe86932..0da550a 100644 --- a/crawl-ref/source/spl-summoning.cc +++ b/crawl-ref/source/spl-summoning.cc @@ -2655,7 +2655,7 @@ void reset_battlesphere(monster* mons) bool fire_battlesphere(monster* mons) { - if (!mons || !mons->type == MONS_BATTLESPHERE) + if (!mons || mons->type != MONS_BATTLESPHERE) return false; actor* agent = actor_by_mid(mons->props["bs_mid"].get_int()); diff --git a/crawl-ref/source/tags.cc b/crawl-ref/source/tags.cc index 2d64cfd..e278a0d 100644 --- a/crawl-ref/source/tags.cc +++ b/crawl-ref/source/tags.cc @@ -2482,7 +2482,15 @@ static PlaceInfo unmarshallPlaceInfo(reader &th) { PlaceInfo place_info; +#if TAG_MAJOR_VERSION == 34 + int br = unmarshallInt(th); + if (br == -1) + br = NUM_BRANCHES; + ASSERT(br >= 0); + place_info.branch = static_cast<branch_type>(br); +#else place_info.branch = static_cast<branch_type>(unmarshallInt(th)); +#endif place_info.num_visits = unmarshallInt(th); place_info.levels_seen = unmarshallInt(th); diff --git a/crawl-ref/source/throw.cc b/crawl-ref/source/throw.cc index b3ef847..912cede 100644 --- a/crawl-ref/source/throw.cc +++ b/crawl-ref/source/throw.cc @@ -299,7 +299,7 @@ static int _fire_prompt_for_item() int slot = prompt_invent_item("Fire/throw which item? (* to show all)", MT_INVLIST, OSEL_THROWABLE, true, true, true, 0, -1, - NULL, OPER_FIRE, false, true); + NULL, OPER_FIRE); if (slot == PROMPT_ABORT || slot == PROMPT_NOTHING) return -1; diff --git a/crawl-ref/source/wcwidth.cc b/crawl-ref/source/wcwidth.cc index 9b8e612..54bd33a 100644 --- a/crawl-ref/source/wcwidth.cc +++ b/crawl-ref/source/wcwidth.cc @@ -62,6 +62,8 @@ #include "AppHdr.h" #ifndef UNIX +#include "unicode.h" + struct interval { ucs_t first; diff --git a/crawl-ref/source/wiz-item.cc b/crawl-ref/source/wiz-item.cc index 2301b32..7d6b2d3 100644 --- a/crawl-ref/source/wiz-item.cc +++ b/crawl-ref/source/wiz-item.cc @@ -185,7 +185,7 @@ void wizard_create_spec_object() dummy.number = prompt_for_int("How many heads? ", false); if (fill_out_corpse(&dummy, dummy.type, - mitm[thing_created], true) == -1) + mitm[thing_created], true) == MONS_NO_MONSTER) { mpr("Failed to create corpse."); mitm[thing_created].clear(); diff --git a/crawl-ref/source/wiz-mon.cc b/crawl-ref/source/wiz-mon.cc index 6173357..547407a 100644 --- a/crawl-ref/source/wiz-mon.cc +++ b/crawl-ref/source/wiz-mon.cc @@ -206,7 +206,7 @@ void wizard_create_spec_monster_name() } mons_spec mspec = mlist.get_monster(0); - if (mspec.type == -1) + if (mspec.type == MONS_NO_MONSTER) { mpr("Such a monster couldn't be found.", MSGCH_DIAGNOSTICS); return; diff --git a/crawl-ref/source/xom.cc b/crawl-ref/source/xom.cc index e1997fe..030614e 100644 --- a/crawl-ref/source/xom.cc +++ b/crawl-ref/source/xom.cc @@ -1060,11 +1060,12 @@ static monster_type _xom_random_demon(int sever, bool use_greater_demons = true) return demon; } -static bool _player_is_dead() +static bool _player_is_dead(bool soon = true) { - return (you.hp <= 0 || you.strength() <= 0 || you.dex() <= 0 || you.intel() <= 0 - || is_feat_dangerous(grd(you.pos())) && !you.is_wall_clinging() - || you.did_escape_death()); + return you.hp <= 0 + || is_feat_dangerous(grd(you.pos())) && !you.is_wall_clinging() + || you.did_escape_death() + || soon && (you.strength() <= 0 || you.dex() <= 0 || you.intel() <= 0); } static int _xom_do_potion(bool debug = false) @@ -3835,8 +3836,7 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) } #endif -#ifdef WIZARD - if (_player_is_dead()) + if (_player_is_dead(false)) { // This should only happen if the player used wizard mode to // escape from death via stat loss, or if the player used wizard @@ -3854,9 +3854,8 @@ int xom_acts(bool niceness, int sever, int tension, bool debug) } return XOM_PLAYER_DEAD; } -#else - ASSERT(!_player_is_dead()); -#endif + else if (_player_is_dead()) + return XOM_PLAYER_DEAD; sever = max(1, sever); -- Dungeon Crawl Stone Soup |