OSDN Git Service

[Refactor] #37353 行動パワー消費処理を take_turn() で再定義 / Redefine take_turn() for consumption...
authorDeskull <deskull@users.sourceforge.jp>
Thu, 31 Jan 2019 14:58:52 +0000 (23:58 +0900)
committerDeskull <deskull@users.sourceforge.jp>
Thu, 31 Jan 2019 14:58:52 +0000 (23:58 +0900)
27 files changed:
src/bldg.c
src/cmd-activate.c
src/cmd-eat.c
src/cmd-item.c
src/cmd-magiceat.c
src/cmd-pet.c
src/cmd-read.c
src/cmd-spell.c
src/cmd-usestaff.c
src/cmd-zaprod.c
src/cmd-zapwand.c
src/cmd2.c
src/dungeon.c
src/effects.c
src/hissatsu.c
src/mane.c
src/melee1.c
src/mind.c
src/mspells3.c
src/object2.c
src/player-move.c
src/player-status.c
src/player-status.h
src/racial.c
src/snipe.c
src/spells-object.c
src/store.c

index 8b44268..ad8b82d 100644 (file)
@@ -26,6 +26,7 @@
 #include "artifact.h"
 #include "cmd-spell.h"
 #include "rumor.h"
+#include "player-status.h"
 
 /*!
  * ループ中で / hack as in leave_store in store.c
@@ -4190,7 +4191,7 @@ void do_cmd_quest(void)
 {
        if(p_ptr->wild_mode) return;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_QUEST_ENTER))
        {
@@ -4232,7 +4233,7 @@ void do_cmd_bldg(void)
 
        if(p_ptr->wild_mode) return;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        if (!cave_have_flag_bold(p_ptr->y, p_ptr->x, FF_BLDG))
        {
index 6ae04fc..4cc510a 100644 (file)
@@ -16,6 +16,7 @@
 #include "avatar.h"
 #include "spells-status.h"
 #include "realm-hex.h"
+#include "player-status.h"
 
 /*!
 * @brief ペット入りモンスターボールをソートするための比較関数
@@ -91,7 +92,7 @@ void do_cmd_activate_aux(INVENTORY_IDX item)
                o_ptr = &o_list[0 - item];
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Extract the item level */
        lev = k_info[o_ptr->k_idx].level;
index c7c6cb4..ff13dc2 100644 (file)
@@ -12,6 +12,7 @@
 #include "avatar.h"\r
 #include "spells-status.h"\r
 #include "realm-hex.h"\r
+#include "player-status.h"\r
 \r
 /*!\r
  * @brief 食料を食べるコマンドのサブルーチン\r
@@ -40,7 +41,7 @@ void do_cmd_eat_food_aux(INVENTORY_IDX item)
 \r
        sound(SOUND_EAT);\r
 \r
-       p_ptr->energy_use = 100;\r
+       take_turn(p_ptr, 100);;\r
 \r
        /* Identity not known yet */\r
        ident = FALSE;\r
index da76e92..80bbf0d 100644 (file)
@@ -342,7 +342,7 @@ void do_cmd_wield(void)
                autopick_alter_item(item, FALSE);
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
        q_ptr = &forge;
 
        /* Obtain local object */
@@ -728,7 +728,7 @@ void do_cmd_destroy(void)
        object_desc(o_name, o_ptr, 0);
        o_ptr->number = old_number;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Artifacts cannot be destroyed */
        if (!can_player_destroy_object(o_ptr))
index 9a3f3c7..59d99f0 100644 (file)
@@ -57,6 +57,7 @@
 #include "cmd-zaprod.h"
 #include "cmd-zapwand.h"
 #include "avatar.h"
+#include "player-status.h"
 
 
 /*!
@@ -551,7 +552,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful)
                sound(SOUND_FAIL);
                if (randint1(100) >= chance)
                        chg_virtue(V_CHANCE,-1);
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);;
 
                return TRUE;
        }
@@ -579,7 +580,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful)
                if (randint1(100) < chance)
                        chg_virtue(V_CHANCE,1);
        }
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
        if (tval == TV_ROD) p_ptr->magic_num1[item] += k_info[k_idx].pval * EATER_ROD_CHARGE;
        else p_ptr->magic_num1[item] -= EATER_CHARGE;
 
index 945827e..c8a0113 100644 (file)
@@ -331,7 +331,7 @@ bool do_riding(bool force)
 
                if (c_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -388,7 +388,7 @@ bool do_riding(bool force)
                if (r_info[m_ptr->r_idx].level > randint1((p_ptr->skill_exp[GINOU_RIDING] / 50 + p_ptr->lev / 2 + 20)))
                {
                        msg_print(_("うまく乗れなかった。", "You failed to ride."));
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                        return FALSE;
                }
 
@@ -408,7 +408,7 @@ bool do_riding(bool force)
                if (p_ptr->riding == p_ptr->health_who) health_track(0);
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Mega-Hack -- Forget the view and lite */
        p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE);
