From 59490b0744229f4f6b80aff7ba689e79fe81d9e0 Mon Sep 17 00:00:00 2001 From: Hourier Date: Wed, 3 Jun 2020 20:08:14 +0900 Subject: [PATCH] [Refactor] #40399 Moved all global variables from object2.c/h to system-variables.c/h --- src/floor/floor-object.c | 1 + src/monster/monster1.c | 1 + src/object-enchant/artifact.c | 1 + src/object/object2.c | 6 ------ src/object/object2.h | 3 --- src/room/rooms-special.c | 18 +++++++++--------- src/room/rooms-special.h | 5 ++++- src/system/system-variables.c | 8 +++++++- src/system/system-variables.h | 5 +++++ 9 files changed, 28 insertions(+), 20 deletions(-) diff --git a/src/floor/floor-object.c b/src/floor/floor-object.c index f7327d603..3718538f7 100644 --- a/src/floor/floor-object.c +++ b/src/floor/floor-object.c @@ -19,6 +19,7 @@ #include "object/object-stack.h" #include "object/object2.h" #include "object-enchant/special-object-flags.h" +#include "system/system-variables.h" #include "view/object-describer.h" #include "world/world-object.h" #include "world/world.h" diff --git a/src/monster/monster1.c b/src/monster/monster1.c index 591182682..adb9a8ff7 100644 --- a/src/monster/monster1.c +++ b/src/monster/monster1.c @@ -50,6 +50,7 @@ #include "sv-definition/sv-protector-types.h" #include "sv-definition/sv-scroll-types.h" #include "sv-definition/sv-weapon-types.h" +#include "system/system-variables.h" #include "object/object2.h" #include "object/object-generator.h" diff --git a/src/object-enchant/artifact.c b/src/object-enchant/artifact.c index ca22ae690..3e5dd91d3 100644 --- a/src/object-enchant/artifact.c +++ b/src/object-enchant/artifact.c @@ -33,6 +33,7 @@ #include "object-enchant/special-object-flags.h" #include "sv-definition/sv-armor-types.h" #include "sv-definition/sv-weapon-types.h" +#include "system/system-variables.h" #include "object-enchant/tr-types.h" #include "object-enchant/trc-types.h" #include "player/avatar.h" diff --git a/src/object/object2.c b/src/object/object2.c index 73e8185e1..c01ab4cae 100644 --- a/src/object/object2.c +++ b/src/object/object2.c @@ -34,9 +34,3 @@ * Chests, and activatable items, never stack (for various reasons). */ -/*! - * Function hook to restrict "get_obj_num_prep()" function - */ -bool(*get_obj_num_hook)(KIND_OBJECT_IDX k_idx); - -OBJECT_SUBTYPE_VALUE coin_type; /* Hack -- force coin type */ diff --git a/src/object/object2.h b/src/object/object2.h index 604dccb96..0d8a6f7cc 100644 --- a/src/object/object2.h +++ b/src/object/object2.h @@ -3,6 +3,3 @@ #include "system/angband.h" #include "floor/floor.h" #include "object-enchant/item-feeling.h" - -extern OBJECT_SUBTYPE_VALUE coin_type; -extern bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx); diff --git a/src/room/rooms-special.c b/src/room/rooms-special.c index 3e7492d81..d08c1a5fe 100644 --- a/src/room/rooms-special.c +++ b/src/room/rooms-special.c @@ -1,17 +1,17 @@ -#include "system/angband.h" -#include "util/util.h" - -#include "grid/grid.h" +#include "room/rooms-special.h" +#include "dungeon/dungeon.h" #include "floor/floor-generate.h" -#include "room/rooms.h" -#include "monster/monster.h" +#include "floor/floor.h" +#include "grid/feature.h" +#include "grid/grid.h" #include "monster/monster-race-hook.h" +#include "monster/monster.h" #include "object-enchant/item-apply-magic.h" #include "object/object-kind-hook.h" #include "object/object2.h" -#include "grid/feature.h" -#include "floor/floor.h" -#include "dungeon/dungeon.h" +#include "room/rooms.h" +#include "system/system-variables.h" +#include "util/util.h" /*! * @brief タイプ15の部屋…ガラス部屋の生成 / Type 15 -- glass rooms diff --git a/src/room/rooms-special.h b/src/room/rooms-special.h index 8baaf0fab..f2e7bb7be 100644 --- a/src/room/rooms-special.h +++ b/src/room/rooms-special.h @@ -1,2 +1,5 @@ -extern bool build_type15(player_type *player_ptr); +#pragma once +#include "system/angband.h" + +bool build_type15(player_type *player_ptr); diff --git a/src/system/system-variables.c b/src/system/system-variables.c index a9dd70bfd..45a00abb9 100644 --- a/src/system/system-variables.c +++ b/src/system/system-variables.c @@ -4,7 +4,6 @@ * @date 2013/12/31 */ -#include "system/angband.h" #include "system/system-variables.h" /*! @@ -24,3 +23,10 @@ concptr ANGBAND_SYS = "xxx"; concptr ANGBAND_KEYBOARD = _("JAPAN", "0"); concptr ANGBAND_GRAF = "ascii"; int init_flags; + +/*! + * Function hook to restrict "get_obj_num_prep()" function + */ +bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx); + +OBJECT_SUBTYPE_VALUE coin_type; diff --git a/src/system/system-variables.h b/src/system/system-variables.h index 5564ea45e..79d165328 100644 --- a/src/system/system-variables.h +++ b/src/system/system-variables.h @@ -1,6 +1,11 @@ #pragma once +#include "system/angband.h" + extern int init_flags; extern concptr ANGBAND_SYS; extern concptr ANGBAND_KEYBOARD; extern concptr ANGBAND_GRAF; + +extern OBJECT_SUBTYPE_VALUE coin_type; +extern bool (*get_obj_num_hook)(KIND_OBJECT_IDX k_idx); -- 2.11.0