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

Method addItem

library/modules/Persistence.cpp:339–348  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

337}
338
339PersistentDataItem Persistence::addItem(int entity_id, const std::string &key) {
340 if (!is_good_entity_id(entity_id) || key.empty() || !Core::getInstance().isWorldLoaded())
341 return PersistentDataItem();
342
343 CoreSuspender suspend;
344
345 auto ptr = std::shared_ptr<DataEntry>(new DataEntry(entity_id, key));
346 add_entry(entity_id, ptr);
347 return PersistentDataItem(ptr);
348}
349
350PersistentDataItem Persistence::getByKey(int entity_id, const std::string &key, bool *added) {
351 if (!is_good_entity_id(entity_id) || key.empty() || !Core::getInstance().isWorldLoaded())

Callers

nothing calls this directly

Calls 4

is_good_entity_idFunction · 0.85
PersistentDataItemFunction · 0.85
add_entryFunction · 0.85
emptyMethod · 0.45

Tested by

no test coverage detected