1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-27 22:49:25 +02:00

Place proper towns in underground (#743)

Implement feature of proper town selection in underground and surface
* Some minor refactoring of rmg
This commit is contained in:
Nordsoft91
2022-05-28 16:03:50 +03:00
committed by GitHub
parent d92356f085
commit 9d06e51631
18 changed files with 214 additions and 196 deletions

View File

@@ -211,6 +211,7 @@ CFaction::CFaction()
town = nullptr;
index = 0;
alignment = EAlignment::NEUTRAL;
preferUndergroundPlacement = false;
}
CFaction::~CFaction()
@@ -1099,6 +1100,9 @@ CFaction * CTownHandler::loadFromJson(const std::string & scope, const JsonNode
int terrainNum = nativeTerrain.isNull()
? -1
: vstd::find_pos(GameConstants::TERRAIN_NAMES, nativeTerrain.String());
auto preferUndergound = source["preferUndergroundPlacement"];
faction->preferUndergroundPlacement = preferUndergound.isNull() ? false : preferUndergound.Bool();
//Contructor is not called here, but operator=
faction->nativeTerrain = terrainNum < 0