index 025b506..d5c968c 100644 (file)
@@ -47,7 +47,7 @@ void do_cmd_read_scroll_aux(INVENTORY_IDX item, bool known)
                o_ptr = &o_list[0 - item];\r
        }\r
 \r
-       p_ptr->energy_use = 100;\r
+       take_turn(p_ptr, 100);;\r
        if (cmd_limit_time_walk(p_ptr)) return;\r
 \r
        if (p_ptr->pclass == CLASS_BERSERKER)\r
index 38ff3c8..767d4fd 100644 (file)
@@ -924,7 +924,7 @@ void do_cmd_study(void)
 #endif\r
        }\r
 \r
-       p_ptr->energy_use = 100;\r
+       take_turn(p_ptr, 100);;\r
 \r
        switch (mp_ptr->spell_book)\r
        {\r
@@ -1336,7 +1336,7 @@ void do_cmd_cast(void)
                }\r
        }\r
 \r
-       p_ptr->energy_use = 100;\r
+       take_turn(p_ptr, 100);;\r
 \r
 \r
        /* Over-exert the player */\r
index 0746f5a..ed1e964 100644 (file)
@@ -2,6 +2,7 @@
 #include "projection.h"\r
 #include "spells-summon.h"\r
 #include "avatar.h"\r
+#include "player-status.h"\r
 \r
 \r
 \r
@@ -298,7 +299,7 @@ void do_cmd_use_staff_aux(INVENTORY_IDX item)
        }\r
 \r
 \r
-       p_ptr->energy_use = 100;\r
+       take_turn(p_ptr, 100);;\r
 \r
        /* Extract the item level */\r
        lev = k_info[o_ptr->k_idx].level;\r
index c04f948..1b88d6e 100644 (file)
@@ -1,6 +1,7 @@
 #include "angband.h"
 #include "avatar.h"
 #include "spells-status.h"
+#include "player-status.h"
 
 /*!
  * @brief ロッドの効果を発動する
@@ -297,7 +298,7 @@ void do_cmd_zap_rod_aux(INVENTORY_IDX item)
        }
 
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Extract the item level */
        lev = k_info[o_ptr->k_idx].level;
index f87cc17..73811e8 100644 (file)
@@ -1,6 +1,7 @@
 #include "angband.h"
 #include "avatar.h"
 #include "spells-status.h"
+#include "player-status.h"
 
 
 /*!
@@ -354,7 +355,7 @@ void do_cmd_aim_wand_aux(INVENTORY_IDX item)
        }
        target_pet = old_target_pet;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Get the level */
        lev = k_info[o_ptr->k_idx].level;
index 2211644..013dcc4 100644 (file)
@@ -178,8 +178,7 @@ void do_cmd_go_up(void)
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
                
-               /* Hack -- take a turn */
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
                /* End the command */
                return;
@@ -197,8 +196,7 @@ void do_cmd_go_up(void)
        /* Cancel the command */
        if (!go_up) return;
 
-       /* Hack -- take a turn */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);
 
        if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -328,13 +326,10 @@ void do_cmd_go_down(void)
 
                /* Leaving */
                p_ptr->leaving = TRUE;
-
                p_ptr->oldpx = 0;
                p_ptr->oldpy = 0;
                
-               
-        /* Hack -- take a turn */
-        p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
        }
 
        else
@@ -369,8 +364,7 @@ void do_cmd_go_down(void)
                        prepare_change_floor_mode(CFM_FIRST_FLOOR);
                }
 
-               /* Hack -- take a turn */
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);
 
                if (autosave_l) do_cmd_save_game(TRUE);
 
@@ -452,7 +446,7 @@ void do_cmd_search(void)
                /* Cancel the arg */
                command_arg = 0;
        }
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Search */
        search();
@@ -510,7 +504,7 @@ static bool do_cmd_open_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
        bool more = FALSE;
        object_type *o_ptr = &o_list[o_idx];
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Attempt to unlock it */
        if (o_ptr->pval > 0)
