| 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 |
no test coverage detected