From: Deskull Date: Wed, 5 Aug 2015 23:24:18 +0000 (+0900) Subject: energy_useグローバル変数をplayer_type構造体に編入。 'energy_use' global variable moved to structure... X-Git-Tag: v2.2.0~57 X-Git-Url: http://git.osdn.net/view?p=hengband%2Fhengband.git;a=commitdiff_plain;h=75f8c452397e02e8c741e9a7128548a082aa73b6 energy_useグローバル変数をplayer_type構造体に編入。 'energy_use' global variable moved to structure 'player_type'. --- diff --git a/src/artifact.c b/src/artifact.c index c6505ff2e..b7fa0987c 100644 --- a/src/artifact.c +++ b/src/artifact.c @@ -3475,7 +3475,7 @@ bool activate_random_artifact(object_type *o_ptr) char m_name[80]; monster_desc(m_name, &m_list[cave[y][x].m_idx], 0); msg_format(_("%sが邪魔だ!", "%^s is stand in your way."), m_name); - energy_use = 0; + p_ptr->energy_use = 0; return FALSE; } set_action(ACTION_FISH); diff --git a/src/bldg.c b/src/bldg.c index 7d74831d1..2d844c08c 100644 --- a/src/bldg.c +++ b/src/bldg.c @@ -4586,7 +4586,7 @@ static void bldg_process_command(building_type *bldg, int i) */ void do_cmd_quest(void) { - energy_use = 100; + p_ptr->energy_use = 100; if (!cave_have_flag_bold(py, px, FF_QUEST_ENTER)) { @@ -4626,7 +4626,7 @@ void do_cmd_bldg(void) building_type *bldg; - energy_use = 100; + p_ptr->energy_use = 100; if (!cave_have_flag_bold(py, px, FF_BLDG)) { @@ -4664,7 +4664,7 @@ void do_cmd_bldg(void) command_new = SPECIAL_KEY_BUILDING; /* No energy needed to re-enter the arena */ - energy_use = 0; + p_ptr->energy_use = 0; } return; @@ -4681,7 +4681,7 @@ void do_cmd_bldg(void) command_new = SPECIAL_KEY_BUILDING; /* No energy needed to re-enter the arena */ - energy_use = 0; + p_ptr->energy_use = 0; return; } diff --git a/src/cmd1.c b/src/cmd1.c index fe84b6a8d..af1a04064 100644 --- a/src/cmd1.c +++ b/src/cmd1.c @@ -2111,16 +2111,16 @@ static void py_attack_aux(int y, int x, bool *fear, bool *mdeath, s16b hand, int if (mon_take_hit(c_ptr->m_idx, k, fear, NULL)) { *mdeath = TRUE; - if ((p_ptr->pclass == CLASS_BERSERKER) && energy_use) + if ((p_ptr->pclass == CLASS_BERSERKER) && p_ptr->energy_use) { if (p_ptr->migite && p_ptr->hidarite) { - if (hand) energy_use = energy_use*3/5+energy_use*num*2/(p_ptr->num_blow[hand]*5); - else energy_use = energy_use*num*3/(p_ptr->num_blow[hand]*5); + if (hand) p_ptr->energy_use = p_ptr->energy_use*3/5+p_ptr->energy_use*num*2/(p_ptr->num_blow[hand]*5); + else p_ptr->energy_use = p_ptr->energy_use*num*3/(p_ptr->num_blow[hand]*5); } else { - energy_use = energy_use*num/p_ptr->num_blow[hand]; + p_ptr->energy_use = p_ptr->energy_use*num/p_ptr->num_blow[hand]; } } if ((o_ptr->name1 == ART_ZANTETSU) && is_lowlevel) @@ -2475,7 +2475,7 @@ bool py_attack(int y, int x, int mode) /* Disturb the player */ disturb(0, 1); - energy_use = 100; + p_ptr->energy_use = 100; if (!p_ptr->migite && !p_ptr->hidarite && !(p_ptr->muta2 & (MUT2_HORNS | MUT2_BEAK | MUT2_SCOR_TAIL | MUT2_TRUNK | MUT2_TENTACLES))) @@ -2943,7 +2943,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) /* Disturb */ disturb(0, 1); - energy_use = 0; + p_ptr->energy_use = 0; /* Hack -- Enter store */ command_new = SPECIAL_KEY_STORE; } @@ -2954,7 +2954,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) /* Disturb */ disturb(0, 1); - energy_use = 0; + p_ptr->energy_use = 0; /* Hack -- Enter building */ command_new = SPECIAL_KEY_BUILDING; } @@ -2965,7 +2965,7 @@ bool move_player_effect(int ny, int nx, u32b mpe_mode) /* Disturb */ disturb(0, 1); - energy_use = 0; + p_ptr->energy_use = 0; /* Hack -- Enter quest level */ command_new = SPECIAL_KEY_QUEST; } @@ -3204,7 +3204,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) } p_ptr->leaving = TRUE; - energy_use = 100; + p_ptr->energy_use = 100; return; } @@ -3266,7 +3266,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) else { msg_format(_("%^sが邪魔だ!", "%^s is in your way!"), m_name); - energy_use = 0; + p_ptr->energy_use = 0; oktomove = FALSE; } @@ -3284,7 +3284,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) if (riding_r_ptr->flags1 & RF1_NEVER_MOVE) { msg_print(_("動けない!", "Can't move!")); - energy_use = 0; + p_ptr->energy_use = 0; oktomove = FALSE; disturb(0, 1); } @@ -3318,21 +3318,21 @@ void move_player(int dir, bool do_pickup, bool break_trap) (have_flag(f_ptr->flags, FF_DEEP) || (riding_r_ptr->flags2 & RF2_AURA_FIRE))) { msg_format(_("%sの上に行けない。", "Can't swim."), f_name + f_info[get_feat_mimic(c_ptr)].name); - energy_use = 0; + p_ptr->energy_use = 0; oktomove = FALSE; disturb(0, 1); } else if (!have_flag(f_ptr->flags, FF_WATER) && (riding_r_ptr->flags7 & RF7_AQUATIC)) { msg_format(_("%sから上がれない。", "Can't land."), f_name + f_info[get_feat_mimic(&cave[py][px])].name); - energy_use = 0; + p_ptr->energy_use = 0; oktomove = FALSE; disturb(0, 1); } else if (have_flag(f_ptr->flags, FF_LAVA) && !(riding_r_ptr->flagsr & RFR_EFF_IM_FIRE_MASK)) { msg_format(_("%sの上に行けない。", "Too hot to go through."), f_name + f_info[get_feat_mimic(c_ptr)].name); - energy_use = 0; + p_ptr->energy_use = 0; oktomove = FALSE; disturb(0, 1); } @@ -3354,7 +3354,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) else if (!have_flag(f_ptr->flags, FF_MOVE) && have_flag(f_ptr->flags, FF_CAN_FLY) && !p_ptr->levitation) { msg_format(_("空を飛ばないと%sの上には行けない。", "You need to fly to go through the %s."), f_name + f_info[get_feat_mimic(c_ptr)].name); - energy_use = 0; + p_ptr->energy_use = 0; running = 0; oktomove = FALSE; } @@ -3366,7 +3366,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) */ else if (have_flag(f_ptr->flags, FF_TREE) && !p_can_kill_walls) { - if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) energy_use *= 2; + if ((p_ptr->pclass != CLASS_RANGER) && !p_ptr->levitation && (!p_ptr->riding || !(riding_r_ptr->flags8 & RF8_WILD_WOOD))) p_ptr->energy_use *= 2; } #ifdef ALLOW_EASY_DISARM /* TNB */ @@ -3425,7 +3425,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) { msg_print(_("それ以上先には進めない。", "You cannot go any more.")); if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) - energy_use = 0; + p_ptr->energy_use = 0; } /* Wall (or secret door) */ @@ -3449,7 +3449,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) * typing mistakes should not cost you a turn... */ if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) - energy_use = 0; + p_ptr->energy_use = 0; } } @@ -3465,7 +3465,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) { if (!(p_ptr->confused || p_ptr->stun || p_ptr->image)) { - energy_use = 0; + p_ptr->energy_use = 0; } /* To avoid a loop with running */ @@ -3483,7 +3483,7 @@ void move_player(int dir, bool do_pickup, bool break_trap) { if (!process_warning(x, y)) { - energy_use = 25; + p_ptr->energy_use = 25; return; } } @@ -4143,7 +4143,7 @@ void run_step(int dir) if (--running <= 0) return; /* Take time */ - energy_use = 100; + p_ptr->energy_use = 100; /* Move the player, using the "pickup" flag */ #ifdef ALLOW_EASY_DISARM /* TNB */ @@ -4289,7 +4289,7 @@ void travel_step(void) return; } - energy_use = 100; + p_ptr->energy_use = 100; move_player(travel.dir, always_pickup, FALSE); diff --git a/src/cmd2.c b/src/cmd2.c index b0d2e8507..2831165a7 100644 --- a/src/cmd2.c +++ b/src/cmd2.c @@ -117,7 +117,7 @@ void do_cmd_go_up(void) p_ptr->oldpy = 0; /* Hack -- take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* End the command */ return; @@ -136,7 +136,7 @@ void do_cmd_go_up(void) if (!go_up) return; /* Hack -- take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (autosave_l) do_cmd_save_game(TRUE); @@ -276,7 +276,7 @@ void do_cmd_go_down(void) /* Hack -- take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; } else @@ -312,7 +312,7 @@ void do_cmd_go_down(void) } /* Hack -- take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (autosave_l) do_cmd_save_game(TRUE); @@ -398,7 +398,7 @@ void do_cmd_search(void) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Search */ search(); @@ -811,7 +811,7 @@ static bool do_cmd_open_chest(int y, int x, s16b o_idx) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Attempt to unlock it */ if (o_ptr->pval > 0) @@ -1036,7 +1036,7 @@ static bool do_cmd_open_aux(int y, int x) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Seeing true feature code (ignore mimic) */ @@ -1197,7 +1197,7 @@ void do_cmd_open(void) else if (c_ptr->m_idx && p_ptr->riding != c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -1246,7 +1246,7 @@ static bool do_cmd_close_aux(int y, int x) bool more = FALSE; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Seeing true feature code (ignore mimic) */ @@ -1358,7 +1358,7 @@ void do_cmd_close(void) else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -1439,7 +1439,7 @@ static bool do_cmd_tunnel_aux(int y, int x) if (!do_cmd_tunnel_test(y, x)) return (FALSE); /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Get grid */ c_ptr = &cave[y][x]; @@ -1619,7 +1619,7 @@ void do_cmd_tunnel(void) else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -1767,7 +1767,7 @@ static bool do_cmd_disarm_chest(int y, int x, s16b o_idx) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Get the "disarm" factor */ i = p_ptr->skill_dis; @@ -1875,7 +1875,7 @@ static bool do_cmd_disarm_aux(int y, int x, int dir) int j; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Penalize some conditions */ if (p_ptr->blind || no_lite()) i = i / 10; @@ -2094,7 +2094,7 @@ static bool do_cmd_bash_aux(int y, int x, int dir) cptr name = f_name + f_info[get_feat_mimic(c_ptr)].name; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_format(_("%sに体当たりをした!", "You smash into the %s!"), name); @@ -2229,7 +2229,7 @@ void do_cmd_bash(void) else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -2311,7 +2311,7 @@ void do_cmd_alter(void) f_ptr = &f_info[feat]; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Attack monsters */ if (c_ptr->m_idx) @@ -2455,7 +2455,7 @@ void do_cmd_spike(void) else if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -2468,7 +2468,7 @@ void do_cmd_spike(void) else { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Successful jamming */ msg_format(_("%sにくさびを打ち込んだ。", "You jam the %s with a spike."), f_name + f_info[feat].name); @@ -2514,7 +2514,7 @@ void do_cmd_walk(bool pickup) if (get_rep_dir(&dir,FALSE)) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if ((dir != 5) && (p_ptr->special_defense & KATA_MUSOU)) { @@ -2522,8 +2522,8 @@ void do_cmd_walk(bool pickup) } /* Hack -- In small scale wilderness it takes MUCH more time to move */ - if (p_ptr->wild_mode) energy_use *= ((MAX_HGT + MAX_WID) / 2); - if (p_ptr->action == ACTION_HAYAGAKE) energy_use = energy_use * (45-(p_ptr->lev/2)) / 100; + if (p_ptr->wild_mode) p_ptr->energy_use *= ((MAX_HGT + MAX_WID) / 2); + if (p_ptr->action == ACTION_HAYAGAKE) p_ptr->energy_use = p_ptr->energy_use * (45-(p_ptr->lev/2)) / 100; /* Actually move the character */ move_player(dir, pickup, FALSE); @@ -2549,7 +2549,7 @@ void do_cmd_walk(bool pickup) change_wild_mode(); /* Give first move to monsters */ - energy_use = 100; + p_ptr->energy_use = 100; /* HACk -- set the encouter flag for the wilderness generation */ generate_encounter = TRUE; @@ -2619,7 +2619,7 @@ void do_cmd_stay(bool pickup) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (pickup) mpe_mode |= MPE_DO_PICKUP; (void)move_player_effect(py, px, mpe_mode); @@ -2686,7 +2686,7 @@ void do_cmd_rest(void) if (p_ptr->special_defense & NINJA_S_STEALTH) set_superstealth(FALSE); /* Take a turn XXX XXX XXX (?) */ - energy_use = 100; + p_ptr->energy_use = 100; /* The sin of sloth */ if (command_arg > 100) @@ -3244,7 +3244,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) else chance = (p_ptr->skill_thb + ((p_ptr->weapon_exp[0][j_ptr->sval] - (WEAPON_EXP_MASTER / 2)) / 200 + bonus) * BTH_PLUS_ADJ); - energy_use = bow_energy(j_ptr->sval); + p_ptr->energy_use = bow_energy(j_ptr->sval); tmul = bow_tmul(j_ptr->sval); /* Get extra "power" from "extra might" */ @@ -3271,7 +3271,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Get a direction (or cancel) */ if (!get_aim_dir(&dir)) { - energy_use = 0; + p_ptr->energy_use = 0; if (snipe_type == SP_AWAY) snipe_type = SP_NONE; @@ -3299,7 +3299,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Don't shoot at my feet */ if (tx == px && ty == py) { - energy_use = 0; + p_ptr->energy_use = 0; /* project_length is already reset to 0 */ @@ -3308,7 +3308,7 @@ void do_cmd_fire_aux(int item, object_type *j_ptr) /* Take a (partial) turn */ - energy_use = (energy_use / thits); + p_ptr->energy_use = (p_ptr->energy_use / thits); is_fired = TRUE; /* Sniper - Difficult to shot twice at 1 turn */ @@ -4052,11 +4052,11 @@ bool do_cmd_throw_aux(int mult, bool boomerang, int shuriken) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Rogue and Ninja gets bonus */ if ((p_ptr->pclass == CLASS_ROGUE) || (p_ptr->pclass == CLASS_NINJA)) - energy_use -= p_ptr->lev; + p_ptr->energy_use -= p_ptr->lev; /* Start at the player */ y = py; diff --git a/src/cmd3.c b/src/cmd3.c index 787d13853..6bddaa3e4 100644 --- a/src/cmd3.c +++ b/src/cmd3.c @@ -441,7 +441,7 @@ void do_cmd_wield(void) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Get local object */ q_ptr = &forge; @@ -707,13 +707,13 @@ void do_cmd_takeoff(void) else { msg_print(_("装備を外せなかった。", "You couldn't remove the equipment.")); - energy_use = 50; + p_ptr->energy_use = 50; return; } } /* Take a partial turn */ - energy_use = 50; + p_ptr->energy_use = 50; /* Take off the item */ (void)inven_takeoff(item, 255); @@ -790,7 +790,7 @@ void do_cmd_drop(void) /* Take a partial turn */ - energy_use = 50; + p_ptr->energy_use = 50; /* Drop (some of) the item */ inven_drop(item, amt); @@ -956,12 +956,12 @@ void do_cmd_destroy(void) o_ptr->number = old_number; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Artifacts cannot be destroyed */ if (!can_player_destroy_object(o_ptr)) { - energy_use = 0; + p_ptr->energy_use = 0; /* Message */ msg_format(_("%sは破壊不可能だ。", "You cannot destroy %s."), o_name); @@ -1315,7 +1315,7 @@ static void do_cmd_refill_lamp(void) /* Take a partial turn */ - energy_use = 50; + p_ptr->energy_use = 50; /* Access the lantern */ j_ptr = &inventory[INVEN_LITE]; @@ -1424,7 +1424,7 @@ static void do_cmd_refill_torch(void) /* Take a partial turn */ - energy_use = 50; + p_ptr->energy_use = 50; /* Access the primary torch */ j_ptr = &inventory[INVEN_LITE]; diff --git a/src/cmd5.c b/src/cmd5.c index 211839b5a..d93dcb106 100644 --- a/src/cmd5.c +++ b/src/cmd5.c @@ -892,7 +892,7 @@ void do_cmd_study(void) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; switch (mp_ptr->spell_book) { @@ -1453,7 +1453,7 @@ msg_format("その%sを%sのに十分なマジックポイントがない。",pr } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Over-exert the player */ @@ -2014,7 +2014,7 @@ bool do_riding(bool force) if (c_ptr->m_idx) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Message */ msg_print(_("モンスターが立ちふさがっている!", "There is a monster in the way!")); @@ -2076,7 +2076,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.")); - energy_use = 100; + p_ptr->energy_use = 100; return FALSE; } @@ -2096,7 +2096,7 @@ bool do_riding(bool force) if (p_ptr->riding == p_ptr->health_who) health_track(0); } - energy_use = 100; + p_ptr->energy_use = 100; /* Mega-Hack -- Forget the view and lite */ p_ptr->update |= (PU_UN_VIEW | PU_UN_LITE); @@ -2552,7 +2552,7 @@ void do_cmd_pet(void) /* Abort if needed */ if (!flag) { - energy_use = 0; + p_ptr->energy_use = 0; return; } diff --git a/src/cmd6.c b/src/cmd6.c index e07f024ae..3cb1e2d07 100644 --- a/src/cmd6.c +++ b/src/cmd6.c @@ -84,7 +84,7 @@ static void do_cmd_eat_food_aux(int item) sound(SOUND_EAT); /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Identity not known yet */ ident = FALSE; @@ -636,7 +636,7 @@ static void do_cmd_quaff_potion_aux(int item) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (world_player) { @@ -1400,7 +1400,7 @@ static void do_cmd_read_scroll_aux(int item, bool known) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; if (world_player) { @@ -2412,7 +2412,7 @@ static void do_cmd_use_staff_aux(int item) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Extract the item level */ lev = k_info[o_ptr->k_idx].level; @@ -2917,7 +2917,7 @@ static void do_cmd_aim_wand_aux(int item) target_pet = old_target_pet; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Get the level */ lev = k_info[o_ptr->k_idx].level; @@ -3349,7 +3349,7 @@ static void do_cmd_zap_rod_aux(int item) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Extract the item level */ lev = k_info[o_ptr->k_idx].level; @@ -3635,7 +3635,7 @@ static void do_cmd_activate_aux(int item) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Extract the item level */ lev = k_info[o_ptr->k_idx].level; @@ -3704,7 +3704,7 @@ static void do_cmd_activate_aux(int item) ((o_ptr->sval == SV_LITE_TORCH) || (o_ptr->sval == SV_LITE_LANTERN))) { msg_print(_("燃料がない。", "It has no fuel.")); - energy_use = 0; + p_ptr->energy_use = 0; return; } @@ -4592,7 +4592,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful) item = select_magic_eater(only_browse); if (item == -1) { - energy_use = 0; + p_ptr->energy_use = 0; return FALSE; } if (item >= EATER_EXT*2) {tval = TV_ROD;sval = item - EATER_EXT*2;} @@ -4626,7 +4626,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful) sound(SOUND_FAIL); if (randint1(100) >= chance) chg_virtue(V_CHANCE,-1); - energy_use = 100; + p_ptr->energy_use = 100; return TRUE; } @@ -4654,7 +4654,7 @@ bool do_cmd_magic_eater(bool only_browse, bool powerful) if (randint1(100) < chance) chg_virtue(V_CHANCE,1); } - energy_use = 100; + p_ptr->energy_use = 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; diff --git a/src/dungeon.c b/src/dungeon.c index a05814446..9533b7616 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -668,7 +668,7 @@ static void pattern_teleport(void) if (record_stair) do_cmd_write_nikki(NIKKI_PAT_TELE,0,NULL); p_ptr->inside_quest = 0; - energy_use = 0; + p_ptr->energy_use = 0; /* * Clear all saved floors @@ -4444,12 +4444,12 @@ static void process_command(void) which_power = _("祈り", "prayer"); msg_format(_("反魔法バリアが%sを邪魔した!", "An anti-magic shell disrupts your %s!"), which_power); - energy_use = 0; + p_ptr->energy_use = 0; } else if (p_ptr->shero && (p_ptr->pclass != CLASS_BERSERKER)) { msg_format(_("狂戦士化していて頭が回らない!", "You cannot think directly!")); - energy_use = 0; + p_ptr->energy_use = 0; } else { @@ -4918,7 +4918,7 @@ static void process_command(void) break; } } - if (!energy_use && !now_message) + if (!p_ptr->energy_use && !now_message) now_message = old_now_message; } @@ -5309,7 +5309,7 @@ static void process_player(void) /* Assume free turn */ - energy_use = 0; + p_ptr->energy_use = 0; if (p_ptr->inside_battle) @@ -5327,7 +5327,7 @@ static void process_player(void) else if (p_ptr->paralyzed || (p_ptr->stun >= 100)) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; } /* Resting */ @@ -5346,14 +5346,14 @@ static void process_player(void) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; } /* Fishing */ else if (p_ptr->action == ACTION_FISH) { /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; } /* Running */ @@ -5417,18 +5417,18 @@ static void process_player(void) /*** Clean up ***/ /* Significant */ - if (energy_use) + if (p_ptr->energy_use) { /* Use some energy */ - if (world_player || energy_use > 400) + if (world_player || p_ptr->energy_use > 400) { /* The Randomness is irrelevant */ - p_ptr->energy_need += energy_use * TURNS_PER_TICK / 10; + p_ptr->energy_need += p_ptr->energy_use * TURNS_PER_TICK / 10; } else { /* There is some randomness of needed energy */ - p_ptr->energy_need += (s16b)((s32b)energy_use * ENERGY_NEED() / 100L); + p_ptr->energy_need += (s16b)((s32b)p_ptr->energy_use * ENERGY_NEED() / 100L); } /* Hack -- constant hallucination */ @@ -5579,7 +5579,7 @@ static void process_player(void) } /* Sniper */ - if (energy_use && reset_concent) reset_concentration(TRUE); + if (p_ptr->energy_use && reset_concent) reset_concentration(TRUE); /* Handle "leaving" */ if (p_ptr->leaving) break; diff --git a/src/effects.c b/src/effects.c index f391c0a3f..d99155767 100644 --- a/src/effects.c +++ b/src/effects.c @@ -72,7 +72,7 @@ void set_action(int typ) case ACTION_HAYAGAKE: { msg_print(_("足が重くなった。", "You are no longer walking extremely fast.")); - energy_use = 100; + p_ptr->energy_use = 100; break; } case ACTION_SPELL: diff --git a/src/externs.h b/src/externs.h index 010bc3ee7..8fb172cd6 100644 --- a/src/externs.h +++ b/src/externs.h @@ -156,7 +156,6 @@ extern s16b command_see; extern s16b command_gap; extern s16b command_wrk; extern s16b command_new; -extern s16b energy_use; extern bool msg_flag; extern s16b running; extern s16b resting; diff --git a/src/hissatsu.c b/src/hissatsu.c index 2a7af74ce..a2f0990e4 100644 --- a/src/hissatsu.c +++ b/src/hissatsu.c @@ -372,7 +372,7 @@ void do_cmd_hissatsu(void) if (!do_spell(REALM_HISSATSU, n, SPELL_CAST)) return; /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Use some mana */ p_ptr->csp -= spell.smana; @@ -479,7 +479,7 @@ void do_cmd_gain_hissatsu(void) /* Take a turn */ else - energy_use = 100; + p_ptr->energy_use = 100; p_ptr->update |= (PU_SPELLS); } diff --git a/src/mane.c b/src/mane.c index 3ba60d5ca..08eec982e 100644 --- a/src/mane.c +++ b/src/mane.c @@ -1033,7 +1033,7 @@ bool do_cmd_mane(bool baigaesi) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Window stuff */ p_ptr->redraw |= (PR_IMITATION); diff --git a/src/mind.c b/src/mind.c index cbe6d02ab..7f56dd50a 100644 --- a/src/mind.c +++ b/src/mind.c @@ -1497,7 +1497,7 @@ static bool cast_ninja_spell(int spell) /* Gives a multiplier of 2 at first, up to 3 at 40th */ do_cmd_throw_aux(1, FALSE, slot); - energy_use = 100; + p_ptr->energy_use = 100; } break; } @@ -1874,11 +1874,11 @@ void do_cmd_mind(void) /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* teleport from mirror costs small energy */ if( on_mirror && p_ptr->pclass == CLASS_MIRROR_MASTER ) { - if( n==3 || n==5 || n==7 || n==16 )energy_use = 50; + if( n==3 || n==5 || n==7 || n==16 ) p_ptr->energy_use = 50; } if ((use_mind == MIND_BERSERKER) || (use_mind == MIND_NINJUTSU)) diff --git a/src/mspells3.c b/src/mspells3.c index 096afbd01..ebd275558 100644 --- a/src/mspells3.c +++ b/src/mspells3.c @@ -1589,7 +1589,7 @@ bool do_cmd_cast_learned(void) } /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; /* Window stuff */ p_ptr->redraw |= (PR_MANA); diff --git a/src/mutation.c b/src/mutation.c index c41367eb2..81065c48a 100644 --- a/src/mutation.c +++ b/src/mutation.c @@ -2505,7 +2505,7 @@ bool mutation_power_aux(u32b power) break; default: - energy_use = 0; + p_ptr->energy_use = 0; msg_format(_("能力 %s は実装されていません。", "Power %s not implemented. Oops."), power); } diff --git a/src/object2.c b/src/object2.c index 438b9e9af..2ad34a140 100644 --- a/src/object2.c +++ b/src/object2.c @@ -7800,7 +7800,7 @@ static void drain_essence(void) if (!get_check(format(_("本当に%sから抽出してよろしいですか?", "Really extract from %s? "), o_name))) return; } - energy_use = 100; + p_ptr->energy_use = 100; object_flags(o_ptr, old_flgs); if (have_flag(old_flgs, TR_KILL_DRAGON)) add_flag(old_flgs, TR_SLAY_DRAGON); @@ -8512,7 +8512,7 @@ static void add_essence(int 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.")); - energy_use = 100; + p_ptr->energy_use = 100; return; } else @@ -8526,7 +8526,7 @@ static void add_essence(int mode) if (o_ptr->to_a >= p_ptr->lev/5+5) { msg_print(_("改良に失敗した。", "You failed to enchant.")); - energy_use = 100; + p_ptr->energy_use = 100; return; } else @@ -8603,7 +8603,7 @@ static void add_essence(int mode) } } - energy_use = 100; + p_ptr->energy_use = 100; #ifdef JP msg_format("%sに%sの能力を付加しました。", o_name, es_ptr->add_name); @@ -8653,7 +8653,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; - energy_use = 100; + p_ptr->energy_use = 100; if (o_ptr->xtra3 == 1+ESSENCE_SLAY_GLOVE) { diff --git a/src/racial.c b/src/racial.c index 9e10467b2..152f1fd00 100644 --- a/src/racial.c +++ b/src/racial.c @@ -362,7 +362,7 @@ bool gain_magic(void) floor_item_describe(0 - item); floor_item_optimize(0 - item); } - energy_use = 100; + p_ptr->energy_use = 100; return TRUE; } @@ -692,7 +692,7 @@ static int racial_aux(power_desc_type *pd_ptr) msg_format(_("この能力を使用するにはレベル %d に達していなければなりません。", "You need to attain level %d to use this power."), min_level); - energy_use = 0; + p_ptr->energy_use = 0; return 0; } @@ -700,7 +700,7 @@ static int racial_aux(power_desc_type *pd_ptr) else if (p_ptr->confused) { msg_print(_("混乱していてその能力は使えない。", "You are too confused to use this power.")); - energy_use = 0; + p_ptr->energy_use = 0; return 0; } @@ -709,7 +709,7 @@ static int racial_aux(power_desc_type *pd_ptr) { if (!get_check(_("本当に今の衰弱した状態でこの能力を使いますか?", "Really use the power in your weakened state? "))) { - energy_use = 0; + p_ptr->energy_use = 0; return 0; } } @@ -733,7 +733,7 @@ static int racial_aux(power_desc_type *pd_ptr) } /* take time and pay the price */ - energy_use = 100; + p_ptr->energy_use = 100; /* Success? */ if (randint1(p_ptr->stat_cur[use_stat]) >= @@ -798,7 +798,7 @@ static bool cmd_racial_power_aux(s32b command) if (p_ptr->realm1 == REALM_HEX) { bool retval = stop_hex_spell(); - if (retval) energy_use = 10; + if (retval) p_ptr->energy_use = 10; return (retval); } case CLASS_MAGE: @@ -1030,7 +1030,7 @@ static bool cmd_racial_power_aux(s32b command) if (!p_ptr->magic_num1[0] && !p_ptr->magic_num1[1]) return FALSE; stop_singing(); - energy_use = 10; + p_ptr->energy_use = 10; break; } case CLASS_RED_MAGE: @@ -1093,7 +1093,7 @@ static bool cmd_racial_power_aux(s32b command) { set_action(ACTION_LEARN); } - energy_use = 0; + p_ptr->energy_use = 0; break; } case CLASS_CAVALRY: @@ -1211,7 +1211,7 @@ static bool cmd_racial_power_aux(s32b command) } - energy_use = 0; + p_ptr->energy_use = 0; break; } @@ -1701,7 +1701,7 @@ static bool cmd_racial_power_aux(s32b command) default: msg_print(_("この種族は特殊な能力を持っていません。", "This race has no bonus power.")); - energy_use = 0; + p_ptr->energy_use = 0; } } return TRUE; @@ -1735,7 +1735,7 @@ void do_cmd_racial_power(void) if (p_ptr->confused) { msg_print(_("混乱していて特殊能力を使えません!", "You are too confused to use any powers!")); - energy_use = 0; + p_ptr->energy_use = 0; return; } @@ -2721,7 +2721,7 @@ if (!repeat_pull(&i) || i<0 || i>=num) { case '0': { screen_load(); - energy_use = 0; + p_ptr->energy_use = 0; return; } @@ -2891,7 +2891,7 @@ if (!repeat_pull(&i) || i<0 || i>=num) { /* Abort if needed */ if (!flag) { - energy_use = 0; + p_ptr->energy_use = 0; return; } #ifdef ALLOW_REPEAT @@ -2936,7 +2936,7 @@ if (!repeat_pull(&i) || i<0 || i>=num) { p_ptr->window |= (PW_PLAYER | PW_SPELL); } } - else energy_use = 0; + else p_ptr->energy_use = 0; /* Success */ return; diff --git a/src/snipe.c b/src/snipe.c index 1fa366447..d4267dbf4 100644 --- a/src/snipe.c +++ b/src/snipe.c @@ -533,7 +533,7 @@ static bool cast_sniper_spell(int spell) { case 0: /* Concentration */ if (!snipe_concentrate()) return (FALSE); - energy_use = 100; + p_ptr->energy_use = 100; return (TRUE); case 1: snipe_type = SP_LITE; break; case 2: snipe_type = SP_AWAY; break; @@ -603,7 +603,7 @@ void do_cmd_snipe(void) if (!cast) return; #if 0 /* Take a turn */ - energy_use = 100; + p_ptr->energy_use = 100; #endif /* Redraw mana */ p_ptr->redraw |= (PR_HP | PR_MANA); diff --git a/src/store.c b/src/store.c index 984c24885..44a1d6648 100644 --- a/src/store.c +++ b/src/store.c @@ -5240,7 +5240,7 @@ void do_cmd_store(void) p_ptr->town_num = old_town_num; /* Free turn XXX XXX XXX */ - energy_use = 100; + p_ptr->energy_use = 100; /* Hack -- Character is no longer in "icky" mode */ diff --git a/src/types.h b/src/types.h index 7eab1537d..90d288e01 100644 --- a/src/types.h +++ b/src/types.h @@ -1340,6 +1340,8 @@ struct player_type byte tval_ammo; /* Correct ammo tval */ byte pspeed; /* Current speed */ + + s16b energy_use; /* Energy use this turn */ }; diff --git a/src/variable.c b/src/variable.c index f10bf7b43..bb92778ce 100644 --- a/src/variable.c +++ b/src/variable.c @@ -107,8 +107,6 @@ s16b command_gap = 999; /* See "object1.c" */ s16b command_new; /* Command chaining from inven/equip view */ -s16b energy_use; /* Energy use this turn */ - bool msg_flag; /* Used in msg_print() for "buffering" */ s16b running; /* Current counter for running, if any */ diff --git a/src/wild.c b/src/wild.c index dbf693d24..912ea0a14 100644 --- a/src/wild.c +++ b/src/wild.c @@ -1157,7 +1157,7 @@ bool change_wild_mode(void) #else msg_print("You cannot enter global map, since there is some monsters nearby!"); #endif - energy_use = 0; + p_ptr->energy_use = 0; return FALSE; } @@ -1171,13 +1171,13 @@ bool change_wild_mode(void) if (!get_check_strict(msg, CHECK_OKAY_CANCEL)) { - energy_use = 0; + p_ptr->energy_use = 0; return FALSE; } } /* HACK */ - energy_use = 1000; + p_ptr->energy_use = 1000; /* Remember the position */ p_ptr->oldpx = px; diff --git a/src/wizard2.c b/src/wizard2.c index 700ef76bf..0dcff8a34 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -1569,7 +1569,7 @@ static void do_cmd_wiz_jump(void) if (record_stair) do_cmd_write_nikki(NIKKI_WIZ_TELE,0,NULL); p_ptr->inside_quest = 0; - energy_use = 0; + p_ptr->energy_use = 0; /* Prevent energy_need from being too lower than 0 */ p_ptr->energy_need = 0;