From b1a60ccbc19f9f8d4b3b33f2fd03d730efb2f2cf Mon Sep 17 00:00:00 2001 From: Hourier Date: Sun, 9 Aug 2020 13:13:00 +0900 Subject: [PATCH] [Refactor] #40624 Separated monster-lite-util.c/h from floor-events.c --- Hengband/Hengband/Hengband.vcxproj | 2 ++ Hengband/Hengband/Hengband.vcxproj.filters | 6 ++++++ src/Makefile.am | 1 + src/floor/floor-events.c | 14 +------------- src/monster-floor/monster-lite-util.c | 12 ++++++++++++ src/monster-floor/monster-lite-util.h | 12 ++++++++++++ 6 files changed, 34 insertions(+), 13 deletions(-) create mode 100644 src/monster-floor/monster-lite-util.c create mode 100644 src/monster-floor/monster-lite-util.h diff --git a/Hengband/Hengband/Hengband.vcxproj b/Hengband/Hengband/Hengband.vcxproj index 254322132..040f3a59a 100644 --- a/Hengband/Hengband/Hengband.vcxproj +++ b/Hengband/Hengband/Hengband.vcxproj @@ -280,6 +280,7 @@ + @@ -876,6 +877,7 @@ + diff --git a/Hengband/Hengband/Hengband.vcxproj.filters b/Hengband/Hengband/Hengband.vcxproj.filters index c0eae422d..82698b29d 100644 --- a/Hengband/Hengband/Hengband.vcxproj.filters +++ b/Hengband/Hengband/Hengband.vcxproj.filters @@ -2006,6 +2006,9 @@ action + + monster-floor + @@ -4363,6 +4366,9 @@ action + + monster-floor + diff --git a/src/Makefile.am b/src/Makefile.am index a37d947ab..d2894153a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -461,6 +461,7 @@ hengband_SOURCES = \ monster-floor/monster-safety-hiding.c monster-floor/monster-safety-hiding.h \ monster-floor/monster-summon.c monster-floor/monster-summon.h \ monster-floor/monster-sweep-grid.c monster-floor/monster-sweep-grid.h \ + monster-floor/monster-lite-util.c monster-floor/monster-lite-util.h \ monster-floor/one-monster-placer.c monster-floor/one-monster-placer.h \ monster-floor/place-monster-types.h \ monster-floor/quantum-effect.c monster-floor/quantum-effect.h \ diff --git a/src/floor/floor-events.c b/src/floor/floor-events.c index c458d41be..726edca0e 100644 --- a/src/floor/floor-events.c +++ b/src/floor/floor-events.c @@ -17,6 +17,7 @@ #include "grid/grid.h" #include "main/sound-of-music.h" #include "mind/mind-ninja.h" +#include "monster-floor/monster-lite-util.h" #include "monster-race/monster-race.h" #include "monster-race/race-flags1.h" #include "monster-race/race-flags7.h" @@ -40,19 +41,6 @@ #include "view/display-messages.h" #include "world/world.h" -typedef struct monster_lite_type { - bool mon_invis; - POSITION mon_fy, mon_fx; -} monster_lite_type; - -monster_lite_type *initialize_monster_lite_type(floor_type *floor_ptr, monster_lite_type *ml_ptr, monster_type *m_ptr) -{ - ml_ptr->mon_fx = m_ptr->fx; - ml_ptr->mon_fy = m_ptr->fy; - ml_ptr->mon_invis = !(floor_ptr->grid_array[ml_ptr->mon_fy][ml_ptr->mon_fx].info & CAVE_VIEW); - return ml_ptr; -} - void day_break(player_type *subject_ptr) { msg_print(_("夜が明けた。", "The sun has risen.")); diff --git a/src/monster-floor/monster-lite-util.c b/src/monster-floor/monster-lite-util.c new file mode 100644 index 000000000..d92b3654c --- /dev/null +++ b/src/monster-floor/monster-lite-util.c @@ -0,0 +1,12 @@ +#include "monster-floor/monster-lite-util.h" +#include "grid/grid.h" +#include "system/floor-type-definition.h" +#include "system/monster-type-definition.h" + +monster_lite_type *initialize_monster_lite_type(floor_type *floor_ptr, monster_lite_type *ml_ptr, monster_type *m_ptr) +{ + ml_ptr->mon_fx = m_ptr->fx; + ml_ptr->mon_fy = m_ptr->fy; + ml_ptr->mon_invis = !(floor_ptr->grid_array[ml_ptr->mon_fy][ml_ptr->mon_fx].info & CAVE_VIEW); + return ml_ptr; +} diff --git a/src/monster-floor/monster-lite-util.h b/src/monster-floor/monster-lite-util.h new file mode 100644 index 000000000..30bf950ec --- /dev/null +++ b/src/monster-floor/monster-lite-util.h @@ -0,0 +1,12 @@ +#pragma once + +#include "system/angband.h" + +typedef struct monster_lite_type { + bool mon_invis; + POSITION mon_fy; + POSITION mon_fx; +} monster_lite_type; + +typedef struct monster_type monster_type; +monster_lite_type *initialize_monster_lite_type(floor_type *floor_ptr, monster_lite_type *ml_ptr, monster_type *m_ptr); -- 2.11.0