From bd4d831582e852bd36d2005d8a5ae7ca2fe5131e Mon Sep 17 00:00:00 2001 From: shevernitskiy Date: Sun, 10 Sep 2023 14:50:03 +0300 Subject: [PATCH] add flag for dummy & resolve conflicts --- library/modules/Textures.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/library/modules/Textures.cpp b/library/modules/Textures.cpp index c8dc33c84..b03821907 100644 --- a/library/modules/Textures.cpp +++ b/library/modules/Textures.cpp @@ -200,6 +200,9 @@ std::vector Textures::loadTileset(const std::string& file, int til if (g_tileset_to_handles.contains(file)) return g_tileset_to_handles[file]; + if (!enabler) + return std::vector{}; + SDL_Surface* surface = DFIMG_Load(file.c_str()); if (!surface) { ERR(textures).printerr("unable to load textures from '%s'\n", file.c_str()); @@ -428,8 +431,8 @@ static void reserve_static_range() { return; } reserved_range.init(enabler->textures.init_texture_size); - auto dummy_surface = - DFSDL_CreateRGBSurfaceWithFormat(0, 0, 0, 32, SDL_PixelFormatEnum::SDL_PIXELFORMAT_RGBA32); + auto dummy_surface = DFSDL_CreateRGBSurfaceWithFormat( + SDL_DONTFREE, 0, 0, 32, SDL_PixelFormatEnum::SDL_PIXELFORMAT_RGBA32); for (int32_t i = 0; i < ReservedRange::size; i++) { add_texture(dummy_surface); }