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:
@@ -21,8 +21,6 @@
|
|||||||
#include "../lib/JsonNode.h"
|
#include "../lib/JsonNode.h"
|
||||||
#include "../lib/CRandomGenerator.h"
|
#include "../lib/CRandomGenerator.h"
|
||||||
|
|
||||||
namespace bfs = boost::filesystem;
|
|
||||||
|
|
||||||
class SDLImageLoader;
|
class SDLImageLoader;
|
||||||
|
|
||||||
typedef std::map <size_t, std::vector <JsonNode> > source_map;
|
typedef std::map <size_t, std::vector <JsonNode> > source_map;
|
||||||
@@ -961,7 +959,7 @@ void CAnimation::exportBitmaps(const bfs::path & path, bool prependResourceName)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bfs::path actualPath = path / "Sprites" / name;
|
bfs::path actualPath = path / "SPRITES" / name;
|
||||||
bfs::create_directories(actualPath);
|
bfs::create_directories(actualPath);
|
||||||
|
|
||||||
size_t counter = 0;
|
size_t counter = 0;
|
||||||
|
@@ -13,6 +13,8 @@
|
|||||||
#include "Geometries.h"
|
#include "Geometries.h"
|
||||||
#include "../../lib/GameConstants.h"
|
#include "../../lib/GameConstants.h"
|
||||||
|
|
||||||
|
namespace bfs = boost::filesystem;
|
||||||
|
|
||||||
#ifdef IN
|
#ifdef IN
|
||||||
#undef IN
|
#undef IN
|
||||||
#endif
|
#endif
|
||||||
@@ -45,7 +47,7 @@ public:
|
|||||||
|
|
||||||
virtual std::shared_ptr<IImage> scaleFast(float scale) const = 0;
|
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
|
//Change palette to specific player
|
||||||
virtual void playerColored(PlayerColor player)=0;
|
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;
|
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
|
//all available frames
|
||||||
void load ();
|
void load ();
|
||||||
|
@@ -18,8 +18,6 @@
|
|||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
namespace bfs = boost::filesystem;
|
|
||||||
|
|
||||||
ArchiveEntry::ArchiveEntry()
|
ArchiveEntry::ArchiveEntry()
|
||||||
: offset(0), fullSize(0), compressedSize(0)
|
: offset(0), fullSize(0), compressedSize(0)
|
||||||
{
|
{
|
||||||
@@ -211,7 +209,7 @@ std::unordered_set<ResourceID> CArchiveLoader::getFilteredFiles(std::function<bo
|
|||||||
return foundID;
|
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
|
si64 currentPosition = fileStream.tell(); // save filestream position
|
||||||
|
|
||||||
@@ -229,7 +227,7 @@ void CArchiveLoader::extractToFolder(std::string outputSubFolder, CFileInputStre
|
|||||||
fileStream.seek(currentPosition); // restore filestream position
|
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));
|
std::unique_ptr<CInputStream> inputStream = load(ResourceID(mountPoint + entry.name));
|
||||||
|
|
||||||
|
@@ -12,6 +12,8 @@
|
|||||||
#include "ISimpleResourceLoader.h"
|
#include "ISimpleResourceLoader.h"
|
||||||
#include "ResourceID.h"
|
#include "ResourceID.h"
|
||||||
|
|
||||||
|
namespace bfs = boost::filesystem;
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
class CFileInputStream;
|
class CFileInputStream;
|
||||||
@@ -56,7 +58,7 @@ public:
|
|||||||
*
|
*
|
||||||
* @throws std::runtime_error if the archive wasn't found or if the archive isn't supported
|
* @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
|
/// Interface implementation
|
||||||
/// @see ISimpleResourceLoader
|
/// @see ISimpleResourceLoader
|
||||||
@@ -66,9 +68,9 @@ public:
|
|||||||
void updateFilteredFiles(std::function<bool(const std::string &)> filter) const override {}
|
void updateFilteredFiles(std::function<bool(const std::string &)> filter) const override {}
|
||||||
std::unordered_set<ResourceID> getFilteredFiles(std::function<bool(const ResourceID &)> 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 */
|
/** 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 */
|
/** 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:
|
private:
|
||||||
/**
|
/**
|
||||||
@@ -93,7 +95,7 @@ private:
|
|||||||
void initSNDArchive(const std::string &mountPoint, CFileInputStream & fileStream);
|
void initSNDArchive(const std::string &mountPoint, CFileInputStream & fileStream);
|
||||||
|
|
||||||
/** The file path to the archive which is scanned and indexed. */
|
/** The file path to the archive which is scanned and indexed. */
|
||||||
boost::filesystem::path archive;
|
bfs::path archive;
|
||||||
|
|
||||||
std::string mountPoint;
|
std::string mountPoint;
|
||||||
|
|
||||||
@@ -105,6 +107,6 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/** Constructs the file path for the extracted file. Creates the subfolder hierarchy aswell **/
|
/** 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
|
VCMI_LIB_NAMESPACE_END
|
||||||
|
@@ -28,9 +28,9 @@ CResourceHandler CResourceHandler::globalResourceHandler;
|
|||||||
|
|
||||||
CFilesystemGenerator::CFilesystemGenerator(std::string prefix, bool extractArchives):
|
CFilesystemGenerator::CFilesystemGenerator(std::string prefix, bool extractArchives):
|
||||||
filesystem(new CFilesystemList()),
|
filesystem(new CFilesystemList()),
|
||||||
prefix(prefix)
|
prefix(prefix),
|
||||||
|
extractArchives(extractArchives)
|
||||||
{
|
{
|
||||||
this->extractArchives = extractArchives;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CFilesystemGenerator::TLoadFunctorMap CFilesystemGenerator::genFunctorMap()
|
CFilesystemGenerator::TLoadFunctorMap CFilesystemGenerator::genFunctorMap()
|
||||||
|
@@ -23,8 +23,6 @@
|
|||||||
|
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
namespace bfs = boost::filesystem;
|
|
||||||
|
|
||||||
typedef std::map<size_t, std::vector<JsonNode>> source_map;
|
typedef std::map<size_t, std::vector<JsonNode>> source_map;
|
||||||
|
|
||||||
/// Class for def loading
|
/// Class for def loading
|
||||||
|
@@ -15,6 +15,8 @@
|
|||||||
#include <QRgb>
|
#include <QRgb>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
|
namespace bfs = boost::filesystem;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Base class for images, can be used for non-animation pictures as well
|
* 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 load (size_t frame, size_t group = 0);
|
||||||
void unload(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)
|
//total count of frames in group (including not loaded)
|
||||||
size_t size(size_t group = 0) const;
|
size_t size(size_t group = 0) const;
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* ResourceConverter.h, part of VCMI engine
|
* ResourceConverter.cpp, part of VCMI engine
|
||||||
*
|
*
|
||||||
* Authors: listed in file AUTHORS in main folder
|
* Authors: listed in file AUTHORS in main folder
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user