@@ -712,7 +706,7 @@ static bool do_cmd_open_aux(POSITION y, POSITION x)
        feature_type *f_ptr = &f_info[c_ptr->feat];
        bool more = FALSE;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -861,7 +855,7 @@ void do_cmd_open(void)
                /* Monster in the way */
                else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
                        py_attack(y, x, 0);
                }
@@ -904,7 +898,7 @@ static bool do_cmd_close_aux(POSITION y, POSITION x)
        FEAT_IDX old_feat = c_ptr->feat;
        bool more = FALSE;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Seeing true feature code (ignore mimic) */
 
@@ -1003,7 +997,7 @@ void do_cmd_close(void)
                /* Monster in the way */
                else if (c_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1077,7 +1071,7 @@ static bool do_cmd_tunnel_aux(POSITION y, POSITION x)
        /* Verify legality */
        if (!do_cmd_tunnel_test(y, x)) return (FALSE);
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Get grid */
        c_ptr = &cave[y][x];
@@ -1248,7 +1242,7 @@ void do_cmd_tunnel(void)
                /* A monster is in the way */
                else if (c_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1378,7 +1372,7 @@ static bool do_cmd_disarm_chest(POSITION y, POSITION x, OBJECT_IDX o_idx)
        bool more = FALSE;
        object_type *o_ptr = &o_list[o_idx];
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Get the "disarm" factor */
        i = p_ptr->skill_dis;
@@ -1473,7 +1467,7 @@ bool do_cmd_disarm_aux(POSITION y, POSITION x, DIRECTION dir)
        int i = p_ptr->skill_dis;
        int j;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Penalize some conditions */
        if (p_ptr->blind || no_lite()) i = i / 10;
@@ -1656,7 +1650,7 @@ static bool do_cmd_bash_aux(POSITION y, POSITION x, DIRECTION dir)
 
        concptr name = f_name + f_info[get_feat_mimic(c_ptr)].name;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name);
 
@@ -1779,7 +1773,7 @@ void do_cmd_bash(void)
                /* Monster in the way */
                else if (c_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -1854,7 +1848,7 @@ void do_cmd_alter(void)
                feat = get_feat_mimic(c_ptr);
                f_ptr = &f_info[feat];
 
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);;
 
                if (c_ptr->m_idx)
                {
@@ -1990,7 +1984,7 @@ void do_cmd_spike(void)
                /* Is a monster in the way? */
                else if (c_ptr->m_idx)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!"));
 
@@ -2001,7 +1995,7 @@ void do_cmd_spike(void)
                /* Go for it */
                else
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        /* Successful jamming */
                        msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name);
@@ -2044,7 +2038,7 @@ void do_cmd_walk(bool pickup)
        /* Get a "repeated" direction */
        if (get_rep_dir(&dir, FALSE))
        {
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);;
 
                if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU))
                {
@@ -2079,7 +2073,7 @@ void do_cmd_walk(bool pickup)
                        change_wild_mode();
 
                        /* Give first move to monsters */
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        /* HACk -- set the encouter flag for the wilderness generation */
                        generate_encounter = TRUE;
@@ -2140,7 +2134,7 @@ void do_cmd_stay(bool pickup)
                command_arg = 0;
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        if (pickup) mpe_mode |= MPE_DO_PICKUP;
        (void)move_player_effect(p_ptr->y, p_ptr->x, mpe_mode);
@@ -2207,7 +2201,7 @@ void do_cmd_rest(void)
        if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE);
 
        /* Take a turn (?) */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* The sin of sloth */
        if (command_arg > 100) chg_virtue(V_DILIGENCE, -1);
@@ -2513,7 +2507,7 @@ bool do_cmd_throw(int mult, bool boomerang, OBJECT_IDX shuriken)
                p_ptr->redraw |= (PR_EQUIPPY);
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Rogue and Ninja gets bonus */
        if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA))
index 3690144..01eeabf 100644 (file)
@@ -3658,7 +3658,7 @@ static void process_world(void)
                                change_wild_mode();
 
                                /* Give first move to monsters */
-                               p_ptr->energy_use = 100;
+                               take_turn(p_ptr, 100);;
 
                                /* HACk -- set the encouter flag for the wilderness generation */
                                generate_encounter = TRUE;
@@ -4997,7 +4997,7 @@ static void process_player(void)
                /* Paralyzed or Knocked Out */
                else if (p_ptr->paralyzed || (p_ptr->stun >= 100))
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                }
 
                /* Resting */
