1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-08-10 22:31:40 +02:00

New type of zone - "sealed"

This commit is contained in:
Tomasz Zieliński
2024-11-23 12:19:25 +01:00
parent a4417f3fc5
commit 6bdb10444f
5 changed files with 22 additions and 9 deletions

View File

@@ -12,7 +12,7 @@
"properties" : { "properties" : {
"type" : { "type" : {
"type" : "string", "type" : "string",
"enum" : ["playerStart", "cpuStart", "treasure", "junction"] "enum" : ["playerStart", "cpuStart", "treasure", "junction", "sealed"]
}, },
"size" : { "type" : "number", "minimum" : 1 }, "size" : { "type" : "number", "minimum" : 1 },
"owner" : {}, "owner" : {},

View File

@@ -28,11 +28,12 @@
/// List of game settings that were overriden by this template. See config/gameConfig.json in vcmi install directory for possible values /// List of game settings that were overriden by this template. See config/gameConfig.json in vcmi install directory for possible values
/// Settings defined here will always override any settings from vcmi or from mods /// Settings defined here will always override any settings from vcmi or from mods
"settings" : { "settings" :
"heroes" : { {
"heroes" :
{
"perPlayerOnMapCap" : 1 "perPlayerOnMapCap" : 1
} }
}
}, },
/// List of named zones, see below for format description /// List of named zones, see below for format description
@@ -59,7 +60,7 @@
``` javascript ``` javascript
{ {
// Type of this zone. Possible values are: // Type of this zone. Possible values are:
// "playerStart", "cpuStart", "treasure", "junction" // "playerStart", "cpuStart", "treasure", "junction", "sealed"
"type" : "playerStart", "type" : "playerStart",
// relative size of zone // relative size of zone

View File

@@ -335,7 +335,8 @@ void ZoneOptions::serializeJson(JsonSerializeFormat & handler)
"cpuStart", "cpuStart",
"treasure", "treasure",
"junction", "junction",
"water" "water",
"sealed"
}; };
handler.serializeEnum("type", type, zoneTypes); handler.serializeEnum("type", type, zoneTypes);

View File

@@ -28,7 +28,8 @@ enum class ETemplateZoneType
CPU_START, CPU_START,
TREASURE, TREASURE,
JUNCTION, JUNCTION,
WATER WATER,
SEALED
}; };
namespace EWaterContent // Not enum class, because it's used in method RandomMapTab::setMapGenOptions namespace EWaterContent // Not enum class, because it's used in method RandomMapTab::setMapGenOptions

View File

@@ -138,7 +138,7 @@ void Zone::initFreeTiles()
}); });
dAreaPossible.assign(possibleTiles); dAreaPossible.assign(possibleTiles);
if(dAreaFree.empty()) if(dAreaFree.empty() && getType() != ETemplateZoneType::SEALED)
{ {
// Fixme: This might fail fot water zone, which doesn't need to have a tile in its center of the mass // Fixme: This might fail fot water zone, which doesn't need to have a tile in its center of the mass
dAreaPossible.erase(pos); dAreaPossible.erase(pos);
@@ -348,6 +348,16 @@ void Zone::fractalize()
tilesToIgnore.clear(); tilesToIgnore.clear();
} }
} }
else if (type == ETemplateZoneType::SEALED)
{
//Completely block all the tiles in the zone
auto tiles = areaPossible()->getTiles();
for(const auto & t : tiles)
map.setOccupied(t, ETileType::BLOCKED);
possibleTiles.clear();
dAreaFree.clear();
return;
}
else else
{ {
// Handle special case - place Monoliths at the edge of a zone // Handle special case - place Monoliths at the edge of a zone