Skip to content

Commit

Permalink
Merge branch 'CleverRaven:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
zdlpoppa authored Nov 21, 2023
2 parents f6e1134 + 3f0a037 commit 59953f2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8720,7 +8720,13 @@ void map::spawn_monsters_submap( const tripoint &gp, bool ignore_sight, bool spa
const tripoint gp_ms = sm_to_ms_copy( gp );

creature_tracker &creatures = get_creature_tracker();
for( spawn_point &i : current_submap->spawns ) {

// The list of spawns on the submap might be updated while we are iterating it.
// For example, `monster::on_load` -> `monster::try_reproduce` calls `map::add_spawn`.
// Therefore, this intentionally uses old-school indexed for-loop with re-check against `.size()` each step.
// NOLINTNEXTLINE(modernize-loop-convert)
for( size_t sp_i = 0; sp_i < current_submap->spawns.size(); ++sp_i ) {
const spawn_point i = current_submap->spawns[sp_i]; // intentional copy
const tripoint center = gp_ms + i.pos;
const tripoint_range<tripoint> points = points_in_radius( center, 3 );

Expand Down

0 comments on commit 59953f2

Please sign in to comment.