mirror of
https://github.com/yairm210/Unciv.git
synced 2025-02-11 11:28:03 +07:00
Fix: Legacy maps with starting locations not playable (#5000)
* Fix: legacy maps with starting locations not playable * Fix: legacy maps with starting locations not playable - ruleset
This commit is contained in:
parent
bf2ee91b67
commit
7085ea95cc
@ -48,7 +48,7 @@ class TileMap {
|
|||||||
@Transient
|
@Transient
|
||||||
lateinit var gameInfo: GameInfo
|
lateinit var gameInfo: GameInfo
|
||||||
|
|
||||||
/** Keep a copy of the [Ruleset] object passer to setTransients, for now only to allow subsequent setTransients without. Copied on [clone]. */
|
/** Keep a copy of the [Ruleset] object passed to setTransients, for now only to allow subsequent setTransients without. Copied on [clone]. */
|
||||||
@Transient
|
@Transient
|
||||||
var ruleset: Ruleset? = null
|
var ruleset: Ruleset? = null
|
||||||
|
|
||||||
@ -330,6 +330,8 @@ class TileMap {
|
|||||||
* Is run before setTransients, so make do without startingLocationsByNation
|
* Is run before setTransients, so make do without startingLocationsByNation
|
||||||
*/
|
*/
|
||||||
fun getRulesetIncompatibility(ruleset: Ruleset): HashSet<String> {
|
fun getRulesetIncompatibility(ruleset: Ruleset): HashSet<String> {
|
||||||
|
setTransients(ruleset)
|
||||||
|
setStartingLocationsTransients()
|
||||||
val rulesetIncompatibilities = HashSet<String>()
|
val rulesetIncompatibilities = HashSet<String>()
|
||||||
for (set in values.map { it.getRulesetIncompatibility(ruleset) })
|
for (set in values.map { it.getRulesetIncompatibility(ruleset) })
|
||||||
rulesetIncompatibilities.addAll(set)
|
rulesetIncompatibilities.addAll(set)
|
||||||
|
@ -176,14 +176,15 @@ class TileGroupIcons(val tileGroup: TileGroup) {
|
|||||||
startingLocationIcons.clear()
|
startingLocationIcons.clear()
|
||||||
if (!showResourcesAndImprovements) return
|
if (!showResourcesAndImprovements) return
|
||||||
if (tileGroup.forMapEditorIcon) return // the editor options for terrain do not bother to fully initialize, so tileInfo.tileMap would be an uninitialized lateinit
|
if (tileGroup.forMapEditorIcon) return // the editor options for terrain do not bother to fully initialize, so tileInfo.tileMap would be an uninitialized lateinit
|
||||||
|
val tileInfo = tileGroup.tileInfo
|
||||||
|
if (tileInfo.tileMap.startingLocationsByNation.isEmpty()) return
|
||||||
|
|
||||||
// Allow display of up to three nations starting locations on the same tile, rest only as count.
|
// Allow display of up to three nations starting locations on the same tile, rest only as count.
|
||||||
// Sorted so major get precedence and to make the display deterministic, otherwise you could get
|
// Sorted so major get precedence and to make the display deterministic, otherwise you could get
|
||||||
// different stacking order of the same nations in the same editing session
|
// different stacking order of the same nations in the same editing session
|
||||||
val tileInfo = tileGroup.tileInfo
|
|
||||||
val nations = tileInfo.tileMap.startingLocationsByNation.asSequence()
|
val nations = tileInfo.tileMap.startingLocationsByNation.asSequence()
|
||||||
.filter { tileInfo in it.value }
|
.filter { tileInfo in it.value }
|
||||||
.map { it.key to ImageGetter.ruleset.nations[it.key]!! }
|
.map { it.key to tileInfo.tileMap.ruleset!!.nations[it.key]!! }
|
||||||
.sortedWith(compareBy({ it.second.isCityState() }, { it.first }))
|
.sortedWith(compareBy({ it.second.isCityState() }, { it.first }))
|
||||||
.toList()
|
.toList()
|
||||||
if (nations.isEmpty()) return
|
if (nations.isEmpty()) return
|
||||||
|
Loading…
Reference in New Issue
Block a user