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:
@@ -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"
|
||||
|
@@ -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())
|
||||
{
|
||||
|
@@ -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);
|
||||
|
Reference in New Issue
Block a user