@@ -5013,13 +5013,13 @@ static void process_player(void)
                                p_ptr->redraw |= (PR_STATE);
                        }
 
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                }
 
                /* Fishing */
                else if (p_ptr->action == ACTION_FISH)
                {
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                }
 
                /* Running */
index 03a1c7d..d3efc5a 100644 (file)
@@ -77,7 +77,7 @@ void set_action(ACTION_IDX typ)
                        case ACTION_HAYAGAKE:
                        {
                                msg_print(_("足が重くなった。", "You are no longer walking extremely fast."));
-                               p_ptr->energy_use = 100;
+                               take_turn(p_ptr, 100);;
                                break;
                        }
                        case ACTION_SPELL:
index 8d76b1a..641cc5c 100644 (file)
@@ -351,7 +351,7 @@ void do_cmd_hissatsu(void)
        /* Cast the spell */
        if (!do_spell(REALM_HISSATSU, n, SPELL_CAST)) return;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Use some mana */
        p_ptr->csp -= spell.smana;
@@ -439,7 +439,7 @@ void do_cmd_gain_hissatsu(void)
                msg_print(_("何も覚えられなかった。", "You were not able to learn any special attacks."));
 
        else
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);;
 
        p_ptr->update |= (PU_SPELLS);
 }
index fbffdd3..95bc894 100644 (file)
@@ -14,6 +14,7 @@
 #include "spells-summon.h"
 #include "spells-status.h"
 #include "cmd-spell.h"
+#include "player-status.h"
 
 static int damage;
 
@@ -997,7 +998,7 @@ bool do_cmd_mane(bool baigaesi)
                p_ptr->mane_dam[j] = p_ptr->mane_dam[j+1];
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        p_ptr->redraw |= (PR_IMITATION);
        p_ptr->window |= (PW_PLAYER);
index 59c7374..0af6959 100644 (file)
@@ -1331,7 +1331,7 @@ bool py_attack(POSITION y, POSITION x, BIT_FLAGS mode)
 
        disturb(FALSE, TRUE);
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        if (!p_ptr->migite && !p_ptr->hidarite &&
                !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES)))
index 4ea7ba2..3b3a389 100644 (file)
@@ -1615,7 +1615,7 @@ static bool cast_ninja_spell(int spell)
                        /* Gives a multiplier of 2 at first, up to 3 at 40th */
                        do_cmd_throw(1, FALSE, slot);
 
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
                }
                break;
        }
@@ -1982,7 +1982,7 @@ void do_cmd_mind(void)
        }
 
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
        /* teleport from mirror costs small energy */
        if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER )
        {
index c31fcc6..c41456b 100644 (file)
@@ -16,6 +16,7 @@
 #include "avatar.h"
 #include "spells-status.h"
 #include "cmd-spell.h"
+#include "player-status.h"
 
 #define pseudo_plev() (((p_ptr->lev + 40) * (p_ptr->lev + 40) - 1550) / 130) /*!< モンスター魔法をプレイヤーが使用する場合の換算レベル */
 
@@ -1512,7 +1513,7 @@ bool do_cmd_cast_learned(void)
                }
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        p_ptr->redraw |= (PR_MANA);
        p_ptr->window |= (PW_PLAYER | PW_SPELL);
index 690c8da..5732cc0 100644 (file)
@@ -7511,7 +7511,7 @@ static void drain_essence(void)
                if (!get_check(format(_("本当に%sから抽出してよろしいですか?", "Really extract from %s? "), o_name))) return;
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        object_flags(o_ptr, old_flgs);
        if (have_flag(old_flgs, TR_KILL_DRAGON)) add_flag(old_flgs, TR_SLAY_DRAGON);
@@ -8194,7 +8194,7 @@ static void add_essence(ESSENCE_IDX mode)
                        if ((o_ptr->to_h >= p_ptr->lev/5+5) && (o_ptr->to_d >= p_ptr->lev/5+5))
                        {
                                msg_print(_("改良に失敗した。", "You failed to enchant."));
-                               p_ptr->energy_use = 100;
+                               take_turn(p_ptr, 100);;
                                return;
                        }
                        else
@@ -8208,7 +8208,7 @@ static void add_essence(ESSENCE_IDX mode)
                        if (o_ptr->to_a >= p_ptr->lev/5+5)
                        {
                                msg_print(_("改良に失敗した。", "You failed to enchant."));
-                               p_ptr->energy_use = 100;
+                               take_turn(p_ptr, 100);;
                                return;
                        }
                        else
