Allow ai city to re-assign specialists.

This commit is contained in:
Duan Tao
2018-12-10 11:34:30 +08:00
parent bb12fc7cdb
commit d364f3896c
2 changed files with 10 additions and 0 deletions

View File

@ -117,6 +117,7 @@ class NextTurnAutomation{
private fun reassignWorkedTiles(civInfo: CivilizationInfo) { private fun reassignWorkedTiles(civInfo: CivilizationInfo) {
for (city in civInfo.cities) { for (city in civInfo.cities) {
city.workedTiles.clear() city.workedTiles.clear()
city.population.specialists.clear()
(0..city.population.population).forEach { city.population.autoAssignPopulation() } (0..city.population.population).forEach { city.population.autoAssignPopulation() }
Automation().chooseNextConstruction(city.cityConstructions) Automation().chooseNextConstruction(city.cityConstructions)
if (city.health < city.getMaxHealth()) if (city.health < city.getMaxHealth())

View File

@ -15,6 +15,15 @@ open class Stats() {
setStats(hashMap) setStats(hashMap)
} }
fun clear() {
production = 0f
food = 0f
gold = 0f
science = 0f
culture = 0f
happiness = 0f
}
fun add(other: Stats) { fun add(other: Stats) {
// Doing this through the hashmap is nicer code but is SUPER INEFFICIENT! // Doing this through the hashmap is nicer code but is SUPER INEFFICIENT!
production += other.production production += other.production