mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-12 10:59:55 +07:00
Fixed "isWorked" not registering for tiles worked not by the owning city
This commit is contained in:
parent
6a7773730b
commit
b012fd0df8
@ -33,8 +33,8 @@ allprojects {
|
||||
version = '1.0.1'
|
||||
ext {
|
||||
appName = "Unciv"
|
||||
appCodeNumber = 425
|
||||
appVersion = "3.8.7"
|
||||
appCodeNumber = 426
|
||||
appVersion = "3.8.7-patch1"
|
||||
|
||||
gdxVersion = '1.9.10'
|
||||
roboVMVersion = '2.3.1'
|
||||
|
@ -162,15 +162,15 @@ class WorkerAutomation(val unit: MapUnit) {
|
||||
|
||||
fun getPriority(tileInfo: TileInfo, civInfo: CivilizationInfo): Int {
|
||||
var priority = 0
|
||||
if (tileInfo.getOwner() == civInfo){
|
||||
if (tileInfo.getOwner() == civInfo) {
|
||||
priority += 2
|
||||
if (tileInfo.isWorked()) priority += 3
|
||||
}
|
||||
// give a minor priority to tiles that we could expand onto
|
||||
else if (tileInfo.getOwner()==null && tileInfo.neighbors.any { it.getOwner() ==civInfo })
|
||||
else if (tileInfo.getOwner() == null && tileInfo.neighbors.any { it.getOwner() == civInfo })
|
||||
priority += 1
|
||||
|
||||
if (priority!=0 && tileInfo.hasViewableResource(civInfo)) priority += 1
|
||||
if (priority != 0 && tileInfo.hasViewableResource(civInfo)) priority += 1
|
||||
return priority
|
||||
}
|
||||
|
||||
|
@ -147,15 +147,19 @@ open class TileInfo {
|
||||
fun getTerrainFeature(): Terrain? =
|
||||
if (terrainFeature == null) null else ruleset.terrains[terrainFeature!!]
|
||||
|
||||
fun getWorkingCity():CityInfo? {
|
||||
val civInfo = getOwner()
|
||||
if (civInfo == null) return null
|
||||
return civInfo.cities.firstOrNull { it.workedTiles.contains(position) }
|
||||
}
|
||||
|
||||
fun isWorked(): Boolean {
|
||||
val city = getCity()
|
||||
return city!=null && city.workedTiles.contains(position)
|
||||
return getWorkingCity() != null
|
||||
}
|
||||
|
||||
fun isLocked(): Boolean{
|
||||
val city = getCity()
|
||||
return city!=null && city.lockedTiles.contains(position)
|
||||
val workingCity = getWorkingCity()
|
||||
return workingCity!=null && workingCity.lockedTiles.contains(position)
|
||||
}
|
||||
|
||||
fun getTileStats(observingCiv: CivilizationInfo): Stats = getTileStats(getCity(), observingCiv)
|
||||
|
@ -25,7 +25,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
||||
}
|
||||
|
||||
fun update() {
|
||||
super.update(city.civInfo,true)
|
||||
super.update(city.civInfo, true)
|
||||
|
||||
// this needs to happen on update, because we can buy tiles, which changes the definition of the bought tiles...
|
||||
when {
|
||||
@ -56,7 +56,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
||||
}
|
||||
}
|
||||
|
||||
terrainFeatureLayerGroup.color.a=0.5f
|
||||
terrainFeatureLayerGroup.color.a = 0.5f
|
||||
icons.improvementIcon?.setColor(1f, 1f, 1f, 0.5f)
|
||||
resourceImage?.setColor(1f, 1f, 1f, 0.5f)
|
||||
cityImage?.setColor(1f, 1f, 1f, 0.5f)
|
||||
|
Loading…
Reference in New Issue
Block a user