mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
- Better name as suggested in PR
- Compile fix
This commit is contained in:
parent
9f2bfbc1d8
commit
506a0cdda0
@ -204,7 +204,7 @@ const FactionID FactionID::NEUTRAL = FactionID(9);
|
|||||||
|
|
||||||
si32 FactionID::decode(const std::string & identifier)
|
si32 FactionID::decode(const std::string & identifier)
|
||||||
{
|
{
|
||||||
auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), scope(), identifier);
|
auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), entityType(), identifier);
|
||||||
if(rawId)
|
if(rawId)
|
||||||
return rawId.value();
|
return rawId.value();
|
||||||
else
|
else
|
||||||
@ -216,7 +216,7 @@ std::string FactionID::encode(const si32 index)
|
|||||||
return VLC->factions()->getByIndex(index)->getJsonKey();
|
return VLC->factions()->getByIndex(index)->getJsonKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string FactionID::scope()
|
std::string FactionID::entityType()
|
||||||
{
|
{
|
||||||
return "faction";
|
return "faction";
|
||||||
}
|
}
|
||||||
@ -224,7 +224,7 @@ std::string FactionID::scope()
|
|||||||
|
|
||||||
si32 TerrainID::decode(const std::string & identifier)
|
si32 TerrainID::decode(const std::string & identifier)
|
||||||
{
|
{
|
||||||
auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), scope(), identifier);
|
auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), entityType(), identifier);
|
||||||
if(rawId)
|
if(rawId)
|
||||||
return rawId.value();
|
return rawId.value();
|
||||||
else
|
else
|
||||||
@ -236,7 +236,7 @@ std::string TerrainID::encode(const si32 index)
|
|||||||
return VLC->terrainTypeHandler->getByIndex(index)->getJsonKey();
|
return VLC->terrainTypeHandler->getByIndex(index)->getJsonKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string TerrainID::scope()
|
std::string TerrainID::entityType()
|
||||||
{
|
{
|
||||||
return "terrain";
|
return "terrain";
|
||||||
}
|
}
|
||||||
|
@ -461,7 +461,7 @@ class FactionID : public BaseForID<FactionID, int32_t>
|
|||||||
|
|
||||||
static si32 decode(const std::string& identifier);
|
static si32 decode(const std::string& identifier);
|
||||||
static std::string encode(const si32 index);
|
static std::string encode(const si32 index);
|
||||||
static std::string scope();
|
static std::string entityType();
|
||||||
};
|
};
|
||||||
|
|
||||||
class TerrainID
|
class TerrainID
|
||||||
@ -470,7 +470,7 @@ class TerrainID
|
|||||||
public:
|
public:
|
||||||
static si32 decode(const std::string & identifier);
|
static si32 decode(const std::string & identifier);
|
||||||
static std::string encode(const si32 index);
|
static std::string encode(const si32 index);
|
||||||
static std::string scope();
|
static std::string entityType();
|
||||||
};
|
};
|
||||||
|
|
||||||
class BuildingID
|
class BuildingID
|
||||||
|
@ -10,6 +10,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../JsonNode.h"
|
#include "../JsonNode.h"
|
||||||
|
#include "../CModHandler.h"
|
||||||
|
|
||||||
VCMI_LIB_NAMESPACE_BEGIN
|
VCMI_LIB_NAMESPACE_BEGIN
|
||||||
|
|
||||||
@ -367,7 +368,7 @@ public:
|
|||||||
|
|
||||||
for(const auto & id : node.Vector())
|
for(const auto & id : node.Vector())
|
||||||
{
|
{
|
||||||
VLC->modh->identifiers.requestIdentifier(U::scope(), id, [&value](int32_t identifier)
|
VLC->modh->identifiers.requestIdentifier(U::entityType(), id, [&value](int32_t identifier)
|
||||||
{
|
{
|
||||||
value.emplace(identifier);
|
value.emplace(identifier);
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user