Skip to content

Commit

Permalink
fix: invalidate mass when moving items to/from vehicles (#3569)
Browse files Browse the repository at this point in the history
* Invalidate mass when moving items to/from vehicles

* style(autofix.ci): automated formatting

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
  • Loading branch information
joveeater and autofix-ci[bot] committed Nov 5, 2023
1 parent 8527fff commit 901d14c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/locations.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,12 +413,15 @@ item_location_type vehicle_item_location::where() const

detached_ptr<item> vehicle_item_location::detach( item *it )
{
return veh->get_part_hack( hack_id ).remove_item( *it );
detached_ptr<item> ret = veh->get_part_hack( hack_id ).remove_item( *it );
veh->invalidate_mass();
return ret;
}

void vehicle_item_location::attach( detached_ptr<item> &&obj )
{
veh->get_part_hack( hack_id ).add_item( std::move( obj ) );
veh->invalidate_mass();
}

int vehicle_item_location::obtain_cost( const Character &ch, int qty, const item *it ) const
Expand Down

0 comments on commit 901d14c

Please sign in to comment.