From de61f774d4b9787e998a24d966b45b5a211761dc Mon Sep 17 00:00:00 2001 From: haranp Date: Tue, 3 Jul 2007 10:58:08 +0000 Subject: Made the weapon warning one-off (until you change weapons.) git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@1726 c06c8d41-db1a-0410-9941-cceddc491573 --- crawl-ref/source/enum.h | 4 ++-- crawl-ref/source/externs.h | 6 +++--- crawl-ref/source/fight.cc | 14 ++++++++------ crawl-ref/source/item_use.cc | 3 +++ crawl-ref/source/player.cc | 3 +++ 5 files changed, 19 insertions(+), 11 deletions(-) (limited to 'crawl-ref/source') diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index 0dc20e6ff4..af60786a08 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -932,8 +932,8 @@ enum dragon_class_type enum game_direction_type { - DIR_DESCENDING = 0, // 0 - change and lose savefile compatibility (!!!) - DIR_ASCENDING = 1 // 1 - change and lose savefile compatibility (!!!) + DIR_DESCENDING = 0, + DIR_ASCENDING = 1 }; // NOTE: The order of these is very important to their usage! diff --git a/crawl-ref/source/externs.h b/crawl-ref/source/externs.h index 89bb2b5fd5..a87304947d 100644 --- a/crawl-ref/source/externs.h +++ b/crawl-ref/source/externs.h @@ -661,6 +661,7 @@ public: char hunger_state; bool wield_change; // redraw weapon + bool received_weapon_warning; unsigned long redraw_status_flags; @@ -698,7 +699,7 @@ public: burden_state_type burden_state; FixedVector spells; char spell_no; - game_direction_type char_direction; // + game_direction_type char_direction; unsigned char pet_target; @@ -1270,7 +1271,6 @@ struct game_state bool need_save; // Set to true when game has started. bool saving_game; // Set to true while in save_game. bool updating_scores; // Set to true while updating hiscores. - bool shopping; // Set if id has been munged for shopping. int seen_hups; // Set to true if SIGHUP received. @@ -1283,7 +1283,7 @@ struct game_state game_state() : mouse_enabled(false), waiting_for_command(false), terminal_resized(false), io_inited(false), need_save(false), - saving_game(false), updating_scores(false), shopping(false), + saving_game(false), updating_scores(false), seen_hups(0), unicode_ok(false), glyph2strfn(NULL), multibyte_strlen(NULL), terminal_resize_handler(NULL), terminal_resize_check(NULL) diff --git a/crawl-ref/source/fight.cc b/crawl-ref/source/fight.cc index f50b52c696..03208d6976 100644 --- a/crawl-ref/source/fight.cc +++ b/crawl-ref/source/fight.cc @@ -3194,12 +3194,14 @@ int melee_attack::mons_to_hit() static void wielded_weapon_check(const item_def *weapon) { - if (weapon && - (weapon->base_type != OBJ_WEAPONS - || is_range_weapon(*weapon))) - { - mpr("You might want to wield a more suitable implement when attacking monsters.", MSGCH_WARN); - learned_something_new(TUT_WIELD_WEAPON); // for tutorial Rangers + if (you.received_weapon_warning == false && + weapon && + (weapon->base_type != OBJ_WEAPONS || is_range_weapon(*weapon))) + { + mpr("You might want to wield a more suitable implement when " + "attacking monsters.", MSGCH_WARN); + learned_something_new(TUT_WIELD_WEAPON); // for tutorial Rangers + you.received_weapon_warning = true; } } diff --git a/crawl-ref/source/item_use.cc b/crawl-ref/source/item_use.cc index f3544c7acc..2504377b1a 100644 --- a/crawl-ref/source/item_use.cc +++ b/crawl-ref/source/item_use.cc @@ -204,6 +204,9 @@ bool wield_weapon(bool auto_wield, int slot, bool show_weff_messages) && you.inv[item_slot].base_type != OBJ_MISSILES && you.inv[item_slot].base_type != OBJ_STAVES; + // Reset the warning counter. + you.received_weapon_warning = false; + // Prompt if not using the auto swap command, or if the swap slot // is empty. if (!auto_wield || !is_valid_item(you.inv[item_slot]) || force_unwield) diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc index dcf781a9b4..cf8b5819a0 100644 --- a/crawl-ref/source/player.cc +++ b/crawl-ref/source/player.cc @@ -4503,6 +4503,9 @@ void player::init() hunger = 6000; hunger_state = HS_SATIATED; + wield_change = false; + received_weapon_warning = false; + gold = 0; // speed = 10; // 0.75; // unused -- cgit v1.2.3-54-g00ecf