| 235 | } |
| 236 | |
| 237 | DFhackCExport command_result plugin_load_site_data(color_ostream &out) { |
| 238 | cycle_timestamp = 0; |
| 239 | auto enabled = World::GetPersistentSiteData(CONFIG_KEY); |
| 240 | if (!enabled.isValid()) { |
| 241 | DEBUG(control, out).print("no config found in this save; initializing\n"); |
| 242 | enabled = World::AddPersistentSiteData(CONFIG_KEY); |
| 243 | enabled.set_bool(CONFIG_IS_ENABLED, is_enabled); |
| 244 | } |
| 245 | |
| 246 | is_enabled = enabled.get_bool(CONFIG_IS_ENABLED); |
| 247 | DEBUG(control, out).print("loading persisted enabled state: {}\n", |
| 248 | is_enabled ? "true" : "false"); |
| 249 | |
| 250 | // Parse constraints |
| 251 | vector<PersistentDataItem> items; |
| 252 | World::GetPersistentSiteData(&items, "autoclothing/clothingItems"); |
| 253 | |
| 254 | for (auto &item : items) { |
| 255 | if (!item.isValid()) |
| 256 | continue; |
| 257 | ClothingRequirement req; |
| 258 | req.Deserialize(item.get_str()); |
| 259 | clothingOrders.push_back(req); |
| 260 | out << "autoclothing added " << req.ToReadableLabel() << endl; |
| 261 | } |
| 262 | return CR_OK; |
| 263 | } |
| 264 | |
| 265 | DFhackCExport command_result plugin_save_site_data(color_ostream &out) { |
| 266 | for (auto &order : clothingOrders) |
nothing calls this directly
no test coverage detected