MCPcopy Create free account
hub / github.com/DFHack/dfhack / remove

Method remove

library/modules/Items.cpp:1044–1063  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1042}
1043
1044bool Items::remove(df::item *item, bool no_uncat) {
1045 CHECK_NULL_POINTER(item);
1046
1047 if (auto spec_ref = getSpecificRef(item, specific_ref_type::JOB))
1048 Job::removeJob(spec_ref->data.job);
1049 if (!detachItem(item))
1050 return false;
1051 if (auto pos = getPosition(item); pos.isValid())
1052 item->pos = pos;
1053 if (!no_uncat)
1054 item->uncategorize();
1055
1056 // Hide them from jobs and the UI until the item can be garbage collected
1057 item->flags.bits.forbid = true;
1058 item->flags.bits.hidden = true;
1059
1060 item->flags.bits.removed = true;
1061 item->flags.bits.garbage_collect = !no_uncat;
1062 return true;
1063}
1064
1065df::proj_itemst *Items::makeProjectile(df::item *item)
1066{ using df::global::proj_next_id;

Callers 3

prompt_loopMethod · 0.45
prompt_loopMethod · 0.45
uninstall_reset_pointFunction · 0.45

Calls 2

detachItemFunction · 0.85
isValidMethod · 0.45

Tested by

no test coverage detected