1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-13 19:54:17 +02:00

Final checks according to review

This commit is contained in:
krs
2022-11-22 19:35:30 +02:00
parent 31b7a81cd2
commit 75b4b64b6f
8 changed files with 20 additions and 20 deletions

View File

@@ -21,8 +21,6 @@
#include "../lib/JsonNode.h"
#include "../lib/CRandomGenerator.h"
namespace bfs = boost::filesystem;
class SDLImageLoader;
typedef std::map <size_t, std::vector <JsonNode> > 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;

View File

@@ -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<IImage> 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<IImage> 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 ();

View File

@@ -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<ResourceID> CArchiveLoader::getFilteredFiles(std::function<bo
return foundID;
}
void CArchiveLoader::extractToFolder(std::string outputSubFolder, CFileInputStream & fileStream, ArchiveEntry entry)
void CArchiveLoader::extractToFolder(const std::string & outputSubFolder, CFileInputStream & fileStream, ArchiveEntry entry)
{
si64 currentPosition = fileStream.tell(); // save filestream position
@@ -229,7 +227,7 @@ void CArchiveLoader::extractToFolder(std::string outputSubFolder, CFileInputStre
fileStream.seek(currentPosition); // restore filestream position
}
void CArchiveLoader::extractToFolder(std::string outputSubFolder, const std::string & mountPoint, ArchiveEntry entry)
void CArchiveLoader::extractToFolder(const std::string & outputSubFolder, const std::string & mountPoint, ArchiveEntry entry)
{
std::unique_ptr<CInputStream> inputStream = load(ResourceID(mountPoint + entry.name));

View File

@@ -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<bool(const std::string &)> filter) const override {}
std::unordered_set<ResourceID> getFilteredFiles(std::function<bool(const ResourceID &)> 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

View File

@@ -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()

View File

@@ -23,8 +23,6 @@
#include <boost/filesystem.hpp>
namespace bfs = boost::filesystem;
typedef std::map<size_t, std::vector<JsonNode>> source_map;
/// Class for def loading

View File

@@ -15,6 +15,8 @@
#include <QRgb>
#include <QImage>
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;

View File

@@ -1,5 +1,5 @@
/*
* ResourceConverter.h, part of VCMI engine
* ResourceConverter.cpp, part of VCMI engine
*
* Authors: listed in file AUTHORS in main folder
*