From 75b4b64b6f01753b7f4e1449137000326c655fac Mon Sep 17 00:00:00 2001 From: krs Date: Tue, 22 Nov 2022 19:35:30 +0200 Subject: [PATCH] Final checks according to review --- client/gui/CAnimation.cpp | 4 +--- client/gui/CAnimation.h | 6 ++++-- lib/filesystem/CArchiveLoader.cpp | 6 ++---- lib/filesystem/CArchiveLoader.h | 12 +++++++----- lib/filesystem/Filesystem.cpp | 4 ++-- mapeditor/Animation.cpp | 2 -- mapeditor/Animation.h | 4 +++- mapeditor/resourceExtractor/ResourceConverter.cpp | 2 +- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/client/gui/CAnimation.cpp b/client/gui/CAnimation.cpp index 37851f28d..d92c4f0ec 100644 --- a/client/gui/CAnimation.cpp +++ b/client/gui/CAnimation.cpp @@ -21,8 +21,6 @@ #include "../lib/JsonNode.h" #include "../lib/CRandomGenerator.h" -namespace bfs = boost::filesystem; - class SDLImageLoader; typedef std::map > source_map; @@ -961,7 +959,7 @@ void CAnimation::exportBitmaps(const bfs::path & path, bool prependResourceName) return; } - bfs::path actualPath = path / "Sprites" / name; + bfs::path actualPath = path / "SPRITES" / name; bfs::create_directories(actualPath); size_t counter = 0; diff --git a/client/gui/CAnimation.h b/client/gui/CAnimation.h index 0ecd5e94c..7533bd24c 100644 --- a/client/gui/CAnimation.h +++ b/client/gui/CAnimation.h @@ -13,6 +13,8 @@ #include "Geometries.h" #include "../../lib/GameConstants.h" +namespace bfs = boost::filesystem; + #ifdef IN #undef IN #endif @@ -45,7 +47,7 @@ public: virtual std::shared_ptr scaleFast(float scale) const = 0; - virtual void exportBitmap(const boost::filesystem::path & path) const = 0; + virtual void exportBitmap(const bfs::path & path) const = 0; //Change palette to specific player virtual void playerColored(PlayerColor player)=0; @@ -122,7 +124,7 @@ public: std::shared_ptr getImage(size_t frame, size_t group=0, bool verbose=true) const; - void exportBitmaps(const boost::filesystem::path & path, bool prependResourceName = false) const; + void exportBitmaps(const bfs::path & path, bool prependResourceName = false) const; //all available frames void load (); diff --git a/lib/filesystem/CArchiveLoader.cpp b/lib/filesystem/CArchiveLoader.cpp index bffd1238e..8c4b21533 100644 --- a/lib/filesystem/CArchiveLoader.cpp +++ b/lib/filesystem/CArchiveLoader.cpp @@ -18,8 +18,6 @@ VCMI_LIB_NAMESPACE_BEGIN -namespace bfs = boost::filesystem; - ArchiveEntry::ArchiveEntry() : offset(0), fullSize(0), compressedSize(0) { @@ -211,7 +209,7 @@ std::unordered_set CArchiveLoader::getFilteredFiles(std::function inputStream = load(ResourceID(mountPoint + entry.name)); diff --git a/lib/filesystem/CArchiveLoader.h b/lib/filesystem/CArchiveLoader.h index cc00a0296..f41423d17 100644 --- a/lib/filesystem/CArchiveLoader.h +++ b/lib/filesystem/CArchiveLoader.h @@ -12,6 +12,8 @@ #include "ISimpleResourceLoader.h" #include "ResourceID.h" +namespace bfs = boost::filesystem; + VCMI_LIB_NAMESPACE_BEGIN class CFileInputStream; @@ -56,7 +58,7 @@ public: * * @throws std::runtime_error if the archive wasn't found or if the archive isn't supported */ - CArchiveLoader(std::string mountPoint, boost::filesystem::path archive, bool extractArchives = false); + CArchiveLoader(std::string mountPoint, bfs::path archive, bool extractArchives = false); /// Interface implementation /// @see ISimpleResourceLoader @@ -66,9 +68,9 @@ public: void updateFilteredFiles(std::function filter) const override {} std::unordered_set getFilteredFiles(std::function filter) const override; /** Extracts one archive entry to the specified subfolder. Used for Video and Sound */ - void extractToFolder(std::string outputSubFolder, CFileInputStream & fileStream, ArchiveEntry entry); + void extractToFolder(const std::string & outputSubFolder, CFileInputStream & fileStream, ArchiveEntry entry); /** Extracts one archive entry to the specified subfolder. Used for Images, Sprites, etc */ - void extractToFolder(std::string outputSubFolder, const std::string &mountPoint, ArchiveEntry entry); + void extractToFolder(const std::string & outputSubFolder, const std::string & mountPoint, ArchiveEntry entry); private: /** @@ -93,7 +95,7 @@ private: void initSNDArchive(const std::string &mountPoint, CFileInputStream & fileStream); /** The file path to the archive which is scanned and indexed. */ - boost::filesystem::path archive; + bfs::path archive; std::string mountPoint; @@ -105,6 +107,6 @@ private: }; /** Constructs the file path for the extracted file. Creates the subfolder hierarchy aswell **/ -boost::filesystem::path createExtractedFilePath(const std::string & outputSubFolder, const std::string & entryName); +bfs::path createExtractedFilePath(const std::string & outputSubFolder, const std::string & entryName); VCMI_LIB_NAMESPACE_END diff --git a/lib/filesystem/Filesystem.cpp b/lib/filesystem/Filesystem.cpp index cd91c1e90..5796c4bc9 100644 --- a/lib/filesystem/Filesystem.cpp +++ b/lib/filesystem/Filesystem.cpp @@ -28,9 +28,9 @@ CResourceHandler CResourceHandler::globalResourceHandler; CFilesystemGenerator::CFilesystemGenerator(std::string prefix, bool extractArchives): filesystem(new CFilesystemList()), - prefix(prefix) + prefix(prefix), + extractArchives(extractArchives) { - this->extractArchives = extractArchives; } CFilesystemGenerator::TLoadFunctorMap CFilesystemGenerator::genFunctorMap() diff --git a/mapeditor/Animation.cpp b/mapeditor/Animation.cpp index 2b4e5c97f..ed69a2b00 100644 --- a/mapeditor/Animation.cpp +++ b/mapeditor/Animation.cpp @@ -23,8 +23,6 @@ #include -namespace bfs = boost::filesystem; - typedef std::map> source_map; /// Class for def loading diff --git a/mapeditor/Animation.h b/mapeditor/Animation.h index 2f814ea2b..38f4154b3 100644 --- a/mapeditor/Animation.h +++ b/mapeditor/Animation.h @@ -15,6 +15,8 @@ #include #include +namespace bfs = boost::filesystem; + /* * Base class for images, can be used for non-animation pictures as well */ @@ -83,7 +85,7 @@ public: void load (size_t frame, size_t group = 0); void unload(size_t frame, size_t group = 0); - void exportBitmaps(const boost::filesystem::path& path, bool prependResourceName = false) const; + void exportBitmaps(const bfs::path & path, bool prependResourceName = false) const; //total count of frames in group (including not loaded) size_t size(size_t group = 0) const; diff --git a/mapeditor/resourceExtractor/ResourceConverter.cpp b/mapeditor/resourceExtractor/ResourceConverter.cpp index a67056174..59b41692c 100644 --- a/mapeditor/resourceExtractor/ResourceConverter.cpp +++ b/mapeditor/resourceExtractor/ResourceConverter.cpp @@ -1,5 +1,5 @@ /* - * ResourceConverter.h, part of VCMI engine + * ResourceConverter.cpp, part of VCMI engine * * Authors: listed in file AUTHORS in main folder *