mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-28 14:24:43 -04:00
Resolved #3289 - can place unbuildable improvements that can exist on tiles
This commit is contained in:
parent
f57955c8d5
commit
c1a717e4f8
@ -299,7 +299,7 @@ open class TileInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Without regards to what civinfo it is, a lot of the checks are ust for the improvement on the tile.
|
/** Without regards to what civinfo it is, a lot of the checks are just for the improvement on the tile.
|
||||||
* Doubles as a check for the map editor.
|
* Doubles as a check for the map editor.
|
||||||
*/
|
*/
|
||||||
fun canImprovementBeBuiltHere(improvement: TileImprovement, resourceIsVisible:Boolean = resource!=null): Boolean {
|
fun canImprovementBeBuiltHere(improvement: TileImprovement, resourceIsVisible:Boolean = resource!=null): Boolean {
|
||||||
|
@ -250,8 +250,12 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
it.airUnits.add(unit)
|
it.airUnits.add(unit)
|
||||||
if (!it.isCityCenter()) unit.isTransported = true // if not city - air unit enters carrier
|
if (!it.isCityCenter()) unit.isTransported = true // if not city - air unit enters carrier
|
||||||
}
|
}
|
||||||
unit.type.isCivilian() -> { it.civilianUnit = unit }
|
unit.type.isCivilian() -> {
|
||||||
else -> { it.militaryUnit = unit }
|
it.civilianUnit = unit
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
it.militaryUnit = unit
|
||||||
|
}
|
||||||
}
|
}
|
||||||
unit.currentTile = it // needed for unit icon - unit needs to know if it's embarked or not...
|
unit.currentTile = it // needed for unit icon - unit needs to know if it's embarked or not...
|
||||||
}
|
}
|
||||||
@ -274,7 +278,8 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
nationImage.onClick {
|
nationImage.onClick {
|
||||||
currentNation = nation;
|
currentNation = nation;
|
||||||
currentPlayer = getPlayerIndexString(player)
|
currentPlayer = getPlayerIndexString(player)
|
||||||
setUnitTileAction() }
|
setUnitTileAction()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// barbarians icon
|
// barbarians icon
|
||||||
@ -518,7 +523,10 @@ class TileEditorOptionsTable(val mapEditorScreen: MapEditorScreen): Table(Camera
|
|||||||
}
|
}
|
||||||
val improvement = tileInfo.getTileImprovement()!!
|
val improvement = tileInfo.getTileImprovement()!!
|
||||||
tileInfo.improvement = null // Unset, and check if it can be reset. If so, do it, if not, invalid.
|
tileInfo.improvement = null // Unset, and check if it can be reset. If so, do it, if not, invalid.
|
||||||
if (tileInfo.canImprovementBeBuiltHere(improvement))
|
if (tileInfo.canImprovementBeBuiltHere(improvement)
|
||||||
|
// Allow building 'other' improvements like city ruins, barb encampments, Great Improvements etc
|
||||||
|
|| (improvement.terrainsCanBeBuiltOn.isEmpty() && ruleset.tileResources.values.none { it.improvement==improvement.name }
|
||||||
|
&& !tileInfo.isImpassible() && tileInfo.isLand))
|
||||||
tileInfo.improvement = improvement.name
|
tileInfo.improvement = improvement.name
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,9 +85,4 @@ class BasicTests {
|
|||||||
Assert.assertTrue(modCheck == "")
|
Assert.assertTrue(modCheck == "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// @Test // This should NOT run as part of the test suite!
|
|
||||||
// fun tryGetGithubTopicInfo(){
|
|
||||||
// println(Github.tryGetGithubReposWithTopic())
|
|
||||||
// }
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user