| 81 | } |
| 82 | |
| 83 | DFhackCExport command_result plugin_load_site_data (color_ostream &out) { |
| 84 | cycle_timestamp = 0; |
| 85 | config = World::GetPersistentSiteData(CONFIG_KEY); |
| 86 | |
| 87 | if (!config.isValid()) { |
| 88 | DEBUG(control,out).print("no config found in this save; initializing\n"); |
| 89 | config = World::AddPersistentSiteData(CONFIG_KEY); |
| 90 | config.set_bool(CONFIG_IS_ENABLED, is_enabled); |
| 91 | } |
| 92 | |
| 93 | // we have to copy our enabled flag into the global plugin variable, but |
| 94 | // all the other state we can directly read/modify from the persistent |
| 95 | // data structure. |
| 96 | is_enabled = config.get_bool(CONFIG_IS_ENABLED); |
| 97 | DEBUG(control,out).print("loading persisted enabled state: {}\n", |
| 98 | is_enabled ? "true" : "false"); |
| 99 | did_complain = false; |
| 100 | return CR_OK; |
| 101 | } |
| 102 | |
| 103 | DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) { |
| 104 | if (event == DFHack::SC_WORLD_UNLOADED) { |