|
@@ -21,6 +21,7 @@ class CLegacyConfigParser;
|
|
class JsonNode;
|
|
class JsonNode;
|
|
class CTown;
|
|
class CTown;
|
|
class CFaction;
|
|
class CFaction;
|
|
|
|
+struct BattleHex;
|
|
|
|
|
|
/// a typical building encountered in every castle ;]
|
|
/// a typical building encountered in every castle ;]
|
|
/// this is structure available to both client and server
|
|
/// this is structure available to both client and server
|
|
@@ -136,6 +137,8 @@ class DLL_LINKAGE CTown
|
|
public:
|
|
public:
|
|
CTown();
|
|
CTown();
|
|
~CTown();
|
|
~CTown();
|
|
|
|
+ // TODO: remove once save and mod compatability not needed
|
|
|
|
+ static std::vector<BattleHex> defaultMoatHexes();
|
|
|
|
|
|
CFaction * faction;
|
|
CFaction * faction;
|
|
|
|
|
|
@@ -156,6 +159,7 @@ public:
|
|
ui16 primaryRes;
|
|
ui16 primaryRes;
|
|
ArtifactID warMachine;
|
|
ArtifactID warMachine;
|
|
si32 moatDamage;
|
|
si32 moatDamage;
|
|
|
|
+ std::vector<BattleHex> moatHexes;
|
|
// default chance for hero of specific class to appear in tavern, if field "tavern" was not set
|
|
// default chance for hero of specific class to appear in tavern, if field "tavern" was not set
|
|
// resulting chance = sqrt(town.chance * heroClass.chance)
|
|
// resulting chance = sqrt(town.chance * heroClass.chance)
|
|
ui32 defaultTavernChance;
|
|
ui32 defaultTavernChance;
|
|
@@ -205,7 +209,16 @@ public:
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
template <typename Handler> void serialize(Handler &h, const int version)
|
|
{
|
|
{
|
|
h & names & faction & creatures & dwellings & dwellingNames & buildings & hordeLvl & mageLevel
|
|
h & names & faction & creatures & dwellings & dwellingNames & buildings & hordeLvl & mageLevel
|
|
- & primaryRes & warMachine & clientInfo & moatDamage & defaultTavernChance;
|
|
|
|
|
|
+ & primaryRes & warMachine & clientInfo & moatDamage;
|
|
|
|
+ if(version >= 758)
|
|
|
|
+ {
|
|
|
|
+ h & moatHexes;
|
|
|
|
+ }
|
|
|
|
+ else if(!h.saving)
|
|
|
|
+ {
|
|
|
|
+ moatHexes = defaultMoatHexes();
|
|
|
|
+ }
|
|
|
|
+ h & defaultTavernChance;
|
|
|
|
|
|
auto findNull = [](const std::pair<BuildingID, ConstTransitivePtr<CBuilding>> &building)
|
|
auto findNull = [](const std::pair<BuildingID, ConstTransitivePtr<CBuilding>> &building)
|
|
{ return building.second == nullptr; };
|
|
{ return building.second == nullptr; };
|