Added extra cities for civilizations (because I actually reached 10+ cities for an AI)

City naming is now dependant on the names of existing cities and not on the umber of cities the civ currently has
This commit is contained in:
Yair Morgenstern 2018-05-09 22:59:32 +03:00
parent 4cfbf18178
commit d12b665e83
3 changed files with 12 additions and 7 deletions

View file

@ -14,12 +14,14 @@
{
name:"China",
RGB:[ 9, 112, 84],
cities:["Beijing","Shanghai","Guangzhou","Nanjing","Xian","Chengdu","Hangzhou","Tianjin","Macau","Shandong"]
cities:["Beijing","Shanghai","Guangzhou","Nanjing","Xian","Chengdu","Hangzhou","Tianjin","Macau","Shandong",
"Kaifeng","Ningbo","Baoding","Yangzhou","Harbin"]
},
{
name:"Egypt",
RGB:[ 255, 153, 0],
cities:["Thebes","Memphis","Heliopolis","Elephantine","Alexandria","Pi-Ramesses","Giza","Byblos","Akhetaten","Hieraconpolis"]
cities:["Thebes","Memphis","Heliopolis","Elephantine","Alexandria","Pi-Ramesses","Giza","Byblos","Akhetaten","Hieraconpolis",
"Abydos","Asyut","Avaris","Lisht","Buto"]
},
{
name:"Barbarians",

View file

@ -84,7 +84,10 @@ class CityInfo {
this.civInfo = civInfo
setTransients()
name = civInfo.getCivilization().cities[civInfo.cities.size]
// Since cities can be captures between civilizations,
// we need to check which other cities exist globally and name accordingly
val allExistingCityNames = civInfo.gameInfo.civilizations.flatMap { it.cities }.map { it.name }.toHashSet()
name = civInfo.getCivilization().cities.first { !allExistingCityNames.contains(it) }
this.location = cityLocation
civInfo.cities.add(this)
if(civInfo == civInfo.gameInfo.getPlayerCivilization())

View file

@ -66,10 +66,10 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
if(currentlyExecutingAction=="moveTo"){
if(selectedUnit!!.movementAlgs()
.getShortestPath(selectedUnit!!.getTile().position, selectedTile.position).isEmpty())
.getShortestPath(selectedTile).isEmpty())
return // can't reach there with the selected unit, watcha want me to do?
val reachedTile = selectedUnit!!.headTowards(selectedTile.position)
val reachedTile = selectedUnit!!.movementAlgs().headTowards(selectedTile)
if(reachedTile!=selectedTile) // Didn't get all the way there
selectedUnit!!.action = "moveTo " + selectedTile.position.x.toInt() + "," + selectedTile.position.y.toInt()