Skip to content

Commit

Permalink
Merge pull request CleverRaven#75020 from PatrikLundell/item_locator
Browse files Browse the repository at this point in the history
Fixed deconstruction save/load item_location loss and screwed progress
  • Loading branch information
Maleclypse authored Jul 18, 2024
2 parents 45c6c30 + bc7e524 commit db34351
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/activity_actor_definitions.h
Original file line number Diff line number Diff line change
Expand Up @@ -1256,7 +1256,7 @@ class disassemble_activity_actor : public activity_actor
int moves_total;
float activity_override = NO_EXERCISE; // NOLINT(cata-serialize)
float cached_workbench_multiplier; // NOLINT(cata-serialize)
bool use_cached_workbench_multiplier; // NOLINT(cata-serialize)
bool use_cached_workbench_multiplier = false; // NOLINT(cata-serialize)
public:
item_location target;

Expand Down
15 changes: 10 additions & 5 deletions src/visitable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -471,8 +471,13 @@ const
VisitResponse map_cursor::visit_items(
const std::function<VisitResponse( item *, item * )> &func ) const
{
map &here = get_map();
tripoint p = pos().raw();
smallmap here; // tinymap would work as well, as we're only looking at a single position.
// pos returns the pos_bub location of the target relative to the reality bubble
// even if the location isn't actually inside of it. Thus, we're loading a map
// around that location to do our work.
tripoint_abs_ms abs_pos = get_map().getglobal( pos() );
here.load( project_to<coords::omt>( abs_pos ), false );
tripoint_omt_ms p = tripoint_omt_ms( here.getlocal( abs_pos ) );

// check furniture pseudo items
if( here.furn( p ) != furn_str_id::NULL_ID() ) {
Expand All @@ -486,12 +491,12 @@ VisitResponse map_cursor::visit_items(
}

// skip inaccessible items
if( here.has_flag( ter_furn_flag::TFLAG_SEALED, p ) &&
!here.has_flag( ter_furn_flag::TFLAG_LIQUIDCONT, p ) ) {
if( here.has_flag( ter_furn_flag::TFLAG_SEALED, p.raw() ) &&
!here.has_flag( ter_furn_flag::TFLAG_LIQUIDCONT, p.raw() ) ) {
return VisitResponse::NEXT;
}

for( item &e : here.i_at( p ) ) {
for( item &e : here.i_at( p.raw() ) ) {
if( visit_internal( func, &e ) == VisitResponse::ABORT ) {
return VisitResponse::ABORT;
}
Expand Down

0 comments on commit db34351

Please sign in to comment.