mirror of
https://github.com/yairm210/Unciv.git
synced 2025-03-12 19:10:12 +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'
|
version = '1.0.1'
|
||||||
ext {
|
ext {
|
||||||
appName = "Unciv"
|
appName = "Unciv"
|
||||||
appCodeNumber = 425
|
appCodeNumber = 426
|
||||||
appVersion = "3.8.7"
|
appVersion = "3.8.7-patch1"
|
||||||
|
|
||||||
gdxVersion = '1.9.10'
|
gdxVersion = '1.9.10'
|
||||||
roboVMVersion = '2.3.1'
|
roboVMVersion = '2.3.1'
|
||||||
|
@ -162,15 +162,15 @@ class WorkerAutomation(val unit: MapUnit) {
|
|||||||
|
|
||||||
fun getPriority(tileInfo: TileInfo, civInfo: CivilizationInfo): Int {
|
fun getPriority(tileInfo: TileInfo, civInfo: CivilizationInfo): Int {
|
||||||
var priority = 0
|
var priority = 0
|
||||||
if (tileInfo.getOwner() == civInfo){
|
if (tileInfo.getOwner() == civInfo) {
|
||||||
priority += 2
|
priority += 2
|
||||||
if (tileInfo.isWorked()) priority += 3
|
if (tileInfo.isWorked()) priority += 3
|
||||||
}
|
}
|
||||||
// give a minor priority to tiles that we could expand onto
|
// 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
|
priority += 1
|
||||||
|
|
||||||
if (priority!=0 && tileInfo.hasViewableResource(civInfo)) priority += 1
|
if (priority != 0 && tileInfo.hasViewableResource(civInfo)) priority += 1
|
||||||
return priority
|
return priority
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,15 +147,19 @@ open class TileInfo {
|
|||||||
fun getTerrainFeature(): Terrain? =
|
fun getTerrainFeature(): Terrain? =
|
||||||
if (terrainFeature == null) null else ruleset.terrains[terrainFeature!!]
|
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 {
|
fun isWorked(): Boolean {
|
||||||
val city = getCity()
|
return getWorkingCity() != null
|
||||||
return city!=null && city.workedTiles.contains(position)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun isLocked(): Boolean{
|
fun isLocked(): Boolean{
|
||||||
val city = getCity()
|
val workingCity = getWorkingCity()
|
||||||
return city!=null && city.lockedTiles.contains(position)
|
return workingCity!=null && workingCity.lockedTiles.contains(position)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTileStats(observingCiv: CivilizationInfo): Stats = getTileStats(getCity(), observingCiv)
|
fun getTileStats(observingCiv: CivilizationInfo): Stats = getTileStats(getCity(), observingCiv)
|
||||||
|
@ -25,7 +25,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo, tileSetStrin
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun update() {
|
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...
|
// this needs to happen on update, because we can buy tiles, which changes the definition of the bought tiles...
|
||||||
when {
|
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)
|
icons.improvementIcon?.setColor(1f, 1f, 1f, 0.5f)
|
||||||
resourceImage?.setColor(1f, 1f, 1f, 0.5f)
|
resourceImage?.setColor(1f, 1f, 1f, 0.5f)
|
||||||
cityImage?.setColor(1f, 1f, 1f, 0.5f)
|
cityImage?.setColor(1f, 1f, 1f, 0.5f)
|
||||||
|
Loading…
Reference in New Issue
Block a user