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

Method deleteItem

library/modules/Persistence.cpp:366–383  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

364}
365
366bool Persistence::deleteItem(const PersistentDataItem &item) {
367 if (!item.isValid())
368 return false;
369
370 CoreSuspender suspend;
371
372 int entity_id = item.entity_id();
373
374 auto range = store[entity_id].equal_range(item.key());
375 for (auto it = range.first; it != range.second; ++it) {
376 if (it->second->isReferencedBy(item)) {
377 entry_cache.erase(it->second->entry_id);
378 store[entity_id].erase(it);
379 break;
380 }
381 }
382 return true;
383}
384
385void Persistence::getAll(std::vector<PersistentDataItem> &vec, int entity_id) {
386 vec.clear();

Callers

nothing calls this directly

Calls 4

entity_idMethod · 0.80
isReferencedByMethod · 0.80
isValidMethod · 0.45
eraseMethod · 0.45

Tested by

no test coverage detected