diff --git a/src/game.cpp b/src/game.cpp index 9c2b2d2bd636e..a79a183926ddb 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -9491,19 +9491,24 @@ void game::ftl_drive( const tripoint &om_dest, vehicle& veh ) load_map( map_om_pos ); // restore vehicle - m.place_vehicle_ftl( std::move(warping_veh), u.pos() ); + m.place_vehicle_ftl( std::move(warping_veh), om_dest ); // restore npc for( npc* passenger_npc : passenger_list_npc) { - passenger_npc->spawn_at_precise( { get_levx(), get_levy() }, passenger_npc->pos() ); + //passenger_npc->spawn_at_precise( { get_levx(), get_levy() }, passenger_npc->pos() ); + tripoint npc_warp_dest_pos = passenger_npc->pos(); + npc_warp_dest_pos.z = om_dest.z; + passenger_npc->setpos( npc_warp_dest_pos ); } // restore monster for( monster* passenger : passenger_list) { int fallback_radius = 2; // TODO handle case that when if monster does not placed // monster *const placed = + tripoint monster_warp_dest_pos = passenger->pos(); + monster_warp_dest_pos.z = om_dest.z; place_critter_around( make_shared_fast( *passenger ), - passenger->pos(), + monster_warp_dest_pos, fallback_radius ); } diff --git a/src/mapgen.cpp b/src/mapgen.cpp index 783261cb7f2c9..b01125d6a8fd0 100644 --- a/src/mapgen.cpp +++ b/src/mapgen.cpp @@ -6032,7 +6032,7 @@ vehicle *map::add_vehicle( const vproto_id &type, const tripoint &p, const int d } // for variant FTL -void map::place_vehicle_ftl( std::unique_ptr veh, const tripoint& /*dest*/ ) { +void map::place_vehicle_ftl( std::unique_ptr veh, const tripoint& om_dest ) { // all of this method is almost copy pesta from half of bottom of map::add_vehicle @@ -6050,6 +6050,8 @@ void map::place_vehicle_ftl( std::unique_ptr veh, const tripoint& /*des //debugmsg("adding veh: %d, sm: %d,%d,%d, pos: %d, %d", veh, veh->smx, veh->smy, veh->smz, veh->posx, veh->posy); + veh->sm_pos.z = om_dest.z; + std::unique_ptr placed_vehicle_up = add_vehicle_to_map( std::move( veh ), true ); vehicle *placed_vehicle = placed_vehicle_up.get();