OSDN Git Service

[Refactor] #40233 Somefunctions moved from store.c/h to store-util.c/h and separated...
[hengband/hengband.git] / src / core.c
index d899b6f..1f7321f 100644 (file)
 
 #include "birth.h"
 #include "bldg.h"
+#include "io/write-diary.h"
 #include "cmd/cmd-activate.h"
+#include "cmd/cmd-diary.h"
+#include "cmd/cmd-draw.h"
 #include "cmd/cmd-dump.h"
 #include "cmd/cmd-eat.h"
 #include "cmd/cmd-help.h"
@@ -30,6 +33,7 @@
 #include "cmd/cmd-item.h"
 #include "cmd/cmd-magiceat.h"
 #include "cmd/cmd-mane.h"
+#include "cmd/cmd-macro.h"
 #include "cmd/cmd-quaff.h"
 #include "cmd/cmd-read.h"
 #include "cmd/cmd-save.h"
@@ -38,7 +42,8 @@
 #include "cmd/cmd-zaprod.h"
 #include "cmd/cmd-zapwand.h"
 #include "cmd/cmd-pet.h"
-#include "cmd-basic.h"
+#include "cmd/cmd-basic.h"
+#include "cmd/cmd-visuals.h"
 #include "racial.h"
 #include "snipe.h"
 #include "dungeon.h"
@@ -60,6 +65,7 @@
 #include "mind.h"
 #include "world.h"
 #include "mutation.h"
+#include "market/store-util.h"
 #include "quest.h"
 #include "artifact.h"
 #include "avatar.h"
@@ -89,6 +95,7 @@
 #include "dungeon-file.h"
 #include "uid-checker.h"
 #include "player/process-death.h"
+#include "io/read-pref-file.h"
 #include "files.h"
 #include "scores.h"
 #include "autopick.h"
@@ -2224,35 +2231,10 @@ static void process_world_aux_mutation(player_type *creature_ptr)
 
        if ((creature_ptr->muta2 & MUT2_DISARM) && one_in_(10000))
        {
-               INVENTORY_IDX slot = 0;
-               object_type *o_ptr = NULL;
-
                disturb(creature_ptr, FALSE, TRUE);
                msg_print(_("足がもつれて転んだ!", "You trip over your own feet!"));
                take_hit(creature_ptr, DAMAGE_NOESCAPE, randint1(creature_ptr->wt / 6), _("転倒", "tripping"), -1);
-
-               msg_print(NULL);
-               if (has_melee_weapon(creature_ptr, INVEN_RARM))
-               {
-                       slot = INVEN_RARM;
-                       o_ptr = &creature_ptr->inventory_list[INVEN_RARM];
-
-                       if (has_melee_weapon(creature_ptr, INVEN_LARM) && one_in_(2))
-                       {
-                               o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
-                               slot = INVEN_LARM;
-                       }
-               }
-               else if (has_melee_weapon(creature_ptr, INVEN_LARM))
-               {
-                       o_ptr = &creature_ptr->inventory_list[INVEN_LARM];
-                       slot = INVEN_LARM;
-               }
-               if (slot && !object_is_cursed(o_ptr))
-               {
-                       msg_print(_("武器を落としてしまった!", "You drop your weapon!"));
-                       drop_from_inventory(creature_ptr, slot, 1);
-               }
+               drop_weapons(creature_ptr);
        }
 }
 
@@ -3634,7 +3616,7 @@ static void process_fishing(player_type *creature_ptr)
                MONRACE_IDX r_idx;
                bool success = FALSE;
                get_mon_num_prep(creature_ptr, monster_is_fishing_target, NULL);
-               r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level);
+               r_idx = get_mon_num(creature_ptr, creature_ptr->current_floor_ptr->dun_level ? creature_ptr->current_floor_ptr->dun_level : wilderness[creature_ptr->wilderness_y][creature_ptr->wilderness_x].level, 0);
                msg_print(NULL);
                if (r_idx && one_in_(2))
                {
@@ -4647,18 +4629,18 @@ void prevent_turn_overflow(player_type *player_ptr)
        {
                for (int j = 0; j < MAX_STORES; j++)
                {
-                       store_type *st_ptr = &town_info[i].store[j];
+                       store_type *store_ptr = &town_info[i].store[j];
 
-                       if (st_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
+                       if (store_ptr->last_visit > -10L * TURNS_PER_TICK * STORE_TICKS)
                        {
-                               st_ptr->last_visit -= rollback_turns;
-                               if (st_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) st_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
+                               store_ptr->last_visit -= rollback_turns;
+                               if (store_ptr->last_visit < -10L * TURNS_PER_TICK * STORE_TICKS) store_ptr->last_visit = -10L * TURNS_PER_TICK * STORE_TICKS;
                        }
 
-                       if (st_ptr->store_open)
+                       if (store_ptr->store_open)
                        {
-                               st_ptr->store_open -= rollback_turns;
-                               if (st_ptr->store_open < 1) st_ptr->store_open = 1;
+                               store_ptr->store_open -= rollback_turns;
+                               if (store_ptr->store_open < 1) store_ptr->store_open = 1;
                        }
                }
        }