|
@@ -174,6 +174,11 @@ EAlignment CFaction::getAlignment() const
|
|
return alignment;
|
|
return alignment;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+EBoatId CFaction::getBoatType() const
|
|
|
|
+{
|
|
|
|
+ return boatType.toEnum();
|
|
|
|
+}
|
|
|
|
+
|
|
TerrainId CFaction::getNativeTerrain() const
|
|
TerrainId CFaction::getNativeTerrain() const
|
|
{
|
|
{
|
|
return nativeTerrain;
|
|
return nativeTerrain;
|
|
@@ -893,16 +898,6 @@ void CTownHandler::loadTown(CTown * town, const JsonNode & source)
|
|
|
|
|
|
warMachinesToLoad[town] = source["warMachine"];
|
|
warMachinesToLoad[town] = source["warMachine"];
|
|
|
|
|
|
-
|
|
|
|
- town->shipyardBoat = EBoatId::NONE;
|
|
|
|
- if (!source["boat"].isNull())
|
|
|
|
- {
|
|
|
|
- VLC->modh->identifiers.requestIdentifier("core:boat", source["boat"], [=](int32_t boatTypeID)
|
|
|
|
- {
|
|
|
|
- town->shipyardBoat = BoatId(boatTypeID);
|
|
|
|
- });
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
town->mageLevel = static_cast<ui32>(source["mageGuild"].Float());
|
|
town->mageLevel = static_cast<ui32>(source["mageGuild"].Float());
|
|
|
|
|
|
town->namesCount = 0;
|
|
town->namesCount = 0;
|
|
@@ -1028,6 +1023,15 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
|
|
faction->creatureBg120 = source["creatureBackground"]["120px"].String();
|
|
faction->creatureBg120 = source["creatureBackground"]["120px"].String();
|
|
faction->creatureBg130 = source["creatureBackground"]["130px"].String();
|
|
faction->creatureBg130 = source["creatureBackground"]["130px"].String();
|
|
|
|
|
|
|
|
+ faction->boatType = EBoatId::NONE;
|
|
|
|
+ if (!source["boat"].isNull())
|
|
|
|
+ {
|
|
|
|
+ VLC->modh->identifiers.requestIdentifier("core:boat", source["boat"], [=](int32_t boatTypeID)
|
|
|
|
+ {
|
|
|
|
+ faction->boatType = BoatId(boatTypeID);
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
int alignment = vstd::find_pos(GameConstants::ALIGNMENT_NAMES, source["alignment"].String());
|
|
int alignment = vstd::find_pos(GameConstants::ALIGNMENT_NAMES, source["alignment"].String());
|
|
if (alignment == -1)
|
|
if (alignment == -1)
|
|
faction->alignment = EAlignment::NEUTRAL;
|
|
faction->alignment = EAlignment::NEUTRAL;
|
|
@@ -1158,25 +1162,6 @@ void CTownHandler::afterLoadFinalization()
|
|
initializeRequirements();
|
|
initializeRequirements();
|
|
initializeOverridden();
|
|
initializeOverridden();
|
|
initializeWarMachines();
|
|
initializeWarMachines();
|
|
-
|
|
|
|
- for(auto & faction : objects)
|
|
|
|
- {
|
|
|
|
- if (!faction->town)
|
|
|
|
- continue;
|
|
|
|
-
|
|
|
|
- bool hasBoat = faction->town->shipyardBoat != EBoatId::NONE;
|
|
|
|
- bool hasShipyard = faction->town->buildings.count(BuildingID::SHIPYARD);
|
|
|
|
-
|
|
|
|
- if ( hasBoat && !hasShipyard )
|
|
|
|
- logMod->warn("Town %s has boat but has no shipyard!", faction->getJsonKey());
|
|
|
|
-
|
|
|
|
- if ( !hasBoat && hasShipyard )
|
|
|
|
- {
|
|
|
|
- logMod->warn("Town %s has shipyard but has no boat set!", faction->getJsonKey());
|
|
|
|
- // Mod compatibility for 1.3
|
|
|
|
- faction->town->shipyardBoat = EBoatId::CASTLE;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
}
|
|
}
|
|
|
|
|
|
void CTownHandler::initializeRequirements()
|
|
void CTownHandler::initializeRequirements()
|