| 123 | } |
| 124 | |
| 125 | DFhackCExport command_result plugin_load_site_data(color_ostream &out) { |
| 126 | cycle_timestamp = 0; |
| 127 | is_painting_warm = false; |
| 128 | is_painting_damp = false; |
| 129 | |
| 130 | warm_config = World::GetPersistentSiteData(WARM_CONFIG_KEY); |
| 131 | damp_config = World::GetPersistentSiteData(DAMP_CONFIG_KEY); |
| 132 | |
| 133 | if (!warm_config.isValid()) { |
| 134 | DEBUG(log,out).print("no warm dig config found in this save; initializing\n"); |
| 135 | warm_config = World::AddPersistentSiteData(WARM_CONFIG_KEY); |
| 136 | } |
| 137 | if (!damp_config.isValid()) { |
| 138 | DEBUG(log,out).print("no damp dig config found in this save; initializing\n"); |
| 139 | damp_config = World::AddPersistentSiteData(DAMP_CONFIG_KEY); |
| 140 | } |
| 141 | |
| 142 | for (auto & block : world->map.map_blocks) { |
| 143 | auto warm_mask = World::getPersistentTilemask(warm_config, block); |
| 144 | auto damp_mask = World::getPersistentTilemask(damp_config, block); |
| 145 | if (warm_mask || damp_mask) { |
| 146 | do_enable(true); |
| 147 | break; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | return CR_OK; |
| 152 | } |
| 153 | |
| 154 | DFhackCExport command_result plugin_onstatechange(color_ostream &out, state_change_event event) { |
| 155 | if (event == DFHack::SC_WORLD_UNLOADED) { |