From 03c35d80f1f28903b38b9aad350f235b40b8f48d Mon Sep 17 00:00:00 2001 From: roloa Date: Thu, 30 Apr 2020 21:25:08 +0900 Subject: [PATCH] =?UTF-8?q?#40=20NPC=E3=81=8C=E5=85=A8=E4=BD=93=E3=83=9E?= =?UTF-8?q?=E3=83=83=E3=83=97=E3=82=92=E3=81=BE=E3=81=9F=E3=81=84=E3=81=A7?= =?UTF-8?q?=E3=82=82=E3=81=A4=E3=81=84=E3=81=A6=E3=81=8F=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=EF=BC=86=20#41=20Z=E8=BB=B8=E3=82=92?= =?UTF-8?q?=E3=81=BE=E3=81=9F=E3=81=84=E3=81=A0FTL=E3=81=8C=E3=81=A7?= =?UTF-8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ちょっとミスって同じコミットになっちた。 --- src/game.cpp | 11 ++++++++--- src/mapgen.cpp | 4 +++- 2 files changed, 11 insertions(+), 4 deletions(-) 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();