OSDN Git Service

[Refactor] #38997 get_hissatsu_power() に player_type * 引数を追加.
authordeskull <deskull@users.sourceforge.jp>
Fri, 16 Aug 2019 15:01:35 +0000 (00:01 +0900)
committerdeskull <deskull@users.sourceforge.jp>
Fri, 16 Aug 2019 15:01:35 +0000 (00:01 +0900)
src/cmd/cmd-hissatsu.c
src/core.c

index 8df037c..5cc6ac5 100644 (file)
  * when you run it. It's probably easy to fix but I haven't tried,\n
  * sorry.\n
  */
  * when you run it. It's probably easy to fix but I haven't tried,\n
  * sorry.\n
  */
-static int get_hissatsu_power(SPELL_IDX *sn)
+static int get_hissatsu_power(player_type *creature_ptr, SPELL_IDX *sn)
 {
        SPELL_IDX i;
        int j = 0;
        int num = 0;
        POSITION y = 1;
        POSITION x = 15;
 {
        SPELL_IDX i;
        int j = 0;
        int num = 0;
        POSITION y = 1;
        POSITION x = 15;
-       PLAYER_LEVEL plev = p_ptr->lev;
+       PLAYER_LEVEL plev = creature_ptr->lev;
        int ask = TRUE;
        char choice;
        char out_val[160];
        int ask = TRUE;
        char choice;
        char out_val[160];
@@ -120,7 +120,7 @@ static int get_hissatsu_power(SPELL_IDX *sn)
                                        {
                                                menu_line += 31;
                                                if (menu_line > 32) menu_line -= 32;
                                        {
                                                menu_line += 31;
                                                if (menu_line > 32) menu_line -= 32;
-                                       } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
+                                       } while(!(creature_ptr->spell_learned1 & (1L << (menu_line-1))));
                                        break;
                                }
 
                                        break;
                                }
 
@@ -132,7 +132,7 @@ static int get_hissatsu_power(SPELL_IDX *sn)
                                        {
                                                menu_line++;
                                                if (menu_line > 32) menu_line -= 32;
                                        {
                                                menu_line++;
                                                if (menu_line > 32) menu_line -= 32;
-                                       } while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))));
+                                       } while(!(creature_ptr->spell_learned1 & (1L << (menu_line-1))));
                                        break;
                                }
 
                                        break;
                                }
 
@@ -151,7 +151,7 @@ static int get_hissatsu_power(SPELL_IDX *sn)
                                                reverse = TRUE;
                                        }
                                        else menu_line+=16;
                                                reverse = TRUE;
                                        }
                                        else menu_line+=16;
-                                       while(!(p_ptr->spell_learned1 & (1L << (menu_line-1))))
+                                       while(!(creature_ptr->spell_learned1 & (1L << (menu_line-1))))
                                        {
                                                if (reverse)
                                                {
                                        {
                                                if (reverse)
                                                {
@@ -201,11 +201,11 @@ static int get_hissatsu_power(SPELL_IDX *sn)
 
                                        if (spell.slevel > PY_MAX_LEVEL) continue;
                                        line++;
 
                                        if (spell.slevel > PY_MAX_LEVEL) continue;
                                        line++;
-                                       if (!(p_ptr->spell_learned1 >> i)) break;
+                                       if (!(creature_ptr->spell_learned1 >> i)) break;
 
                                        /* Access the spell */
                                        if (spell.slevel > plev)   continue;
 
                                        /* Access the spell */
                                        if (spell.slevel > plev)   continue;
-                                       if (!(p_ptr->spell_learned1 & (1L << i))) continue;
+                                       if (!(creature_ptr->spell_learned1 & (1L << i))) continue;
                                        if (use_menu)
                                        {
                                                if (i == (menu_line-1))
                                        if (use_menu)
                                        {
                                                if (i == (menu_line-1))
@@ -266,7 +266,7 @@ static int get_hissatsu_power(SPELL_IDX *sn)
                }
 
                /* Totally Illegal */
                }
 
                /* Totally Illegal */
-               if ((i < 0) || (i >= 32) || !(p_ptr->spell_learned1 & (1 << sentaku[i])))
+               if ((i < 0) || (i >= 32) || !(creature_ptr->spell_learned1 & (1 << sentaku[i])))
                {
                        bell();
                        continue;
                {
                        bell();
                        continue;
@@ -291,7 +291,7 @@ static int get_hissatsu_power(SPELL_IDX *sn)
        }
        if (redraw) screen_load();
 
        }
        if (redraw) screen_load();
 
-       p_ptr->window |= (PW_SPELL);
+       creature_ptr->window |= (PW_SPELL);
        handle_stuff();
 
        /* Abort if needed */
        handle_stuff();
 
        /* Abort if needed */
@@ -334,7 +334,7 @@ void do_cmd_hissatsu(player_type *creature_ptr)
                set_action(creature_ptr, ACTION_NONE);
        }
 
                set_action(creature_ptr, ACTION_NONE);
        }
 
-       if (!get_hissatsu_power(&n)) return;
+       if (!get_hissatsu_power(creature_ptr, &n)) return;
 
        spell = technic_info[TECHNIC_HISSATSU][n];
 
 
        spell = technic_info[TECHNIC_HISSATSU][n];
 
index a6c2d22..f657370 100644 (file)
@@ -1745,7 +1745,7 @@ static void process_world_aux_hp_and_sp(void)
                regen_amount = regen_amount * 2;
        }
 
                regen_amount = regen_amount * 2;
        }
 
-       upkeep_factor = calculate_upkeep();
+       upkeep_factor = calculate_upkeep(p_ptr);
 
        /* No regeneration while special action */
        if ((p_ptr->action == ACTION_LEARN) ||
 
        /* No regeneration while special action */
        if ((p_ptr->action == ACTION_LEARN) ||
@@ -1773,7 +1773,7 @@ static void process_world_aux_hp_and_sp(void)
                        msg_print(NULL);
                        do_cmd_pet_dismiss();
 
                        msg_print(NULL);
                        do_cmd_pet_dismiss();
 
-                       upkeep_factor = calculate_upkeep();
+                       upkeep_factor = calculate_upkeep(p_ptr);
 
                        msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
                        msg_print(NULL);
 
                        msg_format(_("維持MPは %d%%", "Upkeep: %d%% mana."), upkeep_factor);
                        msg_print(NULL);
@@ -4962,7 +4962,7 @@ static void dungeon(bool load_game)
                if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
        }
 
                if (record_maxdepth) exe_write_diary(p_ptr, NIKKI_MAXDEAPTH, current_floor_ptr->dun_level, NULL);
        }
 
-       (void)calculate_upkeep();
+       (void)calculate_upkeep(p_ptr);
 
        /* Validate the panel */
        panel_bounds_center();
 
        /* Validate the panel */
        panel_bounds_center();