mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-24 08:32:34 +02:00
Merge pull request #3743 from dydzio0614/special-factions
Allow factions to be special
This commit is contained in:
commit
6e9f15c8e6
@ -58,6 +58,10 @@
|
||||
"type" : "boolean",
|
||||
"description" : "Random map generator places player/cpu-owned towns underground if true is specified and on the ground otherwise. Parameter is unused for maps without underground."
|
||||
},
|
||||
"special" : {
|
||||
"type" : "boolean",
|
||||
"description" : "If true, faction is disabled from starting pick and in random map generation"
|
||||
},
|
||||
"creatureBackground" : {
|
||||
"type" : "object",
|
||||
"additionalProperties" : false,
|
||||
|
@ -75,6 +75,9 @@ Each town requires a set of buildings (Around 30-45 buildings)
|
||||
|
||||
// Random map generator places player/cpu-owned towns underground if true is specified and on the ground otherwise. Parameter is unused for maps without underground.
|
||||
"preferUndergroundPlacement" : false
|
||||
|
||||
// Optional, if set to true then faction cannot be selected on game start and will not be used for "random town" object
|
||||
"special" : false
|
||||
|
||||
// Town puzzle map
|
||||
"puzzleMap" :
|
||||
|
@ -1058,6 +1058,7 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
|
||||
|
||||
auto preferUndergound = source["preferUndergroundPlacement"];
|
||||
faction->preferUndergroundPlacement = preferUndergound.isNull() ? false : preferUndergound.Bool();
|
||||
faction->special = source["special"].Bool();
|
||||
|
||||
// NOTE: semi-workaround - normally, towns are supposed to have native terrains.
|
||||
// Towns without one are exceptions. So, vcmi requires nativeTerrain to be defined
|
||||
@ -1249,7 +1250,7 @@ std::set<FactionID> CTownHandler::getDefaultAllowed() const
|
||||
std::set<FactionID> allowedFactions;
|
||||
|
||||
for(auto town : objects)
|
||||
if (town->town != nullptr)
|
||||
if (town->town != nullptr && !town->special)
|
||||
allowedFactions.insert(town->getId());
|
||||
|
||||
return allowedFactions;
|
||||
|
@ -168,6 +168,7 @@ public:
|
||||
TerrainId nativeTerrain;
|
||||
EAlignment alignment = EAlignment::NEUTRAL;
|
||||
bool preferUndergroundPlacement = false;
|
||||
bool special = false;
|
||||
|
||||
/// Boat that will be used by town shipyard (if any)
|
||||
/// and for placing heroes directly on boat (in map editor, water prisons & taverns)
|
||||
|
Loading…
Reference in New Issue
Block a user