mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-08 00:39:47 +02:00
remove original resource functionality
This commit is contained in:
parent
70190ea1fe
commit
f327224d45
@ -36,7 +36,6 @@ void AssetGenerator::createAdventureOptionsCleanBackground()
|
|||||||
ResourcePath savePath(filename, EResType::IMAGE);
|
ResourcePath savePath(filename, EResType::IMAGE);
|
||||||
|
|
||||||
auto res = ImagePath::builtin("ADVOPTBK");
|
auto res = ImagePath::builtin("ADVOPTBK");
|
||||||
res = res.setOriginalResource(true);
|
|
||||||
|
|
||||||
std::shared_ptr<IImage> img = GH.renderHandler().loadImage(res, EImageBlitMode::OPAQUE);
|
std::shared_ptr<IImage> img = GH.renderHandler().loadImage(res, EImageBlitMode::OPAQUE);
|
||||||
|
|
||||||
@ -66,7 +65,6 @@ void AssetGenerator::createBigSpellBook()
|
|||||||
ResourcePath savePath(filename, EResType::IMAGE);
|
ResourcePath savePath(filename, EResType::IMAGE);
|
||||||
|
|
||||||
auto res = ImagePath::builtin("SpelBack");
|
auto res = ImagePath::builtin("SpelBack");
|
||||||
res = res.setOriginalResource(true);
|
|
||||||
|
|
||||||
std::shared_ptr<IImage> img = GH.renderHandler().loadImage(res, EImageBlitMode::OPAQUE);
|
std::shared_ptr<IImage> img = GH.renderHandler().loadImage(res, EImageBlitMode::OPAQUE);
|
||||||
Canvas canvas = Canvas(Point(800, 600), CanvasScalingPolicy::IGNORE);
|
Canvas canvas = Canvas(Point(800, 600), CanvasScalingPolicy::IGNORE);
|
||||||
|
@ -66,19 +66,10 @@ CFilesystemList::~CFilesystemList()
|
|||||||
|
|
||||||
std::unique_ptr<CInputStream> CFilesystemList::load(const ResourcePath & resourceName) const
|
std::unique_ptr<CInputStream> CFilesystemList::load(const ResourcePath & resourceName) const
|
||||||
{
|
{
|
||||||
if(resourceName.getOriginalResource())
|
|
||||||
{
|
|
||||||
for(const auto & loader : loaders)
|
|
||||||
if (loader->existsResource(resourceName))
|
|
||||||
return loader->load(resourceName);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// load resource from last loader that have it (last overridden version)
|
// load resource from last loader that have it (last overridden version)
|
||||||
for(const auto & loader : boost::adaptors::reverse(loaders))
|
for(const auto & loader : boost::adaptors::reverse(loaders))
|
||||||
if (loader->existsResource(resourceName))
|
if (loader->existsResource(resourceName))
|
||||||
return loader->load(resourceName);
|
return loader->load(resourceName);
|
||||||
}
|
|
||||||
|
|
||||||
throw std::runtime_error("Resource with name " + resourceName.getName() + " and type "
|
throw std::runtime_error("Resource with name " + resourceName.getName() + " and type "
|
||||||
+ EResTypeHelper::getEResTypeAsString(resourceName.getType()) + " wasn't found.");
|
+ EResTypeHelper::getEResTypeAsString(resourceName.getType()) + " wasn't found.");
|
||||||
|
@ -51,22 +51,19 @@ static inline std::string readName(std::string name, bool uppercase)
|
|||||||
ResourcePath::ResourcePath(const std::string & name_):
|
ResourcePath::ResourcePath(const std::string & name_):
|
||||||
type(readType(name_)),
|
type(readType(name_)),
|
||||||
name(readName(name_, true)),
|
name(readName(name_, true)),
|
||||||
originalName(readName(name_, false)),
|
originalName(readName(name_, false))
|
||||||
originalResource(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ResourcePath::ResourcePath(const std::string & name_, EResType type_):
|
ResourcePath::ResourcePath(const std::string & name_, EResType type_):
|
||||||
type(type_),
|
type(type_),
|
||||||
name(readName(name_, true)),
|
name(readName(name_, true)),
|
||||||
originalName(readName(name_, false)),
|
originalName(readName(name_, false))
|
||||||
originalResource(false)
|
|
||||||
{}
|
{}
|
||||||
|
|
||||||
ResourcePath::ResourcePath(const JsonNode & name, EResType type):
|
ResourcePath::ResourcePath(const JsonNode & name, EResType type):
|
||||||
type(type),
|
type(type),
|
||||||
name(readName(name.String(), true)),
|
name(readName(name.String(), true)),
|
||||||
originalName(readName(name.String(), false)),
|
originalName(readName(name.String(), false))
|
||||||
originalResource(false)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,6 @@ public:
|
|||||||
bool empty() const {return name.empty();}
|
bool empty() const {return name.empty();}
|
||||||
std::string getName() const {return name;}
|
std::string getName() const {return name;}
|
||||||
std::string getOriginalName() const {return originalName;}
|
std::string getOriginalName() const {return originalName;}
|
||||||
bool getOriginalResource() const {return originalResource;}
|
|
||||||
EResType getType() const {return type;}
|
EResType getType() const {return type;}
|
||||||
|
|
||||||
void serializeJson(JsonSerializeFormat & handler);
|
void serializeJson(JsonSerializeFormat & handler);
|
||||||
@ -109,8 +108,6 @@ public:
|
|||||||
h & type;
|
h & type;
|
||||||
h & name;
|
h & name;
|
||||||
h & originalName;
|
h & originalName;
|
||||||
if (h.version >= Handler::Version::RESOURCE_GENERATION)
|
|
||||||
h & originalResource;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -123,9 +120,6 @@ protected:
|
|||||||
|
|
||||||
/// name in original case
|
/// name in original case
|
||||||
std::string originalName;
|
std::string originalName;
|
||||||
|
|
||||||
/// flag for requesting unmodded, original resource
|
|
||||||
bool originalResource;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
template<EResType Type>
|
template<EResType Type>
|
||||||
@ -186,17 +180,6 @@ public:
|
|||||||
ResourcePathTempl result;
|
ResourcePathTempl result;
|
||||||
result.name = prefix + this->getName();
|
result.name = prefix + this->getName();
|
||||||
result.originalName = prefix + this->getOriginalName();
|
result.originalName = prefix + this->getOriginalName();
|
||||||
result.originalResource = this->getOriginalResource();
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
ResourcePathTempl setOriginalResource(bool original) const
|
|
||||||
{
|
|
||||||
ResourcePathTempl result;
|
|
||||||
result.name = this->getName();
|
|
||||||
result.originalName = this->getOriginalName();
|
|
||||||
result.originalResource = original;
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -66,7 +66,6 @@ enum class ESerializationVersion : int32_t
|
|||||||
NEW_TOWN_BUILDINGS, // 855 - old bonusing buildings have been removed
|
NEW_TOWN_BUILDINGS, // 855 - old bonusing buildings have been removed
|
||||||
STATISTICS_SCREEN, // 856 - extent statistic functions
|
STATISTICS_SCREEN, // 856 - extent statistic functions
|
||||||
NEW_MARKETS, // 857 - reworked market classes
|
NEW_MARKETS, // 857 - reworked market classes
|
||||||
RESOURCE_GENERATION, // 858 - resource generation
|
|
||||||
|
|
||||||
CURRENT = RESOURCE_GENERATION
|
CURRENT = NEW_MARKETS
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user