{
POSITION i, y, x, center_y, center_x;
int tmp, attempt = 10000;
- POSITION max_bldg_hgt = 3 * town_hgt / MAX_TOWN_HGT;
- POSITION max_bldg_wid = 5 * town_wid / MAX_TOWN_WID;
+ auto max_buildings_height = 3 * town_hgt / MAX_TOWN_HGT;
+ auto max_buildings_width = 5 * town_wid / MAX_TOWN_WID;
ugbldg_type *cur_ugbldg;
std::vector<std::vector<bool>> ugarcade_used(town_hgt, std::vector<bool>(town_wid));
bool abort;
do {
center_y = rand_range(2, town_hgt - 3);
center_x = rand_range(2, town_wid - 3);
- tmp = center_y - randint1(max_bldg_hgt);
+ tmp = center_y - randint1(max_buildings_height);
cur_ugbldg->y0 = std::max(tmp, 1);
- tmp = center_x - randint1(max_bldg_wid);
+ tmp = center_x - randint1(max_buildings_width);
cur_ugbldg->x0 = std::max(tmp, 1);
- tmp = center_y + randint1(max_bldg_hgt);
+ tmp = center_y + randint1(max_buildings_height);
cur_ugbldg->y1 = std::min(tmp, town_hgt - 2);
- tmp = center_x + randint1(max_bldg_wid);
+ tmp = center_x + randint1(max_buildings_width);
cur_ugbldg->x1 = std::min(tmp, town_wid - 2);
for (abort = false, y = cur_ugbldg->y0; (y <= cur_ugbldg->y1) && !abort; y++) {
for (x = cur_ugbldg->x0; x <= cur_ugbldg->x1; x++) {
#include "player-info/class-types.h"
#include "player-info/race-types.h"
#include "realm/realm-types.h"
-#include "system/angband.h"
+#include <array>
#include <vector>
-#define MAX_BLDG 32 /*!< 施設の種類最大数 / Number of buildings */
+constexpr auto MAX_BUILDINGS = 32; /*!< 施設の種類最大数 / Number of buildings */
-enum class MonsterRaceId : int16_t;
+enum class MonsterRaceId : short;
struct building_type {
- GAME_TEXT name[20]; /* proprietor name */
- GAME_TEXT owner_name[20]; /* proprietor name */
- GAME_TEXT owner_race[20]; /* proprietor race */
+ char name[20]{}; /* proprietor name */
+ char owner_name[20]{}; /* proprietor name */
+ char owner_race[20]{}; /* proprietor race */
- GAME_TEXT act_names[8][30]; /* action names */
- PRICE member_costs[8]; /* Costs for class members of building */
- PRICE other_costs[8]; /* Costs for nonguild members */
- char letters[8]; /* action letters */
- int16_t actions[8]; /*!< 町の施設処理における行動ID */
- int16_t action_restr[8]; /*!< 町の施設処理の規制処理ID */
+ char act_names[8][30]{}; /* action names */
+ int member_costs[8]{}; /* Costs for class members of building */
+ int other_costs[8]{}; /* Costs for nonguild members */
+ char letters[8]{}; /* action letters */
+ short actions[8]{}; /*!< 町の施設処理における行動ID */
+ short action_restr[8]{}; /*!< 町の施設処理の規制処理ID */
- std::vector<short> member_class; /* which classes are part of guild */
- std::vector<short> member_race; /* which races are part of guild */
- std::vector<short> member_realm; /* 店主ごとの魔法領域 / which realms are part of guild */
+ std::vector<short> member_class{}; /* which classes are part of guild */
+ std::vector<short> member_race{}; /* which races are part of guild */
+ std::vector<short> member_realm{}; /* 店主ごとの魔法領域 / which realms are part of guild */
};
-extern building_type buildings[MAX_BLDG];
+extern std::array<building_type, MAX_BUILDINGS> buildings;
extern MonsterRaceId battle_mon_list[4];