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

Implement missing functions, fixes linking errors

This commit is contained in:
Ivan Savenko
2023-10-05 21:18:11 +03:00
parent 910ad50417
commit 77facf9387
34 changed files with 452 additions and 201 deletions

View File

@@ -80,6 +80,15 @@ const FactionID FactionID::FORTRESS(7);
const FactionID FactionID::CONFLUX(8);
const FactionID FactionID::NEUTRAL(9);
const PrimarySkill PrimarySkill::NONE(-1);
const PrimarySkill PrimarySkill::ATTACK(0);
const PrimarySkill PrimarySkill::DEFENSE(1);
const PrimarySkill PrimarySkill::SPELL_POWER(2);
const PrimarySkill PrimarySkill::KNOWLEDGE(3);
const PrimarySkill PrimarySkill::BEGIN(0);
const PrimarySkill PrimarySkill::END(4);
const PrimarySkill PrimarySkill::EXPERIENCE(4);
const BoatId BoatId::NONE(-1);
const BoatId BoatId::NECROPOLIS(0);
const BoatId BoatId::CASTLE(1);
@@ -273,6 +282,21 @@ std::string PlayerColor::entityType()
return "playerColor";
}
si32 PrimarySkill::decode(const std::string& identifier)
{
return *VLC->identifiers()->getIdentifier(ModScope::scopeGame(), entityType(), identifier);
}
std::string PrimarySkill::encode(const si32 index)
{
return NPrimarySkill::names[index];
}
std::string PrimarySkill::entityType()
{
return "primarySkill";
}
si32 FactionID::decode(const std::string & identifier)
{
auto rawId = VLC->identifiers()->getIdentifier(ModScope::scopeGame(), entityType(), identifier);
@@ -323,6 +347,36 @@ const ObstacleInfo * Obstacle::getInfo() const
return VLC->obstacles()->getById(*this);
}
si32 SpellSchool::decode(const std::string & identifier)
{
return *VLC->identifiers()->getIdentifier(ModScope::scopeGame(), entityType(), identifier);
}
std::string SpellSchool::encode(const si32 index)
{
return SpellConfig::SCHOOL[index].jsonName;
}
std::string SpellSchool::entityType()
{
return "spellSchool";
}
si32 GameResID::decode(const std::string & identifier)
{
return *VLC->identifiers()->getIdentifier(ModScope::scopeGame(), entityType(), identifier);
}
std::string GameResID::encode(const si32 index)
{
return GameConstants::RESOURCE_NAMES[index];
}
std::string GameResID::entityType()
{
return "resource";
}
std::string GameResID::entityType()
{
return "resource";