| 196 | static PersistentDataItem warm_config, damp_config; |
| 197 | |
| 198 | static void init_caches(DFHack::color_ostream &out, bool cache_engravings) { |
| 199 | if (cache_engravings) { |
| 200 | // initialize the engravings cache |
| 201 | for (auto engraving : world->event.engravings) { |
| 202 | engravings_cache.emplace(engraving->pos, engraving); |
| 203 | } |
| 204 | } |
| 205 | |
| 206 | df::job_list_link *link = world->jobs.list.next; |
| 207 | for (; link; link = link->next) { |
| 208 | auto job = link->item; |
| 209 | auto type = ENUM_ATTR(job_type, type, job->job_type); |
| 210 | if (type != job_type_class::Digging && type != job_type_class::Carving && type != job_type_class::Gathering) |
| 211 | continue; |
| 212 | dig_job_cache.emplace(job->pos, job); |
| 213 | } |
| 214 | |
| 215 | Lua::CallLuaModuleFunction(out, "plugins.dig", "getWarmConfigKey", {}, 1, [&](lua_State *L){ |
| 216 | string warm_key = lua_tostring(L, -1); |
| 217 | warm_config = World::GetPersistentSiteData(warm_key); |
| 218 | }); |
| 219 | Lua::CallLuaModuleFunction(out, "plugins.dig", "getDampConfigKey", {}, 1, [&](lua_State *L){ |
| 220 | string damp_key = lua_tostring(L, -1); |
| 221 | damp_config = World::GetPersistentSiteData(damp_key); |
| 222 | }); |
| 223 | } |
| 224 | |
| 225 | static void clear_caches() { |
| 226 | string_cache.clear(); |
no test coverage detected