1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-09-16 09:26:28 +02:00

- Removed unecessary includes

- Fixed town types configured from RMG templates
This commit is contained in:
DjWarmonger
2014-10-31 17:09:34 +01:00
parent afaf74a05b
commit 9eeea7299a
3 changed files with 16 additions and 8 deletions

View File

@@ -1,7 +1,5 @@
#include "StdInc.h"
#include "Fuzzy.h"
#include "src/Engine.cpp"
#include "src/Operation.cpp"
#include <limits>
#include "../../lib/mapObjects/MapObjects.h"

View File

@@ -70,14 +70,18 @@ void CJsonRmgTemplateLoader::loadTemplates()
for (int i = 0; i < 2; ++i)
{
std::set<TFaction> allowedTownTypes;
if (zoneNode[i ? "allowedTowns" : "allowedMonsters"].isNull())
if (i)
{
if (i)
if (zoneNode["allowedTowns"].isNull())
allowedTownTypes = zone->getDefaultTownTypes();
else
allowedTownTypes = VLC->townh->getAllowedFactions(false);
}
else
{
if (zoneNode["allowedMonsters"].isNull())
allowedTownTypes = VLC->townh->getAllowedFactions(false);
}
if (allowedTownTypes.empty())
{
for (const JsonNode & allowedTown : zoneNode[i ? "allowedTowns" : "allowedMonsters"].Vector())
{

View File

@@ -1049,13 +1049,19 @@ void CRmgTemplateZone::initTownType (CMapGenerator* gen)
else
{
type = ETemplateZoneType::TREASURE;
townType = *RandomGeneratorUtil::nextItem(VLC->townh->getAllowedFactions(), gen->rand);
if (townTypes.size())
townType = *RandomGeneratorUtil::nextItem(townTypes, gen->rand);
else
townType = *RandomGeneratorUtil::nextItem(getDefaultTownTypes(), gen->rand); //it is possible to have zone with no towns allowed
logGlobal->infoStream() << "Skipping this zone cause no player";
}
}
else //no player
{
townType = *RandomGeneratorUtil::nextItem(VLC->townh->getAllowedFactions(), gen->rand);
if (townTypes.size())
townType = *RandomGeneratorUtil::nextItem(townTypes, gen->rand);
else
townType = *RandomGeneratorUtil::nextItem(getDefaultTownTypes(), gen->rand); //it is possible to have zone with no towns allowed
}
addNewTowns (neutralTowns.getCastleCount(), true, PlayerColor::NEUTRAL);