data class CityMap
A map representing the city. The map hangs on to Buildings and Locations. The map is set up as a grid of BlockCoordinate and various layers hanging onto various values (desirability, crime, etc).
CityMap(width: Int = 512, height: Int = 512)
A map representing the city. The map hangs on to Buildings and Locations. The map is set up as a grid of BlockCoordinate and various layers hanging onto various values (desirability, crime, etc). |
var bulldozedCounts: MutableMap<Zone, Int>
Every time the Liquidator runs it will drop a count of bulldozed zones in here so we know how many get demolished. |
|
val cachedLocationsIn: (block: BlockCoordinate) -> List<Location>
a cached version of locationsIn. This can be used when you want to do a fast lookup on a building but don't really care if you are wrong or not |
|
val censusTaker: CensusTaker |
|
var cityName: String?
Name of the city |
|
val crimeLayer: MutableMap<BlockCoordinate, Double> |
|
var debug: Boolean
Should we print debug output or not? |
|
val desirabilityLayers: List<DesirabilityLayer> |
|
var fileName: String?
where we loaded OR saved this city to... used to determine save vs. save as... |
|
val fireCoverageLayer: MutableMap<BlockCoordinate, Double> |
|
val groundLayer: MutableMap<BlockCoordinate, MapTile> |
|
var height: Int
height in blocks of the city |
|
val nationalTradeEntity: NationalTradeEntity |
|
val policePresenceLayer: MutableMap<BlockCoordinate, Double> |
|
val pollutionLayer: MutableMap<BlockCoordinate, Double> |
|
val powerLineLayer: MutableMap<BlockCoordinate, Building> |
|
val resourceLayers: MutableMap<String, QuantizedMap<Double>> |
|
var time: Date
Current time in the simulation |
|
var trafficLayer: MutableMap<BlockCoordinate, Double> |
|
var width: Int
width in blocks of the city |
|
val zoneLayer: MutableMap<BlockCoordinate, Zone> |
fun build(building: Building, block: BlockCoordinate, updateBuildingIndex: Boolean = true): Unit
Plops the given Building at the given BlockCoordinate. Note the coordinate is the top-left of the building. We do check for collisions, hopefully preventing overlaps. |
|
fun buildPowerline(firstBlock: BlockCoordinate, lastBlock: BlockCoordinate): Unit
Builds a line of powerlines from firstBlock to lastBlock |
|
fun buildRailroad(from: BlockCoordinate, to: BlockCoordinate): Unit
Builds Railroad between the two supplied BlockCoordinate. Railroad can currently be built in an "L" shape. |
|
fun buildRoad(from: BlockCoordinate, to: BlockCoordinate, isOneWay: Boolean = false): Unit
Builds a (possibly) one-way road or standard road |
|
fun buildingBlocks(coordinate: BlockCoordinate, building: Building): List<BlockCoordinate>
Takes a coordinate and a building and returns the "footprint" of the building. In other words, each block the building sits in. |
|
fun bulldoze(from: BlockCoordinate, to: BlockCoordinate): Unit
Bulldozes from the top left to the bottom right |
|
fun canBuildBuildingAt(newBuilding: Building, coordinate: BlockCoordinate, waterCheck: Boolean = true): Boolean
See if we can plop a new building on the map at the given coordinate |
|
fun coordinatesForBuilding(building: Building): BlockCoordinate?
For a given Building, runs through it and finds the coordinate |
|
fun debug(message: String): Unit |
|
fun desirabilityLayer(type: Zone, level: Int): DesirabilityLayer?
We will probably end up having a desirabilty layer for each zone and each level... but I am not 100% sure yet |
|
fun dezone(firstBlock: BlockCoordinate, lastBlock: BlockCoordinate): Unit
Removes zoning designation from a rectangle of BlockCoordinate |
|
fun eachLocation(callback: (Location) -> Unit): Unit |
|
fun elevations(): Pair<Double, Double>
Returns the minimum and maximum heights on this map |
|
fun hasTrafficNearby(coordinate: BlockCoordinate, radius: Int, quantity: Int): Boolean
Used to check traffic at a given coordinate with a certain radius |
|
suspend fun hourlyTick(hour: Int): Unit
Things that we want done each game hour |
|
fun locations(): List<Location>
Returns a massive list of all locations |
|
fun locationsAt(coordinate: BlockCoordinate): List<Location>
Returns a list of Locations that we found at the current coordinate |
|
fun locationsInRectangle(topLeft: BlockCoordinate, bottomRight: BlockCoordinate): List<Location>
Returns a list of Locations in the provided rectangle of coordinates |
|
fun nearestBuildings(coordinate: BlockCoordinate, distance: Int = 10): List<Location>
Does a spatial lookup at coordinate for a list of Locations |
|
fun pollutionNearby(coordinate: BlockCoordinate, radius: Int): Double
Returns a count of pollution at the given BlockCoordinate |
|
fun purgeRTree(): Unit
Purges spatial index of buildings... |
|
fun setResourceValue(resourceName: String, blockCoordinate: BlockCoordinate, resourceValue: Double): Unit
Used to store where oil, gold, etc are underneath the map. Not currently used. |
|
fun suggestedFilename(): String
Suggests a filename to save the city as... it's based off the name of the city but made safe for filenames |
|
fun tick(): Unit
Main game loop. The engine calls this every X milliseconds and various functions are run from here. |
|
fun trafficNearby(coordinate: BlockCoordinate, radius: Int): Int
Returns a count of traffic at the given coordinate and radius |
|
fun updateBuildingIndex(): Unit
Updates the spatial index, enabling quick building lookups... |
|
fun zone(type: Zone, from: BlockCoordinate, to: BlockCoordinate): Unit
Designates a given area as a certain Zone |
fun flatMap(width: Int = 512, height: Int = 512): CityMap
Returns a totally flat map of the given size. |