OSDN Git Service

[Refactor] 店舗の種類を enum class StoreSaleType 型に変更しリファクタリング。
authorDeskull <61610939+sikabane-works@users.noreply.github.com>
Sun, 10 Oct 2021 07:03:43 +0000 (16:03 +0900)
committerDeskull <61610939+sikabane-works@users.noreply.github.com>
Mon, 11 Oct 2021 11:26:33 +0000 (20:26 +0900)
30 files changed:
src/birth/character-builder.cpp
src/core/game-play.cpp
src/io-dump/character-dump.cpp
src/io-dump/random-art-info-dumper.cpp
src/io/input-key-processor.cpp
src/knowledge/knowledge-inventory.cpp
src/knowledge/knowledge-self.cpp
src/load/store-loader.cpp
src/market/building-initializer.cpp
src/mutation/mutation-processor.cpp
src/player/process-death.cpp
src/room/rooms-city.cpp
src/room/rooms-vault.cpp
src/store/black-market.cpp
src/store/cmd-store.cpp
src/store/home.cpp
src/store/home.h
src/store/museum.cpp
src/store/pricing.cpp
src/store/purchase-order.cpp
src/store/say-comments.cpp
src/store/sell-order.cpp
src/store/service-checker.cpp
src/store/store-key-processor.cpp
src/store/store-util.cpp
src/store/store-util.h
src/store/store.cpp
src/store/store.h
src/view/display-store.cpp
src/world/world-turn-processor.cpp

