Skip to content

Commit

Permalink
Call make_patches_of_sunlight() after placing player (#114)
Browse files Browse the repository at this point in the history
Also constrain trial locations for patches of sunlight near player to be within the bounds of the cave.  Resolves #113 .
  • Loading branch information
backwardsEric authored Sep 15, 2024
1 parent beb980b commit 0a87ce3
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/generate.c
Original file line number Diff line number Diff line change
Expand Up @@ -3486,8 +3486,10 @@ void make_patches_of_sunlight()
// bunch near the player
for (i = 0; i < 40; ++i)
{
y = rand_range(p_ptr->py - 5, p_ptr->py + 5);
x = rand_range(p_ptr->px - 5, p_ptr->px + 5);
y = rand_range(MAX(p_ptr->py - 5, 1),
MIN(p_ptr->py + 5, p_ptr->cur_map_hgt - 2));
x = rand_range(MAX(p_ptr->px - 5, 1),
MIN(p_ptr->px + 5, p_ptr->cur_map_wid - 2));
make_patch_of_sunlight(y, x);
}

Expand Down Expand Up @@ -3670,6 +3672,16 @@ static bool cave_gen(void)
}
}

/* place the stairs, traps, rubble, secret doors, and player */
if (!place_rubble_player())
{
if (cheat_room)
msg_format("Couldn't place, rubble, or player.");
if (p_ptr->force_forge)
p_ptr->fixed_forge_count--;
return (FALSE);
}

if (p_ptr->depth == 1)
{
// smaller number of monsters at 50ft
Expand All @@ -3684,16 +3696,6 @@ static bool cave_gen(void)
mon_gen = (dun->cent_n + dieroll(dun->cent_n)) / 2;
}

/* place the stairs, traps, rubble, secret doors */
if (!place_rubble_player())
{
if (cheat_room)
msg_format("Couldn't place, rubble, or player.");
if (p_ptr->force_forge)
p_ptr->fixed_forge_count--;
return (FALSE);
}

// check dungeon connectivity
if (!check_connectivity())
{
Expand Down

0 comments on commit 0a87ce3

Please sign in to comment.