Tiny optimization for isCoastalTile (#2434)

Yes benefit may be low as neighbors are already cached, but cost is negligible
This commit is contained in:
SomeTroglodyte 2020-04-16 19:39:45 +02:00 committed by GitHub
parent 31134d0fe5
commit ac8648216e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -292,7 +292,9 @@ open class TileInfo {
fun hasImprovementInProgress() = improvementInProgress!=null
fun isCoastalTile() = neighbors.any { it.baseTerrain==Constants.coast }
@delegate:Transient
private val _isCoastalTile: Boolean by lazy { neighbors.any { it.baseTerrain==Constants.coast } }
fun isCoastalTile() = _isCoastalTile
fun hasViewableResource(civInfo: CivilizationInfo): Boolean =
resource != null && (getTileResource().revealedBy == null || civInfo.tech.isResearched(getTileResource().revealedBy!!))