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

Method getAllByKey

library/modules/Persistence.cpp:418–432  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

416}
417
418void Persistence::getAllByKey(std::vector<PersistentDataItem> &vec, int entity_id, const std::string &key) {
419 vec.clear();
420
421 if (!is_good_entity_id(entity_id) || !Core::getInstance().isWorldLoaded())
422 return;
423
424 CoreSuspender suspend;
425
426 if (!store.contains(entity_id))
427 return;
428
429 auto range = store[entity_id].equal_range(key);
430 for (auto it = range.first; it != range.second; ++it)
431 vec.emplace_back(it->second);
432}
433
434uint32_t Persistence::getUnsavedSeconds() {
435 uint32_t durMS = Core::getInstance().p->getTickCount() - lastLoadSaveTickCount;

Callers

nothing calls this directly

Calls 3

is_good_entity_idFunction · 0.85
containsMethod · 0.80
clearMethod · 0.45

Tested by

no test coverage detected