1 #include "market/building-initializer.h"
2 #include "floor/floor-town.h"
3 #include "object/object-kind.h"
4 #include "object/object-kind-hook.h"
5 #include "store/articles-on-sale.h"
6 #include "store/store-owners.h"
7 #include "store/store-util.h"
8 #include "store/store.h"
9 #include "system/building-type-definition.h"
10 #include "system/object-type-definition.h"
13 * @brief 町情報読み込みのメインルーチン /
14 * Initialize town array
19 town_info = std::vector<town_type>(max_towns);
20 for (int i = 1; i < max_towns; i++) {
21 town_info[i].store = std::vector<store_type>(MAX_STORES);
22 for (auto sst : STORE_SALE_TYPE_LIST) {
23 store_type *store_ptr = &town_info[i].store[enum2i(sst)];
24 if ((i > 1) && (sst == StoreSaleType::MUSEUM || sst == StoreSaleType::HOME))
28 * 我が家が 20 ページまで使える隠し機能のための準備。
29 * オプションが有効でもそうでなくても一応スペースを作っておく。
31 store_ptr->stock_size = store_get_stock_max(sst);
33 store_ptr->stock = std::make_unique<object_type[]>(store_ptr->stock_size);
34 if ((sst == StoreSaleType::BLACK) || (sst == StoreSaleType::HOME) || (sst == StoreSaleType::MUSEUM))
37 for (int k = 0; k < STORE_INVEN_MAX; k++) {
38 auto tv = store_regular_table[enum2i(sst)][k].tval;
39 auto sv = store_regular_table[enum2i(sst)][k].sval;
40 if (tv == ItemKindType::NONE)
43 KIND_OBJECT_IDX k_idx = lookup_kind(tv, sv);
48 store_ptr->regular.push_back(k_idx);
51 for (int k = 0; k < STORE_CHOICES; k++) {
52 auto tv = store_table[enum2i(sst)][k].tval;
53 auto sv = store_table[enum2i(sst)][k].sval;
54 if (tv == ItemKindType::NONE)
57 KIND_OBJECT_IDX k_idx = lookup_kind(tv, sv);
62 store_ptr->table.push_back(k_idx);
71 * @brief 店情報初期化のメインルーチン /
72 * Initialize buildings
75 errr init_buildings(void)
77 for (int i = 0; i < MAX_BLDG; i++) {
78 building[i].name[0] = '\0';
79 building[i].owner_name[0] = '\0';
80 building[i].owner_race[0] = '\0';
82 for (int j = 0; j < 8; j++) {
83 building[i].act_names[j][0] = '\0';
84 building[i].member_costs[j] = 0;
85 building[i].other_costs[j] = 0;
86 building[i].letters[j] = 0;
87 building[i].actions[j] = 0;
88 building[i].action_restr[j] = 0;
91 for (int j = 0; j < MAX_CLASS; j++)
92 building[i].member_class[j] = CLASS_WARRIOR;
94 for (int j = 0; j < MAX_RACES; j++)
95 building[i].member_race[j] = static_cast<short>(PlayerRaceType::HUMAN);
97 for (int j = 0; j < MAX_MAGIC + 1; j++)
98 building[i].member_realm[j] = 0;