mirror of
https://github.com/yairm210/Unciv.git
synced 2025-08-03 00:29:18 +07:00
Resolved #447 - cities now have roads and railroads only when corresponding tech has been researched
This commit is contained in:
@ -64,7 +64,9 @@ class CityInfo {
|
||||
expansion.reset()
|
||||
|
||||
val tile = getCenterTile()
|
||||
tile.roadStatus = RoadStatus.Railroad
|
||||
|
||||
tryUpdateRoadStatus()
|
||||
|
||||
if (listOf("Forest", "Jungle", "Marsh").contains(tile.terrainFeature))
|
||||
tile.terrainFeature = null
|
||||
|
||||
@ -169,6 +171,13 @@ class CityInfo {
|
||||
cityConstructions.setTransients()
|
||||
}
|
||||
|
||||
fun startTurn(){
|
||||
cityStats.update()
|
||||
tryUpdateRoadStatus()
|
||||
attackedThisTurn = false
|
||||
if (resistanceCounter > 0) resistanceCounter--
|
||||
}
|
||||
|
||||
fun endTurn() {
|
||||
val stats = cityStats.currentCityStats
|
||||
if (cityConstructions.currentConstruction == CityConstructions.Settler && stats.food > 0) {
|
||||
@ -176,7 +185,6 @@ class CityInfo {
|
||||
stats.food = 0f
|
||||
}
|
||||
|
||||
|
||||
cityConstructions.nextTurn(stats)
|
||||
expansion.nextTurn(stats.culture)
|
||||
if(isBeingRazed){
|
||||
@ -189,13 +197,11 @@ class CityInfo {
|
||||
}
|
||||
}
|
||||
else population.nextTurn(stats.food)
|
||||
if (resistanceCounter > 0) resistanceCounter--
|
||||
|
||||
if(this in civInfo.cities) { // city was not destroyed
|
||||
health = min(health + 20, getMaxHealth())
|
||||
population.unassignExtraPopulation()
|
||||
}
|
||||
attackedThisTurn = false
|
||||
}
|
||||
|
||||
fun destroyCity() {
|
||||
@ -223,6 +229,7 @@ class CityInfo {
|
||||
for(building in cityConstructions.getBuiltBuildings().filter { it.requiredBuildingInAllCities!=null })
|
||||
cityConstructions.removeBuilding(building.name)
|
||||
isBeingRazed=false
|
||||
tryUpdateRoadStatus()
|
||||
}
|
||||
|
||||
fun canAcquireTile(newTileInfo: TileInfo): Boolean {
|
||||
@ -236,5 +243,14 @@ class CityInfo {
|
||||
return false
|
||||
}
|
||||
|
||||
fun tryUpdateRoadStatus(){
|
||||
if(getCenterTile().roadStatus==RoadStatus.None
|
||||
&& GameBasics.TileImprovements["Road"]!!.techRequired in civInfo.tech.techsResearched)
|
||||
getCenterTile().roadStatus==RoadStatus.Road
|
||||
|
||||
else if(getCenterTile().roadStatus!=RoadStatus.Railroad
|
||||
&& GameBasics.TileImprovements["Railroad"]!!.techRequired in civInfo.tech.techsResearched)
|
||||
getCenterTile().roadStatus==RoadStatus.Railroad
|
||||
}
|
||||
//endregion
|
||||
}
|
@ -320,6 +320,16 @@ class CivilizationInfo {
|
||||
updateViewableTiles()
|
||||
}
|
||||
|
||||
fun startTurn(){
|
||||
updateViewableTiles() // adds explored tiles so that the units will be able to perform automated actions better
|
||||
setCitiesConnectedToCapitalTransients()
|
||||
for (city in cities){
|
||||
city.startTurn()
|
||||
}
|
||||
happiness = getHappinessForNextTurn().values.sum().roundToInt()
|
||||
getCivUnits().toList().forEach { it.startTurn() }
|
||||
}
|
||||
|
||||
fun endTurn() {
|
||||
notifications.clear()
|
||||
|
||||
@ -370,15 +380,6 @@ class CivilizationInfo {
|
||||
return stats
|
||||
}
|
||||
|
||||
fun startTurn(){
|
||||
updateViewableTiles() // adds explored tiles so that the units will be able to perform automated actions better
|
||||
setCitiesConnectedToCapitalTransients()
|
||||
for (city in cities)
|
||||
city.cityStats.update()
|
||||
happiness = getHappinessForNextTurn().values.sum().roundToInt()
|
||||
getCivUnits().toList().forEach { it.startTurn() }
|
||||
}
|
||||
|
||||
fun canEnterTiles(otherCiv: CivilizationInfo): Boolean {
|
||||
if(otherCiv==this) return true
|
||||
if(isAtWarWith(otherCiv)) return true
|
||||
|
Reference in New Issue
Block a user