Browse Source

Water zones get monster strength ZONE_NONE during their creation instead of a hardcoded check for zone type WATER at guard creation time.
Also preliminary preparations for water zone customization in the template json.

Warzyw647 2 years ago
parent
commit
4c513e8bb0
2 changed files with 5 additions and 2 deletions
  1. 3 0
      lib/rmg/RmgMap.cpp
  2. 2 2
      lib/rmg/TreasurePlacer.cpp

+ 3 - 0
lib/rmg/RmgMap.cpp

@@ -108,6 +108,9 @@ void RmgMap::initTiles(CMapGenerator & generator)
 			options.setType(ETemplateZoneType::WATER);
 			auto zone = std::make_shared<Zone>(*this, generator);
 			zone->setOptions(options);
+			//std::set<FactionID> allowedMonsterFactions({FactionID::CASTLE, FactionID::INFERNO}); // example of filling allowed monster factions
+			//zone->setMonsterTypes(allowedMonsterFactions); // can be set here, probably from template json, along with the treasure ranges and densities
+			zone->monsterStrength = EMonsterStrength::ZONE_NONE; // can be set to other value, probably from a new field in the template json
 			zones[zone->getId()] = zone;
 			break;
 	}

+ 2 - 2
lib/rmg/TreasurePlacer.cpp

@@ -527,8 +527,8 @@ size_t TreasurePlacer::getPossibleObjectsSize() const
 }
 
 bool TreasurePlacer::isGuardNeededForTreasure(int value)
-{// no guard in a zone with "monsters: none", in a water zone and for small treasures
-	return zone.monsterStrength != EMonsterStrength::ZONE_NONE && zone.getType() != ETemplateZoneType::WATER && value > minGuardedValue;
+{// no guard in a zone with "monsters: none" and for small treasures; water zones cen get monster strength ZONE_NONE elsewhere if needed
+	return zone.monsterStrength != EMonsterStrength::ZONE_NONE && value > minGuardedValue;
 }
 
 std::vector<ObjectInfo*> TreasurePlacer::prepareTreasurePile(const CTreasureInfo& treasureInfo)