Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some uses of part_at() to use precalc positions #72658

Merged
merged 2 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13309,7 +13309,7 @@ ret_val<void> item::link_to( vehicle &veh, const point &mount, link_state link_t
} else if( !veh.is_external_part( veh.mount_to_tripoint( mount ) ) ) {
return ret_val<void>::make_failure( _( "You can't attach a tow-line to an internal part." ) );
} else {
const int part_at = veh.part_at( mount );
const int part_at = veh.part_at( veh.coord_translate( mount ) );
if( part_at != -1 && !veh.part( part_at ).carried_stack.empty() ) {
return ret_val<void>::make_failure( _( "You can't attach a tow-line to a racked part." ) );
}
Expand Down
6 changes: 3 additions & 3 deletions src/veh_appliance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void veh_app_interact::remove()
if( auto sel_part = here.veh_at( a_point_bub ).part_with_feature( VPFLAG_APPLIANCE, false ) ) {
vp = &sel_part->part();
} else {
int const part = veh->part_at( a_point );
int const part = veh->part_at( veh->coord_translate( a_point ) );
vp = &veh->part( part >= 0 ? part : 0 );
}
const vpart_info &vpinfo = vp->info();
Expand Down Expand Up @@ -512,7 +512,7 @@ void veh_app_interact::remove()

void veh_app_interact::plug()
{
const int part = veh->part_at( a_point );
const int part = veh->part_at( veh->coord_translate( a_point ) );
const tripoint pos = veh->global_part_pos3( part );
item cord( "power_cord" );
cord.link_to( *veh, a_point, link_state::automatic );
Expand Down Expand Up @@ -564,7 +564,7 @@ void veh_app_interact::populate_app_actions()
if( auto sel_part = here.veh_at( a_point_bub ).part_with_feature( VPFLAG_APPLIANCE, false ) ) {
vp = &sel_part->part();
} else {
const int part = veh->part_at( a_point );
const int part = veh->part_at( veh->coord_translate( a_point ) );
vp = &veh->part( part >= 0 ? part : 0 );
}

Expand Down
Loading