1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-04 09:42:40 +02:00

Merge pull request #4965 from vcmi/sealed_zone

New type of zone - "sealed"
This commit is contained in:
Ivan Savenko 2024-12-02 13:21:02 +02:00 committed by GitHub
commit 306ee95496
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 26 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,11 @@
```json5
{
// Type of this zone. Possible values are:
// "playerStart", "cpuStart", "treasure", "junction"
// "playerStart" - Starting zone for a "human or CPU" players
// "cpuStart" - Starting zone for "CPU only" players
// "treasure" - Generic neutral zone
// "junction" - Neutral zone with narrow passages only. The rest of area is filled with obstacles.
// "sealed" - Decorative impassable zone completely filled with obstacles
"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