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

Method save_state

plugins/autofarm.cpp:404–422  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

402 }
403
404 void save_state(color_ostream& out)
405 {
406 cfg_default_threshold.ival(0) = defaultThreshold;
407 cfg_enabled.ival(0) = enabled;
408
409 std::vector<PersistentDataItem> items;
410 World::GetPersistentSiteData(&items, "autofarm/threshold/", true);
411 for (auto& i : items)
412 World::DeletePersistentData(i);
413
414 for (const auto& t : thresholds)
415 {
416 const std::string& plantID = world->raws.plants.all[t.first]->id;
417 const std::string keyName = "autofarm/threshold/" + plantID;
418 PersistentDataItem cfgThreshold = World::AddPersistentSiteData(keyName);
419 cfgThreshold.val() = plantID;
420 cfgThreshold.ival(0) = t.second;
421 }
422 }
423
424};
425

Callers 3

setThresholdsFunction · 0.80
autofarmFunction · 0.80

Calls 1

ivalMethod · 0.80

Tested by

no test coverage detected