|
@@ -13,6 +13,7 @@
|
|
|
|
|
|
#include "IObjectInfo.h"
|
|
|
#include "../CGeneralTextHandler.h"
|
|
|
+#include "../CModHandler.h"
|
|
|
#include "../VCMI_Lib.h"
|
|
|
#include "../mapObjects/CGObjectInstance.h"
|
|
|
#include "../mapObjects/ObjectTemplate.h"
|
|
@@ -95,10 +96,15 @@ void AObjectTypeHandler::init(const JsonNode & input)
|
|
|
else
|
|
|
aiValue = static_cast<std::optional<si32>>(input["aiValue"].Integer());
|
|
|
|
|
|
- if(input["battleground"].getType() == JsonNode::JsonType::DATA_STRING)
|
|
|
- battlefield = input["battleground"].String();
|
|
|
- else
|
|
|
- battlefield = std::nullopt;
|
|
|
+ battlefield = BattleField::NONE;
|
|
|
+
|
|
|
+ if(!input["battleground"].isNull())
|
|
|
+ {
|
|
|
+ VLC->modh->identifiers.requestIdentifier("battlefield", input["battleground"], [this](int32_t identifier)
|
|
|
+ {
|
|
|
+ battlefield = BattleField(identifier);
|
|
|
+ });
|
|
|
+ }
|
|
|
|
|
|
initTypeData(input);
|
|
|
}
|
|
@@ -175,7 +181,7 @@ std::vector<std::shared_ptr<const ObjectTemplate>> AObjectTypeHandler::getTempla
|
|
|
|
|
|
BattleField AObjectTypeHandler::getBattlefield() const
|
|
|
{
|
|
|
- return battlefield ? BattleField::fromString(battlefield.value()) : BattleField::NONE;
|
|
|
+ return battlefield;
|
|
|
}
|
|
|
|
|
|
std::vector<std::shared_ptr<const ObjectTemplate>>AObjectTypeHandler::getTemplates(TerrainId terrainType) const
|