index 53868a9..6351c0e 100644 (file)
@@ -100,8 +100,8 @@ void player_birth(player_type *player_ptr)
 
     write_birth_diary(player_ptr);
     for (int i = 1; i < max_towns; i++) {
-        for (int j = 0; j < MAX_STORES; j++) {
-            store_init(i, j);
+        for (auto sst : StoreSaleType()) {
+            store_init(i, sst);
         }
     }
 
index c7120df..ffe6f4d 100644 (file)
@@ -417,8 +417,8 @@ void play_game(player_type *player_ptr, bool new_game, bool browsing_movie)
         calc_android_exp(player_ptr);
 
     init_riding_pet(player_ptr, new_game);
-    (void)combine_and_reorder_home(player_ptr, STORE_HOME);
-    (void)combine_and_reorder_home(player_ptr, STORE_MUSEUM);
+    (void)combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
+    (void)combine_and_reorder_home(player_ptr, StoreSaleType::MUSEUM);
     select_floor_music(player_ptr);
     process_game_turn(player_ptr);
     close_game(player_ptr);
index 0395af4..e62aaa0 100644 (file)
@@ -495,7 +495,7 @@ static void dump_aux_equipment_inventory(player_type *player_ptr, FILE *fff)
 static void dump_aux_home_museum(player_type *player_ptr, FILE *fff)
 {
     store_type *store_ptr;
-    store_ptr = &town_info[1].store[STORE_HOME];
+    store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
 
     GAME_TEXT o_name[MAX_NLEN];
     if (store_ptr->stock_num) {
@@ -512,7 +512,7 @@ static void dump_aux_home_museum(player_type *player_ptr, FILE *fff)
         fprintf(fff, "\n\n");
     }
 
-    store_ptr = &town_info[1].store[STORE_MUSEUM];
+    store_ptr = &town_info[1].store[enum2i(StoreSaleType::MUSEUM)];
 
     if (store_ptr->stock_num == 0)
         return;
index 2a3d2a5..631e6f1 100644 (file)
@@ -93,13 +93,13 @@ void spoil_random_artifact(player_type *player_ptr, concptr fname)
                 spoil_random_artifact_aux(player_ptr, q_ptr, tval);
             }
 
-            store_ptr = &town_info[1].store[STORE_HOME];
+            store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
             for (int i = 0; i < store_ptr->stock_num; i++) {
                 q_ptr = &store_ptr->stock[i];
                 spoil_random_artifact_aux(player_ptr, q_ptr, tval);
             }
 
-            store_ptr = &town_info[1].store[STORE_MUSEUM];
+            store_ptr = &town_info[1].store[enum2i(StoreSaleType::MUSEUM)];
             for (int i = 0; i < store_ptr->stock_num; i++) {
                 q_ptr = &store_ptr->stock[i];
                 spoil_random_artifact_aux(player_ptr, q_ptr, tval);
index 67785a1..41ada1c 100644 (file)
@@ -537,7 +537,7 @@ void process_command(player_type *player_ptr)
     }
     case '=': {
         do_cmd_options(player_ptr);
-        (void)combine_and_reorder_home(player_ptr, STORE_HOME);
+        (void)combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
         do_cmd_redraw(player_ptr);
         break;
     }
index e8553dd..46bf0ea 100644 (file)
@@ -256,7 +256,7 @@ static void show_holding_equipment_resistances(player_type *player_ptr, tval_typ
 static void show_home_equipment_resistances(player_type *player_ptr, tval_type tval, int *label_number, FILE *fff)
 {
     store_type *store_ptr;
-    store_ptr = &town_info[1].store[STORE_HOME];
+    store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
     char where[32];
     strcpy(where, _("家", "H "));
     for (int i = 0; i < store_ptr->stock_num; i++) {
index 0804af9..015a1ee 100644 (file)
@@ -217,7 +217,7 @@ void do_cmd_knowledge_home(player_type *player_ptr)
         return;
 
     store_type *store_ptr;
-    store_ptr = &town_info[1].store[STORE_HOME];
+    store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
 
     if (store_ptr->stock_num) {
 #ifdef JP
index 7c5a90d..0265583 100644 (file)
@@ -36,7 +36,7 @@ static void home_carry_load(player_type *player_ptr, store_type *store_ptr, obje
         return;
     }
 
-    if (store_ptr->stock_num >= store_get_stock_max(STORE_HOME))
+    if (store_ptr->stock_num >= store_get_stock_max(StoreSaleType::HOME))
         return;
 
     int32_t value = object_value(o_ptr);
@@ -66,7 +66,7 @@ static errr rd_store(player_type *player_ptr, int town_number, int store_number)
 {
     store_type *store_ptr;
     bool sort = false;
-    if (h_older_than(0, 3, 3) && (store_number == STORE_HOME)) {
+    if (h_older_than(0, 3, 3) && (i2enum<StoreSaleType>(store_number) == StoreSaleType::HOME)) {
         store_ptr = &town_info[1].store[store_number];
         if (store_ptr->stock_num)
             sort = true;
@@ -101,7 +101,7 @@ static errr rd_store(player_type *player_ptr, int town_number, int store_number)
 
         rd_item(q_ptr);
 
-        auto stock_max = store_get_stock_max(i2enum<STORE_TYPE_IDX>(store_number));
+        auto stock_max = store_get_stock_max(i2enum<StoreSaleType>(store_number));
         if (store_ptr->stock_num >= stock_max)
             continue;
 
index 65b383f..76d227d 100644 (file)
@@ -19,24 +19,24 @@ errr init_towns(void)
     town_info = std::vector<town_type>(max_towns);
     for (int i = 1; i < max_towns; i++) {
         town_info[i].store = std::vector<store_type>(MAX_STORES);
-        for (int j = 0; j < MAX_STORES; j++) {
-            store_type *store_ptr = &town_info[i].store[j];
-            if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME))
+        for (auto sst : StoreSaleType()) {
+            store_type *store_ptr = &town_info[i].store[enum2i(sst)];
+            if ((i > 1) && (sst == StoreSaleType::MUSEUM || sst == StoreSaleType::HOME))
                 continue;
 
             /*
              * 我が家が 20 ページまで使える隠し機能のための準備。
              * オプションが有効でもそうでなくても一応スペースを作っておく。
              */
-            store_ptr->stock_size = store_get_stock_max(i2enum<STORE_TYPE_IDX>(j));
+            store_ptr->stock_size = store_get_stock_max(sst);
 
             store_ptr->stock = std::make_unique<object_type[]>(store_ptr->stock_size);
-            if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM))
+            if ((sst == StoreSaleType::BLACK) || (sst == StoreSaleType::HOME) || (sst == StoreSaleType::MUSEUM))
                 continue;
 
             for (int k = 0; k < STORE_INVEN_MAX; k++) {
-                int tv = store_regular_table[j][k].tval;
-                int sv = store_regular_table[j][k].sval;
+                int tv = store_regular_table[enum2i(sst)][k].tval;
+                int sv = store_regular_table[enum2i(sst)][k].sval;
                 if (tv == 0)
                     break;
 
@@ -49,8 +49,8 @@ errr init_towns(void)
             }
 
             for (int k = 0; k < STORE_CHOICES; k++) {
-                int tv = store_table[j][k].tval;
-                int sv = store_table[j][k].sval;
+                int tv = store_table[enum2i(sst)][k].tval;
+                int sv = store_table[enum2i(sst)][k].sval;
                 if (tv == 0)
                     break;
 
index 7fe4576..4b71fc5 100644 (file)
@@ -244,13 +244,13 @@ void process_world_aux_mutation(player_type *player_ptr)
 
         banish_monsters(player_ptr, 100);
         if (!is_in_dungeon(player_ptr) && player_ptr->town_num) {
-            int n;
+            StoreSaleType sst;
             do {
-                n = randint0(MAX_STORES);
-            } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
+                sst = i2enum<StoreSaleType>(randint0(MAX_STORES));
+            } while ((sst == StoreSaleType::HOME) || (sst == StoreSaleType::MUSEUM));
 
             msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
-            store_shuffle(player_ptr, n);
+            store_shuffle(player_ptr, sst);
         }
         msg_print(nullptr);
     }
index 11968ca..00e6010 100644 (file)
@@ -270,7 +270,7 @@ static void home_aware(player_type *player_ptr)
     object_type *o_ptr;
     store_type *store_ptr;
     for (int i = 1; i < max_towns; i++) {
-        store_ptr = &town_info[i].store[STORE_HOME];
+        store_ptr = &town_info[i].store[enum2i(StoreSaleType::HOME)];
         for (int j = 0; j < store_ptr->stock_num; j++) {
             o_ptr = &store_ptr->stock[j];
             if (!o_ptr->k_idx)
@@ -317,7 +317,7 @@ static void show_dead_home_items(player_type *player_ptr)
 {
     for (int l = 1; l < max_towns; l++) {
         store_type *store_ptr;
-        store_ptr = &town_info[l].store[STORE_HOME];
+        store_ptr = &town_info[l].store[enum2i(StoreSaleType::HOME)];
         if (store_ptr->stock_num == 0)
             continue;
 
index 72137a5..a3fb825 100644 (file)
@@ -99,7 +99,7 @@ static void generate_fill_perm_bold(player_type *player_ptr, POSITION y1, POSITI
  * @note
  * Note: ltcy and ltcx indicate "left top corner".
  */
-static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx, int stores[], int n, const std::vector<ugbldg_type>& ugbldg)
+static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx, StoreSaleType stores[], int n, const std::vector<ugbldg_type>& ugbldg)
 {
     int i;
     POSITION y, x;
@@ -143,7 +143,7 @@ static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx,
 
         if (auto it = std::find_if(f_info.begin(), f_info.end(),
                 [subtype = stores[i]](const feature_type &f_ref) {
-                    return f_ref.flags.has(FF::STORE) && (f_ref.subtype == subtype);
+                    return f_ref.flags.has(FF::STORE) && (i2enum<StoreSaleType>(static_cast<int>(f_ref.subtype)) == subtype);
                 });
             it != f_info.end()) {
             cave_set_feat(player_ptr, ltcy + y, ltcx + x, (*it).idx);
@@ -167,15 +167,15 @@ static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx,
  */
 bool build_type16(player_type *player_ptr, dun_data_type *dd_ptr)
 {
-    int stores[] = {
-        STORE_GENERAL,
-        STORE_ARMOURY,
-        STORE_WEAPON,
-        STORE_TEMPLE,
-        STORE_ALCHEMIST,
-        STORE_MAGIC,
-        STORE_BLACK,
-        STORE_BOOK,
+    StoreSaleType stores[] = {
+        StoreSaleType::GENERAL,
+        StoreSaleType::ARMOURY,
+        StoreSaleType::WEAPON,
+        StoreSaleType::TEMPLE,
+        StoreSaleType::ALCHEMIST,
+        StoreSaleType::MAGIC,
+        StoreSaleType::BLACK,
+        StoreSaleType::BOOK,
     };
     int n = sizeof stores / sizeof(int);
     POSITION y1, x1, yval, xval;
index 4164ef6..e47d9d7 100644 (file)
@@ -426,7 +426,7 @@ static void build_vault(
                 /* Black market in a dungeon */
             case 'S':
                 set_cave_feat(floor_ptr, y, x, feat_black_market);
-                store_init(NO_TOWN, STORE_BLACK);
+                store_init(NO_TOWN, StoreSaleType::BLACK);
                 break;
 
                 /* The Pattern */
index 2b4cdcf..4a1089c 100644 (file)
@@ -31,14 +31,13 @@ bool black_market_crap(player_type *player_ptr, object_type *o_ptr)
     if (o_ptr->to_d > 0)
         return false;
 
-    for (int i = 0; i < MAX_STORES; i++) {
-        if (i == STORE_HOME)
-            continue;
-        if (i == STORE_MUSEUM)
+    for (auto sst : StoreSaleType()) {
+        if (sst == StoreSaleType::HOME || sst == StoreSaleType::MUSEUM) {
             continue;
+        }
 
-        for (int j = 0; j < town_info[player_ptr->town_num].store[i].stock_num; j++) {
-            object_type *j_ptr = &town_info[player_ptr->town_num].store[i].stock[j];
+        for (int j = 0; j < town_info[player_ptr->town_num].store[enum2i(sst)].stock_num; j++) {
+            object_type *j_ptr = &town_info[player_ptr->town_num].store[enum2i(sst)].stock[j];
             if (o_ptr->k_idx == j_ptr->k_idx)
                 return true;
         }
index 4e15b8b..23c7261 100644 (file)
@@ -76,27 +76,27 @@ void do_cmd_store(player_type *player_ptr)
     //   inner_town_num は、施設内で C コマンドなどを使ったときにそのままでは現在地の偽装がバレる
     //   ため、それを糊塗するためのグローバル変数。
     //   この辺はリファクタしたい。
-    int which = f_info[g_ptr->feat].subtype;
+    StoreSaleType which = i2enum<StoreSaleType>(f_info[g_ptr->feat].subtype);
     old_town_num = player_ptr->town_num;
-    if ((which == STORE_HOME) || (which == STORE_MUSEUM))
+    if ((which == StoreSaleType::HOME) || (which == StoreSaleType::MUSEUM))
         player_ptr->town_num = 1;
     if (is_in_dungeon(player_ptr))
         player_ptr->town_num = NO_TOWN;
     inner_town_num = player_ptr->town_num;
 
-    if ((town_info[player_ptr->town_num].store[which].store_open >= w_ptr->game_turn) || ironman_shops) {
+    if ((town_info[player_ptr->town_num].store[enum2i(which)].store_open >= w_ptr->game_turn) || ironman_shops) {
         msg_print(_("ドアに鍵がかかっている。", "The doors are locked."));
         player_ptr->town_num = old_town_num;
         return;
     }
 
-    int maintain_num = (w_ptr->game_turn - town_info[player_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
+    int maintain_num = (w_ptr->game_turn - town_info[player_ptr->town_num].store[enum2i(which)].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
     if (maintain_num > 10)
         maintain_num = 10;
     if (maintain_num) {
         store_maintenance(player_ptr, player_ptr->town_num, which, maintain_num);
 
-        town_info[player_ptr->town_num].store[which].last_visit = w_ptr->game_turn;
+        town_info[player_ptr->town_num].store[enum2i(which)].last_visit = w_ptr->game_turn;
     }
 
     forget_lite(player_ptr->current_floor_ptr);
@@ -108,8 +108,8 @@ void do_cmd_store(player_type *player_ptr)
     get_com_no_macros = true;
     cur_store_num = which;
     cur_store_feat = g_ptr->feat;
-    st_ptr = &town_info[player_ptr->town_num].store[cur_store_num];
-    ot_ptr = &owners[cur_store_num][st_ptr->owner];
+    st_ptr = &town_info[player_ptr->town_num].store[enum2i(cur_store_num)];
+    ot_ptr = &owners[enum2i(cur_store_num)][st_ptr->owner];
     store_top = 0;
     play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
     display_store(player_ptr);
@@ -124,11 +124,11 @@ void do_cmd_store(player_type *player_ptr)
             prt(_(" スペース) 次ページ", " SPACE) Next page"), 23 + xtra_stock, 0);
         }
 
-        if (cur_store_num == STORE_HOME) {
+        if (cur_store_num == StoreSaleType::HOME) {
             prt(_("g) アイテムを取る", "g) Get an item."), 21 + xtra_stock, 27);
             prt(_("d) アイテムを置く", "d) Drop an item."), 22 + xtra_stock, 27);
             prt(_("x) 家のアイテムを調べる", "x) eXamine an item in the home."), 23 + xtra_stock, 27);
-        } else if (cur_store_num == STORE_MUSEUM) {
+        } else if (cur_store_num == StoreSaleType::MUSEUM) {
             prt(_("d) アイテムを置く", "d) Drop an item."), 21 + xtra_stock, 27);
             prt(_("r) アイテムの展示をやめる", "r) order to Remove an item."), 22 + xtra_stock, 27);
             prt(_("x) 博物館のアイテムを調べる", "x) eXamine an item in the museum."), 23 + xtra_stock, 27);
@@ -154,8 +154,8 @@ void do_cmd_store(player_type *player_ptr)
         if (player_ptr->inventory_list[INVEN_PACK].k_idx) {
             INVENTORY_IDX item = INVEN_PACK;
             object_type *o_ptr = &player_ptr->inventory_list[item];
-            if (cur_store_num != STORE_HOME) {
-                if (cur_store_num == STORE_MUSEUM)
+            if (cur_store_num != StoreSaleType::HOME) {
+                if (cur_store_num == StoreSaleType::MUSEUM)
                     msg_print(_("ザックからアイテムがあふれそうなので、あわてて博物館から出た...", "Your pack is so full that you flee the Museum..."));
                 else
                     msg_print(_("ザックからアイテムがあふれそうなので、あわてて店から出た...", "Your pack is so full that you flee the store..."));
index e36f492..be6fb10 100644 (file)
@@ -27,7 +27,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
 {
     bool old_stack_force_notes = stack_force_notes;
     bool old_stack_force_costs = stack_force_costs;
-    if (cur_store_num != STORE_HOME) {
+    if (cur_store_num != StoreSaleType::HOME) {
         stack_force_notes = false;
         stack_force_costs = false;
     }
@@ -37,7 +37,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
         j_ptr = &st_ptr->stock[slot];
         if (object_similar(j_ptr, o_ptr)) {
             object_absorb(j_ptr, o_ptr);
-            if (cur_store_num != STORE_HOME) {
+            if (cur_store_num != StoreSaleType::HOME) {
                 stack_force_notes = old_stack_force_notes;
                 stack_force_costs = old_stack_force_costs;
             }
@@ -46,7 +46,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
         }
     }
 
-    if (cur_store_num != STORE_HOME) {
+    if (cur_store_num != StoreSaleType::HOME) {
         stack_force_notes = old_stack_force_notes;
         stack_force_costs = old_stack_force_costs;
     }
@@ -56,7 +56,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
      * 隠し機能: オプション powerup_home が設定されていると
      *           我が家が 20 ページまで使える
      */
-    if ((cur_store_num != STORE_HOME) || powerup_home) {
+    if ((cur_store_num != StoreSaleType::HOME) || powerup_home) {
         if (st_ptr->stock_num >= st_ptr->stock_size) {
             return -1;
         }
@@ -164,14 +164,14 @@ static void exe_reorder_store_item(player_type *player_ptr, bool *flag)
  * @param store_num 店舗ID
  * @return 実際に整理が行われたならばTRUEを返す。
  */
-bool combine_and_reorder_home(player_type *player_ptr, const int store_num)
+bool combine_and_reorder_home(player_type *player_ptr, const StoreSaleType store_num)
 {
     bool old_stack_force_notes = stack_force_notes;
     bool old_stack_force_costs = stack_force_costs;
     store_type *old_st_ptr = st_ptr;
-    st_ptr = &town_info[1].store[store_num];
+    st_ptr = &town_info[1].store[enum2i(store_num)];
     bool flag = false;
-    if (store_num != STORE_HOME) {
+    if (store_num != StoreSaleType::HOME) {
         stack_force_notes = false;
         stack_force_costs = false;
     }
@@ -193,7 +193,7 @@ bool combine_and_reorder_home(player_type *player_ptr, const int store_num)
 
     exe_reorder_store_item(player_ptr, &flag);
     st_ptr = old_st_ptr;
-    if (store_num != STORE_HOME) {
+    if (store_num != StoreSaleType::HOME) {
         stack_force_notes = old_stack_force_notes;
         stack_force_costs = old_stack_force_costs;
     }
index 6332499..90ab1d7 100644 (file)
@@ -1,6 +1,7 @@
 #pragma once
 
-struct object_type;;
+struct object_type;
 struct player_type;
+enum class StoreSaleType;
 int home_carry(player_type *player_ptr, object_type *o_ptr);
-bool combine_and_reorder_home(player_type *player_ptr, const int store_num);
+bool combine_and_reorder_home(player_type *player_ptr, const StoreSaleType store_num);
index 01cb7d3..3608dbd 100644 (file)
@@ -44,7 +44,7 @@ void museum_remove_object(player_type *player_ptr)
     msg_format(_("%sの展示をやめさせた。", "You ordered to remove %s."), o_name);
     store_item_increase(item, -o_ptr->number);
     store_item_optimize(item);
-    (void)combine_and_reorder_home(player_ptr, STORE_MUSEUM);
+    (void)combine_and_reorder_home(player_ptr, StoreSaleType::MUSEUM);
     if (st_ptr->stock_num == 0)
         store_top = 0;
     else if (store_top >= st_ptr->stock_num)
index 8d15b9f..8908ae6 100644 (file)
@@ -45,7 +45,7 @@ PRICE price_item(player_type *player_ptr, object_type *o_ptr, int greed, bool fl
         if (adjust > 100)
             adjust = 100;
 
-        if (cur_store_num == STORE_BLACK)
+        if (cur_store_num == StoreSaleType::BLACK)
             price = price / 2;
 
         price = (price * adjust + 50L) / 100L;
@@ -54,7 +54,7 @@ PRICE price_item(player_type *player_ptr, object_type *o_ptr, int greed, bool fl
         if (adjust < 100)
             adjust = 100;
 
-        if (cur_store_num == STORE_BLACK)
+        if (cur_store_num == StoreSaleType::BLACK)
             price = price * 2;
 
         price = (int32_t)(((uint32_t)price * (uint32_t)adjust + 50UL) / 100UL);
index 15d4e47..42def34 100644 (file)
@@ -73,10 +73,10 @@ static bool show_store_select_item(COMMAND_CODE *item, const int i)
     char out_val[160];
 
     switch (cur_store_num) {
-    case STORE_HOME:
+    case StoreSaleType::HOME:
         sprintf(out_val, _("どのアイテムを取りますか? ", "Which item do you want to take? "));
         break;
-    case STORE_BLACK:
+    case StoreSaleType::BLACK:
         sprintf(out_val, _("どれ? ", "Which item, huh? "));
         break;
     default:
@@ -112,7 +112,7 @@ static void take_item_from_home(player_type *player_ptr, object_type *o_ptr, obj
     store_item_increase(item, -amt);
     store_item_optimize(item);
 
-    auto combined_or_reordered = combine_and_reorder_home(player_ptr, STORE_HOME);
+    auto combined_or_reordered = combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
 
     if (i == st_ptr->stock_num) {
         if (combined_or_reordered)
@@ -177,13 +177,13 @@ static void switch_store_stock(player_type *player_ptr, const int i, const COMMA
  */
 void store_purchase(player_type *player_ptr)
 {
-    if (cur_store_num == STORE_MUSEUM) {
+    if (cur_store_num == StoreSaleType::MUSEUM) {
         msg_print(_("博物館から取り出すことはできません。", "Items cannot be taken out of the Museum."));
         return;
     }
 
     if (st_ptr->stock_num <= 0) {
-        if (cur_store_num == STORE_HOME)
+        if (cur_store_num == StoreSaleType::HOME)
             msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
         else
             msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
@@ -220,7 +220,7 @@ void store_purchase(player_type *player_ptr)
 
     PRICE best = price_item(player_ptr, j_ptr, ot_ptr->inflate, false);
     if (o_ptr->number > 1) {
-        if (cur_store_num != STORE_HOME) {
+        if (cur_store_num != StoreSaleType::HOME) {
             msg_format(_("一つにつき $%ldです。", "That costs %ld gold per item."), (long)(best));
         }
 
@@ -243,7 +243,7 @@ void store_purchase(player_type *player_ptr)
         return;
     }
 
-    if (cur_store_num == STORE_HOME) {
+    if (cur_store_num == StoreSaleType::HOME) {
         take_item_from_home(player_ptr, o_ptr, j_ptr, item);
         return;
     }
@@ -269,9 +269,9 @@ void store_purchase(player_type *player_ptr)
     }
 
     store_owner_says_comment(player_ptr);
-    if (cur_store_num == STORE_BLACK)
+    if (cur_store_num == StoreSaleType::BLACK)
         chg_virtue(player_ptr, V_JUSTICE, -1);
-    if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
+    if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != StoreSaleType::HOME))
         chg_virtue(player_ptr, V_NATURE, -1);
 
     sound(SOUND_BUY);
index 01e6d09..80d6c5d 100644 (file)
@@ -17,7 +17,7 @@
  */
 void store_owner_says_comment(player_type *player_ptr)
 {
-    if (cur_store_num == STORE_BLACK)
+    if (cur_store_num == StoreSaleType::BLACK)
         msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
     else
         msg_print(comment_1[randint0(MAX_COMMENT_1)]);
index d927557..53a4938 100644 (file)
@@ -73,12 +73,12 @@ void store_sell(player_type *player_ptr)
     concptr s_none; //!< @note 売る/置くものがない場合のメッセージ
     concptr s_full; //!< @note もう置けない場合のメッセージ
     switch (cur_store_num) {
-    case STORE_HOME:
+    case StoreSaleType::HOME:
         q = _("どのアイテムを置きますか? ", "Drop which item? ");
         s_none = _("置けるアイテムを持っていません。", "You don't have any items to drop.");
         s_full = _("我が家にはもう置く場所がない。", "Your home is full.");
         break;
-    case STORE_MUSEUM:
+    case StoreSaleType::MUSEUM:
         q = _("どのアイテムを寄贈しますか? ", "Give which item? ");
         s_none = _("寄贈できるアイテムを持っていません。", "You don't have any items to give.");
         s_full = _("博物館はもう満杯だ。", "The Museum is full.");
@@ -118,7 +118,7 @@ void store_sell(player_type *player_ptr)
 
     GAME_TEXT o_name[MAX_NLEN];
     describe_flavor(player_ptr, o_name, q_ptr, 0);
-    if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM)) {
+    if ((cur_store_num != StoreSaleType::HOME) && (cur_store_num != StoreSaleType::MUSEUM)) {
         q_ptr->inscription = 0;
         q_ptr->feeling = FEEL_NONE;
     }
@@ -129,7 +129,7 @@ void store_sell(player_type *player_ptr)
     }
 
     bool placed = false;
-    if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM)) {
+    if ((cur_store_num != StoreSaleType::HOME) && (cur_store_num != StoreSaleType::MUSEUM)) {
         msg_format(_("%s(%c)を売却する。", "Selling %s (%c)."), o_name, index_to_label(item));
         msg_print(nullptr);
 
@@ -140,10 +140,10 @@ void store_sell(player_type *player_ptr)
             store_owner_says_comment(player_ptr);
 
             sound(SOUND_SELL);
-            if (cur_store_num == STORE_BLACK)
+            if (cur_store_num == StoreSaleType::BLACK)
                 chg_virtue(player_ptr, V_JUSTICE, -1);
 
-            if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
+            if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != StoreSaleType::HOME))
                 chg_virtue(player_ptr, V_NATURE, 1);
 
             player_ptr->au += price;
@@ -183,7 +183,7 @@ void store_sell(player_type *player_ptr)
                 display_store_inventory(player_ptr);
             }
         }
-    } else if (cur_store_num == STORE_MUSEUM) {
+    } else if (cur_store_num == StoreSaleType::MUSEUM) {
         char o2_name[MAX_NLEN];
         describe_flavor(player_ptr, o2_name, q_ptr, OD_NAME_ONLY);
 
index 11eee8b..2892436 100644 (file)
@@ -183,19 +183,19 @@ static bool check_store_book(const object_type *o_ptr)
 static bool switch_store_check(const object_type *o_ptr)
 {
     switch (cur_store_num) {
-    case STORE_GENERAL:
+    case StoreSaleType::GENERAL:
         return check_store_general(o_ptr);
-    case STORE_ARMOURY:
+    case StoreSaleType::ARMOURY:
         return check_store_armoury(o_ptr);
-    case STORE_WEAPON:
+    case StoreSaleType::WEAPON:
         return check_store_weapon(o_ptr);
-    case STORE_TEMPLE:
+    case StoreSaleType::TEMPLE:
         return check_store_temple(o_ptr);
-    case STORE_ALCHEMIST:
+    case StoreSaleType::ALCHEMIST:
         return check_store_alchemist(o_ptr);
-    case STORE_MAGIC:
+    case StoreSaleType::MAGIC:
         return check_store_magic(o_ptr);
-    case STORE_BOOK:
+    case StoreSaleType::BOOK:
         return check_store_book(o_ptr);
     default:
         return true;
@@ -212,7 +212,7 @@ static bool switch_store_check(const object_type *o_ptr)
  */
 bool store_will_buy(player_type *, const object_type *o_ptr)
 {
-    if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
+    if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM))
         return true;
 
     if (!switch_store_check(o_ptr))
@@ -311,7 +311,7 @@ static int mass_figurine_produce(const PRICE cost)
 static int mass_magic_produce(const PRICE cost)
 {
     int size = 1;
-    if ((cur_store_num != STORE_BLACK) || !one_in_(3))
+    if ((cur_store_num != StoreSaleType::BLACK) || !one_in_(3))
         return size;
 
     if (cost < 1601L)
index 9c0b5ef..fd08a16 100644 (file)
@@ -71,7 +71,7 @@ void store_process_command(player_type *player_ptr)
             if (store_top < 0)
                 store_top = ((st_ptr->stock_num - 1) / store_bottom) * store_bottom;
 
-            if ((cur_store_num == STORE_HOME) && !powerup_home)
+            if ((cur_store_num == StoreSaleType::HOME) && !powerup_home)
                 if (store_top >= store_bottom)
                     store_top = store_bottom;
 
@@ -90,7 +90,7 @@ void store_process_command(player_type *player_ptr)
              * 隠しオプション(powerup_home)がセットされていないときは
              * 我が家では 2 ページまでしか表示しない
              */
-            auto inven_max = store_get_stock_max(STORE_HOME, powerup_home);
+            auto inven_max = store_get_stock_max(StoreSaleType::HOME, powerup_home);
             if (store_top >= st_ptr->stock_num || store_top >= inven_max)
                 store_top = 0;
 
@@ -217,7 +217,7 @@ void store_process_command(player_type *player_ptr)
     }
     case '=': {
         do_cmd_options(player_ptr);
-        (void)combine_and_reorder_home(player_ptr, STORE_HOME);
+        (void)combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
         do_cmd_redraw(player_ptr);
         display_store(player_ptr);
         break;
@@ -259,7 +259,7 @@ void store_process_command(player_type *player_ptr)
         break;
     }
     default: {
-        if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r')) {
+        if ((cur_store_num == StoreSaleType::MUSEUM) && (command_cmd == 'r')) {
             museum_remove_object(player_ptr);
         } else {
             msg_print(_("そのコマンドは店の中では使えません。", "That command does not work in stores."));
index 9af8d6d..248c0b7 100644 (file)
 #include "system/object-type-definition.h"
 #include "world/world-object.h"
 
-int cur_store_num = 0;
+StoreSaleType cur_store_num = StoreSaleType::GENERAL;
 store_type *st_ptr = nullptr;
 
+StoreSaleType begin(StoreSaleType)
+{
+    return StoreSaleType::GENERAL;
+}
+
+StoreSaleType end(StoreSaleType)
+{
+    return StoreSaleType::MAX;
+}
+
+StoreSaleType operator*(StoreSaleType s)
+{
+    return s;
+}
+
+StoreSaleType operator++(StoreSaleType &s)
+{
+    return s = StoreSaleType(std::underlying_type<StoreSaleType>::type(s) + 1);
+}
+
 /*!
  * @brief 店舗のオブジェクト数を増やす /
  * Add the item "o_ptr" to a real stores inventory.
@@ -135,7 +155,7 @@ void store_create(
     for (int tries = 0; tries < 4; tries++) {
         KIND_OBJECT_IDX k_idx;
         DEPTH level;
-        if (cur_store_num == STORE_BLACK) {
+        if (cur_store_num == StoreSaleType::BLACK) {
             level = 25 + randint0(25);
             k_idx = get_obj_num(player_ptr, level, 0x00000000);
             if (k_idx == 0)
@@ -175,7 +195,7 @@ void store_create(
         if (q_ptr->tval == TV_CHEST)
             continue;
 
-        if (cur_store_num == STORE_BLACK) {
+        if (cur_store_num == StoreSaleType::BLACK) {
             if (black_market_crap(player_ptr, q_ptr) || (object_value(q_ptr) < 10))
                 continue;
         } else {
index aef916a..7dd1e81 100644 (file)
@@ -7,20 +7,25 @@
 
 #define STORE_OBJ_LEVEL 5 //!< 通常店舗の階層レベル / Magic Level for normal stores
 
-enum STORE_TYPE_IDX {
-    STORE_GENERAL   = 0, //!< 店舗の種類: 雑貨屋
-    STORE_ARMOURY   = 1, //!< 店舗の種類: 防具屋
-    STORE_WEAPON    = 2, //!< 店舗の種類: 武器屋
-    STORE_TEMPLE    = 3, //!< 店舗の種類: 寺院
-    STORE_ALCHEMIST = 4, //!< 店舗の種類: 錬金術の店
-    STORE_MAGIC     = 5, //!< 店舗の種類: 魔道具屋
-    STORE_BLACK     = 6, //!< 店舗の種類: ブラック・マーケット
-    STORE_HOME      = 7, //!< 店舗の種類: 我が家
-    STORE_BOOK      = 8, //!< 店舗の種類: 書店
-    STORE_MUSEUM    = 9, //!< 店舗の種類: 博物館
-    STORE_MAX       = 10
+enum class StoreSaleType {
+    GENERAL   = 0, //!< 店舗の種類: 雑貨屋
+    ARMOURY   = 1, //!< 店舗の種類: 防具屋
+    WEAPON    = 2, //!< 店舗の種類: 武器屋
+    TEMPLE    = 3, //!< 店舗の種類: 寺院
+    ALCHEMIST = 4, //!< 店舗の種類: 錬金術の店
+    MAGIC     = 5, //!< 店舗の種類: 魔道具屋
+    BLACK     = 6, //!< 店舗の種類: ブラック・マーケット
+    HOME      = 7, //!< 店舗の種類: 我が家
+    BOOK      = 8, //!< 店舗の種類: 書店
+    MUSEUM    = 9, //!< 店舗の種類: 博物館
+    MAX       = 10
 };
 
+StoreSaleType begin(StoreSaleType);
+StoreSaleType end(StoreSaleType);
+StoreSaleType operator*(StoreSaleType s);
+StoreSaleType operator++(StoreSaleType &s);
+
 using store_k_idx = std::vector<KIND_OBJECT_IDX>;
 
 /*!
@@ -47,7 +52,7 @@ struct store_type {
     store_type &operator=(const store_type &) = delete;
 };
 
-extern int cur_store_num;
+extern StoreSaleType cur_store_num;
 extern store_type *st_ptr;
 
 struct player_type;
index 1fe2249..90663f3 100644 (file)
@@ -53,12 +53,12 @@ bool allow_inc = false;
  * @param store_idx 店舗ID
  * @return 店舗の最大スロット数
  */
-int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup)
+int16_t store_get_stock_max(StoreSaleType sst, bool powerup)
 {
-    switch (store_idx) {
-    case STORE_HOME:
+    switch (sst) {
+    case StoreSaleType::HOME:
         return powerup ? STORE_INVEN_MAX * 10 : STORE_INVEN_MAX;
-    case STORE_MUSEUM:
+    case StoreSaleType::MUSEUM:
         return STORE_INVEN_MAX * 50;
     default:
         return STORE_INVEN_MAX * 3 / 2;
@@ -76,7 +76,7 @@ int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup)
  */
 static int check_free_space(void)
 {
-    if ((cur_store_num == STORE_HOME) && !powerup_home) {
+    if ((cur_store_num == StoreSaleType::HOME) && !powerup_home) {
         if (st_ptr->stock_num < ((st_ptr->stock_size) / 10))
             return 1;
     } else if (st_ptr->stock_num < st_ptr->stock_size)
@@ -103,10 +103,10 @@ static int check_free_space(void)
 int store_check_num(object_type *o_ptr)
 {
     object_type *j_ptr;
-    if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) {
+    if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) {
         bool old_stack_force_notes = stack_force_notes;
         bool old_stack_force_costs = stack_force_costs;
-        if (cur_store_num != STORE_HOME) {
+        if (cur_store_num != StoreSaleType::HOME) {
             stack_force_notes = false;
             stack_force_costs = false;
         }
@@ -116,7 +116,7 @@ int store_check_num(object_type *o_ptr)
             if (!object_similar(j_ptr, o_ptr))
                 continue;
 
-            if (cur_store_num != STORE_HOME) {
+            if (cur_store_num != StoreSaleType::HOME) {
                 stack_force_notes = old_stack_force_notes;
                 stack_force_costs = old_stack_force_costs;
             }
@@ -124,7 +124,7 @@ int store_check_num(object_type *o_ptr)
             return -1;
         }
 
-        if (cur_store_num != STORE_HOME) {
+        if (cur_store_num != StoreSaleType::HOME) {
             stack_force_notes = old_stack_force_notes;
             stack_force_costs = old_stack_force_costs;
         }
@@ -159,7 +159,7 @@ int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
     char hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
     char out_val[160];
 #ifdef JP
-    (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s", (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"), lo, hi, pmt);
+    (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s", (((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) ? "アイテム" : "商品"), lo, hi, pmt);
 #else
     (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s", lo, hi, pmt);
 #endif
@@ -200,9 +200,9 @@ int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
 void store_examine(player_type *player_ptr)
 {
     if (st_ptr->stock_num <= 0) {
-        if (cur_store_num == STORE_HOME)
+        if (cur_store_num == StoreSaleType::HOME)
             msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
-        else if (cur_store_num == STORE_MUSEUM)
+        else if (cur_store_num == StoreSaleType::MUSEUM)
             msg_print(_("博物館には何も置いてありません。", "The Museum is empty."));
         else
             msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
@@ -239,13 +239,13 @@ void store_examine(player_type *player_ptr)
  * Shuffle one of the stores.
  * @param which 店舗種類のID
  */
-void store_shuffle(player_type *player_ptr, int which)
+void store_shuffle(player_type *player_ptr, StoreSaleType which)
 {
-    if ((which == STORE_HOME) || (which == STORE_MUSEUM))
+    if ((which == StoreSaleType::HOME) || (which == StoreSaleType::MUSEUM))
         return;
 
     cur_store_num = which;
-    st_ptr = &town_info[player_ptr->town_num].store[cur_store_num];
+    st_ptr = &town_info[player_ptr->town_num].store[enum2i(cur_store_num)];
     int j = st_ptr->owner;
     while (true) {
         st_ptr->owner = (byte)randint0(MAX_OWNERS);
@@ -257,7 +257,7 @@ void store_shuffle(player_type *player_ptr, int which)
             if (i == player_ptr->town_num)
                 continue;
 
-            if (st_ptr->owner == town_info[i].store[cur_store_num].owner)
+            if (st_ptr->owner == town_info[i].store[enum2i(cur_store_num)].owner)
                 break;
         }
 
@@ -265,7 +265,7 @@ void store_shuffle(player_type *player_ptr, int which)
             break;
     }
 
-    ot_ptr = &owners[cur_store_num][st_ptr->owner];
+    ot_ptr = &owners[enum2i(cur_store_num)][st_ptr->owner];
     st_ptr->insult_cur = 0;
     st_ptr->store_open = 0;
     st_ptr->good_buy = 0;
@@ -289,16 +289,16 @@ void store_shuffle(player_type *player_ptr, int which)
  * @param store_num 店舗種類のID
  * @param chance 更新商品数
  */
-void store_maintenance(player_type *player_ptr, int town_num, int store_num, int chance)
+void store_maintenance(player_type *player_ptr, int town_num, StoreSaleType store_num, int chance)
 {
     cur_store_num = store_num;
-    if ((store_num == STORE_HOME) || (store_num == STORE_MUSEUM))
+    if ((store_num == StoreSaleType::HOME) || (store_num == StoreSaleType::MUSEUM))
         return;
 
-    st_ptr = &town_info[town_num].store[store_num];
-    ot_ptr = &owners[store_num][st_ptr->owner];
+    st_ptr = &town_info[town_num].store[enum2i(store_num)];
+    ot_ptr = &owners[enum2i(store_num)][st_ptr->owner];
     st_ptr->insult_cur = 0;
-    if (store_num == STORE_BLACK) {
+    if (store_num == StoreSaleType::BLACK) {
         for (INVENTORY_IDX j = st_ptr->stock_num - 1; j >= 0; j--) {
             object_type *o_ptr = &st_ptr->stock[j];
             if (black_market_crap(player_ptr, o_ptr)) {
@@ -358,17 +358,17 @@ void store_maintenance(player_type *player_ptr, int town_num, int store_num, int
  * @param town_num 町のID
  * @param store_num 店舗種類のID
  */
-void store_init(int town_num, int store_num)
+void store_init(int town_num, StoreSaleType store_num)
 {
     cur_store_num = store_num;
-    st_ptr = &town_info[town_num].store[store_num];
+    st_ptr = &town_info[town_num].store[enum2i(store_num)];
     while (true) {
         st_ptr->owner = (byte)randint0(MAX_OWNERS);
         int i;
         for (i = 1; i < max_towns; i++) {
             if (i == town_num)
                 continue;
-            if (st_ptr->owner == town_info[i].store[store_num].owner)
+            if (st_ptr->owner == town_info[i].store[enum2i(store_num)].owner)
                 break;
         }
 
@@ -376,7 +376,7 @@ void store_init(int town_num, int store_num)
             break;
     }
 
-    ot_ptr = &owners[store_num][st_ptr->owner];
+    ot_ptr = &owners[enum2i(store_num)][st_ptr->owner];
     st_ptr->store_open = 0;
     st_ptr->insult_cur = 0;
     st_ptr->good_buy = 0;
@@ -386,3 +386,4 @@ void store_init(int town_num, int store_num)
     for (int k = 0; k < st_ptr->stock_size; k++)
         (&st_ptr->stock[k])->wipe();
 }
+
index 4485c93..fcaf50b 100644 (file)
@@ -23,10 +23,10 @@ extern int cur_store_feat;
 extern bool allow_inc;
 
 struct player_type;
-int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup = true);
-void store_shuffle(player_type *player_ptr, int which);
-void store_maintenance(player_type *player_ptr, int town_num, int store_num, int chance);
-void store_init(int town_num, int store_num);
+int16_t store_get_stock_max(StoreSaleType sst, bool powerup = true);
+void store_shuffle(player_type *player_ptr, StoreSaleType which);
+void store_maintenance(player_type *player_ptr, int town_num, StoreSaleType store_num, int chance);
+void store_init(int town_num, StoreSaleType store_num);
 void store_examine(player_type *player_ptr);
 int store_check_num(object_type *o_ptr);
 int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j);
index eff6f63..abf4d03 100644 (file)
@@ -64,7 +64,7 @@ void display_entry(player_type *player_ptr, int pos)
 
     /* Describe an item in the home */
     int maxwid = 75;
-    if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) {
+    if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) {
         maxwid = 75;
         if (show_weights)
             maxwid -= 10;
@@ -129,9 +129,9 @@ void display_store_inventory(player_type *player_ptr)
         put_str(format(_("(%dページ)  ", "(Page %d)  "), store_top / store_bottom + 1), 5, _(20, 22));
     }
 
-    if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM) {
+    if (cur_store_num == StoreSaleType::HOME || cur_store_num == StoreSaleType::MUSEUM) {
         k = st_ptr->stock_size;
-        if (cur_store_num == STORE_HOME && !powerup_home)
+        if (cur_store_num == StoreSaleType::HOME && !powerup_home)
             k /= 10;
 
         put_str(format(_("アイテム数:  %4d/%4d", "Objects:  %4d/%4d"), st_ptr->stock_num, k), 19 + xtra_stock, _(27, 30));
@@ -147,7 +147,7 @@ void display_store_inventory(player_type *player_ptr)
 void display_store(player_type *player_ptr)
 {
     term_clear();
-    if (cur_store_num == STORE_HOME) {
+    if (cur_store_num == StoreSaleType::HOME) {
         put_str(_("我が家", "Your Home"), 3, 31);
         put_str(_("アイテムの一覧", "Item Description"), 5, 4);
         if (show_weights) {
@@ -159,7 +159,7 @@ void display_store(player_type *player_ptr)
         return;
     }
 
-    if (cur_store_num == STORE_MUSEUM) {
+    if (cur_store_num == StoreSaleType::MUSEUM) {
         put_str(_("博物館", "Museum"), 3, 31);
         put_str(_("アイテムの一覧", "Item Description"), 5, 4);
         if (show_weights) {
index 09821f9..6952c0b 100644 (file)
@@ -275,7 +275,7 @@ void WorldTurnProcessor::shuffle_shopkeeper()
     int n;
     do {
         n = randint0(MAX_STORES);
-        if ((n == STORE_HOME) || (n == STORE_MUSEUM)) {
+        if ((n == enum2i(StoreSaleType::HOME)) || (n == enum2i(StoreSaleType::MUSEUM))) {
             break;
         }
     } while (true);
@@ -292,7 +292,7 @@ void WorldTurnProcessor::shuffle_shopkeeper()
             msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_ref.name.c_str());
         }
 
-        store_shuffle(this->player_ptr, n);
+        store_shuffle(this->player_ptr, i2enum<StoreSaleType>(n));
         break;
     }
 }