From cbd3dffb7c381a8bf5ce12ca6ce7cc4e72ba0ade Mon Sep 17 00:00:00 2001 From: krs Date: Wed, 23 Nov 2022 22:45:58 +0200 Subject: [PATCH] Reverted changes in CAnimation.h and .cpp --- client/gui/CAnimation.cpp | 16 ++++++---------- client/gui/CAnimation.h | 6 ++---- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/client/gui/CAnimation.cpp b/client/gui/CAnimation.cpp index d92c4f0ec..be4c357a2 100644 --- a/client/gui/CAnimation.cpp +++ b/client/gui/CAnimation.cpp @@ -95,7 +95,7 @@ public: void draw(SDL_Surface * where, int posX=0, int posY=0, Rect *src=nullptr, ui8 alpha=255) const override; void draw(SDL_Surface * where, SDL_Rect * dest, SDL_Rect * src, ui8 alpha=255) const override; std::shared_ptr scaleFast(float scale) const override; - void exportBitmap(const bfs::path & path) const override; + void exportBitmap(const boost::filesystem::path & path) const override; void playerColored(PlayerColor player) override; void setFlagColor(PlayerColor player) override; int width() const override; @@ -714,7 +714,7 @@ std::shared_ptr SDLImage::scaleFast(float scale) const return std::shared_ptr(ret); } -void SDLImage::exportBitmap(const bfs::path & path) const +void SDLImage::exportBitmap(const boost::filesystem::path& path) const { SDL_SaveBMP(surf, path.string().c_str()); } @@ -951,7 +951,7 @@ void CAnimation::initFromJson(const JsonNode & config) } } -void CAnimation::exportBitmaps(const bfs::path & path, bool prependResourceName) const +void CAnimation::exportBitmaps(const boost::filesystem::path& path) const { if(images.empty()) { @@ -959,8 +959,8 @@ void CAnimation::exportBitmaps(const bfs::path & path, bool prependResourceName) return; } - bfs::path actualPath = path / "SPRITES" / name; - bfs::create_directories(actualPath); + boost::filesystem::path actualPath = path / "SPRITES" / name; + boost::filesystem::create_directories(actualPath); size_t counter = 0; @@ -975,12 +975,8 @@ void CAnimation::exportBitmaps(const bfs::path & path, bool prependResourceName) boost::format fmt("%d_%d.bmp"); fmt % group % frame; - std::string fileName = fmt.str(); - if(prependResourceName) - fileName = name + "_" + fileName; - - img->exportBitmap(actualPath / fileName); + img->exportBitmap(actualPath / fmt.str()); counter++; } } diff --git a/client/gui/CAnimation.h b/client/gui/CAnimation.h index 7533bd24c..cb885fa36 100644 --- a/client/gui/CAnimation.h +++ b/client/gui/CAnimation.h @@ -13,8 +13,6 @@ #include "Geometries.h" #include "../../lib/GameConstants.h" -namespace bfs = boost::filesystem; - #ifdef IN #undef IN #endif @@ -47,7 +45,7 @@ public: virtual std::shared_ptr scaleFast(float scale) const = 0; - virtual void exportBitmap(const bfs::path & path) const = 0; + virtual void exportBitmap(const boost::filesystem::path & path) const = 0; //Change palette to specific player virtual void playerColored(PlayerColor player)=0; @@ -124,7 +122,7 @@ public: std::shared_ptr getImage(size_t frame, size_t group=0, bool verbose=true) const; - void exportBitmaps(const bfs::path & path, bool prependResourceName = false) const; + void exportBitmaps(const boost::filesystem::path & path) const; //all available frames void load ();