WorkerAutomation

class WorkerAutomation(civInfo: CivilizationInfo, cachedForTurn: Int, cloningSource: WorkerAutomation?)

Contains the logic for worker automation.

This is instantiated from CivilizationInfo.getWorkerAutomation and cached there.

Parameters

civInfo

The Civilization - data common to all automated workers is cached once per Civ

cachedForTurn

The turn number this was created for - a recreation of the instance is forced on different turn numbers

Constructors

WorkerAutomation
Link copied to clipboard
fun WorkerAutomation(civInfo: CivilizationInfo, cachedForTurn: Int, cloningSource: WorkerAutomation? = null)

Types

Companion
Link copied to clipboard
object Companion

Functions

automateWorkerAction
Link copied to clipboard
fun automateWorkerAction(unit: MapUnit)

Automate one Worker - decide what to do and where, move, start or continue work.

chooseImprovement
Link copied to clipboard
private fun chooseImprovement(unit: MapUnit, tile: TileInfo): TileImprovement?

Determine the improvement appropriate to a given tile and worker

equals
Link copied to clipboard
open operator fun equals(other: Any?): Boolean
evaluateFortPlacement
Link copied to clipboard
private fun evaluateFortPlacement(tile: TileInfo, isCitadel: Boolean): Boolean

Do we want a Fort here considering surroundings?

findTileToWork
Link copied to clipboard
private fun findTileToWork(unit: MapUnit): TileInfo

Looks for a worthwhile tile to improve

getPriority
Link copied to clipboard
private fun getPriority(tileInfo: TileInfo): Int

Calculate a priority for improving a tile

hashCode
Link copied to clipboard
open fun hashCode(): Int
isAcceptableTileForFort
Link copied to clipboard
private fun isAcceptableTileForFort(tile: TileInfo): Boolean

Checks whether a given tile allows a Fort and whether a Fort may be undesirable (without checking surroundings).

isImprovementOnFeatureAllowed
Link copied to clipboard
private fun isImprovementOnFeatureAllowed(tile: TileInfo): Boolean

Checks whether the improvement matching the tile resource requires any terrain feature to be removed first.

tileCanBeImproved
Link copied to clipboard
private fun tileCanBeImproved(unit: MapUnit?, tile: TileInfo): Boolean

Tests if tile can be improved by a specific unit, or if no unit is passed, any unit at all (but does not check whether the ruleset contains any unit capable of it)

toString
Link copied to clipboard
open fun toString(): String
tryConnectingCities
Link copied to clipboard
private fun tryConnectingCities(unit: MapUnit): Boolean

Looks for work connecting cities

Properties

bestRoadAvailable
Link copied to clipboard
private val bestRoadAvailable: RoadStatus

Caches road to build for connecting cities unless option is off or ruleset removed all roads

bfsCache
Link copied to clipboard
private val bfsCache: HashMap<Vector2, BFS>

Caches BFS by city locations (cities needing connecting).

cachedForTurn
Link copied to clipboard
val cachedForTurn: Int
citiesThatNeedConnecting
Link copied to clipboard
private val citiesThatNeedConnecting: List<CityInfo>

Civ-wide list of unconnected Cities, sorted by closest to capital first

civInfo
Link copied to clipboard
val civInfo: CivilizationInfo
ruleSet
Link copied to clipboard
private val ruleSet: Ruleset
tilesOfConnectedCities
Link copied to clipboard
private val tilesOfConnectedCities: List<TileInfo>

Civ-wide list of connected Cities, unsorted

Sources

jvm source
Link copied to clipboard