MCPcopy Create free account
hub / github.com/DFHack/dfhack / deleteHandle

Method deleteHandle

library/modules/Textures.cpp:265–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

263}
264
265void Textures::deleteHandle(TexposHandle handle) {
266 if (!enabler)
267 return;
268
269 auto texpos = Textures::getTexposByHandle(handle);
270 if (texpos > 0)
271 delete_texture(texpos);
272 if (g_handle_to_reserved_texpos.contains(handle))
273 g_handle_to_reserved_texpos.erase(handle);
274 if (g_handle_to_texpos.contains(handle))
275 g_handle_to_texpos.erase(handle);
276 if (auto it = std::find(g_delayed_regs.begin(), g_delayed_regs.end(), handle);
277 it != g_delayed_regs.end())
278 g_delayed_regs.erase(it);
279 if (g_handle_to_surface.contains(handle)) {
280 auto surface = g_handle_to_surface[handle];
281 while (surface->refcount)
282 DFSDL_FreeSurface(surface);
283 g_handle_to_surface.erase(handle);
284 }
285}
286
287static void reset_texpos() {
288 DEBUG(textures).print("resetting texture mappings\n");

Callers

nothing calls this directly

Calls 6

delete_textureFunction · 0.85
containsMethod · 0.80
findFunction · 0.50
eraseMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected