• R/O
  • HTTP
  • SSH
  • HTTPS

hengbandosx: Commit

The master and develop branches track hengband.

OS X development happens on the macos-1-6-2, macos-2-2-1, and macos-develop branches.


Commit MetaInfo

Revision62cb75f018e6c6dfe8120056445712b10ee8565b (tree)
Time2021-10-11 20:38:50
AuthorDeskull <61610939+sikabane-works@user...>
CommiterGitHub

Log Message

Merge pull request #1760 from sikabane-works/feature/refactor-StoreSaleType

[Refactor] 店舗の種類を enum class StoreSaleType 型に変更しリファクタリング。

Change Summary

Incremental Difference

--- a/src/birth/character-builder.cpp
+++ b/src/birth/character-builder.cpp
@@ -100,8 +100,8 @@ void player_birth(player_type *player_ptr)
100100
101101 write_birth_diary(player_ptr);
102102 for (int i = 1; i < max_towns; i++) {
103- for (int j = 0; j < MAX_STORES; j++) {
104- store_init(i, j);
103+ for (auto sst : StoreSaleType()) {
104+ store_init(i, sst);
105105 }
106106 }
107107
--- a/src/core/game-play.cpp
+++ b/src/core/game-play.cpp
@@ -417,8 +417,8 @@ void play_game(player_type *player_ptr, bool new_game, bool browsing_movie)
417417 calc_android_exp(player_ptr);
418418
419419 init_riding_pet(player_ptr, new_game);
420- (void)combine_and_reorder_home(player_ptr, STORE_HOME);
421- (void)combine_and_reorder_home(player_ptr, STORE_MUSEUM);
420+ (void)combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
421+ (void)combine_and_reorder_home(player_ptr, StoreSaleType::MUSEUM);
422422 select_floor_music(player_ptr);
423423 process_game_turn(player_ptr);
424424 close_game(player_ptr);
--- a/src/io-dump/character-dump.cpp
+++ b/src/io-dump/character-dump.cpp
@@ -495,7 +495,7 @@ static void dump_aux_equipment_inventory(player_type *player_ptr, FILE *fff)
495495 static void dump_aux_home_museum(player_type *player_ptr, FILE *fff)
496496 {
497497 store_type *store_ptr;
498- store_ptr = &town_info[1].store[STORE_HOME];
498+ store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
499499
500500 GAME_TEXT o_name[MAX_NLEN];
501501 if (store_ptr->stock_num) {
@@ -512,7 +512,7 @@ static void dump_aux_home_museum(player_type *player_ptr, FILE *fff)
512512 fprintf(fff, "\n\n");
513513 }
514514
515- store_ptr = &town_info[1].store[STORE_MUSEUM];
515+ store_ptr = &town_info[1].store[enum2i(StoreSaleType::MUSEUM)];
516516
517517 if (store_ptr->stock_num == 0)
518518 return;
--- a/src/io-dump/random-art-info-dumper.cpp
+++ b/src/io-dump/random-art-info-dumper.cpp
@@ -93,13 +93,13 @@ void spoil_random_artifact(player_type *player_ptr, concptr fname)
9393 spoil_random_artifact_aux(player_ptr, q_ptr, tval);
9494 }
9595
96- store_ptr = &town_info[1].store[STORE_HOME];
96+ store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
9797 for (int i = 0; i < store_ptr->stock_num; i++) {
9898 q_ptr = &store_ptr->stock[i];
9999 spoil_random_artifact_aux(player_ptr, q_ptr, tval);
100100 }
101101
102- store_ptr = &town_info[1].store[STORE_MUSEUM];
102+ store_ptr = &town_info[1].store[enum2i(StoreSaleType::MUSEUM)];
103103 for (int i = 0; i < store_ptr->stock_num; i++) {
104104 q_ptr = &store_ptr->stock[i];
105105 spoil_random_artifact_aux(player_ptr, q_ptr, tval);
--- a/src/io/input-key-processor.cpp
+++ b/src/io/input-key-processor.cpp
@@ -537,7 +537,7 @@ void process_command(player_type *player_ptr)
537537 }
538538 case '=': {
539539 do_cmd_options(player_ptr);
540- (void)combine_and_reorder_home(player_ptr, STORE_HOME);
540+ (void)combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
541541 do_cmd_redraw(player_ptr);
542542 break;
543543 }
--- a/src/knowledge/knowledge-inventory.cpp
+++ b/src/knowledge/knowledge-inventory.cpp
@@ -256,7 +256,7 @@ static void show_holding_equipment_resistances(player_type *player_ptr, tval_typ
256256 static void show_home_equipment_resistances(player_type *player_ptr, tval_type tval, int *label_number, FILE *fff)
257257 {
258258 store_type *store_ptr;
259- store_ptr = &town_info[1].store[STORE_HOME];
259+ store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
260260 char where[32];
261261 strcpy(where, _("家", "H "));
262262 for (int i = 0; i < store_ptr->stock_num; i++) {
--- a/src/knowledge/knowledge-self.cpp
+++ b/src/knowledge/knowledge-self.cpp
@@ -217,7 +217,7 @@ void do_cmd_knowledge_home(player_type *player_ptr)
217217 return;
218218
219219 store_type *store_ptr;
220- store_ptr = &town_info[1].store[STORE_HOME];
220+ store_ptr = &town_info[1].store[enum2i(StoreSaleType::HOME)];
221221
222222 if (store_ptr->stock_num) {
223223 #ifdef JP
--- a/src/load/store-loader.cpp
+++ b/src/load/store-loader.cpp
@@ -36,7 +36,7 @@ static void home_carry_load(player_type *player_ptr, store_type *store_ptr, obje
3636 return;
3737 }
3838
39- if (store_ptr->stock_num >= store_get_stock_max(STORE_HOME))
39+ if (store_ptr->stock_num >= store_get_stock_max(StoreSaleType::HOME))
4040 return;
4141
4242 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)
6666 {
6767 store_type *store_ptr;
6868 bool sort = false;
69- if (h_older_than(0, 3, 3) && (store_number == STORE_HOME)) {
69+ if (h_older_than(0, 3, 3) && (i2enum<StoreSaleType>(store_number) == StoreSaleType::HOME)) {
7070 store_ptr = &town_info[1].store[store_number];
7171 if (store_ptr->stock_num)
7272 sort = true;
@@ -101,7 +101,7 @@ static errr rd_store(player_type *player_ptr, int town_number, int store_number)
101101
102102 rd_item(q_ptr);
103103
104- auto stock_max = store_get_stock_max(i2enum<STORE_TYPE_IDX>(store_number));
104+ auto stock_max = store_get_stock_max(i2enum<StoreSaleType>(store_number));
105105 if (store_ptr->stock_num >= stock_max)
106106 continue;
107107
--- a/src/market/building-initializer.cpp
+++ b/src/market/building-initializer.cpp
@@ -19,24 +19,24 @@ errr init_towns(void)
1919 town_info = std::vector<town_type>(max_towns);
2020 for (int i = 1; i < max_towns; i++) {
2121 town_info[i].store = std::vector<store_type>(MAX_STORES);
22- for (int j = 0; j < MAX_STORES; j++) {
23- store_type *store_ptr = &town_info[i].store[j];
24- if ((i > 1) && (j == STORE_MUSEUM || j == STORE_HOME))
22+ for (auto sst : StoreSaleType()) {
23+ store_type *store_ptr = &town_info[i].store[enum2i(sst)];
24+ if ((i > 1) && (sst == StoreSaleType::MUSEUM || sst == StoreSaleType::HOME))
2525 continue;
2626
2727 /*
2828 * 我が家が 20 ページまで使える隠し機能のための準備。
2929 * オプションが有効でもそうでなくても一応スペースを作っておく。
3030 */
31- store_ptr->stock_size = store_get_stock_max(i2enum<STORE_TYPE_IDX>(j));
31+ store_ptr->stock_size = store_get_stock_max(sst);
3232
3333 store_ptr->stock = std::make_unique<object_type[]>(store_ptr->stock_size);
34- if ((j == STORE_BLACK) || (j == STORE_HOME) || (j == STORE_MUSEUM))
34+ if ((sst == StoreSaleType::BLACK) || (sst == StoreSaleType::HOME) || (sst == StoreSaleType::MUSEUM))
3535 continue;
3636
3737 for (int k = 0; k < STORE_INVEN_MAX; k++) {
38- int tv = store_regular_table[j][k].tval;
39- int sv = store_regular_table[j][k].sval;
38+ int tv = store_regular_table[enum2i(sst)][k].tval;
39+ int sv = store_regular_table[enum2i(sst)][k].sval;
4040 if (tv == 0)
4141 break;
4242
@@ -49,8 +49,8 @@ errr init_towns(void)
4949 }
5050
5151 for (int k = 0; k < STORE_CHOICES; k++) {
52- int tv = store_table[j][k].tval;
53- int sv = store_table[j][k].sval;
52+ int tv = store_table[enum2i(sst)][k].tval;
53+ int sv = store_table[enum2i(sst)][k].sval;
5454 if (tv == 0)
5555 break;
5656
--- a/src/mutation/mutation-processor.cpp
+++ b/src/mutation/mutation-processor.cpp
@@ -244,13 +244,13 @@ void process_world_aux_mutation(player_type *player_ptr)
244244
245245 banish_monsters(player_ptr, 100);
246246 if (!is_in_dungeon(player_ptr) && player_ptr->town_num) {
247- int n;
247+ StoreSaleType sst;
248248 do {
249- n = randint0(MAX_STORES);
250- } while ((n == STORE_HOME) || (n == STORE_MUSEUM));
249+ sst = i2enum<StoreSaleType>(randint0(MAX_STORES));
250+ } while ((sst == StoreSaleType::HOME) || (sst == StoreSaleType::MUSEUM));
251251
252252 msg_print(_("店の主人が丘に向かって走っている!", "You see one of the shopkeepers running for the hills!"));
253- store_shuffle(player_ptr, n);
253+ store_shuffle(player_ptr, sst);
254254 }
255255 msg_print(nullptr);
256256 }
--- a/src/player/process-death.cpp
+++ b/src/player/process-death.cpp
@@ -270,7 +270,7 @@ static void home_aware(player_type *player_ptr)
270270 object_type *o_ptr;
271271 store_type *store_ptr;
272272 for (int i = 1; i < max_towns; i++) {
273- store_ptr = &town_info[i].store[STORE_HOME];
273+ store_ptr = &town_info[i].store[enum2i(StoreSaleType::HOME)];
274274 for (int j = 0; j < store_ptr->stock_num; j++) {
275275 o_ptr = &store_ptr->stock[j];
276276 if (!o_ptr->k_idx)
@@ -317,7 +317,7 @@ static void show_dead_home_items(player_type *player_ptr)
317317 {
318318 for (int l = 1; l < max_towns; l++) {
319319 store_type *store_ptr;
320- store_ptr = &town_info[l].store[STORE_HOME];
320+ store_ptr = &town_info[l].store[enum2i(StoreSaleType::HOME)];
321321 if (store_ptr->stock_num == 0)
322322 continue;
323323
--- a/src/room/rooms-city.cpp
+++ b/src/room/rooms-city.cpp
@@ -99,7 +99,7 @@ static void generate_fill_perm_bold(player_type *player_ptr, POSITION y1, POSITI
9999 * @note
100100 * Note: ltcy and ltcx indicate "left top corner".
101101 */
102-static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx, int stores[], int n, const std::vector<ugbldg_type>& ugbldg)
102+static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx, StoreSaleType stores[], int n, const std::vector<ugbldg_type>& ugbldg)
103103 {
104104 int i;
105105 POSITION y, x;
@@ -143,7 +143,7 @@ static void build_stores(player_type *player_ptr, POSITION ltcy, POSITION ltcx,
143143
144144 if (auto it = std::find_if(f_info.begin(), f_info.end(),
145145 [subtype = stores[i]](const feature_type &f_ref) {
146- return f_ref.flags.has(FF::STORE) && (f_ref.subtype == subtype);
146+ return f_ref.flags.has(FF::STORE) && (i2enum<StoreSaleType>(static_cast<int>(f_ref.subtype)) == subtype);
147147 });
148148 it != f_info.end()) {
149149 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,
167167 */
168168 bool build_type16(player_type *player_ptr, dun_data_type *dd_ptr)
169169 {
170- int stores[] = {
171- STORE_GENERAL,
172- STORE_ARMOURY,
173- STORE_WEAPON,
174- STORE_TEMPLE,
175- STORE_ALCHEMIST,
176- STORE_MAGIC,
177- STORE_BLACK,
178- STORE_BOOK,
170+ StoreSaleType stores[] = {
171+ StoreSaleType::GENERAL,
172+ StoreSaleType::ARMOURY,
173+ StoreSaleType::WEAPON,
174+ StoreSaleType::TEMPLE,
175+ StoreSaleType::ALCHEMIST,
176+ StoreSaleType::MAGIC,
177+ StoreSaleType::BLACK,
178+ StoreSaleType::BOOK,
179179 };
180180 int n = sizeof stores / sizeof(int);
181181 POSITION y1, x1, yval, xval;
--- a/src/room/rooms-vault.cpp
+++ b/src/room/rooms-vault.cpp
@@ -426,7 +426,7 @@ static void build_vault(
426426 /* Black market in a dungeon */
427427 case 'S':
428428 set_cave_feat(floor_ptr, y, x, feat_black_market);
429- store_init(NO_TOWN, STORE_BLACK);
429+ store_init(NO_TOWN, StoreSaleType::BLACK);
430430 break;
431431
432432 /* The Pattern */
--- a/src/store/black-market.cpp
+++ b/src/store/black-market.cpp
@@ -31,14 +31,13 @@ bool black_market_crap(player_type *player_ptr, object_type *o_ptr)
3131 if (o_ptr->to_d > 0)
3232 return false;
3333
34- for (int i = 0; i < MAX_STORES; i++) {
35- if (i == STORE_HOME)
36- continue;
37- if (i == STORE_MUSEUM)
34+ for (auto sst : StoreSaleType()) {
35+ if (sst == StoreSaleType::HOME || sst == StoreSaleType::MUSEUM) {
3836 continue;
37+ }
3938
40- for (int j = 0; j < town_info[player_ptr->town_num].store[i].stock_num; j++) {
41- object_type *j_ptr = &town_info[player_ptr->town_num].store[i].stock[j];
39+ for (int j = 0; j < town_info[player_ptr->town_num].store[enum2i(sst)].stock_num; j++) {
40+ object_type *j_ptr = &town_info[player_ptr->town_num].store[enum2i(sst)].stock[j];
4241 if (o_ptr->k_idx == j_ptr->k_idx)
4342 return true;
4443 }
--- a/src/store/cmd-store.cpp
+++ b/src/store/cmd-store.cpp
@@ -76,27 +76,27 @@ void do_cmd_store(player_type *player_ptr)
7676 // inner_town_num は、施設内で C コマンドなどを使ったときにそのままでは現在地の偽装がバレる
7777 // ため、それを糊塗するためのグローバル変数。
7878 // この辺はリファクタしたい。
79- int which = f_info[g_ptr->feat].subtype;
79+ StoreSaleType which = i2enum<StoreSaleType>(f_info[g_ptr->feat].subtype);
8080 old_town_num = player_ptr->town_num;
81- if ((which == STORE_HOME) || (which == STORE_MUSEUM))
81+ if ((which == StoreSaleType::HOME) || (which == StoreSaleType::MUSEUM))
8282 player_ptr->town_num = 1;
8383 if (is_in_dungeon(player_ptr))
8484 player_ptr->town_num = NO_TOWN;
8585 inner_town_num = player_ptr->town_num;
8686
87- if ((town_info[player_ptr->town_num].store[which].store_open >= w_ptr->game_turn) || ironman_shops) {
87+ if ((town_info[player_ptr->town_num].store[enum2i(which)].store_open >= w_ptr->game_turn) || ironman_shops) {
8888 msg_print(_("ドアに鍵がかかっている。", "The doors are locked."));
8989 player_ptr->town_num = old_town_num;
9090 return;
9191 }
9292
93- int maintain_num = (w_ptr->game_turn - town_info[player_ptr->town_num].store[which].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
93+ int maintain_num = (w_ptr->game_turn - town_info[player_ptr->town_num].store[enum2i(which)].last_visit) / (TURNS_PER_TICK * STORE_TICKS);
9494 if (maintain_num > 10)
9595 maintain_num = 10;
9696 if (maintain_num) {
9797 store_maintenance(player_ptr, player_ptr->town_num, which, maintain_num);
9898
99- town_info[player_ptr->town_num].store[which].last_visit = w_ptr->game_turn;
99+ town_info[player_ptr->town_num].store[enum2i(which)].last_visit = w_ptr->game_turn;
100100 }
101101
102102 forget_lite(player_ptr->current_floor_ptr);
@@ -108,8 +108,8 @@ void do_cmd_store(player_type *player_ptr)
108108 get_com_no_macros = true;
109109 cur_store_num = which;
110110 cur_store_feat = g_ptr->feat;
111- st_ptr = &town_info[player_ptr->town_num].store[cur_store_num];
112- ot_ptr = &owners[cur_store_num][st_ptr->owner];
111+ st_ptr = &town_info[player_ptr->town_num].store[enum2i(cur_store_num)];
112+ ot_ptr = &owners[enum2i(cur_store_num)][st_ptr->owner];
113113 store_top = 0;
114114 play_music(TERM_XTRA_MUSIC_BASIC, MUSIC_BASIC_BUILD);
115115 display_store(player_ptr);
@@ -124,11 +124,11 @@ void do_cmd_store(player_type *player_ptr)
124124 prt(_(" スペース) 次ページ", " SPACE) Next page"), 23 + xtra_stock, 0);
125125 }
126126
127- if (cur_store_num == STORE_HOME) {
127+ if (cur_store_num == StoreSaleType::HOME) {
128128 prt(_("g) アイテムを取る", "g) Get an item."), 21 + xtra_stock, 27);
129129 prt(_("d) アイテムを置く", "d) Drop an item."), 22 + xtra_stock, 27);
130130 prt(_("x) 家のアイテムを調べる", "x) eXamine an item in the home."), 23 + xtra_stock, 27);
131- } else if (cur_store_num == STORE_MUSEUM) {
131+ } else if (cur_store_num == StoreSaleType::MUSEUM) {
132132 prt(_("d) アイテムを置く", "d) Drop an item."), 21 + xtra_stock, 27);
133133 prt(_("r) アイテムの展示をやめる", "r) order to Remove an item."), 22 + xtra_stock, 27);
134134 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)
154154 if (player_ptr->inventory_list[INVEN_PACK].k_idx) {
155155 INVENTORY_IDX item = INVEN_PACK;
156156 object_type *o_ptr = &player_ptr->inventory_list[item];
157- if (cur_store_num != STORE_HOME) {
158- if (cur_store_num == STORE_MUSEUM)
157+ if (cur_store_num != StoreSaleType::HOME) {
158+ if (cur_store_num == StoreSaleType::MUSEUM)
159159 msg_print(_("ザックからアイテムがあふれそうなので、あわてて博物館から出た...", "Your pack is so full that you flee the Museum..."));
160160 else
161161 msg_print(_("ザックからアイテムがあふれそうなので、あわてて店から出た...", "Your pack is so full that you flee the store..."));
--- a/src/store/home.cpp
+++ b/src/store/home.cpp
@@ -27,7 +27,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
2727 {
2828 bool old_stack_force_notes = stack_force_notes;
2929 bool old_stack_force_costs = stack_force_costs;
30- if (cur_store_num != STORE_HOME) {
30+ if (cur_store_num != StoreSaleType::HOME) {
3131 stack_force_notes = false;
3232 stack_force_costs = false;
3333 }
@@ -37,7 +37,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
3737 j_ptr = &st_ptr->stock[slot];
3838 if (object_similar(j_ptr, o_ptr)) {
3939 object_absorb(j_ptr, o_ptr);
40- if (cur_store_num != STORE_HOME) {
40+ if (cur_store_num != StoreSaleType::HOME) {
4141 stack_force_notes = old_stack_force_notes;
4242 stack_force_costs = old_stack_force_costs;
4343 }
@@ -46,7 +46,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
4646 }
4747 }
4848
49- if (cur_store_num != STORE_HOME) {
49+ if (cur_store_num != StoreSaleType::HOME) {
5050 stack_force_notes = old_stack_force_notes;
5151 stack_force_costs = old_stack_force_costs;
5252 }
@@ -56,7 +56,7 @@ int home_carry(player_type *player_ptr, object_type *o_ptr)
5656 * 隠し機能: オプション powerup_home が設定されていると
5757 * 我が家が 20 ページまで使える
5858 */
59- if ((cur_store_num != STORE_HOME) || powerup_home) {
59+ if ((cur_store_num != StoreSaleType::HOME) || powerup_home) {
6060 if (st_ptr->stock_num >= st_ptr->stock_size) {
6161 return -1;
6262 }
@@ -164,14 +164,14 @@ static void exe_reorder_store_item(player_type *player_ptr, bool *flag)
164164 * @param store_num 店舗ID
165165 * @return 実際に整理が行われたならばTRUEを返す。
166166 */
167-bool combine_and_reorder_home(player_type *player_ptr, const int store_num)
167+bool combine_and_reorder_home(player_type *player_ptr, const StoreSaleType store_num)
168168 {
169169 bool old_stack_force_notes = stack_force_notes;
170170 bool old_stack_force_costs = stack_force_costs;
171171 store_type *old_st_ptr = st_ptr;
172- st_ptr = &town_info[1].store[store_num];
172+ st_ptr = &town_info[1].store[enum2i(store_num)];
173173 bool flag = false;
174- if (store_num != STORE_HOME) {
174+ if (store_num != StoreSaleType::HOME) {
175175 stack_force_notes = false;
176176 stack_force_costs = false;
177177 }
@@ -193,7 +193,7 @@ bool combine_and_reorder_home(player_type *player_ptr, const int store_num)
193193
194194 exe_reorder_store_item(player_ptr, &flag);
195195 st_ptr = old_st_ptr;
196- if (store_num != STORE_HOME) {
196+ if (store_num != StoreSaleType::HOME) {
197197 stack_force_notes = old_stack_force_notes;
198198 stack_force_costs = old_stack_force_costs;
199199 }
--- a/src/store/home.h
+++ b/src/store/home.h
@@ -1,6 +1,7 @@
11 #pragma once
22
3-struct object_type;;
3+struct object_type;
44 struct player_type;
5+enum class StoreSaleType;
56 int home_carry(player_type *player_ptr, object_type *o_ptr);
6-bool combine_and_reorder_home(player_type *player_ptr, const int store_num);
7+bool combine_and_reorder_home(player_type *player_ptr, const StoreSaleType store_num);
--- a/src/store/museum.cpp
+++ b/src/store/museum.cpp
@@ -44,7 +44,7 @@ void museum_remove_object(player_type *player_ptr)
4444 msg_format(_("%sの展示をやめさせた。", "You ordered to remove %s."), o_name);
4545 store_item_increase(item, -o_ptr->number);
4646 store_item_optimize(item);
47- (void)combine_and_reorder_home(player_ptr, STORE_MUSEUM);
47+ (void)combine_and_reorder_home(player_ptr, StoreSaleType::MUSEUM);
4848 if (st_ptr->stock_num == 0)
4949 store_top = 0;
5050 else if (store_top >= st_ptr->stock_num)
--- a/src/store/pricing.cpp
+++ b/src/store/pricing.cpp
@@ -45,7 +45,7 @@ PRICE price_item(player_type *player_ptr, object_type *o_ptr, int greed, bool fl
4545 if (adjust > 100)
4646 adjust = 100;
4747
48- if (cur_store_num == STORE_BLACK)
48+ if (cur_store_num == StoreSaleType::BLACK)
4949 price = price / 2;
5050
5151 price = (price * adjust + 50L) / 100L;
@@ -54,7 +54,7 @@ PRICE price_item(player_type *player_ptr, object_type *o_ptr, int greed, bool fl
5454 if (adjust < 100)
5555 adjust = 100;
5656
57- if (cur_store_num == STORE_BLACK)
57+ if (cur_store_num == StoreSaleType::BLACK)
5858 price = price * 2;
5959
6060 price = (int32_t)(((uint32_t)price * (uint32_t)adjust + 50UL) / 100UL);
--- a/src/store/purchase-order.cpp
+++ b/src/store/purchase-order.cpp
@@ -73,10 +73,10 @@ static bool show_store_select_item(COMMAND_CODE *item, const int i)
7373 char out_val[160];
7474
7575 switch (cur_store_num) {
76- case STORE_HOME:
76+ case StoreSaleType::HOME:
7777 sprintf(out_val, _("どのアイテムを取りますか? ", "Which item do you want to take? "));
7878 break;
79- case STORE_BLACK:
79+ case StoreSaleType::BLACK:
8080 sprintf(out_val, _("どれ? ", "Which item, huh? "));
8181 break;
8282 default:
@@ -112,7 +112,7 @@ static void take_item_from_home(player_type *player_ptr, object_type *o_ptr, obj
112112 store_item_increase(item, -amt);
113113 store_item_optimize(item);
114114
115- auto combined_or_reordered = combine_and_reorder_home(player_ptr, STORE_HOME);
115+ auto combined_or_reordered = combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
116116
117117 if (i == st_ptr->stock_num) {
118118 if (combined_or_reordered)
@@ -177,13 +177,13 @@ static void switch_store_stock(player_type *player_ptr, const int i, const COMMA
177177 */
178178 void store_purchase(player_type *player_ptr)
179179 {
180- if (cur_store_num == STORE_MUSEUM) {
180+ if (cur_store_num == StoreSaleType::MUSEUM) {
181181 msg_print(_("博物館から取り出すことはできません。", "Items cannot be taken out of the Museum."));
182182 return;
183183 }
184184
185185 if (st_ptr->stock_num <= 0) {
186- if (cur_store_num == STORE_HOME)
186+ if (cur_store_num == StoreSaleType::HOME)
187187 msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
188188 else
189189 msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
@@ -220,7 +220,7 @@ void store_purchase(player_type *player_ptr)
220220
221221 PRICE best = price_item(player_ptr, j_ptr, ot_ptr->inflate, false);
222222 if (o_ptr->number > 1) {
223- if (cur_store_num != STORE_HOME) {
223+ if (cur_store_num != StoreSaleType::HOME) {
224224 msg_format(_("一つにつき $%ldです。", "That costs %ld gold per item."), (long)(best));
225225 }
226226
@@ -243,7 +243,7 @@ void store_purchase(player_type *player_ptr)
243243 return;
244244 }
245245
246- if (cur_store_num == STORE_HOME) {
246+ if (cur_store_num == StoreSaleType::HOME) {
247247 take_item_from_home(player_ptr, o_ptr, j_ptr, item);
248248 return;
249249 }
@@ -269,9 +269,9 @@ void store_purchase(player_type *player_ptr)
269269 }
270270
271271 store_owner_says_comment(player_ptr);
272- if (cur_store_num == STORE_BLACK)
272+ if (cur_store_num == StoreSaleType::BLACK)
273273 chg_virtue(player_ptr, V_JUSTICE, -1);
274- if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
274+ if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != StoreSaleType::HOME))
275275 chg_virtue(player_ptr, V_NATURE, -1);
276276
277277 sound(SOUND_BUY);
--- a/src/store/say-comments.cpp
+++ b/src/store/say-comments.cpp
@@ -17,7 +17,7 @@
1717 */
1818 void store_owner_says_comment(player_type *player_ptr)
1919 {
20- if (cur_store_num == STORE_BLACK)
20+ if (cur_store_num == StoreSaleType::BLACK)
2121 msg_print(comment_1_B[randint0(MAX_COMMENT_1)]);
2222 else
2323 msg_print(comment_1[randint0(MAX_COMMENT_1)]);
--- a/src/store/sell-order.cpp
+++ b/src/store/sell-order.cpp
@@ -73,12 +73,12 @@ void store_sell(player_type *player_ptr)
7373 concptr s_none; //!< @note 売る/置くものがない場合のメッセージ
7474 concptr s_full; //!< @note もう置けない場合のメッセージ
7575 switch (cur_store_num) {
76- case STORE_HOME:
76+ case StoreSaleType::HOME:
7777 q = _("どのアイテムを置きますか? ", "Drop which item? ");
7878 s_none = _("置けるアイテムを持っていません。", "You don't have any items to drop.");
7979 s_full = _("我が家にはもう置く場所がない。", "Your home is full.");
8080 break;
81- case STORE_MUSEUM:
81+ case StoreSaleType::MUSEUM:
8282 q = _("どのアイテムを寄贈しますか? ", "Give which item? ");
8383 s_none = _("寄贈できるアイテムを持っていません。", "You don't have any items to give.");
8484 s_full = _("博物館はもう満杯だ。", "The Museum is full.");
@@ -118,7 +118,7 @@ void store_sell(player_type *player_ptr)
118118
119119 GAME_TEXT o_name[MAX_NLEN];
120120 describe_flavor(player_ptr, o_name, q_ptr, 0);
121- if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM)) {
121+ if ((cur_store_num != StoreSaleType::HOME) && (cur_store_num != StoreSaleType::MUSEUM)) {
122122 q_ptr->inscription = 0;
123123 q_ptr->feeling = FEEL_NONE;
124124 }
@@ -129,7 +129,7 @@ void store_sell(player_type *player_ptr)
129129 }
130130
131131 bool placed = false;
132- if ((cur_store_num != STORE_HOME) && (cur_store_num != STORE_MUSEUM)) {
132+ if ((cur_store_num != StoreSaleType::HOME) && (cur_store_num != StoreSaleType::MUSEUM)) {
133133 msg_format(_("%s(%c)を売却する。", "Selling %s (%c)."), o_name, index_to_label(item));
134134 msg_print(nullptr);
135135
@@ -140,10 +140,10 @@ void store_sell(player_type *player_ptr)
140140 store_owner_says_comment(player_ptr);
141141
142142 sound(SOUND_SELL);
143- if (cur_store_num == STORE_BLACK)
143+ if (cur_store_num == StoreSaleType::BLACK)
144144 chg_virtue(player_ptr, V_JUSTICE, -1);
145145
146- if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != STORE_HOME))
146+ if ((o_ptr->tval == TV_BOTTLE) && (cur_store_num != StoreSaleType::HOME))
147147 chg_virtue(player_ptr, V_NATURE, 1);
148148
149149 player_ptr->au += price;
@@ -183,7 +183,7 @@ void store_sell(player_type *player_ptr)
183183 display_store_inventory(player_ptr);
184184 }
185185 }
186- } else if (cur_store_num == STORE_MUSEUM) {
186+ } else if (cur_store_num == StoreSaleType::MUSEUM) {
187187 char o2_name[MAX_NLEN];
188188 describe_flavor(player_ptr, o2_name, q_ptr, OD_NAME_ONLY);
189189
--- a/src/store/service-checker.cpp
+++ b/src/store/service-checker.cpp
@@ -183,19 +183,19 @@ static bool check_store_book(const object_type *o_ptr)
183183 static bool switch_store_check(const object_type *o_ptr)
184184 {
185185 switch (cur_store_num) {
186- case STORE_GENERAL:
186+ case StoreSaleType::GENERAL:
187187 return check_store_general(o_ptr);
188- case STORE_ARMOURY:
188+ case StoreSaleType::ARMOURY:
189189 return check_store_armoury(o_ptr);
190- case STORE_WEAPON:
190+ case StoreSaleType::WEAPON:
191191 return check_store_weapon(o_ptr);
192- case STORE_TEMPLE:
192+ case StoreSaleType::TEMPLE:
193193 return check_store_temple(o_ptr);
194- case STORE_ALCHEMIST:
194+ case StoreSaleType::ALCHEMIST:
195195 return check_store_alchemist(o_ptr);
196- case STORE_MAGIC:
196+ case StoreSaleType::MAGIC:
197197 return check_store_magic(o_ptr);
198- case STORE_BOOK:
198+ case StoreSaleType::BOOK:
199199 return check_store_book(o_ptr);
200200 default:
201201 return true;
@@ -212,7 +212,7 @@ static bool switch_store_check(const object_type *o_ptr)
212212 */
213213 bool store_will_buy(player_type *, const object_type *o_ptr)
214214 {
215- if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM))
215+ if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM))
216216 return true;
217217
218218 if (!switch_store_check(o_ptr))
@@ -311,7 +311,7 @@ static int mass_figurine_produce(const PRICE cost)
311311 static int mass_magic_produce(const PRICE cost)
312312 {
313313 int size = 1;
314- if ((cur_store_num != STORE_BLACK) || !one_in_(3))
314+ if ((cur_store_num != StoreSaleType::BLACK) || !one_in_(3))
315315 return size;
316316
317317 if (cost < 1601L)
--- a/src/store/store-key-processor.cpp
+++ b/src/store/store-key-processor.cpp
@@ -71,7 +71,7 @@ void store_process_command(player_type *player_ptr)
7171 if (store_top < 0)
7272 store_top = ((st_ptr->stock_num - 1) / store_bottom) * store_bottom;
7373
74- if ((cur_store_num == STORE_HOME) && !powerup_home)
74+ if ((cur_store_num == StoreSaleType::HOME) && !powerup_home)
7575 if (store_top >= store_bottom)
7676 store_top = store_bottom;
7777
@@ -90,7 +90,7 @@ void store_process_command(player_type *player_ptr)
9090 * 隠しオプション(powerup_home)がセットされていないときは
9191 * 我が家では 2 ページまでしか表示しない
9292 */
93- auto inven_max = store_get_stock_max(STORE_HOME, powerup_home);
93+ auto inven_max = store_get_stock_max(StoreSaleType::HOME, powerup_home);
9494 if (store_top >= st_ptr->stock_num || store_top >= inven_max)
9595 store_top = 0;
9696
@@ -217,7 +217,7 @@ void store_process_command(player_type *player_ptr)
217217 }
218218 case '=': {
219219 do_cmd_options(player_ptr);
220- (void)combine_and_reorder_home(player_ptr, STORE_HOME);
220+ (void)combine_and_reorder_home(player_ptr, StoreSaleType::HOME);
221221 do_cmd_redraw(player_ptr);
222222 display_store(player_ptr);
223223 break;
@@ -259,7 +259,7 @@ void store_process_command(player_type *player_ptr)
259259 break;
260260 }
261261 default: {
262- if ((cur_store_num == STORE_MUSEUM) && (command_cmd == 'r')) {
262+ if ((cur_store_num == StoreSaleType::MUSEUM) && (command_cmd == 'r')) {
263263 museum_remove_object(player_ptr);
264264 } else {
265265 msg_print(_("そのコマンドは店の中では使えません。", "That command does not work in stores."));
--- a/src/store/store-util.cpp
+++ b/src/store/store-util.cpp
@@ -17,9 +17,29 @@
1717 #include "system/object-type-definition.h"
1818 #include "world/world-object.h"
1919
20-int cur_store_num = 0;
20+StoreSaleType cur_store_num = StoreSaleType::GENERAL;
2121 store_type *st_ptr = nullptr;
2222
23+StoreSaleType begin(StoreSaleType)
24+{
25+ return StoreSaleType::GENERAL;
26+}
27+
28+StoreSaleType end(StoreSaleType)
29+{
30+ return StoreSaleType::MAX;
31+}
32+
33+StoreSaleType operator*(StoreSaleType s)
34+{
35+ return s;
36+}
37+
38+StoreSaleType operator++(StoreSaleType &s)
39+{
40+ return s = StoreSaleType(std::underlying_type<StoreSaleType>::type(s) + 1);
41+}
42+
2343 /*!
2444 * @brief 店舗のオブジェクト数を増やす /
2545 * Add the item "o_ptr" to a real stores inventory.
@@ -135,7 +155,7 @@ void store_create(
135155 for (int tries = 0; tries < 4; tries++) {
136156 KIND_OBJECT_IDX k_idx;
137157 DEPTH level;
138- if (cur_store_num == STORE_BLACK) {
158+ if (cur_store_num == StoreSaleType::BLACK) {
139159 level = 25 + randint0(25);
140160 k_idx = get_obj_num(player_ptr, level, 0x00000000);
141161 if (k_idx == 0)
@@ -175,7 +195,7 @@ void store_create(
175195 if (q_ptr->tval == TV_CHEST)
176196 continue;
177197
178- if (cur_store_num == STORE_BLACK) {
198+ if (cur_store_num == StoreSaleType::BLACK) {
179199 if (black_market_crap(player_ptr, q_ptr) || (object_value(q_ptr) < 10))
180200 continue;
181201 } else {
--- a/src/store/store-util.h
+++ b/src/store/store-util.h
@@ -7,20 +7,25 @@
77
88 #define STORE_OBJ_LEVEL 5 //!< 通常店舗の階層レベル / Magic Level for normal stores
99
10-enum STORE_TYPE_IDX {
11- STORE_GENERAL = 0, //!< 店舗の種類: 雑貨屋
12- STORE_ARMOURY = 1, //!< 店舗の種類: 防具屋
13- STORE_WEAPON = 2, //!< 店舗の種類: 武器屋
14- STORE_TEMPLE = 3, //!< 店舗の種類: 寺院
15- STORE_ALCHEMIST = 4, //!< 店舗の種類: 錬金術の店
16- STORE_MAGIC = 5, //!< 店舗の種類: 魔道具屋
17- STORE_BLACK = 6, //!< 店舗の種類: ブラック・マーケット
18- STORE_HOME = 7, //!< 店舗の種類: 我が家
19- STORE_BOOK = 8, //!< 店舗の種類: 書店
20- STORE_MUSEUM = 9, //!< 店舗の種類: 博物館
21- STORE_MAX = 10
10+enum class StoreSaleType {
11+ GENERAL = 0, //!< 店舗の種類: 雑貨屋
12+ ARMOURY = 1, //!< 店舗の種類: 防具屋
13+ WEAPON = 2, //!< 店舗の種類: 武器屋
14+ TEMPLE = 3, //!< 店舗の種類: 寺院
15+ ALCHEMIST = 4, //!< 店舗の種類: 錬金術の店
16+ MAGIC = 5, //!< 店舗の種類: 魔道具屋
17+ BLACK = 6, //!< 店舗の種類: ブラック・マーケット
18+ HOME = 7, //!< 店舗の種類: 我が家
19+ BOOK = 8, //!< 店舗の種類: 書店
20+ MUSEUM = 9, //!< 店舗の種類: 博物館
21+ MAX = 10
2222 };
2323
24+StoreSaleType begin(StoreSaleType);
25+StoreSaleType end(StoreSaleType);
26+StoreSaleType operator*(StoreSaleType s);
27+StoreSaleType operator++(StoreSaleType &s);
28+
2429 using store_k_idx = std::vector<KIND_OBJECT_IDX>;
2530
2631 /*!
@@ -47,7 +52,7 @@ struct store_type {
4752 store_type &operator=(const store_type &) = delete;
4853 };
4954
50-extern int cur_store_num;
55+extern StoreSaleType cur_store_num;
5156 extern store_type *st_ptr;
5257
5358 struct player_type;
--- a/src/store/store.cpp
+++ b/src/store/store.cpp
@@ -53,12 +53,12 @@ bool allow_inc = false;
5353 * @param store_idx 店舗ID
5454 * @return 店舗の最大スロット数
5555 */
56-int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup)
56+int16_t store_get_stock_max(StoreSaleType sst, bool powerup)
5757 {
58- switch (store_idx) {
59- case STORE_HOME:
58+ switch (sst) {
59+ case StoreSaleType::HOME:
6060 return powerup ? STORE_INVEN_MAX * 10 : STORE_INVEN_MAX;
61- case STORE_MUSEUM:
61+ case StoreSaleType::MUSEUM:
6262 return STORE_INVEN_MAX * 50;
6363 default:
6464 return STORE_INVEN_MAX * 3 / 2;
@@ -76,7 +76,7 @@ int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup)
7676 */
7777 static int check_free_space(void)
7878 {
79- if ((cur_store_num == STORE_HOME) && !powerup_home) {
79+ if ((cur_store_num == StoreSaleType::HOME) && !powerup_home) {
8080 if (st_ptr->stock_num < ((st_ptr->stock_size) / 10))
8181 return 1;
8282 } else if (st_ptr->stock_num < st_ptr->stock_size)
@@ -103,10 +103,10 @@ static int check_free_space(void)
103103 int store_check_num(object_type *o_ptr)
104104 {
105105 object_type *j_ptr;
106- if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) {
106+ if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) {
107107 bool old_stack_force_notes = stack_force_notes;
108108 bool old_stack_force_costs = stack_force_costs;
109- if (cur_store_num != STORE_HOME) {
109+ if (cur_store_num != StoreSaleType::HOME) {
110110 stack_force_notes = false;
111111 stack_force_costs = false;
112112 }
@@ -116,7 +116,7 @@ int store_check_num(object_type *o_ptr)
116116 if (!object_similar(j_ptr, o_ptr))
117117 continue;
118118
119- if (cur_store_num != STORE_HOME) {
119+ if (cur_store_num != StoreSaleType::HOME) {
120120 stack_force_notes = old_stack_force_notes;
121121 stack_force_costs = old_stack_force_costs;
122122 }
@@ -124,7 +124,7 @@ int store_check_num(object_type *o_ptr)
124124 return -1;
125125 }
126126
127- if (cur_store_num != STORE_HOME) {
127+ if (cur_store_num != StoreSaleType::HOME) {
128128 stack_force_notes = old_stack_force_notes;
129129 stack_force_costs = old_stack_force_costs;
130130 }
@@ -159,7 +159,7 @@ int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
159159 char hi = (j > 25) ? toupper(I2A(j - 26)) : I2A(j);
160160 char out_val[160];
161161 #ifdef JP
162- (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s", (((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) ? "アイテム" : "商品"), lo, hi, pmt);
162+ (void)sprintf(out_val, "(%s:%c-%c, ESCで中断) %s", (((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) ? "アイテム" : "商品"), lo, hi, pmt);
163163 #else
164164 (void)sprintf(out_val, "(Items %c-%c, ESC to exit) %s", lo, hi, pmt);
165165 #endif
@@ -200,9 +200,9 @@ int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j)
200200 void store_examine(player_type *player_ptr)
201201 {
202202 if (st_ptr->stock_num <= 0) {
203- if (cur_store_num == STORE_HOME)
203+ if (cur_store_num == StoreSaleType::HOME)
204204 msg_print(_("我が家には何も置いてありません。", "Your home is empty."));
205- else if (cur_store_num == STORE_MUSEUM)
205+ else if (cur_store_num == StoreSaleType::MUSEUM)
206206 msg_print(_("博物館には何も置いてありません。", "The Museum is empty."));
207207 else
208208 msg_print(_("現在商品の在庫を切らしています。", "I am currently out of stock."));
@@ -239,13 +239,13 @@ void store_examine(player_type *player_ptr)
239239 * Shuffle one of the stores.
240240 * @param which 店舗種類のID
241241 */
242-void store_shuffle(player_type *player_ptr, int which)
242+void store_shuffle(player_type *player_ptr, StoreSaleType which)
243243 {
244- if ((which == STORE_HOME) || (which == STORE_MUSEUM))
244+ if ((which == StoreSaleType::HOME) || (which == StoreSaleType::MUSEUM))
245245 return;
246246
247247 cur_store_num = which;
248- st_ptr = &town_info[player_ptr->town_num].store[cur_store_num];
248+ st_ptr = &town_info[player_ptr->town_num].store[enum2i(cur_store_num)];
249249 int j = st_ptr->owner;
250250 while (true) {
251251 st_ptr->owner = (byte)randint0(MAX_OWNERS);
@@ -257,7 +257,7 @@ void store_shuffle(player_type *player_ptr, int which)
257257 if (i == player_ptr->town_num)
258258 continue;
259259
260- if (st_ptr->owner == town_info[i].store[cur_store_num].owner)
260+ if (st_ptr->owner == town_info[i].store[enum2i(cur_store_num)].owner)
261261 break;
262262 }
263263
@@ -265,7 +265,7 @@ void store_shuffle(player_type *player_ptr, int which)
265265 break;
266266 }
267267
268- ot_ptr = &owners[cur_store_num][st_ptr->owner];
268+ ot_ptr = &owners[enum2i(cur_store_num)][st_ptr->owner];
269269 st_ptr->insult_cur = 0;
270270 st_ptr->store_open = 0;
271271 st_ptr->good_buy = 0;
@@ -289,16 +289,16 @@ void store_shuffle(player_type *player_ptr, int which)
289289 * @param store_num 店舗種類のID
290290 * @param chance 更新商品数
291291 */
292-void store_maintenance(player_type *player_ptr, int town_num, int store_num, int chance)
292+void store_maintenance(player_type *player_ptr, int town_num, StoreSaleType store_num, int chance)
293293 {
294294 cur_store_num = store_num;
295- if ((store_num == STORE_HOME) || (store_num == STORE_MUSEUM))
295+ if ((store_num == StoreSaleType::HOME) || (store_num == StoreSaleType::MUSEUM))
296296 return;
297297
298- st_ptr = &town_info[town_num].store[store_num];
299- ot_ptr = &owners[store_num][st_ptr->owner];
298+ st_ptr = &town_info[town_num].store[enum2i(store_num)];
299+ ot_ptr = &owners[enum2i(store_num)][st_ptr->owner];
300300 st_ptr->insult_cur = 0;
301- if (store_num == STORE_BLACK) {
301+ if (store_num == StoreSaleType::BLACK) {
302302 for (INVENTORY_IDX j = st_ptr->stock_num - 1; j >= 0; j--) {
303303 object_type *o_ptr = &st_ptr->stock[j];
304304 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
358358 * @param town_num 町のID
359359 * @param store_num 店舗種類のID
360360 */
361-void store_init(int town_num, int store_num)
361+void store_init(int town_num, StoreSaleType store_num)
362362 {
363363 cur_store_num = store_num;
364- st_ptr = &town_info[town_num].store[store_num];
364+ st_ptr = &town_info[town_num].store[enum2i(store_num)];
365365 while (true) {
366366 st_ptr->owner = (byte)randint0(MAX_OWNERS);
367367 int i;
368368 for (i = 1; i < max_towns; i++) {
369369 if (i == town_num)
370370 continue;
371- if (st_ptr->owner == town_info[i].store[store_num].owner)
371+ if (st_ptr->owner == town_info[i].store[enum2i(store_num)].owner)
372372 break;
373373 }
374374
@@ -376,7 +376,7 @@ void store_init(int town_num, int store_num)
376376 break;
377377 }
378378
379- ot_ptr = &owners[store_num][st_ptr->owner];
379+ ot_ptr = &owners[enum2i(store_num)][st_ptr->owner];
380380 st_ptr->store_open = 0;
381381 st_ptr->insult_cur = 0;
382382 st_ptr->good_buy = 0;
@@ -386,3 +386,4 @@ void store_init(int town_num, int store_num)
386386 for (int k = 0; k < st_ptr->stock_size; k++)
387387 (&st_ptr->stock[k])->wipe();
388388 }
389+
--- a/src/store/store.h
+++ b/src/store/store.h
@@ -23,10 +23,10 @@ extern int cur_store_feat;
2323 extern bool allow_inc;
2424
2525 struct player_type;
26-int16_t store_get_stock_max(STORE_TYPE_IDX store_idx, bool powerup = true);
27-void store_shuffle(player_type *player_ptr, int which);
28-void store_maintenance(player_type *player_ptr, int town_num, int store_num, int chance);
29-void store_init(int town_num, int store_num);
26+int16_t store_get_stock_max(StoreSaleType sst, bool powerup = true);
27+void store_shuffle(player_type *player_ptr, StoreSaleType which);
28+void store_maintenance(player_type *player_ptr, int town_num, StoreSaleType store_num, int chance);
29+void store_init(int town_num, StoreSaleType store_num);
3030 void store_examine(player_type *player_ptr);
3131 int store_check_num(object_type *o_ptr);
3232 int get_stock(COMMAND_CODE *com_val, concptr pmt, int i, int j);
--- a/src/view/display-store.cpp
+++ b/src/view/display-store.cpp
@@ -64,7 +64,7 @@ void display_entry(player_type *player_ptr, int pos)
6464
6565 /* Describe an item in the home */
6666 int maxwid = 75;
67- if ((cur_store_num == STORE_HOME) || (cur_store_num == STORE_MUSEUM)) {
67+ if ((cur_store_num == StoreSaleType::HOME) || (cur_store_num == StoreSaleType::MUSEUM)) {
6868 maxwid = 75;
6969 if (show_weights)
7070 maxwid -= 10;
@@ -129,9 +129,9 @@ void display_store_inventory(player_type *player_ptr)
129129 put_str(format(_("(%dページ) ", "(Page %d) "), store_top / store_bottom + 1), 5, _(20, 22));
130130 }
131131
132- if (cur_store_num == STORE_HOME || cur_store_num == STORE_MUSEUM) {
132+ if (cur_store_num == StoreSaleType::HOME || cur_store_num == StoreSaleType::MUSEUM) {
133133 k = st_ptr->stock_size;
134- if (cur_store_num == STORE_HOME && !powerup_home)
134+ if (cur_store_num == StoreSaleType::HOME && !powerup_home)
135135 k /= 10;
136136
137137 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)
147147 void display_store(player_type *player_ptr)
148148 {
149149 term_clear();
150- if (cur_store_num == STORE_HOME) {
150+ if (cur_store_num == StoreSaleType::HOME) {
151151 put_str(_("我が家", "Your Home"), 3, 31);
152152 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
153153 if (show_weights) {
@@ -159,7 +159,7 @@ void display_store(player_type *player_ptr)
159159 return;
160160 }
161161
162- if (cur_store_num == STORE_MUSEUM) {
162+ if (cur_store_num == StoreSaleType::MUSEUM) {
163163 put_str(_("博物館", "Museum"), 3, 31);
164164 put_str(_("アイテムの一覧", "Item Description"), 5, 4);
165165 if (show_weights) {
--- a/src/world/world-turn-processor.cpp
+++ b/src/world/world-turn-processor.cpp
@@ -275,7 +275,7 @@ void WorldTurnProcessor::shuffle_shopkeeper()
275275 int n;
276276 do {
277277 n = randint0(MAX_STORES);
278- if ((n == STORE_HOME) || (n == STORE_MUSEUM)) {
278+ if ((n == enum2i(StoreSaleType::HOME)) || (n == enum2i(StoreSaleType::MUSEUM))) {
279279 break;
280280 }
281281 } while (true);
@@ -292,7 +292,7 @@ void WorldTurnProcessor::shuffle_shopkeeper()
292292 msg_format(_("%sの店主をシャッフルします。", "Shuffle a Shopkeeper of %s."), f_ref.name.c_str());
293293 }
294294
295- store_shuffle(this->player_ptr, n);
295+ store_shuffle(this->player_ptr, i2enum<StoreSaleType>(n));
296296 break;
297297 }
298298 }
Show on old repository browser