From 901d14c65a9f86a7e3f1c116cb2a8816e915c005 Mon Sep 17 00:00:00 2001 From: joveeater Date: Sun, 5 Nov 2023 14:54:18 +0000 Subject: [PATCH] fix: invalidate mass when moving items to/from vehicles (#3569) * 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> --- src/locations.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/locations.cpp b/src/locations.cpp index 9bcf7e33c260..044b9814a525 100644 --- a/src/locations.cpp +++ b/src/locations.cpp @@ -413,12 +413,15 @@ item_location_type vehicle_item_location::where() const detached_ptr vehicle_item_location::detach( item *it ) { - return veh->get_part_hack( hack_id ).remove_item( *it ); + detached_ptr ret = veh->get_part_hack( hack_id ).remove_item( *it ); + veh->invalidate_mass(); + return ret; } void vehicle_item_location::attach( detached_ptr &&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