| 181 | } |
| 182 | |
| 183 | DFhackCExport command_result plugin_load_site_data (color_ostream &out) { |
| 184 | cycle_timestamp = 0; |
| 185 | |
| 186 | watched_seeds.clear(); |
| 187 | vector<PersistentDataItem> seed_configs; |
| 188 | World::GetPersistentSiteData(&seed_configs, SEED_CONFIG_KEY_PREFIX, true); |
| 189 | const size_t num_seed_configs = seed_configs.size(); |
| 190 | for (size_t idx = 0; idx < num_seed_configs; ++idx) { |
| 191 | auto& c = seed_configs[idx]; |
| 192 | if (validate_seed_config(out, c)) |
| 193 | watched_seeds.emplace(c.get_int(SEED_CONFIG_ID), c); |
| 194 | } |
| 195 | |
| 196 | config = World::GetPersistentSiteData(CONFIG_KEY); |
| 197 | |
| 198 | if (!config.isValid()) { |
| 199 | DEBUG(control,out).print("no config found in this save; initializing\n"); |
| 200 | config = World::AddPersistentSiteData(CONFIG_KEY); |
| 201 | config.set_bool(CONFIG_IS_ENABLED, is_enabled); |
| 202 | seedwatch_setTarget(out, "all", DEFAULT_TARGET); |
| 203 | } |
| 204 | |
| 205 | is_enabled = config.get_bool(CONFIG_IS_ENABLED); |
| 206 | DEBUG(control,out).print("loading persisted enabled state: {}\n", |
| 207 | is_enabled ? "true" : "false"); |
| 208 | return CR_OK; |
| 209 | } |
| 210 | |
| 211 | DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) { |
| 212 | if (event == DFHack::SC_WORLD_UNLOADED) { |
nothing calls this directly
no test coverage detected