MCPcopy Create free account
hub / github.com/DFHack/dfhack / command_result plugin_load_site_data

Function command_result plugin_load_site_data

plugins/seedwatch.cpp:183–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

181}
182
183DFhackCExport 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
211DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) {
212 if (event == DFHack::SC_WORLD_UNLOADED) {

Callers

nothing calls this directly

Calls 6

validate_seed_configFunction · 0.85
seedwatch_setTargetFunction · 0.85
clearMethod · 0.45
sizeMethod · 0.45
isValidMethod · 0.45
printMethod · 0.45

Tested by

no test coverage detected