mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Merge branch 'develop' of https://github.com/vcmi/vcmi into RMG
This commit is contained in:
commit
e51e2190fd
@ -207,7 +207,7 @@ void CMapHandler::borderAndTerrainBitmapInit()
|
||||
terBitmapNum = 17;
|
||||
else if(i==(sizes.x) && j==(sizes.y))
|
||||
terBitmapNum = 18;
|
||||
else if(j == -1 && i > -1 && i < sizes.y)
|
||||
else if(j == -1 && i > -1 && i < sizes.x)
|
||||
terBitmapNum = rand.nextInt(22, 23);
|
||||
else if(i == -1 && j > -1 && j < sizes.y)
|
||||
terBitmapNum = rand.nextInt(33, 34);
|
||||
|
@ -68,7 +68,7 @@
|
||||
],
|
||||
"combat_value": 1013,
|
||||
"reward" : {
|
||||
"value": 20000
|
||||
"value": 20000,
|
||||
"resources":
|
||||
{
|
||||
"wood" : 8,
|
||||
@ -664,7 +664,7 @@
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"derelictShip" : {
|
||||
"index" :24,
|
||||
"handler": "bank",
|
||||
@ -863,9 +863,9 @@
|
||||
"gold" : 20000
|
||||
},
|
||||
"artifacts": [
|
||||
{ "class" : "TREASURE" }
|
||||
{ "class" : "MINOR" }
|
||||
{ "class" : "MAJOR" }
|
||||
{ "class" : "TREASURE" },
|
||||
{ "class" : "MINOR" },
|
||||
{ "class" : "MAJOR" },
|
||||
{ "class" : "RELIC" }
|
||||
]
|
||||
}
|
||||
@ -886,9 +886,9 @@
|
||||
"gold" : 30000
|
||||
},
|
||||
"artifacts": [
|
||||
{ "class" : "MINOR" }
|
||||
{ "class" : "MAJOR" }
|
||||
{ "class" : "RELIC" }
|
||||
{ "class" : "MINOR" },
|
||||
{ "class" : "MAJOR" },
|
||||
{ "class" : "RELIC" },
|
||||
{ "class" : "RELIC" }
|
||||
]
|
||||
}
|
||||
@ -908,11 +908,10 @@
|
||||
{
|
||||
"gold" : 40000
|
||||
},
|
||||
"artifacts": [ 0, 0, 1, 3 ]
|
||||
"artifacts": [
|
||||
{ "class" : "MAJOR" }
|
||||
{ "class" : "RELIC" }
|
||||
{ "class" : "RELIC" }
|
||||
{ "class" : "MAJOR" },
|
||||
{ "class" : "RELIC" },
|
||||
{ "class" : "RELIC" },
|
||||
{ "class" : "RELIC" }
|
||||
]
|
||||
}
|
||||
@ -932,11 +931,10 @@
|
||||
{
|
||||
"gold" : 50000
|
||||
},
|
||||
"artifacts": [ 0, 0, 0, 4 ]
|
||||
"artifacts": [
|
||||
{ "class" : "RELIC" }
|
||||
{ "class" : "RELIC" }
|
||||
{ "class" : "RELIC" }
|
||||
{ "class" : "RELIC" },
|
||||
{ "class" : "RELIC" },
|
||||
{ "class" : "RELIC" },
|
||||
{ "class" : "RELIC" }
|
||||
]
|
||||
}
|
||||
|
@ -110,8 +110,6 @@ CHeroClass *CHeroClassHandler::loadFromJson(const JsonNode & node)
|
||||
|
||||
heroClass->name = node["name"].String();
|
||||
heroClass->affinity = vstd::find_pos(affinityStr, node["affinity"].String());
|
||||
if (heroClass->affinity >= 2) //FIXME: MODS COMPATIBILITY
|
||||
heroClass->affinity = 0;
|
||||
|
||||
for(const std::string & pSkill : PrimarySkill::names)
|
||||
{
|
||||
@ -125,15 +123,11 @@ CHeroClass *CHeroClassHandler::loadFromJson(const JsonNode & node)
|
||||
heroClass->secSkillProbability.push_back(node["secondarySkills"][secSkill].Float());
|
||||
}
|
||||
|
||||
//FIXME: MODS COMPATIBILITY
|
||||
if (!node["commander"].isNull())
|
||||
VLC->modh->identifiers.requestIdentifier ("creature", node["commander"],
|
||||
[=](si32 commanderID)
|
||||
{
|
||||
VLC->modh->identifiers.requestIdentifier ("creature", node["commander"],
|
||||
[=](si32 commanderID)
|
||||
{
|
||||
heroClass->commander = VLC->creh->creatures[commanderID];
|
||||
});
|
||||
}
|
||||
heroClass->commander = VLC->creh->creatures[commanderID];
|
||||
});
|
||||
|
||||
heroClass->defaultTavernChance = node["defaultTavern"].Float();
|
||||
for(auto & tavern : node["tavern"].Struct())
|
||||
|
@ -94,6 +94,7 @@ set(lib_SRCS
|
||||
registerTypes/TypesClientPacks2.cpp
|
||||
registerTypes/TypesMapObjects1.cpp
|
||||
registerTypes/TypesMapObjects2.cpp
|
||||
registerTypes/TypesMapObjects3.cpp
|
||||
registerTypes/TypesPregamePacks.cpp
|
||||
registerTypes/TypesServerPacks.cpp
|
||||
)
|
||||
|
@ -272,24 +272,12 @@ void CTownHandler::loadBuildingRequirements(CTown &town, CBuilding & building, c
|
||||
{
|
||||
if (source.isNull())
|
||||
return;
|
||||
if (source.Vector()[0].getType() == JsonNode::DATA_FLOAT)
|
||||
{
|
||||
// MODS COMPATIBILITY
|
||||
CBuilding::TRequired::OperatorAll required;
|
||||
|
||||
for(const JsonNode &building : source.Vector())
|
||||
required.expressions.push_back(BuildingID(building.Float()));
|
||||
|
||||
building.requirements = CBuilding::TRequired(required);
|
||||
}
|
||||
else
|
||||
{
|
||||
BuildingRequirementsHelper hlp;
|
||||
hlp.building = &building;
|
||||
hlp.faction = town.faction;
|
||||
hlp.json = source;
|
||||
requirementsToLoad.push_back(hlp);
|
||||
}
|
||||
BuildingRequirementsHelper hlp;
|
||||
hlp.building = &building;
|
||||
hlp.faction = town.faction;
|
||||
hlp.json = source;
|
||||
requirementsToLoad.push_back(hlp);
|
||||
}
|
||||
|
||||
void CTownHandler::loadBuilding(CTown &town, const std::string & stringID, const JsonNode & source)
|
||||
@ -308,56 +296,49 @@ void CTownHandler::loadBuilding(CTown &town, const std::string & stringID, const
|
||||
ret->resources = TResources(source["cost"]);
|
||||
ret->produce = TResources(source["produce"]);
|
||||
|
||||
//for compatibility with older town mods
|
||||
//MODS COMPATIBILITY FOR 0.96
|
||||
if(!ret->produce.nonZero())
|
||||
{
|
||||
if (ret->bid == BuildingID::VILLAGE_HALL) ret->produce[Res::GOLD] = 500;
|
||||
|
||||
if (ret->bid == BuildingID::TOWN_HALL) ret->produce[Res::GOLD] = 1000;
|
||||
|
||||
if (ret->bid == BuildingID::CITY_HALL) ret->produce[Res::GOLD] = 2000;
|
||||
|
||||
if (ret->bid == BuildingID::CAPITOL) ret->produce[Res::GOLD] = 4000;
|
||||
|
||||
if (ret->bid == BuildingID::GRAIL) ret->produce[Res::GOLD] = 5000;
|
||||
//
|
||||
if (ret->bid == BuildingID::RESOURCE_SILO)
|
||||
{
|
||||
if ((ret->town->primaryRes != Res::WOOD) && (ret->town->primaryRes != Res::ORE) && (ret->town->primaryRes != Res::GOLD))
|
||||
ret->produce[ret->town->primaryRes] = 1;
|
||||
else
|
||||
{
|
||||
if (ret->town->primaryRes == Res::GOLD) ret->produce[ret->town->primaryRes] = 500;
|
||||
else
|
||||
switch (ret->bid) {
|
||||
break; case BuildingID::VILLAGE_HALL: ret->produce[Res::GOLD] = 500;
|
||||
break; case BuildingID::TOWN_HALL : ret->produce[Res::GOLD] = 1000;
|
||||
break; case BuildingID::CITY_HALL : ret->produce[Res::GOLD] = 2000;
|
||||
break; case BuildingID::CAPITOL : ret->produce[Res::GOLD] = 4000;
|
||||
break; case BuildingID::GRAIL : ret->produce[Res::GOLD] = 5000;
|
||||
break; case BuildingID::RESOURCE_SILO :
|
||||
{
|
||||
ret->produce[Res::WOOD] = 1;
|
||||
ret->produce[Res::ORE] = 1;
|
||||
switch (ret->town->primaryRes)
|
||||
{
|
||||
case Res::GOLD:
|
||||
ret->produce[ret->town->primaryRes] = 500;
|
||||
break;
|
||||
case Res::WOOD_AND_ORE:
|
||||
ret->produce[Res::WOOD] = 1;
|
||||
ret->produce[Res::ORE] = 1;
|
||||
break;
|
||||
default:
|
||||
ret->produce[ret->town->primaryRes] = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
loadBuildingRequirements(town, *ret, source["requires"]);
|
||||
|
||||
if (!source["upgrades"].isNull())
|
||||
{
|
||||
//MODS COMPATIBILITY
|
||||
if (source["upgrades"].getType() == JsonNode::DATA_FLOAT)
|
||||
ret->upgrade = BuildingID(source["upgrades"].Float());
|
||||
else
|
||||
// building id and upgrades can't be the same
|
||||
if(stringID == source["upgrades"].String())
|
||||
{
|
||||
// building id and upgrades can't be the same
|
||||
if(stringID == source["upgrades"].String())
|
||||
{
|
||||
throw std::runtime_error(boost::str(boost::format("Building with ID '%s' of town '%s' can't be an upgrade of the same building.") %
|
||||
stringID % town.faction->name));
|
||||
}
|
||||
|
||||
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, source["upgrades"], [=](si32 identifier)
|
||||
{
|
||||
ret->upgrade = BuildingID(identifier);
|
||||
});
|
||||
throw std::runtime_error(boost::str(boost::format("Building with ID '%s' of town '%s' can't be an upgrade of the same building.") %
|
||||
stringID % town.faction->name));
|
||||
}
|
||||
|
||||
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, source["upgrades"], [=](si32 identifier)
|
||||
{
|
||||
ret->upgrade = BuildingID(identifier);
|
||||
});
|
||||
}
|
||||
else
|
||||
ret->upgrade = BuildingID::NONE;
|
||||
@ -381,7 +362,6 @@ void CTownHandler::loadStructure(CTown &town, const std::string & stringID, cons
|
||||
{
|
||||
auto ret = new CStructure;
|
||||
|
||||
//Note: MODS COMPATIBILITY CODE
|
||||
ret->building = nullptr;
|
||||
ret->buildable = nullptr;
|
||||
|
||||
@ -399,17 +379,10 @@ void CTownHandler::loadStructure(CTown &town, const std::string & stringID, cons
|
||||
}
|
||||
else
|
||||
{
|
||||
if (source["builds"].getType() == JsonNode::DATA_FLOAT)
|
||||
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, source["builds"], [=, &town](si32 identifier) mutable
|
||||
{
|
||||
ret->buildable = town.buildings[BuildingID(source["builds"].Float())];
|
||||
}
|
||||
else
|
||||
{
|
||||
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, source["builds"], [=, &town](si32 identifier) mutable
|
||||
{
|
||||
ret->buildable = town.buildings[BuildingID(identifier)];
|
||||
});
|
||||
}
|
||||
ret->buildable = town.buildings[BuildingID(identifier)];
|
||||
});
|
||||
}
|
||||
|
||||
ret->identifier = stringID;
|
||||
@ -457,16 +430,10 @@ void CTownHandler::loadTownHall(CTown &town, const JsonNode & source)
|
||||
auto & dst = dstBox[k];
|
||||
auto & src = srcBox[k];
|
||||
|
||||
//MODS COMPATIBILITY
|
||||
if (src.getType() == JsonNode::DATA_FLOAT)
|
||||
dst = BuildingID(src.Float());
|
||||
else
|
||||
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, src, [&](si32 identifier)
|
||||
{
|
||||
VLC->modh->identifiers.requestIdentifier("building." + town.faction->identifier, src, [&](si32 identifier)
|
||||
{
|
||||
dst = BuildingID(identifier);
|
||||
});
|
||||
}
|
||||
dst = BuildingID(identifier);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -673,20 +640,6 @@ CFaction * CTownHandler::loadFromJson(const JsonNode &source, std::string identi
|
||||
faction->name = source["name"].String();
|
||||
faction->identifier = identifier;
|
||||
|
||||
//FIXME: MODS COMPATIBILITY
|
||||
if (!source["commander"].isNull())
|
||||
{
|
||||
VLC->modh->identifiers.requestIdentifier ("creature", source["commander"],
|
||||
[=](si32 commanderID)
|
||||
{
|
||||
for (auto ptr : VLC->heroh->classes.heroClasses)
|
||||
{
|
||||
if (ptr->commander == nullptr && ptr->faction == faction->index)
|
||||
ptr->commander = VLC->creh->creatures[commanderID];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
faction->creatureBg120 = source["creatureBackground"]["120px"].String();
|
||||
faction->creatureBg130 = source["creatureBackground"]["130px"].String();
|
||||
|
||||
|
@ -91,8 +91,6 @@
|
||||
<Unit filename="CCreatureHandler.h" />
|
||||
<Unit filename="CCreatureSet.cpp" />
|
||||
<Unit filename="CCreatureSet.h" />
|
||||
<Unit filename="CDefObjInfoHandler.cpp" />
|
||||
<Unit filename="CDefObjInfoHandler.h" />
|
||||
<Unit filename="CGameInfoCallback.cpp" />
|
||||
<Unit filename="CGameInfoCallback.h" />
|
||||
<Unit filename="CGameInterface.cpp" />
|
||||
@ -105,8 +103,6 @@
|
||||
<Unit filename="CHeroHandler.h" />
|
||||
<Unit filename="CModHandler.cpp" />
|
||||
<Unit filename="CModHandler.h" />
|
||||
<Unit filename="CObjectHandler.cpp" />
|
||||
<Unit filename="CObjectHandler.h" />
|
||||
<Unit filename="CObstacleInstance.cpp" />
|
||||
<Unit filename="CObstacleInstance.h" />
|
||||
<Unit filename="CRandomGenerator.cpp" />
|
||||
@ -185,6 +181,37 @@
|
||||
<Unit filename="logging/CBasicLogConfigurator.h" />
|
||||
<Unit filename="logging/CLogger.cpp" />
|
||||
<Unit filename="logging/CLogger.h" />
|
||||
<Unit filename="mapObjects/CArmedInstance.cpp" />
|
||||
<Unit filename="mapObjects/CArmedInstance.h" />
|
||||
<Unit filename="mapObjects/CBank.cpp" />
|
||||
<Unit filename="mapObjects/CBank.h" />
|
||||
<Unit filename="mapObjects/CGHeroInstance.cpp" />
|
||||
<Unit filename="mapObjects/CGHeroInstance.h" />
|
||||
<Unit filename="mapObjects/CGMarket.cpp" />
|
||||
<Unit filename="mapObjects/CGMarket.h" />
|
||||
<Unit filename="mapObjects/CGPandoraBox.cpp" />
|
||||
<Unit filename="mapObjects/CGPandoraBox.h" />
|
||||
<Unit filename="mapObjects/CGTownInstance.cpp" />
|
||||
<Unit filename="mapObjects/CGTownInstance.h" />
|
||||
<Unit filename="mapObjects/CObjectClassesHandler.cpp" />
|
||||
<Unit filename="mapObjects/CObjectClassesHandler.h" />
|
||||
<Unit filename="mapObjects/CObjectHandler.cpp" />
|
||||
<Unit filename="mapObjects/CObjectHandler.h" />
|
||||
<Unit filename="mapObjects/CQuest.cpp" />
|
||||
<Unit filename="mapObjects/CQuest.h" />
|
||||
<Unit filename="mapObjects/CRewardableConstructor.cpp" />
|
||||
<Unit filename="mapObjects/CRewardableConstructor.h" />
|
||||
<Unit filename="mapObjects/CRewardableObject.cpp" />
|
||||
<Unit filename="mapObjects/CRewardableObject.h" />
|
||||
<Unit filename="mapObjects/CommonConstructors.cpp" />
|
||||
<Unit filename="mapObjects/CommonConstructors.h" />
|
||||
<Unit filename="mapObjects/JsonRandom.cpp" />
|
||||
<Unit filename="mapObjects/JsonRandom.h" />
|
||||
<Unit filename="mapObjects/MapObjects.h" />
|
||||
<Unit filename="mapObjects/MiscObjects.cpp" />
|
||||
<Unit filename="mapObjects/MiscObjects.h" />
|
||||
<Unit filename="mapObjects/ObjectTemplate.cpp" />
|
||||
<Unit filename="mapObjects/ObjectTemplate.h" />
|
||||
<Unit filename="mapping/CCampaignHandler.cpp" />
|
||||
<Unit filename="mapping/CCampaignHandler.h" />
|
||||
<Unit filename="mapping/CMap.cpp" />
|
||||
@ -205,6 +232,7 @@
|
||||
<Unit filename="registerTypes/TypesClientPacks2.cpp" />
|
||||
<Unit filename="registerTypes/TypesMapObjects1.cpp" />
|
||||
<Unit filename="registerTypes/TypesMapObjects2.cpp" />
|
||||
<Unit filename="registerTypes/TypesMapObjects3.cpp" />
|
||||
<Unit filename="registerTypes/TypesPregamePacks.cpp" />
|
||||
<Unit filename="registerTypes/TypesServerPacks.cpp" />
|
||||
<Unit filename="rmg/CMapGenOptions.cpp" />
|
||||
|
@ -228,6 +228,7 @@
|
||||
<ClCompile Include="registerTypes\TypesClientPacks2.cpp" />
|
||||
<ClCompile Include="registerTypes\TypesMapObjects1.cpp" />
|
||||
<ClCompile Include="registerTypes\TypesMapObjects2.cpp" />
|
||||
<ClCompile Include="registerTypes\TypesMapObjects3.cpp" />
|
||||
<ClCompile Include="registerTypes\TypesPregamePacks.cpp" />
|
||||
<ClCompile Include="registerTypes\TypesServerPacks.cpp" />
|
||||
<ClCompile Include="rmg\CMapGenerator.cpp" />
|
||||
|
@ -203,6 +203,7 @@
|
||||
<ClCompile Include="mapObjects\ObjectTemplate.cpp">
|
||||
<Filter>mapObjects</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="registerTypes\TypesMapObjects3.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="CCreatureSet.h">
|
||||
|
@ -10,10 +10,10 @@
|
||||
|
||||
#include "StdInc.h"
|
||||
#include "CGTownInstance.h"
|
||||
#include "CObjectClassesHandler.h"
|
||||
|
||||
#include "../NetPacks.h"
|
||||
#include "../CGeneralTextHandler.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
using namespace boost::assign;
|
||||
|
||||
|
@ -20,7 +20,7 @@ class JsonNode;
|
||||
class CRandomGenerator;
|
||||
|
||||
/// Structure that describes placement rules for this object in random map
|
||||
struct RandomMapInfo
|
||||
struct DLL_LINKAGE RandomMapInfo
|
||||
{
|
||||
/// How valuable this object is, 1k = worthless, 10k = Utopia-level
|
||||
ui32 value;
|
||||
@ -47,7 +47,7 @@ struct RandomMapInfo
|
||||
}
|
||||
};
|
||||
|
||||
class IObjectInfo
|
||||
class DLL_LINKAGE IObjectInfo
|
||||
{
|
||||
public:
|
||||
struct CArmyStructure
|
||||
@ -93,7 +93,7 @@ public:
|
||||
|
||||
class CGObjectInstance;
|
||||
|
||||
class DLL_EXPORT AObjectTypeHandler : public boost::noncopyable
|
||||
class DLL_LINKAGE AObjectTypeHandler : public boost::noncopyable
|
||||
{
|
||||
RandomMapInfo rmgInfo;
|
||||
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
class CRandomRewardObjectInfo : public IObjectInfo
|
||||
class DLL_LINKAGE CRandomRewardObjectInfo : public IObjectInfo
|
||||
{
|
||||
JsonNode parameters;
|
||||
public:
|
||||
@ -42,7 +42,7 @@ public:
|
||||
void init(const JsonNode & objectConfig);
|
||||
};
|
||||
|
||||
class CRewardableConstructor : public AObjectTypeHandler
|
||||
class DLL_LINKAGE CRewardableConstructor : public AObjectTypeHandler
|
||||
{
|
||||
CRandomRewardObjectInfo objectInfo;
|
||||
|
||||
|
@ -128,7 +128,7 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CVisitInfo
|
||||
class DLL_LINKAGE CVisitInfo
|
||||
{
|
||||
public:
|
||||
CRewardLimiter limiter;
|
||||
|
@ -90,8 +90,8 @@ namespace JsonRandom
|
||||
for (auto & entry : value["slot"].Vector())
|
||||
allowedPositions.insert(VLC->arth->stringToSlot(entry.String()));
|
||||
|
||||
if (value["minValue"].isNull()) minValue = value["minValue"].Float();
|
||||
if (value["maxValue"].isNull()) maxValue = value["maxValue"].Float();
|
||||
if (!value["minValue"].isNull()) minValue = value["minValue"].Float();
|
||||
if (!value["maxValue"].isNull()) maxValue = value["maxValue"].Float();
|
||||
|
||||
return VLC->arth->pickRandomArtifact(rng, [=](ArtifactID artID) -> bool
|
||||
{
|
||||
@ -206,7 +206,12 @@ namespace JsonRandom
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<Bonus> loadBonuses(const JsonNode & value)
|
||||
std::vector<Component> loadComponents(const JsonNode & value)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
std::vector<Bonus> DLL_LINKAGE loadBonuses(const JsonNode & value)
|
||||
{
|
||||
std::vector<Bonus> ret;
|
||||
for (const JsonNode & entry : value.Vector())
|
||||
@ -218,8 +223,4 @@ namespace JsonRandom
|
||||
return ret;
|
||||
}
|
||||
|
||||
std::vector<Component> loadComponents(const JsonNode & value)
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,6 @@ namespace JsonRandom
|
||||
std::vector<CStackBasicDescriptor> loadCreatures(const JsonNode & value, CRandomGenerator & rng);
|
||||
std::vector<RandomStackInfo> evaluateCreatures(const JsonNode & value);
|
||||
|
||||
std::vector<Bonus> loadBonuses(const JsonNode & value);
|
||||
std::vector<Bonus> DLL_LINKAGE loadBonuses(const JsonNode & value);
|
||||
std::vector<Component> loadComponents(const JsonNode & value);
|
||||
}
|
||||
|
@ -18,15 +18,6 @@
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
template void registerTypesMapObjectTypes<CISer<CConnection>>(CISer<CConnection>& s);
|
||||
template void registerTypesMapObjectTypes<COSer<CConnection>>(COSer<CConnection>& s);
|
||||
template void registerTypesMapObjectTypes<CISer<CMemorySerializer>>(CISer<CMemorySerializer>& s);
|
||||
template void registerTypesMapObjectTypes<COSer<CMemorySerializer>>(COSer<CMemorySerializer>& s);
|
||||
template void registerTypesMapObjectTypes<CSaveFile>(CSaveFile & s);
|
||||
template void registerTypesMapObjectTypes<CLoadFile>(CLoadFile & s);
|
||||
template void registerTypesMapObjectTypes<CTypeList>(CTypeList & s);
|
||||
template void registerTypesMapObjectTypes<CLoadIntegrityValidator>(CLoadIntegrityValidator & s);
|
||||
|
||||
template void registerTypesMapObjects1<CISer<CConnection>>(CISer<CConnection>& s);
|
||||
template void registerTypesMapObjects1<COSer<CConnection>>(COSer<CConnection>& s);
|
||||
template void registerTypesMapObjects1<CISer<CMemorySerializer>>(CISer<CMemorySerializer>& s);
|
||||
|
28
lib/registerTypes/TypesMapObjects3.cpp
Normal file
28
lib/registerTypes/TypesMapObjects3.cpp
Normal file
@ -0,0 +1,28 @@
|
||||
#include "StdInc.h"
|
||||
#include "RegisterTypes.h"
|
||||
|
||||
#include "../mapping/CMapInfo.h"
|
||||
#include "../StartInfo.h"
|
||||
#include "../BattleState.h"
|
||||
#include "../CGameState.h"
|
||||
#include "../mapping/CMap.h"
|
||||
#include "../CModHandler.h"
|
||||
#include "../mapObjects/CObjectHandler.h"
|
||||
#include "../CCreatureHandler.h"
|
||||
#include "../VCMI_Lib.h"
|
||||
#include "../CArtHandler.h"
|
||||
#include "../CHeroHandler.h"
|
||||
#include "../CSpellHandler.h"
|
||||
#include "../CTownHandler.h"
|
||||
#include "../mapping/CCampaignHandler.h"
|
||||
#include "../NetPacks.h"
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
|
||||
template void registerTypesMapObjectTypes<CISer<CConnection>>(CISer<CConnection>& s);
|
||||
template void registerTypesMapObjectTypes<COSer<CConnection>>(COSer<CConnection>& s);
|
||||
template void registerTypesMapObjectTypes<CISer<CMemorySerializer>>(CISer<CMemorySerializer>& s);
|
||||
template void registerTypesMapObjectTypes<COSer<CMemorySerializer>>(COSer<CMemorySerializer>& s);
|
||||
template void registerTypesMapObjectTypes<CSaveFile>(CSaveFile & s);
|
||||
template void registerTypesMapObjectTypes<CLoadFile>(CLoadFile & s);
|
||||
template void registerTypesMapObjectTypes<CTypeList>(CTypeList & s);
|
||||
template void registerTypesMapObjectTypes<CLoadIntegrityValidator>(CLoadIntegrityValidator & s);
|
@ -237,7 +237,7 @@ void CMapGenerator::createConnections()
|
||||
int3 guardPos(-1,-1,-1);
|
||||
|
||||
auto otherZoneTiles = zoneB->getTileInfo();
|
||||
auto otherZoneCenter = zoneB->getPos();
|
||||
//auto otherZoneCenter = zoneB->getPos();
|
||||
|
||||
for (auto tile : tiles)
|
||||
{
|
||||
|
@ -20,9 +20,8 @@
|
||||
#include "../CSpellHandler.h" //for choosing random spells
|
||||
|
||||
#include "../mapObjects/CObjectClassesHandler.h"
|
||||
//#include "../mapObjects/CGPandoraBox.h"
|
||||
//#include "../mapObjects/CRewardableObject.h"
|
||||
#include "../mapObjects/MapObjects.h"
|
||||
#include "../mapObjects/CGPandoraBox.h"
|
||||
#include "../mapObjects/CRewardableObject.h"
|
||||
|
||||
class CMap;
|
||||
class CMapEditManager;
|
||||
@ -125,9 +124,16 @@ void CTileInfo::setTerrainType(ETerrainType value)
|
||||
terrain = value;
|
||||
}
|
||||
|
||||
CRmgTemplateZone::CRmgTemplateZone() : id(0), type(ETemplateZoneType::PLAYER_START), size(1),
|
||||
terrainType (ETerrainType::GRASS), townType(0), townsAreSameType(false), matchTerrainToTown(true), totalDensity(0),
|
||||
zoneMonsterStrength(EMonsterStrength::ZONE_NORMAL)
|
||||
CRmgTemplateZone::CRmgTemplateZone() :
|
||||
id(0),
|
||||
type(ETemplateZoneType::PLAYER_START),
|
||||
size(1),
|
||||
townsAreSameType(false),
|
||||
matchTerrainToTown(true),
|
||||
townType(0),
|
||||
terrainType (ETerrainType::GRASS),
|
||||
zoneMonsterStrength(EMonsterStrength::ZONE_NORMAL),
|
||||
totalDensity(0)
|
||||
{
|
||||
townTypes = getDefaultTownTypes();
|
||||
terrainTypes = getDefaultTerrainTypes();
|
||||
@ -308,6 +314,11 @@ std::vector<CTreasureInfo> CRmgTemplateZone::getTreasureInfo()
|
||||
return treasureInfo;
|
||||
}
|
||||
|
||||
std::set<int3>* CRmgTemplateZone::getFreePaths()
|
||||
{
|
||||
return &freePaths;
|
||||
}
|
||||
|
||||
float3 CRmgTemplateZone::getCenter() const
|
||||
{
|
||||
return center;
|
||||
@ -318,6 +329,7 @@ void CRmgTemplateZone::setCenter(const float3 &f)
|
||||
center = float3 (std::min(std::max(f.x, 0.f), 1.f), std::min(std::max(f.y, 0.f), 1.f), f.z);
|
||||
}
|
||||
|
||||
|
||||
bool CRmgTemplateZone::pointIsIn(int x, int y)
|
||||
{
|
||||
return true;
|
||||
@ -342,11 +354,6 @@ std::set<int3> CRmgTemplateZone::getTileInfo () const
|
||||
return tileinfo;
|
||||
}
|
||||
|
||||
std::set<int3>* CRmgTemplateZone::getFreePaths()
|
||||
{
|
||||
return &freePaths;
|
||||
}
|
||||
|
||||
void CRmgTemplateZone::createBorder(CMapGenerator* gen)
|
||||
{
|
||||
for (auto tile : tileinfo)
|
||||
@ -377,7 +384,7 @@ void CRmgTemplateZone::fractalize(CMapGenerator* gen)
|
||||
{
|
||||
if (gen->isFree(tile))
|
||||
clearedTiles.push_back(tile);
|
||||
else if (gen->isPossible(tile));
|
||||
else if (gen->isPossible(tile))
|
||||
possibleTiles.insert(tile);
|
||||
}
|
||||
if (clearedTiles.empty()) //this should come from zone connections
|
||||
@ -660,7 +667,6 @@ bool CRmgTemplateZone::createTreasurePile (CMapGenerator* gen, int3 &pos)
|
||||
int3 zoneCenter = getPos();
|
||||
int3 closestTile = int3(-1,-1,-1);
|
||||
float minDistance = 1e10;
|
||||
|
||||
for (auto treasure : treasures)
|
||||
{
|
||||
if (zoneCenter.dist2d(treasure.first) < minDistance)
|
||||
@ -1040,8 +1046,8 @@ bool CRmgTemplateZone::findPlaceForObject(CMapGenerator* gen, CGObjectInstance*
|
||||
//si32 min_dist = sqrt(tileinfo.size()/density);
|
||||
int best_distance = 0;
|
||||
bool result = false;
|
||||
si32 w = gen->map->width;
|
||||
si32 h = gen->map->height;
|
||||
//si32 w = gen->map->width;
|
||||
//si32 h = gen->map->height;
|
||||
|
||||
//logGlobal->infoStream() << boost::format("Min dist for density %f is %d") % density % min_dist;
|
||||
|
||||
@ -1190,9 +1196,8 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
|
||||
for (auto tile : tiles)
|
||||
{
|
||||
//crunching path may fail if center of teh zone is dirrectly over wide object
|
||||
if (crunchPath (gen, tile, findClosestTile(freePaths, tile), id, &freePaths)) //required objects will contitute our core free paths
|
||||
if (crunchPath (gen, tile, getPos(), id)) //make sure object is accessible before surrounding it with blocked tiles
|
||||
{
|
||||
//make sure object is accessible before surrounding it with blocked tiles
|
||||
guardTile = tile;
|
||||
break;
|
||||
}
|
||||
@ -1213,14 +1218,8 @@ bool CRmgTemplateZone::guardObject(CMapGenerator* gen, CGObjectInstance* object,
|
||||
|
||||
gen->setOccupied (guardTile, ETileType::USED);
|
||||
}
|
||||
else //make sure no other stuff spawns next to unguarded object
|
||||
{
|
||||
for (auto tile : tiles)
|
||||
{
|
||||
if (!gen->isBlocked(tile))
|
||||
gen->setOccupied (tile, ETileType::FREE);
|
||||
}
|
||||
}
|
||||
else
|
||||
gen->setOccupied (guardTile, ETileType::FREE);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1280,6 +1279,7 @@ ObjectInfo CRmgTemplateZone::getRandomObject (CMapGenerator* gen, ui32 value)
|
||||
if (r <= t.first)
|
||||
return t.second;
|
||||
}
|
||||
//FIXME: control reaches end of non-void function. Missing return?
|
||||
}
|
||||
|
||||
void CRmgTemplateZone::addAllPossibleObjects (CMapGenerator* gen)
|
||||
|
Loading…
Reference in New Issue
Block a user