1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-04 09:42: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" : {
"type" : {
"type" : "string",
"enum" : ["playerStart", "cpuStart", "treasure", "junction"]
"enum" : ["playerStart", "cpuStart", "treasure", "junction", "sealed"]
},
"size" : { "type" : "number", "minimum" : 1 },
"owner" : {},

View File

@ -28,10 +28,11 @@
/// 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" : {
"heroes" : {
"perPlayerOnMapCap" : 1
}
"settings" :
{
"heroes" :
{
"perPlayerOnMapCap" : 1
}
},
@ -59,7 +60,7 @@
``` javascript
{
// Type of this zone. Possible values are:
// "playerStart", "cpuStart", "treasure", "junction"
// "playerStart", "cpuStart", "treasure", "junction", "sealed"
"type" : "playerStart",
// relative size of zone

View File

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

View File

@ -28,7 +28,8 @@ enum class ETemplateZoneType
CPU_START,
TREASURE,
JUNCTION,
WATER
WATER,
SEALED
};
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);
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
dAreaPossible.erase(pos);
@ -348,6 +348,16 @@ void Zone::fractalize()
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
{
// Handle special case - place Monoliths at the edge of a zone