Skip to content

Commit

Permalink
Use correct z-level for ant check
Browse files Browse the repository at this point in the history
The existing `i.pos` in this loop has no z-level, so the check for
whether `tripoint_above` was an anthill was looking at z+1, and there
are no anthills in the sky, therefore all underground ants were spawning
as acid ants. This commit uses the correct z-level, allowing normal ants
to spawn in normal anthills.

This commit also stores the calculated tripoint with correct z-level in
a variable `p_loc`, then re-uses that in the three places that need it.
  • Loading branch information
wapcaplet committed Apr 16, 2020
1 parent ac64d81 commit 1131a45
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/overmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1764,14 +1764,15 @@ bool overmap::generate_sub( const int z )
requires_sub = true;
}
for( auto &i : ant_points ) {
if( ter( { i.pos, z } ) != "empty_rock" ) {
const tripoint p_loc = tripoint( i.pos, z );
if( ter( p_loc ) != "empty_rock" ) {
continue;
}
mongroup_id ant_group( ter( i.pos + tripoint_above ) == "anthill" ?
mongroup_id ant_group( ter( p_loc + tripoint_above ) == "anthill" ?
"GROUP_ANT" : "GROUP_ANT_ACID" );
add_mon_group( mongroup( ant_group, tripoint( i.pos.x * 2, i.pos.y * 2, z ),
( i.size * 3 ) / 2, rng( 6000, 8000 ) ) );
build_anthill( tripoint( i.pos, z ), i.size );
build_anthill( p_loc, i.size );
}

return requires_sub;
Expand Down

0 comments on commit 1131a45

Please sign in to comment.