Skip to content

Commit

Permalink
CleverRaven#40 NPCが全体マップをまたいでもついてくるように& CleverRaven#41 Z軸をまたいだFTLができるように
Browse files Browse the repository at this point in the history
ちょっとミスって同じコミットになっちた。
  • Loading branch information
roloa committed Apr 30, 2020
1 parent e6cb153 commit 03c35d8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<monster>( *passenger ),
passenger->pos(),
monster_warp_dest_pos,
fallback_radius );
}

Expand Down
4 changes: 3 additions & 1 deletion src/mapgen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<vehicle> veh, const tripoint& /*dest*/ ) {
void map::place_vehicle_ftl( std::unique_ptr<vehicle> veh, const tripoint& om_dest ) {

// all of this method is almost copy pesta from half of bottom of map::add_vehicle

Expand All @@ -6050,6 +6050,8 @@ void map::place_vehicle_ftl( std::unique_ptr<vehicle> 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<vehicle> placed_vehicle_up =
add_vehicle_to_map( std::move( veh ), true );
vehicle *placed_vehicle = placed_vehicle_up.get();
Expand Down

0 comments on commit 03c35d8

Please sign in to comment.