From ae1a48deed52287459bda089ca2292fea6f7e77c Mon Sep 17 00:00:00 2001 From: "Zed A. Shaw" Date: Sun, 17 Aug 2025 11:08:01 -0400 Subject: [PATCH] Now I have a better error that's more exact, but I think next level of this is to just show a generic texture for missing ones. Closes #80. --- systems.cpp | 1 - textures.cpp | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/systems.cpp b/systems.cpp index a8ef45f..2be7556 100644 --- a/systems.cpp +++ b/systems.cpp @@ -311,7 +311,6 @@ void System::collision(GameLevel &level) { void System::remove_from_world(GameLevel &level, Entity entity) { auto& item_pos = level.world->get(entity); level.collision->remove(item_pos.location, entity); - // level.world->remove(entity); // if you don't do this you get the bug that you can pickup // an item and it'll also be in your inventory level.world->remove(entity); diff --git a/textures.cpp b/textures.cpp index 7aac290..73af589 100644 --- a/textures.cpp +++ b/textures.cpp @@ -5,16 +5,20 @@ #include "config.hpp" #include "constants.hpp" #include +#include namespace textures { using std::shared_ptr, std::make_shared, nlohmann::json, std::string; + namespace fs = std::filesystem; static TextureManager TMGR; static bool initialized = false; void load_sprite_textures(SpriteTextureMap &mapping, json &config, bool smooth) { for(auto& [name, settings] : config.items()) { - auto texture = make_shared(settings["path"]); + const string& path = settings["path"]; + dbc::check(fs::exists(path), fmt::format("texture at {} doesn't exist", path)); + auto texture = make_shared(path); texture->setSmooth(smooth); auto sprite = make_shared(*texture);