mirror of
https://github.com/yairm210/Unciv.git
synced 2025-09-29 06:51:30 -04:00
Resolved #447 - cities now have roads and railroads only when corresponding tech has been researched
This commit is contained in:
parent
11b2a301cd
commit
50931a86c1
@ -64,7 +64,9 @@ class CityInfo {
|
|||||||
expansion.reset()
|
expansion.reset()
|
||||||
|
|
||||||
val tile = getCenterTile()
|
val tile = getCenterTile()
|
||||||
tile.roadStatus = RoadStatus.Railroad
|
|
||||||
|
tryUpdateRoadStatus()
|
||||||
|
|
||||||
if (listOf("Forest", "Jungle", "Marsh").contains(tile.terrainFeature))
|
if (listOf("Forest", "Jungle", "Marsh").contains(tile.terrainFeature))
|
||||||
tile.terrainFeature = null
|
tile.terrainFeature = null
|
||||||
|
|
||||||
@ -169,6 +171,13 @@ class CityInfo {
|
|||||||
cityConstructions.setTransients()
|
cityConstructions.setTransients()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun startTurn(){
|
||||||
|
cityStats.update()
|
||||||
|
tryUpdateRoadStatus()
|
||||||
|
attackedThisTurn = false
|
||||||
|
if (resistanceCounter > 0) resistanceCounter--
|
||||||
|
}
|
||||||
|
|
||||||
fun endTurn() {
|
fun endTurn() {
|
||||||
val stats = cityStats.currentCityStats
|
val stats = cityStats.currentCityStats
|
||||||
if (cityConstructions.currentConstruction == CityConstructions.Settler && stats.food > 0) {
|
if (cityConstructions.currentConstruction == CityConstructions.Settler && stats.food > 0) {
|
||||||
@ -176,7 +185,6 @@ class CityInfo {
|
|||||||
stats.food = 0f
|
stats.food = 0f
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
cityConstructions.nextTurn(stats)
|
cityConstructions.nextTurn(stats)
|
||||||
expansion.nextTurn(stats.culture)
|
expansion.nextTurn(stats.culture)
|
||||||
if(isBeingRazed){
|
if(isBeingRazed){
|
||||||
@ -189,13 +197,11 @@ class CityInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else population.nextTurn(stats.food)
|
else population.nextTurn(stats.food)
|
||||||
if (resistanceCounter > 0) resistanceCounter--
|
|
||||||
|
|
||||||
if(this in civInfo.cities) { // city was not destroyed
|
if(this in civInfo.cities) { // city was not destroyed
|
||||||
health = min(health + 20, getMaxHealth())
|
health = min(health + 20, getMaxHealth())
|
||||||
population.unassignExtraPopulation()
|
population.unassignExtraPopulation()
|
||||||
}
|
}
|
||||||
attackedThisTurn = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun destroyCity() {
|
fun destroyCity() {
|
||||||
@ -223,6 +229,7 @@ class CityInfo {
|
|||||||
for(building in cityConstructions.getBuiltBuildings().filter { it.requiredBuildingInAllCities!=null })
|
for(building in cityConstructions.getBuiltBuildings().filter { it.requiredBuildingInAllCities!=null })
|
||||||
cityConstructions.removeBuilding(building.name)
|
cityConstructions.removeBuilding(building.name)
|
||||||
isBeingRazed=false
|
isBeingRazed=false
|
||||||
|
tryUpdateRoadStatus()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun canAcquireTile(newTileInfo: TileInfo): Boolean {
|
fun canAcquireTile(newTileInfo: TileInfo): Boolean {
|
||||||
@ -236,5 +243,14 @@ class CityInfo {
|
|||||||
return false
|
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
|
//endregion
|
||||||
}
|
}
|
@ -320,6 +320,16 @@ class CivilizationInfo {
|
|||||||
updateViewableTiles()
|
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() {
|
fun endTurn() {
|
||||||
notifications.clear()
|
notifications.clear()
|
||||||
|
|
||||||
@ -370,15 +380,6 @@ class CivilizationInfo {
|
|||||||
return stats
|
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 {
|
fun canEnterTiles(otherCiv: CivilizationInfo): Boolean {
|
||||||
if(otherCiv==this) return true
|
if(otherCiv==this) return true
|
||||||
if(isAtWarWith(otherCiv)) return true
|
if(isAtWarWith(otherCiv)) return true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user