mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-10 23:48:04 +02:00
Fixes
This commit is contained in:
parent
6a7b23c007
commit
b7568a160c
@ -19,6 +19,8 @@
|
|||||||
#include <vcmi/FactionService.h>
|
#include <vcmi/FactionService.h>
|
||||||
#include <vcmi/HeroType.h>
|
#include <vcmi/HeroType.h>
|
||||||
#include <vcmi/HeroTypeService.h>
|
#include <vcmi/HeroTypeService.h>
|
||||||
|
#include <vcmi/HeroClass.h>
|
||||||
|
#include <vcmi/HeroClassService.h>
|
||||||
|
|
||||||
#include <vcmi/spells/Spell.h>
|
#include <vcmi/spells/Spell.h>
|
||||||
#include <vcmi/spells/Service.h>
|
#include <vcmi/spells/Service.h>
|
||||||
@ -103,6 +105,25 @@ namespace GameConstants
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
si32 HeroClassID::decode(const std::string & identifier)
|
||||||
|
{
|
||||||
|
auto rawId = VLC->identifiers()->getIdentifier(ModScope::scopeMap(), "heroClass", identifier);
|
||||||
|
if(rawId)
|
||||||
|
return rawId.value();
|
||||||
|
else
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HeroClassID::encode(const si32 index)
|
||||||
|
{
|
||||||
|
return VLC->heroClasses()->getByIndex(index)->getJsonKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string HeroClassID::entityType()
|
||||||
|
{
|
||||||
|
return "heroClass";
|
||||||
|
}
|
||||||
|
|
||||||
si32 HeroTypeID::decode(const std::string & identifier)
|
si32 HeroTypeID::decode(const std::string & identifier)
|
||||||
{
|
{
|
||||||
auto rawId = VLC->identifiers()->getIdentifier(ModScope::scopeMap(), "hero", identifier);
|
auto rawId = VLC->identifiers()->getIdentifier(ModScope::scopeMap(), "hero", identifier);
|
||||||
|
@ -223,6 +223,10 @@ class HeroClassID : public Identifier<HeroClassID>
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using Identifier<HeroClassID>::Identifier;
|
using Identifier<HeroClassID>::Identifier;
|
||||||
|
///json serialization helpers
|
||||||
|
DLL_LINKAGE static si32 decode(const std::string & identifier);
|
||||||
|
DLL_LINKAGE static std::string encode(const si32 index);
|
||||||
|
static std::string entityType();
|
||||||
};
|
};
|
||||||
|
|
||||||
class HeroTypeID : public Identifier<HeroTypeID>
|
class HeroTypeID : public Identifier<HeroTypeID>
|
||||||
|
@ -154,9 +154,9 @@ void Rewardable::Limiter::serializeJson(JsonSerializeFormat & handler)
|
|||||||
handler.serializeInt("manaPercentage", manaPercentage);
|
handler.serializeInt("manaPercentage", manaPercentage);
|
||||||
handler.serializeInt("heroExperience", heroExperience);
|
handler.serializeInt("heroExperience", heroExperience);
|
||||||
handler.serializeInt("heroLevel", heroLevel);
|
handler.serializeInt("heroLevel", heroLevel);
|
||||||
handler.serializeIdArray("hero", heroes);
|
handler.serializeIdArray("heroes", heroes);
|
||||||
handler.serializeIdArray("heroClass", heroClasses);
|
handler.serializeIdArray("heroClasses", heroClasses);
|
||||||
handler.serializeIdArray("color", players);
|
handler.serializeIdArray("colors", players);
|
||||||
handler.serializeInt("manaPoints", manaPoints);
|
handler.serializeInt("manaPoints", manaPoints);
|
||||||
handler.serializeIdArray("artifacts", artifacts);
|
handler.serializeIdArray("artifacts", artifacts);
|
||||||
handler.enterArray("creatures").serializeStruct(creatures);
|
handler.enterArray("creatures").serializeStruct(creatures);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user