1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

multiple fixes

This commit is contained in:
Laserlicht
2025-09-16 01:29:54 +02:00
parent 134c145b98
commit 2bf9454b77
4 changed files with 11 additions and 2 deletions

View File

@@ -43,6 +43,7 @@
#include <vcmi/Services.h> #include <vcmi/Services.h>
#include <vcmi/SkillService.h> #include <vcmi/SkillService.h>
#include <vcmi/spells/Service.h> #include <vcmi/spells/Service.h>
#include <vcmi/ResourceTypeService.h>
RenderHandler::RenderHandler() RenderHandler::RenderHandler()
:assetGenerator(std::make_unique<AssetGenerator>()) :assetGenerator(std::make_unique<AssetGenerator>())
@@ -494,6 +495,7 @@ void RenderHandler::onLibraryLoadingFinished(const Services * services)
addImageListEntries(services->factions()); addImageListEntries(services->factions());
addImageListEntries(services->spells()); addImageListEntries(services->spells());
addImageListEntries(services->skills()); addImageListEntries(services->skills());
addImageListEntries(services->resources());
if (settings["mods"]["validation"].String() == "full") if (settings["mods"]["validation"].String() == "full")
{ {

View File

@@ -99,7 +99,12 @@ public:
const TResource & operator[](size_t index) const const TResource & operator[](size_t index) const
{ {
return container.at(GameResID(index)); auto it = container.find(GameResID(index));
if (it != container.end())
return it->second;
static const TResource default_resource{};
return default_resource;
} }
bool empty () const bool empty () const

View File

@@ -65,7 +65,7 @@ std::shared_ptr<Resource> ResourceTypeHandler::loadFromJson(const std::string &
const std::vector<std::string> & ResourceTypeHandler::getTypeNames() const const std::vector<std::string> & ResourceTypeHandler::getTypeNames() const
{ {
static const std::vector<std::string> types = { "resources" }; static const std::vector<std::string> types = { "resource" };
return types; return types;
} }

View File

@@ -19,6 +19,7 @@
#include <vcmi/HeroTypeService.h> #include <vcmi/HeroTypeService.h>
#include <vcmi/SkillService.h> #include <vcmi/SkillService.h>
#include <vcmi/spells/Service.h> #include <vcmi/spells/Service.h>
#include <vcmi/ResourceTypeService.h>
#include "../lib/filesystem/Filesystem.h" #include "../lib/filesystem/Filesystem.h"
#include "../lib/filesystem/CBinaryReader.h" #include "../lib/filesystem/CBinaryReader.h"
@@ -342,4 +343,5 @@ void Graphics::initializeImageLists()
addImageListEntries(LIBRARY->factions()); addImageListEntries(LIBRARY->factions());
addImageListEntries(LIBRARY->spells()); addImageListEntries(LIBRARY->spells());
addImageListEntries(LIBRARY->skills()); addImageListEntries(LIBRARY->skills());
addImageListEntries(LIBRARY->resources());
} }