diff --git a/src/map.cpp b/src/map.cpp index 76760fb5b6057..1653f0ad162a7 100644 --- a/src/map.cpp +++ b/src/map.cpp @@ -6678,7 +6678,7 @@ void map::rotten_item_spawn( const item &item, const tripoint &pnt ) const int chance = ( comest->rot_spawn_chance * get_option( "CARRION_SPAWNRATE" ) ) / 100; if( rng( 0, 100 ) < chance ) { MonsterGroupResult spawn_details = MonsterGroupManager::GetResultFromGroup( mgroup ); - add_spawn( spawn_details.name, 1, pnt.xy(), false ); + add_spawn( spawn_details.name, 1, pnt, false ); if( g->u.sees( pnt ) ) { if( item.is_seed() ) { add_msg( m_warning, _( "Something has crawled out of the %s plants!" ), item.get_plant_name() ); diff --git a/src/map.h b/src/map.h index 8de02608fc198..904abbd913b51 100644 --- a/src/map.h +++ b/src/map.h @@ -1330,9 +1330,8 @@ class map character_id place_npc( const point &p, const string_id &type, bool force = false ); void apply_faction_ownership( const point &p1, const point &p2, faction_id id ); - void add_spawn( const mtype_id &type, int count, const point &p, - bool friendly = false, - int faction_id = -1, int mission_id = -1, + void add_spawn( const mtype_id &type, int count, const tripoint &p, + bool friendly = false, int faction_id = -1, int mission_id = -1, const std::string &name = "NONE" ) const; void do_vehicle_caching( int z ); // Note: in 3D mode, will actually build caches on ALL z-levels diff --git a/src/map_extras.cpp b/src/map_extras.cpp index 680985260d938..38e9ea12278c2 100644 --- a/src/map_extras.cpp +++ b/src/map_extras.cpp @@ -181,7 +181,7 @@ static void dead_vegetation_parser( map &m, const tripoint &loc ) } } -static void mx_house_wasp( map &m, const tripoint & ) +static void mx_house_wasp( map &m, const tripoint &loc ) { for( int i = 0; i < SEEX * 2; i++ ) { for( int j = 0; j < SEEY * 2; j++ ) { @@ -213,13 +213,13 @@ static void mx_house_wasp( map &m, const tripoint & ) } } } - m.add_spawn( mon_wasp, 1, point( podx, pody ) ); + m.add_spawn( mon_wasp, 1, tripoint( podx, pody, loc.z ) ); } m.place_items( "rare", 70, point_zero, point( SEEX * 2 - 1, SEEY * 2 - 1 ), false, calendar::start_of_cataclysm ); } -static void mx_house_spider( map &m, const tripoint & ) +static void mx_house_spider( map &m, const tripoint &loc ) { auto spider_type = mon_spider_widow_giant; auto egg_type = f_egg_sackbw; @@ -231,7 +231,7 @@ static void mx_house_spider( map &m, const tripoint & ) for( int j = 0; j < SEEY * 2; j++ ) { if( m.ter( point( i, j ) ) == t_floor ) { if( one_in( 15 ) ) { - m.add_spawn( spider_type, rng( 1, 2 ), point( i, j ) ); + m.add_spawn( spider_type, rng( 1, 2 ), tripoint( i, j, loc.z ) ); for( int x = i - 1; x <= i + 1; x++ ) { for( int y = j - 1; y <= j + 1; y++ ) { if( m.ter( point( x, y ) ) == t_floor ) { @@ -347,14 +347,14 @@ static void mx_helicopter( map &m, const tripoint &abs_sub ) const tripoint pos = vp.pos(); // Spawn pilots in seats with controls.CTRL_ELECTRONIC if( controls_at( wreckage, pos ) ) { - m.add_spawn( mon_zombie_military_pilot, 1, pos.xy() ); + m.add_spawn( mon_zombie_military_pilot, 1, pos ); } else { if( one_in( 5 ) ) { - m.add_spawn( mon_zombie_bio_op, 1, pos.xy() ); + m.add_spawn( mon_zombie_bio_op, 1, pos ); } else if( one_in( 5 ) ) { - m.add_spawn( mon_zombie_scientist, 1, pos.xy() ); + m.add_spawn( mon_zombie_scientist, 1, pos ); } else { - m.add_spawn( mon_zombie_soldier, 1, pos.xy() ); + m.add_spawn( mon_zombie_soldier, 1, pos ); } } @@ -375,10 +375,10 @@ static void mx_helicopter( map &m, const tripoint &abs_sub ) const tripoint pos = vp.pos(); // Spawn pilots in seats with controls. if( controls_at( wreckage, pos ) ) { - m.add_spawn( mon_zombie_military_pilot, 1, pos.xy() ); + m.add_spawn( mon_zombie_military_pilot, 1, pos ); } else { if( !one_in( 3 ) ) { - m.add_spawn( mon_zombie_soldier, 1, pos.xy() ); + m.add_spawn( mon_zombie_soldier, 1, pos ); } } @@ -396,7 +396,7 @@ static void mx_helicopter( map &m, const tripoint &abs_sub ) // Just pilots for( const vpart_reference &vp : wreckage->get_any_parts( VPFLAG_CONTROLS ) ) { const tripoint pos = vp.pos(); - m.add_spawn( mon_zombie_military_pilot, 1, pos.xy() ); + m.add_spawn( mon_zombie_military_pilot, 1, pos ); // Delete the items that would have spawned here from a "corpse" for( auto sp : wreckage->parts_at_relative( vp.mount(), true ) ) { @@ -433,12 +433,12 @@ static void mx_military( map &m, const tripoint & ) return m.passable( n ); } ) ) { if( one_in( 10 ) ) { - m.add_spawn( mon_zombie_soldier, 1, p->xy() ); + m.add_spawn( mon_zombie_soldier, 1, *p ); } else if( one_in( 25 ) ) { if( one_in( 2 ) ) { - m.add_spawn( mon_zombie_bio_op, 1, p->xy() ); + m.add_spawn( mon_zombie_bio_op, 1, *p ); } else { - m.add_spawn( mon_dispatch, 1, p->xy() ); + m.add_spawn( mon_dispatch, 1, *p ); } } else { m.place_items( "map_extra_military", 100, *p, *p, true, calendar::start_of_cataclysm ); @@ -465,7 +465,7 @@ static void mx_science( map &m, const tripoint & ) return m.passable( n ); } ) ) { if( one_in( 10 ) ) { - m.add_spawn( mon_zombie_scientist, 1, p->xy() ); + m.add_spawn( mon_zombie_scientist, 1, *p ); } else { m.place_items( "map_extra_science", 100, *p, *p, true, calendar::start_of_cataclysm ); } @@ -491,7 +491,7 @@ static void mx_collegekids( map &m, const tripoint & ) return m.passable( n ); } ) ) { if( one_in( 10 ) ) { - m.add_spawn( mon_zombie_tough, 1, p->xy() ); + m.add_spawn( mon_zombie_tough, 1, *p ); } else { if( type < 6 ) { // kids going to a cabin in the woods m.place_items( "map_extra_college_camping", 100, *p, *p, true, calendar::start_of_cataclysm ); @@ -525,11 +525,11 @@ static void mx_roadblock( map &m, const tripoint &abs_sub ) const auto spawn_turret = [&]( int x, int y ) { if( one_in( 3 ) ) { - m.add_spawn( mon_turret_bmg, 1, point( x, y ) ); + m.add_spawn( mon_turret_bmg, 1, { x, y, abs_sub.z } ); } else if( one_in( 2 ) ) { - m.add_spawn( mon_turret_rifle, 1, point( x, y ) ); + m.add_spawn( mon_turret_rifle, 1, { x, y, abs_sub.z } ); } else { - m.add_spawn( mon_turret_riot, 1, point( x, y ) ); + m.add_spawn( mon_turret_riot, 1, { x, y, abs_sub.z } ); } }; bool mil = false; @@ -624,22 +624,22 @@ static void mx_roadblock( map &m, const tripoint &abs_sub ) if( road_at_north ) { line_furn( &m, f_barricade_road, 4, 3, 10, 3 ); line_furn( &m, f_barricade_road, 13, 3, 19, 3 ); - m.add_spawn( mon_turret_riot, 1, point( 12, 1 ) ); + m.add_spawn( mon_turret_riot, 1, { 12, 1, abs_sub.z } ); } if( road_at_east ) { line_furn( &m, f_barricade_road, SEEX * 2 - 3, 4, SEEX * 2 - 3, 10 ); line_furn( &m, f_barricade_road, SEEX * 2 - 3, 13, SEEX * 2 - 3, 19 ); - m.add_spawn( mon_turret_riot, 1, point( SEEX * 2 - 1, 12 ) ); + m.add_spawn( mon_turret_riot, 1, { SEEX * 2 - 1, 12, abs_sub.z } ); } if( road_at_south ) { line_furn( &m, f_barricade_road, 4, SEEY * 2 - 3, 10, SEEY * 2 - 3 ); line_furn( &m, f_barricade_road, 13, SEEY * 2 - 3, 19, SEEY * 2 - 3 ); - m.add_spawn( mon_turret_riot, 1, point( 12, SEEY * 2 - 1 ) ); + m.add_spawn( mon_turret_riot, 1, { 12, SEEY * 2 - 1, abs_sub.z } ); } if( road_at_west ) { line_furn( &m, f_barricade_road, 3, 4, 3, 10 ); line_furn( &m, f_barricade_road, 3, 13, 3, 19 ); - m.add_spawn( mon_turret_riot, 1, point( 1, 12 ) ); + m.add_spawn( mon_turret_riot, 1, { 1, 12, abs_sub.z } ); } m.add_vehicle( vproto_id( "policecar" ), point( 8, 6 ), 20 ); @@ -672,8 +672,8 @@ static void mx_marloss_pilgrimage( map &m, const tripoint &abs_sub ) tripoint where = random_entry( spawnzone ); /// @todo wrong: this access the main game map, not m. Also accesses creatures currently loaded. if( g->is_empty( where ) ) { - one_in( 2 ) ? m.add_spawn( mon_marloss_zealot_f, 1, - where.xy() ) : m.add_spawn( mon_marloss_zealot_m, 1, where.xy() ); + one_in( 2 ) ? m.add_spawn( mon_marloss_zealot_f, 1, where ) : + m.add_spawn( mon_marloss_zealot_m, 1, where ); } } } @@ -793,7 +793,7 @@ static void mx_drugdeal( map &m, const tripoint &abs_sub ) m.spawn_item( point( x, y ), drugtype, 0, drugs_placed ); } if( one_in( 10 ) ) { - m.add_spawn( mon_zombie_spitter, 1, point( x, y ) ); + m.add_spawn( mon_zombie_spitter, 1, { x, y, abs_sub.z } ); } else { m.place_items( "map_extra_drugdeal", 100, point( x, y ), point( x, y ), true, calendar::start_of_cataclysm ); @@ -827,7 +827,7 @@ static void mx_drugdeal( map &m, const tripoint &abs_sub ) if( tries < 10 ) { // We found a valid spot! if( one_in( 20 ) ) { - m.add_spawn( mon_zombie_smoker, 1, point( x, y ) ); + m.add_spawn( mon_zombie_smoker, 1, { x, y, abs_sub.z } ); } else { m.place_items( "map_extra_drugdeal", 100, point( x, y ), point( x, y ), true, calendar::start_of_cataclysm ); @@ -1676,14 +1676,14 @@ static void mx_anomaly( map &m, const tripoint &abs_sub ) m.spawn_natural_artifact( center, prop ); } -static void mx_shia( map &m, const tripoint & ) +static void mx_shia( map &m, const tripoint &loc ) { // A rare chance to spawn Shia. This was extracted from the hardcoded forest mapgen // and moved into a map extra, but it still has a one_in chance of spawning because // otherwise the extreme rarity of this event wildly skewed the values for all of the // other extras. if( one_in( 5000 ) ) { - m.add_spawn( mon_shia, 1, point( SEEX, SEEY ) ); + m.add_spawn( mon_shia, 1, { SEEX, SEEY, loc.z } ); } } @@ -1709,10 +1709,10 @@ static void mx_spider( map &m, const tripoint &abs_sub ) m.ter_set( point( 12, 12 ), t_dirt ); m.furn_set( point( 12, 12 ), f_egg_sackws ); m.remove_field( { 12, 12, m.get_abs_sub().z }, fd_web ); - m.add_spawn( mon_spider_web, rng( 1, 2 ), point( SEEX, SEEY ) ); + m.add_spawn( mon_spider_web, rng( 1, 2 ), { SEEX, SEEY, abs_sub.z } ); } -static void mx_jabberwock( map &m, const tripoint & ) +static void mx_jabberwock( map &m, const tripoint &loc ) { // A rare chance to spawn a jabberwock. This was extracted from the harcoded forest mapgen // and moved into a map extra. It still has a one_in chance of spawning because otherwise @@ -1720,7 +1720,7 @@ static void mx_jabberwock( map &m, const tripoint & ) // into the monster group, but again the hardcoded rarity it had in the forest mapgen was // not easily replicated there. if( one_in( 50 ) ) { - m.add_spawn( mon_jabberwock, 1, point( SEEX, SEEY ) ); + m.add_spawn( mon_jabberwock, 1, { SEEX, SEEY, loc.z } ); } } diff --git a/src/map_field.cpp b/src/map_field.cpp index 253306c4de5c1..15981304877e3 100644 --- a/src/map_field.cpp +++ b/src/map_field.cpp @@ -1084,11 +1084,12 @@ bool map::process_fields_in_submap( submap *const current_submap, if( !spawn_details.name ) { continue; } - if( const auto spawn_point = random_point( points_in_radius( p, - cur.monster_spawn_radius() ), [this]( const tripoint & n ) { + if( const cata::optional spawn_point = random_point( + points_in_radius( p, cur.monster_spawn_radius() ), + [this]( const tripoint & n ) { return passable( n ); } ) ) { - add_spawn( spawn_details.name, spawn_details.pack_size, spawn_point->xy() ); + add_spawn( spawn_details.name, spawn_details.pack_size, *spawn_point ); } } } diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 4eb206c519909..1a1879cc23c67 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -179,10 +179,11 @@ void map::generate( const tripoint &p, const time_point &when ) if( !spawn_details.name ) { continue; } - if( const auto p = random_point( *this, [this]( const tripoint & n ) { + if( const cata::optional p = + random_point( *this, [this]( const tripoint & n ) { return passable( n ); } ) ) { - add_spawn( spawn_details.name, spawn_details.pack_size, p->xy() ); + add_spawn( spawn_details.name, spawn_details.pack_size, *p ); } } } @@ -1207,8 +1208,6 @@ class jmapgen_monster : public jmapgen_piece mission_id = dat.mission()->get_id(); } - - int spawn_count = roll_remainder( density_multiplier ); if( one_or_none ) { // don't let high spawn density alone cause more than 1 to spawn. @@ -1224,11 +1223,13 @@ class jmapgen_monster : public jmapgen_piece if( m_id != mongroup_id::NULL_ID() ) { MonsterGroupResult spawn_details = MonsterGroupManager::GetResultFromGroup( m_id ); - dat.m.add_spawn( spawn_details.name, spawn_count * pack_size.get(), point( x.get(), y.get() ), - friendly, -1, mission_id, name ); + dat.m.add_spawn( spawn_details.name, spawn_count * pack_size.get(), + { x.get(), y.get(), dat.m.get_abs_sub().z }, + friendly, -1, mission_id, name ); } else { - dat.m.add_spawn( *( ids.pick() ), spawn_count * pack_size.get(), point( x.get(), y.get() ), - friendly, -1, mission_id, name ); + dat.m.add_spawn( *( ids.pick() ), spawn_count * pack_size.get(), + { x.get(), y.get(), dat.m.get_abs_sub().z }, + friendly, -1, mission_id, name ); } } }; @@ -5785,8 +5786,8 @@ void map::place_spawns( const mongroup_id &group, const int chance, // Pick a monster type MonsterGroupResult spawn_details = MonsterGroupManager::GetResultFromGroup( group, &num ); - add_spawn( spawn_details.name, spawn_details.pack_size, point( x, y ), friendly, -1, mission_id, - name ); + add_spawn( spawn_details.name, spawn_details.pack_size, { x, y, abs_sub.z }, + friendly, -1, mission_id, name ); } } @@ -5921,7 +5922,7 @@ std::vector map::put_items_from_loc( const items_location &loc, const tr return spawn_items( p, items ); } -void map::add_spawn( const mtype_id &type, int count, const point &p, bool friendly, +void map::add_spawn( const mtype_id &type, int count, const tripoint &p, bool friendly, int faction_id, int mission_id, const std::string &name ) const { if( p.x < 0 || p.x >= SEEX * my_MAPSIZE || p.y < 0 || p.y >= SEEY * my_MAPSIZE ) { @@ -5932,8 +5933,8 @@ void map::add_spawn( const mtype_id &type, int count, const point &p, bool frien submap *place_on_submap = get_submap_at( p, offset ); if( !place_on_submap ) { - debugmsg( "centadodecamonant doesn't exist in grid; within add_spawn(%s, %d, %d, %d)", - type.c_str(), count, p.x, p.y ); + debugmsg( "centadodecamonant doesn't exist in grid; within add_spawn(%s, %d, %d, %d, %d)", + type.c_str(), count, p.x, p.y, p.z ); return; } if( MonsterGroupManager::monster_is_blacklisted( type ) ) { diff --git a/src/mapgen_functions.cpp b/src/mapgen_functions.cpp index bcaed432731bf..d861fc1f44aeb 100644 --- a/src/mapgen_functions.cpp +++ b/src/mapgen_functions.cpp @@ -307,8 +307,8 @@ void mapgen_hive( mapgendata &dat ) m->ter_set( point( i + k, j + l ), t_floor_wax ); } } - m->add_spawn( mon_bee, 2, point( i, j ) ); - m->add_spawn( mon_beekeeper, 1, point( i, j ) ); + m->add_spawn( mon_bee, 2, { i, j, m->get_abs_sub().z } ); + m->add_spawn( mon_beekeeper, 1, { i, j, m->get_abs_sub().z } ); m->ter_set( point( i, j - 3 ), t_floor_wax ); m->ter_set( point( i, j + 3 ), t_floor_wax ); m->ter_set( point( i - 1, j - 2 ), t_floor_wax ); @@ -887,7 +887,7 @@ void mapgen_road( mapgendata &dat ) dat.monster_density() ); // 1 per 10 overmaps if( one_in( 10000 ) ) { - m->add_spawn( mon_zombie_jackson, 1, point( SEEX, SEEY ) ); + m->add_spawn( mon_zombie_jackson, 1, { SEEX, SEEY, m->get_abs_sub().z } ); } } @@ -2025,11 +2025,11 @@ void mapgen_cave_rat( mapgendata &dat ) for( int i = SEEX - 4; i <= SEEX + 4; i++ ) { for( int j = SEEY - 4; j <= SEEY + 4; j++ ) { if( ( i <= SEEX - 2 || i >= SEEX + 2 ) && ( j <= SEEY - 2 || j >= SEEY + 2 ) ) { - m->add_spawn( mon_sewer_rat, 1, point( i, j ) ); + m->add_spawn( mon_sewer_rat, 1, { i, j, m->get_abs_sub().z } ); } } } - m->add_spawn( mon_rat_king, 1, point( SEEX, SEEY ) ); + m->add_spawn( mon_rat_king, 1, { SEEX, SEEY, m->get_abs_sub().z } ); m->place_items( "rare", 75, point( SEEX - 4, SEEY - 4 ), point( SEEX + 4, SEEY + 4 ), true, dat.when() ); } else { @@ -2049,7 +2049,7 @@ void mapgen_cave_rat( mapgendata &dat ) madd_field( m, cx, cy, fd_blood, rng( 1, 3 ) ); } if( one_in( 20 ) ) { - m->add_spawn( mon_sewer_rat, 1, point( cx, cy ) ); + m->add_spawn( mon_sewer_rat, 1, { cx, cy, m->get_abs_sub().z } ); } } } @@ -2069,7 +2069,7 @@ void mapgen_cave_rat( mapgendata &dat ) madd_field( m, cx, cy, fd_blood, rng( 1, 3 ) ); } if( one_in( 20 ) ) { - m->add_spawn( mon_sewer_rat, 1, point( cx, cy ) ); + m->add_spawn( mon_sewer_rat, 1, { cx, cy, m->get_abs_sub().z } ); } } } @@ -2613,9 +2613,9 @@ static void mapgen_ants_generic( mapgendata &dat ) m->place_items( "ant_egg", 98, point_zero, point( SEEX * 2 - 1, SEEY * 2 - 1 ), true, dat.when() ); } if( dat.terrain_type() == "ants_queen" ) { - m->add_spawn( mon_ant_queen, 1, point( SEEX, SEEY ) ); + m->add_spawn( mon_ant_queen, 1, { SEEX, SEEY, m->get_abs_sub().z } ); } else if( dat.terrain_type() == "ants_larvae" ) { - m->add_spawn( mon_ant_larva, 10, point( SEEX, SEEY ) ); + m->add_spawn( mon_ant_larva, 10, { SEEX, SEEY, m->get_abs_sub().z } ); } } @@ -2632,7 +2632,7 @@ void mapgen_ants_larvae( mapgendata &dat ) mapgen_ants_generic( dat ); dat.m.place_items( "ant_egg", 98, point_zero, point( SEEX * 2 - 1, SEEY * 2 - 1 ), true, dat.when() ); - dat.m.add_spawn( mon_ant_larva, 10, point( SEEX, SEEY ) ); + dat.m.add_spawn( mon_ant_larva, 10, { SEEX, SEEY, dat.m.get_abs_sub().z } ); } void mapgen_ants_queen( mapgendata &dat ) @@ -2640,7 +2640,7 @@ void mapgen_ants_queen( mapgendata &dat ) mapgen_ants_generic( dat ); dat.m.place_items( "ant_egg", 98, point_zero, point( SEEX * 2 - 1, SEEY * 2 - 1 ), true, dat.when() ); - dat.m.add_spawn( mon_ant_queen, 1, point( SEEX, SEEY ) ); + dat.m.add_spawn( mon_ant_queen, 1, { SEEX, SEEY, dat.m.get_abs_sub().z } ); } void mapgen_tutorial( mapgendata &dat ) diff --git a/src/mission_start.cpp b/src/mission_start.cpp index ea08e2e866002..672155a5b0d81 100644 --- a/src/mission_start.cpp +++ b/src/mission_start.cpp @@ -59,7 +59,7 @@ void mission_start::place_dog( mission *miss ) tinymap doghouse; doghouse.load( tripoint( house.x * 2, house.y * 2, house.z ), false ); - doghouse.add_spawn( mon_dog, 1, point( SEEX, SEEY ), true, -1, miss->uid ); + doghouse.add_spawn( mon_dog, 1, { SEEX, SEEY, house.z }, true, -1, miss->uid ); doghouse.save(); } @@ -72,7 +72,7 @@ void mission_start::place_zombie_mom( mission *miss ) tinymap zomhouse; zomhouse.load( tripoint( house.x * 2, house.y * 2, house.z ), false ); - zomhouse.add_spawn( mon_zombie, 1, point( SEEX, SEEY ), false, -1, miss->uid, + zomhouse.add_spawn( mon_zombie, 1, { SEEX, SEEY, house.z }, false, -1, miss->uid, Name::get( nameIsFemaleName | nameIsGivenName ) ); zomhouse.save(); } @@ -102,21 +102,21 @@ void mission_start::kill_horde_master( mission *miss ) overmap_buffer.reveal( site, 6 ); tinymap tile; tile.load( tripoint( site.x * 2, site.y * 2, site.z ), false ); - tile.add_spawn( mon_zombie_master, 1, point( SEEX, SEEY ), false, -1, miss->uid, + tile.add_spawn( mon_zombie_master, 1, { SEEX, SEEY, site.z }, false, -1, miss->uid, _( "Demonic Soul" ) ); - tile.add_spawn( mon_zombie_brute, 3, point( SEEX, SEEY ) ); - tile.add_spawn( mon_zombie_dog, 3, point( SEEX, SEEY ) ); + tile.add_spawn( mon_zombie_brute, 3, { SEEX, SEEY, site.z } ); + tile.add_spawn( mon_zombie_dog, 3, { SEEX, SEEY, site.z } ); if( overmap::inbounds( tripoint( SEEX, SEEY, 0 ), 1 ) ) { for( int x = SEEX - 1; x <= SEEX + 1; x++ ) { for( int y = SEEY - 1; y <= SEEY + 1; y++ ) { - tile.add_spawn( mon_zombie, rng( 3, 10 ), point( x, y ) ); + tile.add_spawn( mon_zombie, rng( 3, 10 ), { x, y, site.z } ); } - tile.add_spawn( mon_zombie_dog, rng( 0, 2 ), point( SEEX, SEEY ) ); + tile.add_spawn( mon_zombie_dog, rng( 0, 2 ), { SEEX, SEEY, site.z } ); } } - tile.add_spawn( mon_zombie_necro, 2, point( SEEX, SEEY ) ); - tile.add_spawn( mon_zombie_hulk, 1, point( SEEX, SEEY ) ); + tile.add_spawn( mon_zombie_necro, 2, { SEEX, SEEY, site.z } ); + tile.add_spawn( mon_zombie_hulk, 1, { SEEX, SEEY, site.z } ); tile.save(); } diff --git a/src/monster.cpp b/src/monster.cpp index 0c3e76417bc7f..251116dfee51a 100644 --- a/src/monster.cpp +++ b/src/monster.cpp @@ -443,7 +443,7 @@ void monster::try_reproduce() if( season_match && female && one_in( chance ) ) { int spawn_cnt = rng( 1, type->baby_count ); if( type->baby_monster ) { - g->m.add_spawn( type->baby_monster, spawn_cnt, pos().xy() ); + g->m.add_spawn( type->baby_monster, spawn_cnt, pos() ); } else { g->m.add_item_or_charges( pos(), item( type->baby_egg, *baby_timer, spawn_cnt ), true ); }