diff --git a/textures.cpp b/textures.cpp index 994c481..0f31e17 100644 --- a/textures.cpp +++ b/textures.cpp @@ -13,6 +13,7 @@ namespace textures { static TextureManager TMGR; static bool initialized = false; + static bool failure = false; void load_sprite_textures(SpriteTextureMap &mapping, json &config, bool smooth) { for(auto& [name, settings] : config.items()) { @@ -25,8 +26,10 @@ namespace textures { int width = settings["frame_width"]; int height = settings["frame_height"]; - dbc::check(width % 2 == 0, - fmt::format("sprite {} has invalid frame size {}", name, width)); + + dbc::check(width % 2 == 0 && height % 2 == 0, + fmt::format("sprite {}:{} has invalid frame size {}:{}", + path, name, width, height)); sf::Vector2i frame_size{width, height}; @@ -113,11 +116,18 @@ namespace textures { } void init() { - if(!initialized) { - load_tiles(); - load_sprites(); - load_map_tiles(); - initialized = true; + dbc::check(!failure, "YOU HAD A CATASTROPHIC TEXTURES FAILURE, FIX IT"); + + try { + if(!initialized) { + load_tiles(); + load_sprites(); + load_map_tiles(); + initialized = true; + } + } catch(...) { + failure = true; + throw; } }