|
@@ -33,6 +33,7 @@
|
|
|
#include "StringConstants.h"
|
|
#include "StringConstants.h"
|
|
|
#include "CGeneralTextHandler.h"
|
|
#include "CGeneralTextHandler.h"
|
|
|
#include "CModHandler.h"//todo: remove
|
|
#include "CModHandler.h"//todo: remove
|
|
|
|
|
+#include "TerrainHandler.h" //TODO: remove
|
|
|
#include "BattleFieldHandler.h"
|
|
#include "BattleFieldHandler.h"
|
|
|
#include "ObstacleHandler.h"
|
|
#include "ObstacleHandler.h"
|
|
|
|
|
|
|
@@ -203,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(), "faction", identifier);
|
|
|
|
|
|
|
+ auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), scope(), identifier);
|
|
|
if(rawId)
|
|
if(rawId)
|
|
|
return rawId.value();
|
|
return rawId.value();
|
|
|
else
|
|
else
|
|
@@ -215,6 +216,31 @@ std::string FactionID::encode(const si32 index)
|
|
|
return VLC->factions()->getByIndex(index)->getJsonKey();
|
|
return VLC->factions()->getByIndex(index)->getJsonKey();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+std::string FactionID::scope()
|
|
|
|
|
+{
|
|
|
|
|
+ return "faction";
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+si32 TerrainID::decode(const std::string & identifier)
|
|
|
|
|
+{
|
|
|
|
|
+ auto rawId = VLC->modh->identifiers.getIdentifier(CModHandler::scopeGame(), scope(), identifier);
|
|
|
|
|
+ if(rawId)
|
|
|
|
|
+ return rawId.value();
|
|
|
|
|
+ else
|
|
|
|
|
+ return static_cast<si32>(ETerrainId::NONE);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+std::string TerrainID::encode(const si32 index)
|
|
|
|
|
+{
|
|
|
|
|
+ return VLC->terrainTypeHandler->getByIndex(index)->getJsonKey();
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+std::string TerrainID::scope()
|
|
|
|
|
+{
|
|
|
|
|
+ return "terrain";
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
std::ostream & operator<<(std::ostream & os, const EActionType actionType)
|
|
std::ostream & operator<<(std::ostream & os, const EActionType actionType)
|
|
|
{
|
|
{
|
|
|
static const std::map<EActionType, std::string> actionTypeToString =
|
|
static const std::map<EActionType, std::string> actionTypeToString =
|