@@ -8285,7 +8285,7 @@ static void add_essence(ESSENCE_IDX mode)
                }
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
 #ifdef JP
        msg_format("%sに%sの能力を付加しました。", o_name, es_ptr->add_name);
@@ -8322,7 +8322,7 @@ static void erase_essence(void)
        object_desc(o_name, o_ptr, (OD_OMIT_PREFIX | OD_NAME_ONLY));
        if (!get_check(format(_("よろしいですか? [%s]", "Are you sure? [%s]"), o_name))) return;
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        if (o_ptr->xtra3 == 1 + ESSENCE_SLAY_GLOVE)
        {
index 204b195..147ea2e 100644 (file)
@@ -1200,7 +1200,7 @@ void move_player(DIRECTION dir, bool do_pickup, bool break_trap)
                        }
 
                        p_ptr->leaving = TRUE;
-                       p_ptr->energy_use = 100;
+                       take_turn(p_ptr, 100);;
 
                        return;
                }
@@ -2101,7 +2101,7 @@ void run_step(DIRECTION dir)
        if (--running <= 0) return;
 
        /* Take time */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Move the player, using the "pickup" flag */
        move_player(find_current, FALSE, FALSE);
@@ -2238,7 +2238,7 @@ void travel_step(void)
                return;
        }
 
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        move_player(travel.dir, always_pickup, FALSE);
 
index dcd8774..0d19df6 100644 (file)
@@ -3811,3 +3811,8 @@ bool player_has_no_spellbooks(void)
 
        return TRUE;
 }
+
+void take_turn(player_type *creature_ptr, PERCENTAGE need_cost)
+{
+       p_ptr->energy_use = (ENERGY)need_cost;
+}
index 7cc31bc..cf85b2e 100644 (file)
@@ -12,3 +12,5 @@ extern bool heavy_armor(void);
 extern void update_creature(player_type *creature_ptr);
 extern BIT_FLAGS16 empty_hands(bool riding_control);
 extern bool player_has_no_spellbooks(void);
+
+extern void take_turn(player_type *creature_ptr, PERCENTAGE need_cost);
index 7bf0f97..49fa292 100644 (file)
@@ -349,7 +349,7 @@ static int racial_aux(power_desc_type *pd_ptr)
        }
 
        /* take time and pay the price */
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
 
        /* Success? */
        if (randint1(p_ptr->stat_cur[use_stat]) >= ((difficulty / 2) + randint1(difficulty / 2)))
index 1c533cb..3900818 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include "angband.h"
+#include "player-status.h"
 
 #define MAX_SNIPE_POWERS 16
 
@@ -505,7 +506,7 @@ static bool cast_sniper_spell(int spell)
        {
        case 0: /* Concentration */
                if (!snipe_concentrate()) return (FALSE);
-               p_ptr->energy_use = 100;
+               take_turn(p_ptr, 100);;
                return (TRUE);
        case 1: snipe_type = SP_LITE; break;
        case 2: snipe_type = SP_AWAY; break;
index 21ae4d5..10dc2bb 100644 (file)
@@ -2,6 +2,7 @@
 #include "angband.h"
 #include "spells-object.h"
 #include "object-hook.h"
+#include "player-status.h"
 
 /*!
  * @brief「弾/矢の製造」処理 / do_cmd_cast calls this function if the player's class is 'archer'.
@@ -298,6 +299,6 @@ bool import_magic_device(void)
                floor_item_describe(0 - item);
                floor_item_optimize(0 - item);
        }
-       p_ptr->energy_use = 100;
+       take_turn(p_ptr, 100);;
        return TRUE;
 }
index 8c73e6f..2e22fe3 100644 (file)
@@ -18,6 +18,7 @@
 #include "avatar.h"
 #include "cmd-spell.h"
 #include "rumor.h"
+#include "player-status.h"
 
 #define MIN_STOCK 12
 
@@ -6072,14 +6073,11 @@ void do_cmd_store(void)
 
        p_ptr->town_num = old_town_num;
 
-       /* Free turn */
-       p_ptr->energy_use = 100;
-
+       take_turn(p_ptr, 100);;
 
        /* Hack -- Character is no longer in "icky" mode */
        character_icky = FALSE;
 
-
        /* Hack -- Cancel automatic command */
        command_new = 0;