diff --git a/client/render/AssetGenerator.cpp b/client/render/AssetGenerator.cpp index a1e4befe7..56945f922 100644 --- a/client/render/AssetGenerator.cpp +++ b/client/render/AssetGenerator.cpp @@ -22,11 +22,19 @@ #include "../lib/GameSettings.h" #include "../lib/IGameSettings.h" #include "../lib/json/JsonNode.h" +#include "../lib/VCMIDirs.h" #include "../lib/VCMI_Lib.h" #include "../lib/RiverHandler.h" #include "../lib/RoadHandler.h" #include "../lib/TerrainHandler.h" +void AssetGenerator::clear() +{ + // clear to avoid non updated sprites after mod change (if base imnages are used) + if(boost::filesystem::is_directory(VCMIDirs::get().userDataPath() / "Generated")) + boost::filesystem::remove_all(VCMIDirs::get().userDataPath() / "Generated"); +} + void AssetGenerator::generateAll() { createBigSpellBook(); diff --git a/client/render/AssetGenerator.h b/client/render/AssetGenerator.h index 8ca08aae6..51584754a 100644 --- a/client/render/AssetGenerator.h +++ b/client/render/AssetGenerator.h @@ -16,6 +16,7 @@ VCMI_LIB_NAMESPACE_END class AssetGenerator { public: + static void clear(); static void generateAll(); static void createAdventureOptionsCleanBackground(); static void createBigSpellBook(); diff --git a/clientapp/EntryPoint.cpp b/clientapp/EntryPoint.cpp index 64a7043ef..2f7f22629 100644 --- a/clientapp/EntryPoint.cpp +++ b/clientapp/EntryPoint.cpp @@ -27,6 +27,7 @@ #include "../client/media/CMusicHandler.h" #include "../client/media/CSoundHandler.h" #include "../client/media/CVideoHandler.h" +#include "../client/render/AssetGenerator.h" #include "../client/render/Graphics.h" #include "../client/render/IRenderHandler.h" #include "../client/render/IScreenHandler.h" @@ -231,6 +232,8 @@ int main(int argc, char * argv[]) logGlobal->info("Creating console and configuring logger: %d ms", pomtime.getDiff()); logGlobal->info("The log file will be saved to %s", logPath); + AssetGenerator::clear(); + // Init filesystem and settings try { diff --git a/lib/filesystem/Filesystem.cpp b/lib/filesystem/Filesystem.cpp index 4840b3f87..6987064d9 100644 --- a/lib/filesystem/Filesystem.cpp +++ b/lib/filesystem/Filesystem.cpp @@ -183,8 +183,6 @@ void CResourceHandler::initialize() knownLoaders["saves"] = new CFilesystemLoader("SAVES/", VCMIDirs::get().userSavePath()); knownLoaders["config"] = new CFilesystemLoader("CONFIG/", VCMIDirs::get().userConfigPath()); - if(boost::filesystem::is_directory(VCMIDirs::get().userDataPath() / "Generated")) - boost::filesystem::remove_all(VCMIDirs::get().userDataPath() / "Generated"); knownLoaders["gen_data"] = new CFilesystemLoader("DATA/", VCMIDirs::get().userDataPath() / "Generated" / "Data"); knownLoaders["gen_sprites"] = new CFilesystemLoader("SPRITES/", VCMIDirs::get().userDataPath() / "Generated" / "Sprites");