| 263 | } |
| 264 | |
| 265 | void 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 | |
| 287 | static void reset_texpos() { |
| 288 | DEBUG(textures).print("resetting texture mappings\n"); |