From: Hourier Date: Sat, 27 Jun 2020 13:28:07 +0000 (+0900) Subject: [Refactor] #40482 Separated spells-perception.c/h from spells3.c/h X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=09bda08f5100e0e6cbf3d47ad3b714fe528e3e6a;p=hengband%2Fhengband.git [Refactor] #40482 Separated spells-perception.c/h from spells3.c/h --- diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index e0dabb49e..0825bcf9f 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -217,6 +217,7 @@ + @@ -629,6 +630,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index f7bffa7a8..b572d75cc 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -1463,6 +1463,9 @@ spell-kind + + spell-kind + @@ -3217,6 +3220,9 @@ spell-kind + + spell-kind + diff --git a/src/Makefile.am b/src/Makefile.am index 38ba6e84e..303003233 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -527,6 +527,7 @@ hengband_SOURCES = \ spell-kind/spells-lite.c spell-kind/spells-lite.h \ spell-kind/spells-neighbor.c spell-kind/spells-neighbor.h \ spell-kind/spells-pet.c spell-kind/spells-pet.h \ + spell-kind/spells-perception.c spell-kind/spells-perception.h \ spell-kind/spells-random.c spell-kind/spells-random.h \ spell-kind/spells-recall.c spell-kind/spells-recall.h \ spell-kind/spells-sight.c spell-kind/spells-sight.h \ diff --git a/src/cmd-building/cmd-building.c b/src/cmd-building/cmd-building.c index b512273dc..9014de6cf 100644 --- a/src/cmd-building/cmd-building.c +++ b/src/cmd-building/cmd-building.c @@ -13,8 +13,8 @@ #include "cmd-building/cmd-building.h" #include "cmd-action/cmd-spell.h" -#include "cmd-io/cmd-dump.h" #include "cmd-building/cmd-inn.h" +#include "cmd-io/cmd-dump.h" #include "core/asking-player.h" #include "core/scores.h" #include "core/show-file.h" @@ -51,10 +51,10 @@ #include "player/avatar.h" #include "player/player-personalities-types.h" #include "player/player-status.h" -#include "spell/spells-status.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-teleport.h" -#include "spell/spells3.h" +#include "spell/spells-status.h" #include "system/building-type-definition.h" #include "term/screen-processor.h" #include "util/bit-flags-calculator.h" diff --git a/src/cmd-item/cmd-activate.c b/src/cmd-item/cmd-activate.c index 41ed21c6b..3e7586d7c 100644 --- a/src/cmd-item/cmd-activate.c +++ b/src/cmd-item/cmd-activate.c @@ -61,6 +61,7 @@ #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-random.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" diff --git a/src/cmd-item/cmd-item.c b/src/cmd-item/cmd-item.c index 03ff5bc88..9868d9bf9 100644 --- a/src/cmd-item/cmd-item.c +++ b/src/cmd-item/cmd-item.c @@ -64,7 +64,7 @@ #include "realm/realm-hex-numbers.h" #include "realm/realm-names-table.h" #include "realm/realm-types.h" -#include "spell/spells3.h" +#include "spell-kind/spells-perception.h" #include "sv-definition/sv-lite-types.h" #include "term/screen-processor.h" #include "util/int-char-converter.h" diff --git a/src/cmd-item/cmd-quaff.c b/src/cmd-item/cmd-quaff.c index 0a2887c63..b0b45497c 100644 --- a/src/cmd-item/cmd-quaff.c +++ b/src/cmd-item/cmd-quaff.c @@ -37,6 +37,7 @@ #include "realm/realm-hex-numbers.h" #include "spell-kind/spells-detection.h" #include "spell-kind/spells-floor.h" +#include "spell-kind/spells-perception.h" #include "spell-realm/spells-hex.h" #include "spell/spells-status.h" #include "spell/spells3.h" diff --git a/src/cmd-item/cmd-read.c b/src/cmd-item/cmd-read.c index af0340e97..4ae4336ac 100644 --- a/src/cmd-item/cmd-read.c +++ b/src/cmd-item/cmd-read.c @@ -38,6 +38,7 @@ #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" diff --git a/src/cmd-item/cmd-usestaff.c b/src/cmd-item/cmd-usestaff.c index 0134ff253..104457389 100644 --- a/src/cmd-item/cmd-usestaff.c +++ b/src/cmd-item/cmd-usestaff.c @@ -31,12 +31,12 @@ #include "spell-kind/spells-genocide.h" #include "spell-kind/spells-lite.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" #include "spell/spells-staff-only.h" #include "spell/spells-status.h" #include "spell/spells-summon.h" -#include "spell/spells3.h" #include "sv-definition/sv-staff-types.h" #include "term/screen-processor.h" #include "view/display-messages.h" diff --git a/src/cmd-item/cmd-zaprod.c b/src/cmd-item/cmd-zaprod.c index 65b79079c..7de2467b5 100644 --- a/src/cmd-item/cmd-zaprod.c +++ b/src/cmd-item/cmd-zaprod.c @@ -23,6 +23,7 @@ #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-random.h" #include "spell-kind/spells-sight.h" @@ -30,7 +31,6 @@ #include "spell-kind/spells-teleport.h" #include "spell/spells-status.h" #include "spell/spell-types.h" -#include "spell/spells3.h" #include "sv-definition/sv-other-types.h" #include "sv-definition/sv-rod-types.h" #include "term/screen-processor.h" diff --git a/src/effect/effect-item.c b/src/effect/effect-item.c index 3330c4754..f6c0bbc72 100644 --- a/src/effect/effect-item.c +++ b/src/effect/effect-item.c @@ -11,8 +11,8 @@ #include "object/object-hook.h" #include "object/object-mark-types.h" #include "perception/object-perception.h" +#include "spell-kind/spells-perception.h" #include "spell/spell-types.h" -#include "spell/spells3.h" #include "sv-definition/sv-other-types.h" #include "sv-definition/sv-scroll-types.h" #include "util/bit-flags-calculator.h" diff --git a/src/market/building-recharger.c b/src/market/building-recharger.c index e998deb73..971435c70 100644 --- a/src/market/building-recharger.c +++ b/src/market/building-recharger.c @@ -9,7 +9,7 @@ #include "object/object-hook.h" #include "object/object-kind.h" #include "object-enchant/special-object-flags.h" -#include "spell/spells3.h" +#include "spell-kind/spells-perception.h" #include "term/screen-processor.h" #include "view/display-messages.h" diff --git a/src/mind/mind.c b/src/mind/mind.c index 549fd8f89..d1c2c6856 100644 --- a/src/mind/mind.c +++ b/src/mind/mind.c @@ -56,6 +56,7 @@ #include "spell-kind/spells-grid.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell/spells-status.h" diff --git a/src/mind/racial.c b/src/mind/racial.c index 87ae5fc13..470d0d265 100644 --- a/src/mind/racial.c +++ b/src/mind/racial.c @@ -55,6 +55,7 @@ #include "spell-kind/spells-grid.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" diff --git a/src/player/player-move.c b/src/player/player-move.c index 187056551..56583e1b5 100644 --- a/src/player/player-move.c +++ b/src/player/player-move.c @@ -192,9 +192,9 @@ #include "player/player-status.h" #include "realm/realm-song-numbers.h" #include "spell-kind/spells-floor.h" +#include "spell-kind/spells-perception.h" #include "spell/process-effect.h" #include "spell/spell-types.h" -#include "spell/spells3.h" #include "term/screen-processor.h" #include "util/bit-flags-calculator.h" #include "view/display-messages.h" diff --git a/src/realm/realm-arcane.c b/src/realm/realm-arcane.c index 597c286c5..c2c8a1359 100644 --- a/src/realm/realm-arcane.c +++ b/src/realm/realm-arcane.c @@ -14,13 +14,13 @@ #include "spell-kind/spells-floor.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell/spells-object.h" #include "spell/spells-status.h" #include "spell/spells-summon.h" #include "spell-kind/spells-teleport.h" #include "spell/spell-types.h" -#include "spell/spells3.h" #include "view/display-messages.h" /*! diff --git a/src/realm/realm-craft.c b/src/realm/realm-craft.c index 964d5bbf8..a8809e4d2 100644 --- a/src/realm/realm-craft.c +++ b/src/realm/realm-craft.c @@ -7,6 +7,7 @@ #include "player/player-status.h" #include "player/selfinfo.h" #include "spell-kind/spells-curse-removal.h" +#include "spell-kind/spells-perception.h" #include "spell/range-calc.h" #include "spell/spells-object.h" #include "spell/spells-status.h" diff --git a/src/realm/realm-death.c b/src/realm/realm-death.c index b99f0604f..1459af571 100644 --- a/src/realm/realm-death.c +++ b/src/realm/realm-death.c @@ -13,6 +13,7 @@ #include "spell-kind/spells-genocide.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-specific-bolt.h" #include "spell/process-effect.h" @@ -21,7 +22,6 @@ #include "spell/spells-status.h" #include "spell/spells-summon.h" #include "spell/spell-types.h" -#include "spell/spells3.h" /*! * @brief 暗黒領域魔法の各処理を行う diff --git a/src/realm/realm-hissatsu.c b/src/realm/realm-hissatsu.c index 43186b8dc..2931445c5 100644 --- a/src/realm/realm-hissatsu.c +++ b/src/realm/realm-hissatsu.c @@ -31,11 +31,11 @@ #include "spell-kind/earthquake.h" #include "spell-kind/spells-detection.h" #include "spell-kind/spells-launcher.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" #include "spell/spell-types.h" #include "spell/spells-util.h" -#include "spell/spells3.h" #include "spell/technic-info-table.h" #include "term/screen-processor.h" #include "util/bit-flags-calculator.h" diff --git a/src/realm/realm-life.c b/src/realm/realm-life.c index 6b6d3cd4d..c5b794f9a 100644 --- a/src/realm/realm-life.c +++ b/src/realm/realm-life.c @@ -13,6 +13,7 @@ #include "spell-kind/spells-lite.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell/spells-status.h" diff --git a/src/realm/realm-nature.c b/src/realm/realm-nature.c index eeb3be180..f815af7f7 100644 --- a/src/realm/realm-nature.c +++ b/src/realm/realm-nature.c @@ -23,6 +23,7 @@ #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" #include "spell-kind/spells-neighbor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-sight.h" #include "spell/process-effect.h" #include "spell/spells-diceroll.h" diff --git a/src/realm/realm-sorcery.c b/src/realm/realm-sorcery.c index 881187dcf..1077421cc 100644 --- a/src/realm/realm-sorcery.c +++ b/src/realm/realm-sorcery.c @@ -11,6 +11,7 @@ #include "spell-kind/spells-grid.h" #include "spell-kind/spells-launcher.h" #include "spell-kind/spells-lite.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" diff --git a/src/realm/realm-trump.c b/src/realm/realm-trump.c index a5ef8390c..2397789e5 100644 --- a/src/realm/realm-trump.c +++ b/src/realm/realm-trump.c @@ -11,6 +11,7 @@ #include "spell-kind/spells-detection.h" #include "spell-kind/spells-floor.h" #include "spell-kind/spells-launcher.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-recall.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" diff --git a/src/spell-kind/spells-perception.c b/src/spell-kind/spells-perception.c new file mode 100644 index 000000000..37c353021 --- /dev/null +++ b/src/spell-kind/spells-perception.c @@ -0,0 +1,188 @@ +#include "spell-kind/spells-perception.h" +#include "autopick/autopick.h" +#include "core/stuff-handler.h" +#include "game-option/auto-destruction-options.h" +#include "game-option/play-record-options.h" +#include "inventory/player-inventory.h" +#include "io/write-diary.h" +#include "object-enchant/special-object-flags.h" +#include "object/item-use-flags.h" +#include "object/object-flavor.h" +#include "object/object-hook.h" +#include "object/object-info.h" +#include "object/object-mark-types.h" +#include "perception/identification.h" +#include "perception/object-perception.h" +#include "player/avatar.h" +#include "system/object-type-definition.h" +#include "view/display-messages.h" +#include "world/world.h" + +/*! + * @brief 全所持アイテム鑑定処理 / + * Identify everything being carried. + * Done by a potion of "self knowledge". + * @param target_ptr プレーヤーへの参照ポインタ + * @return なし + */ +void identify_pack(player_type *target_ptr) +{ + for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) { + object_type *o_ptr = &target_ptr->inventory_list[i]; + if (!o_ptr->k_idx) + continue; + + identify_item(target_ptr, o_ptr); + autopick_alter_item(target_ptr, i, FALSE); + } +} + +/*! + * @brief アイテム鑑定処理 / + * Identify an object + * @param owner_ptr プレーヤーへの参照ポインタ + * @param o_ptr 鑑定されるアイテムの情報参照ポインタ + * @return 実際に鑑定できたらTRUEを返す + */ +bool identify_item(player_type *owner_ptr, object_type *o_ptr) +{ + GAME_TEXT o_name[MAX_NLEN]; + object_desc(owner_ptr, o_name, o_ptr, 0); + + bool old_known = FALSE; + if (o_ptr->ident & IDENT_KNOWN) + old_known = TRUE; + + if (!object_is_fully_known(o_ptr)) { + if (object_is_artifact(o_ptr) || one_in_(5)) + chg_virtue(owner_ptr, V_KNOWLEDGE, 1); + } + + object_aware(owner_ptr, o_ptr); + object_known(o_ptr); + o_ptr->marked |= OM_TOUCHED; + + owner_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER); + owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); + + strcpy(record_o_name, o_name); + record_turn = current_world_ptr->game_turn; + + object_desc(owner_ptr, o_name, o_ptr, OD_NAME_ONLY); + + if (record_fix_art && !old_known && object_is_fixed_artifact(o_ptr)) + exe_write_diary(owner_ptr, DIARY_ART, 0, o_name); + if (record_rand_art && !old_known && o_ptr->art_name) + exe_write_diary(owner_ptr, DIARY_ART, 0, o_name); + + return old_known; +} + +/*! + * @brief アイテム鑑定のメインルーチン処理 / + * Identify an object in the inventory (or on the floor) + * @param caster_ptr プレーヤーへの参照ポインタ + * @param only_equip 装備品のみを対象とするならばTRUEを返す + * @return 実際に鑑定を行ったならばTRUEを返す + * @details + * This routine does *not* automatically combine objects. + * Returns TRUE if something was identified, else FALSE. + */ +bool ident_spell(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval) +{ + if (only_equip) + item_tester_hook = item_tester_hook_identify_weapon_armour; + else + item_tester_hook = item_tester_hook_identify; + + concptr q; + if (can_get_item(caster_ptr, item_tester_tval)) { + q = _("どのアイテムを鑑定しますか? ", "Identify which item? "); + } else { + if (only_equip) + item_tester_hook = object_is_weapon_armour_ammo; + else + item_tester_hook = NULL; + + q = _("すべて鑑定済みです。 ", "All items are identified. "); + } + + concptr s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); + OBJECT_IDX item; + object_type *o_ptr; + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + if (!o_ptr) + return FALSE; + + bool old_known = identify_item(caster_ptr, o_ptr); + + GAME_TEXT o_name[MAX_NLEN]; + object_desc(caster_ptr, o_name, o_ptr, 0); + if (item >= INVEN_RARM) { + msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(caster_ptr, item), o_name, index_to_label(item)); + } else if (item >= 0) { + msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item)); + } else { + msg_format(_("床上: %s。", "On the ground: %s."), o_name); + } + + autopick_alter_item(caster_ptr, item, (bool)(destroy_identify && !old_known)); + return TRUE; +} + +/*! + * @brief アイテム*鑑定*のメインルーチン処理 / + * Identify an object in the inventory (or on the floor) + * @param caster_ptr プレーヤーへの参照ポインタ + * @param only_equip 装備品のみを対象とするならばTRUEを返す + * @return 実際に鑑定を行ったならばTRUEを返す + * @details + * Fully "identify" an object in the inventory -BEN- + * This routine returns TRUE if an item was identified. + */ +bool identify_fully(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval) +{ + if (only_equip) + item_tester_hook = item_tester_hook_identify_fully_weapon_armour; + else + item_tester_hook = item_tester_hook_identify_fully; + + concptr q; + if (can_get_item(caster_ptr, item_tester_tval)) { + q = _("どのアイテムを*鑑定*しますか? ", "*Identify* which item? "); + } else { + if (only_equip) + item_tester_hook = object_is_weapon_armour_ammo; + else + item_tester_hook = NULL; + + q = _("すべて*鑑定*済みです。 ", "All items are *identified*. "); + } + + concptr s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*."); + + OBJECT_IDX item; + object_type *o_ptr; + o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); + if (!o_ptr) + return FALSE; + + bool old_known = identify_item(caster_ptr, o_ptr); + + o_ptr->ident |= (IDENT_FULL_KNOWN); + handle_stuff(caster_ptr); + + GAME_TEXT o_name[MAX_NLEN]; + object_desc(caster_ptr, o_name, o_ptr, 0); + if (item >= INVEN_RARM) { + msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(caster_ptr, item), o_name, index_to_label(item)); + } else if (item >= 0) { + msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item)); + } else { + msg_format(_("床上: %s。", "On the ground: %s."), o_name); + } + + (void)screen_object(caster_ptr, o_ptr, 0L); + autopick_alter_item(caster_ptr, item, (bool)(destroy_identify && !old_known)); + return TRUE; +} diff --git a/src/spell-kind/spells-perception.h b/src/spell-kind/spells-perception.h new file mode 100644 index 000000000..71b0d6f47 --- /dev/null +++ b/src/spell-kind/spells-perception.h @@ -0,0 +1,9 @@ +#pragma once + +#include "system/angband.h" +#include "object/tval-types.h" + +void identify_pack(player_type *target_ptr); +bool identify_item(player_type *owner_ptr, object_type *o_ptr); +bool ident_spell(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval); +bool identify_fully(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval); diff --git a/src/spell/spells-object.c b/src/spell/spells-object.c index 8017409f5..b5c52a195 100644 --- a/src/spell/spells-object.c +++ b/src/spell/spells-object.c @@ -43,7 +43,7 @@ #include "player/player-damage.h" #include "player/player-effects.h" #include "player/player-status.h" -#include "spell/spells3.h" +#include "spell-kind/spells-perception.h" #include "sv-definition/sv-food-types.h" #include "sv-definition/sv-lite-types.h" #include "sv-definition/sv-other-types.h" diff --git a/src/spell/spells3.c b/src/spell/spells3.c index 6bb8c81c7..78c10cf95 100644 --- a/src/spell/spells3.c +++ b/src/spell/spells3.c @@ -103,10 +103,6 @@ #include "view/display-messages.h" #include "world/world.h" -// todo コピペ感が強くなったので関数化 -static bool update_player(player_type *caster_ptr); -static bool redraw_player(player_type *caster_ptr); - /*! * @brief プレイヤーの装備劣化処理 / * Apply disenchantment to the player's stuff @@ -325,25 +321,6 @@ void reserve_alter_reality(player_type *caster_ptr) } /*! - * @brief 全所持アイテム鑑定処理 / - * Identify everything being carried. - * Done by a potion of "self knowledge". - * @param target_ptr プレーヤーへの参照ポインタ - * @return なし - */ -void identify_pack(player_type *target_ptr) -{ - for (INVENTORY_IDX i = 0; i < INVEN_TOTAL; i++) { - object_type *o_ptr = &target_ptr->inventory_list[i]; - if (!o_ptr->k_idx) - continue; - - identify_item(target_ptr, o_ptr); - autopick_alter_item(target_ptr, i, FALSE); - } -} - -/*! * @brief アイテムの価値に応じた錬金術処理 / * Turns an object into gold, gain some of its value in a shop * @param caster_ptr プレーヤーへの参照ポインタ @@ -499,99 +476,6 @@ bool artifact_scroll(player_type *caster_ptr) } /*! - * @brief アイテム鑑定処理 / - * Identify an object - * @param owner_ptr プレーヤーへの参照ポインタ - * @param o_ptr 鑑定されるアイテムの情報参照ポインタ - * @return 実際に鑑定できたらTRUEを返す - */ -bool identify_item(player_type *owner_ptr, object_type *o_ptr) -{ - GAME_TEXT o_name[MAX_NLEN]; - object_desc(owner_ptr, o_name, o_ptr, 0); - - bool old_known = FALSE; - if (o_ptr->ident & IDENT_KNOWN) - old_known = TRUE; - - if (!object_is_fully_known(o_ptr)) { - if (object_is_artifact(o_ptr) || one_in_(5)) - chg_virtue(owner_ptr, V_KNOWLEDGE, 1); - } - - object_aware(owner_ptr, o_ptr); - object_known(o_ptr); - o_ptr->marked |= OM_TOUCHED; - - owner_ptr->update |= (PU_BONUS | PU_COMBINE | PU_REORDER); - owner_ptr->window |= (PW_INVEN | PW_EQUIP | PW_PLAYER); - - strcpy(record_o_name, o_name); - record_turn = current_world_ptr->game_turn; - - object_desc(owner_ptr, o_name, o_ptr, OD_NAME_ONLY); - - if (record_fix_art && !old_known && object_is_fixed_artifact(o_ptr)) - exe_write_diary(owner_ptr, DIARY_ART, 0, o_name); - if (record_rand_art && !old_known && o_ptr->art_name) - exe_write_diary(owner_ptr, DIARY_ART, 0, o_name); - - return old_known; -} - -/*! - * @brief アイテム鑑定のメインルーチン処理 / - * Identify an object in the inventory (or on the floor) - * @param caster_ptr プレーヤーへの参照ポインタ - * @param only_equip 装備品のみを対象とするならばTRUEを返す - * @return 実際に鑑定を行ったならばTRUEを返す - * @details - * This routine does *not* automatically combine objects. - * Returns TRUE if something was identified, else FALSE. - */ -bool ident_spell(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval) -{ - if (only_equip) - item_tester_hook = item_tester_hook_identify_weapon_armour; - else - item_tester_hook = item_tester_hook_identify; - - concptr q; - if (can_get_item(caster_ptr, item_tester_tval)) { - q = _("どのアイテムを鑑定しますか? ", "Identify which item? "); - } else { - if (only_equip) - item_tester_hook = object_is_weapon_armour_ammo; - else - item_tester_hook = NULL; - - q = _("すべて鑑定済みです。 ", "All items are identified. "); - } - - concptr s = _("鑑定するべきアイテムがない。", "You have nothing to identify."); - OBJECT_IDX item; - object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); - if (!o_ptr) - return FALSE; - - bool old_known = identify_item(caster_ptr, o_ptr); - - GAME_TEXT o_name[MAX_NLEN]; - object_desc(caster_ptr, o_name, o_ptr, 0); - if (item >= INVEN_RARM) { - msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(caster_ptr, item), o_name, index_to_label(item)); - } else if (item >= 0) { - msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item)); - } else { - msg_format(_("床上: %s。", "On the ground: %s."), o_name); - } - - autopick_alter_item(caster_ptr, item, (bool)(destroy_identify && !old_known)); - return TRUE; -} - -/*! * @brief アイテム凡庸化のメインルーチン処理 / * Identify an object in the inventory (or on the floor) * @param owner_ptr プレーヤーへの参照ポインタ @@ -640,60 +524,22 @@ bool mundane_spell(player_type *owner_ptr, bool only_equip) return TRUE; } -/*! - * @brief アイテム*鑑定*のメインルーチン処理 / - * Identify an object in the inventory (or on the floor) - * @param caster_ptr プレーヤーへの参照ポインタ - * @param only_equip 装備品のみを対象とするならばTRUEを返す - * @return 実際に鑑定を行ったならばTRUEを返す - * @details - * Fully "identify" an object in the inventory -BEN- - * This routine returns TRUE if an item was identified. - */ -bool identify_fully(player_type *caster_ptr, bool only_equip, tval_type item_tester_tval) +static bool update_player(player_type *caster_ptr) { - if (only_equip) - item_tester_hook = item_tester_hook_identify_fully_weapon_armour; - else - item_tester_hook = item_tester_hook_identify_fully; - - concptr q; - if (can_get_item(caster_ptr, item_tester_tval)) { - q = _("どのアイテムを*鑑定*しますか? ", "*Identify* which item? "); - } else { - if (only_equip) - item_tester_hook = object_is_weapon_armour_ammo; - else - item_tester_hook = NULL; - - q = _("すべて*鑑定*済みです。 ", "All items are *identified*. "); - } - - concptr s = _("*鑑定*するべきアイテムがない。", "You have nothing to *identify*."); - - OBJECT_IDX item; - object_type *o_ptr; - o_ptr = choose_object(caster_ptr, &item, q, s, (USE_EQUIP | USE_INVEN | USE_FLOOR | IGNORE_BOTHHAND_SLOT), 0); - if (!o_ptr) - return FALSE; - - bool old_known = identify_item(caster_ptr, o_ptr); - - o_ptr->ident |= (IDENT_FULL_KNOWN); - handle_stuff(caster_ptr); + caster_ptr->update |= PU_COMBINE | PU_REORDER; + caster_ptr->window |= PW_INVEN; + return TRUE; +} - GAME_TEXT o_name[MAX_NLEN]; - object_desc(caster_ptr, o_name, o_ptr, 0); - if (item >= INVEN_RARM) { - msg_format(_("%^s: %s(%c)。", "%^s: %s (%c)."), describe_use(caster_ptr, item), o_name, index_to_label(item)); - } else if (item >= 0) { - msg_format(_("ザック中: %s(%c)。", "In your pack: %s (%c)."), o_name, index_to_label(item)); - } else { - msg_format(_("床上: %s。", "On the ground: %s."), o_name); +static bool redraw_player(player_type *caster_ptr) +{ + if (caster_ptr->csp > caster_ptr->msp) { + caster_ptr->csp = caster_ptr->msp; } - (void)screen_object(caster_ptr, o_ptr, 0L); - autopick_alter_item(caster_ptr, item, (bool)(destroy_identify && !old_known)); + caster_ptr->redraw |= PR_MANA; + caster_ptr->update |= PU_COMBINE | PU_REORDER; + caster_ptr->window |= PW_INVEN; return TRUE; } @@ -1804,32 +1650,25 @@ bool fetch_monster(player_type *caster_ptr) tx = nx; } } - /* Update the old location */ - caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx = 0; - /* Update the new location */ + caster_ptr->current_floor_ptr->grid_array[target_row][target_col].m_idx = 0; caster_ptr->current_floor_ptr->grid_array[ty][tx].m_idx = m_idx; - - /* Move the monster */ m_ptr->fy = ty; m_ptr->fx = tx; - - /* Wake the monster up */ (void)set_monster_csleep(caster_ptr, m_idx, 0); - update_monster(caster_ptr, m_idx, TRUE); lite_spot(caster_ptr, target_row, target_col); lite_spot(caster_ptr, ty, tx); - if (r_info[m_ptr->r_idx].flags7 & (RF7_LITE_MASK | RF7_DARK_MASK)) caster_ptr->update |= (PU_MON_LITE); if (m_ptr->ml) { - /* Auto-Recall if possible and visible */ if (!caster_ptr->image) monster_race_track(caster_ptr, m_ptr->ap_r_idx); + health_track(caster_ptr, m_idx); } + return TRUE; } @@ -2106,22 +1945,3 @@ bool tele_town(player_type *caster_ptr) screen_load(); return TRUE; } - -static bool update_player(player_type *caster_ptr) -{ - caster_ptr->update |= PU_COMBINE | PU_REORDER; - caster_ptr->window |= PW_INVEN; - return TRUE; -} - -static bool redraw_player(player_type *caster_ptr) -{ - if (caster_ptr->csp > caster_ptr->msp) { - caster_ptr->csp = caster_ptr->msp; - } - - caster_ptr->redraw |= PR_MANA; - caster_ptr->update |= PU_COMBINE | PU_REORDER; - caster_ptr->window |= PW_INVEN; - return TRUE; -} diff --git a/src/spell/spells3.h b/src/spell/spells3.h index 3c21118b5..f49a15c67 100644 --- a/src/spell/spells3.h +++ b/src/spell/spells3.h @@ -8,13 +8,9 @@ bool eat_magic(player_type *caster_ptr, int power); bool apply_disenchant(player_type* target_ptr, BIT_FLAGS mode); void fetch(player_type* caster_ptr, DIRECTION dir, WEIGHT wgt, bool require_los); void reserve_alter_reality(player_type* caster_ptr); -void identify_pack(player_type* target_ptr); bool alchemy(player_type* caster_ptr); bool artifact_scroll(player_type* caster_ptr); -bool ident_spell(player_type* caster_ptr, bool only_equip, tval_type item_tester_tval); bool mundane_spell(player_type* ownner_ptr, bool only_equip); -bool identify_item(player_type* owner_ptr, object_type* o_ptr); -bool identify_fully(player_type* caster_ptr, bool only_equip, tval_type item_tester_tval); bool recharge(player_type* caster_ptr, int power); void display_spell_list(player_type* caster_ptr); EXP experience_of_spell(player_type* caster_ptr, SPELL_IDX spell, REALM_IDX use_realm); diff --git a/src/store/store.c b/src/store/store.c index dd7cfd558..b66b0b2bc 100644 --- a/src/store/store.c +++ b/src/store/store.c @@ -72,7 +72,7 @@ #include "player/player-effects.h" #include "player/player-status.h" #include "player/race-info-table.h" -#include "spell/spells3.h" +#include "spell-kind/spells-perception.h" #include "store/black-market.h" #include "store/rumor.h" #include "store/say-comments.h" diff --git a/src/wizard/wizard-special-process.c b/src/wizard/wizard-special-process.c index e1cb214b0..4bd4e280d 100644 --- a/src/wizard/wizard-special-process.c +++ b/src/wizard/wizard-special-process.c @@ -64,13 +64,13 @@ #include "player/selfinfo.h" #include "spell-kind/spells-detection.h" #include "spell-kind/spells-floor.h" +#include "spell-kind/spells-perception.h" #include "spell-kind/spells-sight.h" #include "spell-kind/spells-teleport.h" #include "spell/spells-object.h" #include "spell/spells-status.h" #include "spell/spells-summon.h" #include "spell/spells-util.h" -#include "spell/spells3.h" #include "system/alloc-entries.h" #include "system/angband-version.h" #include "term/screen-processor.h"