- /* Big town */
- floor_type *floor_ptr = creature_ptr->current_floor_ptr;
- floor_ptr->height = MAX_HGT;
- floor_ptr->width = MAX_WID;
-
- /* Assume illegal panel */
- panel_row_min = floor_ptr->height;
- panel_col_min = floor_ptr->width;
-
- process_dungeon_file(creature_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
- POSITION x = creature_ptr->wilderness_x;
- POSITION y = creature_ptr->wilderness_y;
- get_mon_num_prep(creature_ptr, get_monster_hook(creature_ptr), NULL);
-
- /* North border */
- generate_area(creature_ptr, y - 1, x, TRUE, FALSE);
-
- for (int i = 1; i < MAX_WID - 1; i++)
- {
- border.north[i] = floor_ptr->grid_array[MAX_HGT - 2][i].feat;
- }
-
- /* South border */
- generate_area(creature_ptr, y + 1, x, TRUE, FALSE);
-
- for (int i = 1; i < MAX_WID - 1; i++)
- {
- border.south[i] = floor_ptr->grid_array[1][i].feat;
- }
-
- /* West border */
- generate_area(creature_ptr, y, x - 1, TRUE, FALSE);
-
- for (int i = 1; i < MAX_HGT - 1; i++)
- {
- border.west[i] = floor_ptr->grid_array[i][MAX_WID - 2].feat;
- }
-
- /* East border */
- generate_area(creature_ptr, y, x + 1, TRUE, FALSE);
-
- for (int i = 1; i < MAX_HGT - 1; i++)
- {
- border.east[i] = floor_ptr->grid_array[i][1].feat;
- }
-
- /* North west corner */
- generate_area(creature_ptr, y - 1, x - 1, FALSE, TRUE);
- border.north_west = floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
-
- /* North east corner */
- generate_area(creature_ptr, y - 1, x + 1, FALSE, TRUE);
- border.north_east = floor_ptr->grid_array[MAX_HGT - 2][1].feat;
-
- /* South west corner */
- generate_area(creature_ptr, y + 1, x - 1, FALSE, TRUE);
- border.south_west = floor_ptr->grid_array[1][MAX_WID - 2].feat;
-
- /* South east corner */
- generate_area(creature_ptr, y + 1, x + 1, FALSE, TRUE);
- border.south_east = floor_ptr->grid_array[1][1].feat;
-
- /* Create terrain of the current area */
- generate_area(creature_ptr, y, x, FALSE, FALSE);
-
- /* Special boundary walls -- North */
- for (int i = 0; i < MAX_WID; i++)
- {
- floor_ptr->grid_array[0][i].feat = feat_permanent;
- floor_ptr->grid_array[0][i].mimic = border.north[i];
- }
-
- /* Special boundary walls -- South */
- for (int i = 0; i < MAX_WID; i++)
- {
- floor_ptr->grid_array[MAX_HGT - 1][i].feat = feat_permanent;
- floor_ptr->grid_array[MAX_HGT - 1][i].mimic = border.south[i];
- }
-
- /* Special boundary walls -- West */
- for (int i = 0; i < MAX_HGT; i++)
- {
- floor_ptr->grid_array[i][0].feat = feat_permanent;
- floor_ptr->grid_array[i][0].mimic = border.west[i];
- }
-
- /* Special boundary walls -- East */
- for (int i = 0; i < MAX_HGT; i++)
- {
- floor_ptr->grid_array[i][MAX_WID - 1].feat = feat_permanent;
- floor_ptr->grid_array[i][MAX_WID - 1].mimic = border.east[i];
- }
-
- floor_ptr->grid_array[0][0].mimic = border.north_west;
- floor_ptr->grid_array[0][MAX_WID - 1].mimic = border.north_east;
- floor_ptr->grid_array[MAX_HGT - 1][0].mimic = border.south_west;
- floor_ptr->grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east;
-
- /* Light up or darken the area */
- for (y = 0; y < floor_ptr->height; y++)
- {
- for (x = 0; x < floor_ptr->width; x++)
- {
- grid_type *g_ptr;
- g_ptr = &floor_ptr->grid_array[y][x];
-
- if (is_daytime())
- {
- /* Assume lit */
- g_ptr->info |= CAVE_GLOW;
-
- /* Hack -- Memorize lit grids if allowed */
- if (view_perma_grids) g_ptr->info |= CAVE_MARK;
- continue;
- }
-
- /* Feature code (applying "mimic" field) */
- feature_type *f_ptr;
- f_ptr = &f_info[get_feat_mimic(g_ptr)];
-
- if (!is_mirror_grid(g_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) &&
- !have_flag(f_ptr->flags, FF_ENTRANCE))
- {
- /* Assume dark */
- g_ptr->info &= ~(CAVE_GLOW);
-
- /* Darken "boring" features */
- if (!have_flag(f_ptr->flags, FF_REMEMBER))
- {
- /* Forget the grid */
- g_ptr->info &= ~(CAVE_MARK);
- }
-
- continue;
- }
-
- if (!have_flag(f_ptr->flags, FF_ENTRANCE)) continue;
-
- g_ptr->info |= CAVE_GLOW;
-
- /* Hack -- Memorize lit grids if allowed */
- if (view_perma_grids) g_ptr->info |= CAVE_MARK;
- }
- }
-
- if (creature_ptr->teleport_town)
- {
- for (y = 0; y < floor_ptr->height; y++)
- {
- for (x = 0; x < floor_ptr->width; x++)
- {
- grid_type *g_ptr;
- g_ptr = &floor_ptr->grid_array[y][x];
-
- /* Seeing true feature code (ignore mimic) */
- feature_type *f_ptr;
- f_ptr = &f_info[g_ptr->feat];
-
- if (!have_flag(f_ptr->flags, FF_BLDG)) continue;
-
- if ((f_ptr->subtype != 4) && !((creature_ptr->town_num == 1) && (f_ptr->subtype == 0)))
- continue;
-
- if (g_ptr->m_idx)
- {
- delete_monster_idx(creature_ptr, g_ptr->m_idx);
- }
-
- creature_ptr->oldpy = y;
- creature_ptr->oldpx = x;
- }
- }
-
- creature_ptr->teleport_town = FALSE;
- }
- else if (creature_ptr->leaving_dungeon)
- {
- for (y = 0; y < floor_ptr->height; y++)
- {
- for (x = 0; x < floor_ptr->width; x++)
- {
- grid_type *g_ptr;
- g_ptr = &floor_ptr->grid_array[y][x];
-
- if (!cave_have_flag_grid(g_ptr, FF_ENTRANCE)) continue;
-
- if (g_ptr->m_idx)
- {
- delete_monster_idx(creature_ptr, g_ptr->m_idx);
- }
-
- creature_ptr->oldpy = y;
- creature_ptr->oldpx = x;
- }
- }
-
- creature_ptr->teleport_town = FALSE;
- }
-
- player_place(creature_ptr, creature_ptr->oldpy, creature_ptr->oldpx);
- int lim = (generate_encounter == TRUE) ? 40 : MIN_M_ALLOC_TN;
-
- /* Make some residents */
- for (int i = 0; i < lim; i++)
- {
- BIT_FLAGS mode = 0;
-
- if (!(generate_encounter || (one_in_(2) && (!creature_ptr->town_num))))
- mode |= PM_ALLOW_SLEEP;
-
- /* Make a resident */
- (void)alloc_monster(creature_ptr, generate_encounter ? 0 : 3, mode);
- }
-
- if(generate_encounter) creature_ptr->ambush_flag = TRUE;
- generate_encounter = FALSE;
-
- /* Fill the arrays of floors and walls in the good proportions */
- set_floor_and_wall(0);
-
- /* Set rewarded quests to finished */
- for (int i = 0; i < max_q_idx; i++)
- {
- if (quest[i].status == QUEST_STATUS_REWARDED)
- quest[i].status = QUEST_STATUS_FINISHED;
- }
+ /* Big town */
+ floor_type *floor_ptr = creature_ptr->current_floor_ptr;
+ floor_ptr->height = MAX_HGT;
+ floor_ptr->width = MAX_WID;
+
+ /* Assume illegal panel */
+ panel_row_min = floor_ptr->height;
+ panel_col_min = floor_ptr->width;
+
+ parse_fixed_map(creature_ptr, "w_info.txt", 0, 0, current_world_ptr->max_wild_y, current_world_ptr->max_wild_x);
+ POSITION x = creature_ptr->wilderness_x;
+ POSITION y = creature_ptr->wilderness_y;
+ get_mon_num_prep(creature_ptr, get_monster_hook(creature_ptr), NULL);
+
+ /* North border */
+ generate_area(creature_ptr, y - 1, x, TRUE, FALSE);
+
+ for (int i = 1; i < MAX_WID - 1; i++) {
+ border.north[i] = floor_ptr->grid_array[MAX_HGT - 2][i].feat;
+ }
+
+ /* South border */
+ generate_area(creature_ptr, y + 1, x, TRUE, FALSE);
+
+ for (int i = 1; i < MAX_WID - 1; i++) {
+ border.south[i] = floor_ptr->grid_array[1][i].feat;
+ }
+
+ /* West border */
+ generate_area(creature_ptr, y, x - 1, TRUE, FALSE);
+
+ for (int i = 1; i < MAX_HGT - 1; i++) {
+ border.west[i] = floor_ptr->grid_array[i][MAX_WID - 2].feat;
+ }
+
+ /* East border */
+ generate_area(creature_ptr, y, x + 1, TRUE, FALSE);
+
+ for (int i = 1; i < MAX_HGT - 1; i++) {
+ border.east[i] = floor_ptr->grid_array[i][1].feat;
+ }
+
+ /* North west corner */
+ generate_area(creature_ptr, y - 1, x - 1, FALSE, TRUE);
+ border.north_west = floor_ptr->grid_array[MAX_HGT - 2][MAX_WID - 2].feat;
+
+ /* North east corner */
+ generate_area(creature_ptr, y - 1, x + 1, FALSE, TRUE);
+ border.north_east = floor_ptr->grid_array[MAX_HGT - 2][1].feat;
+
+ /* South west corner */
+ generate_area(creature_ptr, y + 1, x - 1, FALSE, TRUE);
+ border.south_west = floor_ptr->grid_array[1][MAX_WID - 2].feat;
+
+ /* South east corner */
+ generate_area(creature_ptr, y + 1, x + 1, FALSE, TRUE);
+ border.south_east = floor_ptr->grid_array[1][1].feat;
+
+ /* Create terrain of the current area */
+ generate_area(creature_ptr, y, x, FALSE, FALSE);
+
+ /* Special boundary walls -- North */
+ for (int i = 0; i < MAX_WID; i++) {
+ floor_ptr->grid_array[0][i].feat = feat_permanent;
+ floor_ptr->grid_array[0][i].mimic = border.north[i];
+ }
+
+ /* Special boundary walls -- South */
+ for (int i = 0; i < MAX_WID; i++) {
+ floor_ptr->grid_array[MAX_HGT - 1][i].feat = feat_permanent;
+ floor_ptr->grid_array[MAX_HGT - 1][i].mimic = border.south[i];
+ }
+
+ /* Special boundary walls -- West */
+ for (int i = 0; i < MAX_HGT; i++) {
+ floor_ptr->grid_array[i][0].feat = feat_permanent;
+ floor_ptr->grid_array[i][0].mimic = border.west[i];
+ }
+
+ /* Special boundary walls -- East */
+ for (int i = 0; i < MAX_HGT; i++) {
+ floor_ptr->grid_array[i][MAX_WID - 1].feat = feat_permanent;
+ floor_ptr->grid_array[i][MAX_WID - 1].mimic = border.east[i];
+ }
+
+ floor_ptr->grid_array[0][0].mimic = border.north_west;
+ floor_ptr->grid_array[0][MAX_WID - 1].mimic = border.north_east;
+ floor_ptr->grid_array[MAX_HGT - 1][0].mimic = border.south_west;
+ floor_ptr->grid_array[MAX_HGT - 1][MAX_WID - 1].mimic = border.south_east;
+
+ /* Light up or darken the area */
+ for (y = 0; y < floor_ptr->height; y++) {
+ for (x = 0; x < floor_ptr->width; x++) {
+ grid_type *g_ptr;
+ g_ptr = &floor_ptr->grid_array[y][x];
+
+ if (is_daytime()) {
+ /* Assume lit */
+ g_ptr->info |= CAVE_GLOW;
+
+ /* Hack -- Memorize lit grids if allowed */
+ if (view_perma_grids)
+ g_ptr->info |= CAVE_MARK;
+ continue;
+ }
+
+ /* Feature code (applying "mimic" field) */
+ feature_type *f_ptr;
+ f_ptr = &f_info[get_feat_mimic(g_ptr)];
+
+ if (!is_mirror_grid(g_ptr) && !have_flag(f_ptr->flags, FF_QUEST_ENTER) && !have_flag(f_ptr->flags, FF_ENTRANCE)) {
+ /* Assume dark */
+ g_ptr->info &= ~(CAVE_GLOW);
+
+ /* Darken "boring" features */
+ if (!have_flag(f_ptr->flags, FF_REMEMBER)) {
+ /* Forget the grid */
+ g_ptr->info &= ~(CAVE_MARK);
+ }
+
+ continue;
+ }
+
+ if (!have_flag(f_ptr->flags, FF_ENTRANCE))
+ continue;
+
+ g_ptr->info |= CAVE_GLOW;
+
+ /* Hack -- Memorize lit grids if allowed */
+ if (view_perma_grids)
+ g_ptr->info |= CAVE_MARK;
+ }
+ }
+
+ if (creature_ptr->teleport_town) {
+ for (y = 0; y < floor_ptr->height; y++) {
+ for (x = 0; x < floor_ptr->width; x++) {
+ grid_type *g_ptr;
+ g_ptr = &floor_ptr->grid_array[y][x];
+
+ /* Seeing true feature code (ignore mimic) */
+ feature_type *f_ptr;
+ f_ptr = &f_info[g_ptr->feat];
+
+ if (!have_flag(f_ptr->flags, FF_BLDG))
+ continue;
+
+ if ((f_ptr->subtype != 4) && !((creature_ptr->town_num == 1) && (f_ptr->subtype == 0)))
+ continue;
+
+ if (g_ptr->m_idx) {
+ delete_monster_idx(creature_ptr, g_ptr->m_idx);
+ }
+
+ creature_ptr->oldpy = y;
+ creature_ptr->oldpx = x;
+ }
+ }
+
+ creature_ptr->teleport_town = FALSE;
+ } else if (creature_ptr->leaving_dungeon) {
+ for (y = 0; y < floor_ptr->height; y++) {
+ for (x = 0; x < floor_ptr->width; x++) {
+ grid_type *g_ptr;
+ g_ptr = &floor_ptr->grid_array[y][x];
+
+ if (!cave_have_flag_grid(g_ptr, FF_ENTRANCE))
+ continue;
+
+ if (g_ptr->m_idx) {
+ delete_monster_idx(creature_ptr, g_ptr->m_idx);
+ }
+
+ creature_ptr->oldpy = y;
+ creature_ptr->oldpx = x;
+ }
+ }
+
+ creature_ptr->teleport_town = FALSE;
+ }
+
+ player_place(creature_ptr, creature_ptr->oldpy, creature_ptr->oldpx);
+ int lim = (generate_encounter == TRUE) ? 40 : MIN_M_ALLOC_TN;
+
+ /* Make some residents */
+ for (int i = 0; i < lim; i++) {
+ BIT_FLAGS mode = 0;
+
+ if (!(generate_encounter || (one_in_(2) && (!creature_ptr->town_num))))
+ mode |= PM_ALLOW_SLEEP;
+
+ /* Make a resident */
+ (void)alloc_monster(creature_ptr, generate_encounter ? 0 : 3, mode, summon_specific);
+ }
+
+ if (generate_encounter)
+ creature_ptr->ambush_flag = TRUE;
+ generate_encounter = FALSE;
+
+ /* Fill the arrays of floors and walls in the good proportions */
+ set_floor_and_wall(0);
+
+ /* Set rewarded quests to finished */
+ for (int i = 0; i < max_q_idx; i++) {
+ if (quest[i].status == QUEST_STATUS_REWARDED)
+ quest[i].status = QUEST_STATUS_FINISHED;
+ }