From 26d4e19d064a860155fcdb3a7c27c009c2c562cc Mon Sep 17 00:00:00 2001 From: Hourier Date: Tue, 21 Apr 2020 23:39:01 +0900 Subject: [PATCH] [Refactor] #40236 Renamed bldg.c/h to market/building.c/h --- Hengband_vcs2017/Hengband/Hengband.vcxproj | 4 +- Hengband_vcs2017/Hengband/Hengband.vcxproj.filters | 12 ++--- src/Makefile.am | 2 +- src/birth.c | 2 +- src/cmd/cmd-inn.c | 57 +++++++++++++--------- src/core.c | 2 +- src/dungeon-file.c | 2 +- src/floor-generate.c | 2 +- src/floor-save.c | 2 +- src/init.c | 2 +- src/load.c | 2 +- src/{bldg.c => market/building.c} | 32 ++++++------ src/{bldg.h => market/building.h} | 0 src/monster1.c | 2 +- src/player-damage.c | 2 +- src/player-effects.c | 2 +- src/player-status.c | 2 +- src/player-status.h | 2 +- src/save.c | 2 +- src/spells3.c | 2 +- src/targeting.c | 2 +- src/view-mainwindow.c | 2 +- src/wizard2.c | 2 +- 23 files changed, 75 insertions(+), 66 deletions(-) rename src/{bldg.c => market/building.c} (99%) rename src/{bldg.h => market/building.h} (100%) diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj b/Hengband_vcs2017/Hengband/Hengband.vcxproj index c7648e96f..6e3d141ca 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj @@ -152,7 +152,7 @@ - + @@ -274,7 +274,7 @@ - + diff --git a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters index 3e9d2b114..043b1fb78 100644 --- a/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters +++ b/Hengband_vcs2017/Hengband/Hengband.vcxproj.filters @@ -211,9 +211,6 @@ market - - market - market @@ -586,6 +583,9 @@ cmd + + market + @@ -776,9 +776,6 @@ market - - market - market @@ -1154,6 +1151,9 @@ cmd + + market + diff --git a/src/Makefile.am b/src/Makefile.am index f89b678cb..f04342180 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,7 @@ hengband_SOURCES = \ market/say-comments.c market/say-comments.h \ market/store-util.c market/store-util.h \ market/gold-magnification-table.c market/gold-magnification-table.h \ - store.c store.h bldg.c bldg.h chest.c chest.h chuukei.c chuukei.h \ + store.c store.h building.c building.h chest.c chest.h chuukei.c chuukei.h \ \ view/display-characteristic.c view/display-characteristic.h \ view/display-fruit.c view/display-fruit.h \ diff --git a/src/birth.c b/src/birth.c index 283c3d174..695906fcb 100644 --- a/src/birth.c +++ b/src/birth.c @@ -13,7 +13,7 @@ #include "angband.h" #include "util.h" -#include "bldg.h" +#include "market/building.h" #include "core.h" #include "core/show-file.h" #include "io/read-pref-file.h" diff --git a/src/cmd/cmd-inn.c b/src/cmd/cmd-inn.c index 4d42fb710..64ddc2294 100644 --- a/src/cmd/cmd-inn.c +++ b/src/cmd/cmd-inn.c @@ -167,6 +167,36 @@ static void display_stay_result(player_type *customer_ptr, int prev_hour) /*! + * @brief 宿屋への宿泊実行処理 + * @param customer_ptr プレーヤーへの参照ポインタ + * @return 泊まれたらTRUE + */ +static bool stay_inn(player_type *customer_ptr) +{ + if (!is_healthy_stay(customer_ptr)) return FALSE; + + int prev_day, prev_hour, prev_min; + extract_day_hour_min(customer_ptr, &prev_day, &prev_hour, &prev_min); + write_diary_stay_inn(customer_ptr, prev_hour); + + pass_game_turn_by_stay(); + prevent_turn_overflow(customer_ptr); + + if ((prev_hour >= 18) && (prev_hour <= 23)) + exe_write_diary(customer_ptr, DIARY_DIALY, 0, NULL); + + customer_ptr->chp = customer_ptr->mhp; + if (have_a_nightmare(customer_ptr)) return TRUE; + + back_to_health(customer_ptr); + charge_magic_eating_energy(customer_ptr); + + display_stay_result(customer_ptr, prev_hour); + return TRUE; +} + + +/*! * todo 悪夢を見る前後に全回復しているが、何か意図がある? * @brief 宿屋を利用する * @param customer_ptr プレーヤーへの参照ポインタ @@ -186,30 +216,9 @@ bool inn_comm(player_type *customer_ptr, int cmd) { case BACT_FOOD: return buy_food(customer_ptr); - case BACT_REST: /* Rest for the night */ - { - if (!is_healthy_stay(customer_ptr)) return FALSE; - - int prev_day, prev_hour, prev_min; - extract_day_hour_min(customer_ptr, &prev_day, &prev_hour, &prev_min); - write_diary_stay_inn(customer_ptr, prev_hour); - - pass_game_turn_by_stay(); - prevent_turn_overflow(customer_ptr); - - if ((prev_hour >= 18) && (prev_hour <= 23)) - exe_write_diary(customer_ptr, DIARY_DIALY, 0, NULL); - - customer_ptr->chp = customer_ptr->mhp; - if (have_a_nightmare(customer_ptr)) return TRUE; - - back_to_health(customer_ptr); - charge_magic_eating_energy(customer_ptr); - - display_stay_result(customer_ptr); - return TRUE; - } - case BACT_RUMORS: /* Listen for rumors */ + case BACT_REST: + return stay_inn(customer_ptr); + case BACT_RUMORS: display_rumor(customer_ptr, TRUE); return TRUE; default: diff --git a/src/core.c b/src/core.c index 2f6f45a64..9ba9e423a 100644 --- a/src/core.c +++ b/src/core.c @@ -21,7 +21,7 @@ #include "creature.h" #include "birth.h" -#include "bldg.h" +#include "market/building.h" #include "io/write-diary.h" #include "cmd/cmd-activate.h" #include "cmd/cmd-diary.h" diff --git a/src/dungeon-file.c b/src/dungeon-file.c index bede3767a..2abf9343b 100644 --- a/src/dungeon-file.c +++ b/src/dungeon-file.c @@ -48,7 +48,7 @@ #include "player-race.h" #include "dungeon.h" #include "floor.h" -#include "bldg.h" +#include "market/building.h" #include "world.h" #include "rooms-vault.h" #include "objectkind.h" diff --git a/src/floor-generate.c b/src/floor-generate.c index 1695c7604..ce78e00bf 100644 --- a/src/floor-generate.c +++ b/src/floor-generate.c @@ -99,7 +99,7 @@ #include "angband.h" #include "util.h" #include "core.h" -#include "bldg.h" +#include "market/building.h" #include "io/write-diary.h" #include "cmd/cmd-dump.h" diff --git a/src/floor-save.c b/src/floor-save.c index a7bd8e2c6..444521b29 100644 --- a/src/floor-save.c +++ b/src/floor-save.c @@ -11,7 +11,7 @@ */ #include "angband.h" -#include "bldg.h" +#include "market/building.h" #include "core.h" #include "load.h" #include "util.h" diff --git a/src/init.c b/src/init.c index 0e27a8d4c..0de612623 100644 --- a/src/init.c +++ b/src/init.c @@ -39,7 +39,7 @@ #include "term.h" #include "artifact.h" -#include "bldg.h" +#include "market/building.h" #include "init.h" #include "quest.h" #include "trap.h" diff --git a/src/load.c b/src/load.c index a8ca93120..41eb86026 100644 --- a/src/load.c +++ b/src/load.c @@ -45,7 +45,7 @@ #include "core.h" #include "load.h" -#include "bldg.h" +#include "market/building.h" #include "report.h" #include "dungeon.h" diff --git a/src/bldg.c b/src/market/building.c similarity index 99% rename from src/bldg.c rename to src/market/building.c index 87305ba20..b2bd73ed6 100644 --- a/src/bldg.c +++ b/src/market/building.c @@ -1,15 +1,15 @@ /*! - @file bldg.c - @brief 町の施設処理 / Building commands - @date 2013/12/23 - @author - Created by Ken Wigle for Kangband - a variant of Angband 2.8.3 - -KMW- - - Rewritten for Kangband 2.8.3i using Kamband's version of - bldg.c as written by Ivan Tkatchev - - Changed for ZAngband by Robert Ruehlmann + * @file building.c + * @brief 町の施設処理 / Building commands + * @date 2013/12/23 + * @author + * Created by Ken Wigle for Kangband - a variant of Angband 2.8.3 + * -KMW- + * + * Rewritten for Kangband 2.8.3i using Kamband's version of + * building.c as written by Ivan Tkatchev + * + * Changed for ZAngband by Robert Ruehlmann */ #include "angband.h" @@ -36,7 +36,7 @@ #include "sort.h" #include "avatar.h" -#include "bldg.h" +#include "market/building.h" #include "dungeon.h" #include "mutation.h" #include "quest.h" @@ -269,9 +269,6 @@ static void show_building(player_type *player_ptr, building_type* bldg) */ static void arena_comm(player_type *player_ptr, int cmd) { - monster_race *r_ptr; - concptr name; - switch (cmd) { case BACT_ARENA: @@ -344,6 +341,7 @@ static void arena_comm(player_type *player_ptr, int cmd) player_ptr->leave_bldg = TRUE; break; case BACT_POSTER: + { if (player_ptr->arena_number == MAX_ARENA_MONS) { msg_print(_("あなたは勝利者だ。 アリーナでのセレモニーに参加しなさい。", @@ -357,14 +355,16 @@ static void arena_comm(player_type *player_ptr, int cmd) break; } + monster_race *r_ptr; r_ptr = &r_info[arena_info[player_ptr->arena_number].r_idx]; - name = (r_name + r_ptr->name); + concptr name = (r_name + r_ptr->name); msg_format(_("%s に挑戦するものはいないか?", "Do I hear any challenges against: %s"), name); player_ptr->monster_race_idx = arena_info[player_ptr->arena_number].r_idx; player_ptr->window |= (PW_MONSTER); handle_stuff(player_ptr); break; + } case BACT_ARENA_RULES: screen_save(); diff --git a/src/bldg.h b/src/market/building.h similarity index 100% rename from src/bldg.h rename to src/market/building.h diff --git a/src/monster1.c b/src/monster1.c index d23df4a13..bc02c8fd9 100644 --- a/src/monster1.c +++ b/src/monster1.c @@ -16,7 +16,7 @@ #include "io/write-diary.h" #include "cmd/cmd-dump.h" -#include "bldg.h" +#include "market/building.h" #include "cmd-pet.h" #include "floor.h" #include "objectkind-hook.h" diff --git a/src/player-damage.c b/src/player-damage.c index 2c22ab0eb..da989f137 100644 --- a/src/player-damage.c +++ b/src/player-damage.c @@ -4,7 +4,7 @@ #include "term.h" #include "avatar.h" -#include "bldg.h" +#include "market/building.h" #include "io/write-diary.h" #include "cmd/cmd-dump.h" #include "market/arena-info-table.h" diff --git a/src/player-effects.c b/src/player-effects.c index d9361ddd5..9f6b5c35f 100644 --- a/src/player-effects.c +++ b/src/player-effects.c @@ -22,7 +22,7 @@ #include "artifact.h" #include "cmd-dump.h" #include "floor.h" -#include "bldg.h" +#include "market/building.h" #include "birth.h" #include "grid.h" #include "mutation.h" diff --git a/src/player-status.c b/src/player-status.c index 47832cf6b..3b2c20f2f 100644 --- a/src/player-status.c +++ b/src/player-status.c @@ -2,7 +2,7 @@ #include "core.h" #include "util.h" -#include "bldg.h" +#include "market/building.h" #include "quest.h" #include "player-move.h" #include "player-status.h" diff --git a/src/player-status.h b/src/player-status.h index 49d6b394b..19c5202e3 100644 --- a/src/player-status.h +++ b/src/player-status.h @@ -1,5 +1,5 @@ #pragma once -#include "bldg.h" +#include "market/building.h" struct floor_type; typedef struct floor_type floor_type; diff --git a/src/save.c b/src/save.c index ab5cb4393..0c99a5983 100644 --- a/src/save.c +++ b/src/save.c @@ -35,7 +35,7 @@ #include "objectkind.h" #include "monsterrace.h" #include "birth.h" -#include "bldg.h" +#include "market/building.h" #include "view-mainwindow.h" /* diff --git a/src/spells3.c b/src/spells3.c index 85951bd65..782331315 100644 --- a/src/spells3.c +++ b/src/spells3.c @@ -12,7 +12,7 @@ */ #include "angband.h" -#include "bldg.h" +#include "market/building.h" #include "core.h" #include "term.h" #include "util.h" diff --git a/src/targeting.c b/src/targeting.c index c46d530c8..97c49aa2a 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -16,7 +16,7 @@ #include "term.h" #include "targeting.h" -#include "bldg.h" +#include "market/building.h" #include "cmd-pet.h" #include "dungeon-file.h" #include "object-curse.h" diff --git a/src/view-mainwindow.c b/src/view-mainwindow.c index 4d2aafba1..7ff12a2e8 100644 --- a/src/view-mainwindow.c +++ b/src/view-mainwindow.c @@ -15,7 +15,7 @@ #include "autopick.h" #include "term.h" -#include "bldg.h" +#include "market/building.h" #include "core.h" #include "files.h" #include "world.h" diff --git a/src/wizard2.c b/src/wizard2.c index 85a814c94..a3252fad1 100644 --- a/src/wizard2.c +++ b/src/wizard2.c @@ -50,7 +50,7 @@ #include "dungeon-file.h" #include "files.h" #include "monster-spell.h" -#include "bldg.h" +#include "market/building.h" #include "objectkind.h" #include "targeting.h" #include "view-mainwindow.h" -- 2.11.0