mirror of
https://github.com/yairm210/Unciv.git
synced 2025-07-13 01:08:25 +07:00
More changes to enable multiplayer - save the current player in the civInfo, distinguish between "current player" and "human player"
This commit is contained in:
@ -16,6 +16,7 @@ class GameParameters{
|
||||
var difficulty="Prince"
|
||||
var nation="Babylon"
|
||||
var mapRadius=20
|
||||
var humanPlayers=1
|
||||
var numberOfEnemies=3
|
||||
var mapType= MapType.Perlin
|
||||
}
|
||||
@ -27,15 +28,19 @@ class GameStarter{
|
||||
gameInfo.gameParameters = newGameParameters
|
||||
gameInfo.tileMap = TileMap(newGameParameters.mapRadius, newGameParameters.mapType)
|
||||
gameInfo.tileMap.gameInfo = gameInfo // need to set this transient before placing units in the map
|
||||
val startingLocations = getStartingLocations(newGameParameters.numberOfEnemies+1,gameInfo.tileMap)
|
||||
val startingLocations = getStartingLocations(
|
||||
newGameParameters.numberOfEnemies+newGameParameters.humanPlayers, gameInfo.tileMap)
|
||||
|
||||
|
||||
val playerCiv = CivilizationInfo(newGameParameters.nation)
|
||||
gameInfo.difficulty=newGameParameters.difficulty
|
||||
playerCiv.playerType=PlayerType.Human
|
||||
gameInfo.civilizations.add(playerCiv) // first one is player civ
|
||||
for(i in 1..newGameParameters.humanPlayers) {
|
||||
val playerCiv = CivilizationInfo(newGameParameters.nation)
|
||||
gameInfo.difficulty = newGameParameters.difficulty
|
||||
playerCiv.playerType = PlayerType.Human
|
||||
gameInfo.civilizations.add(playerCiv)
|
||||
}
|
||||
|
||||
val barbarianCivilization = CivilizationInfo()
|
||||
barbarianCivilization.civName = "Barbarians"
|
||||
gameInfo.civilizations.add(barbarianCivilization)// second is barbarian civ
|
||||
|
||||
for (nationName in GameBasics.Nations.keys.filterNot { it=="Barbarians" || it==newGameParameters.nation }.shuffled()
|
||||
@ -45,8 +50,6 @@ class GameStarter{
|
||||
}
|
||||
|
||||
|
||||
barbarianCivilization.civName = "Barbarians"
|
||||
|
||||
gameInfo.setTransients() // needs to be before placeBarbarianUnit because it depends on the tilemap having its gameinfo set
|
||||
|
||||
for (civInfo in gameInfo.civilizations.filter {!it.isBarbarianCivilization() && !it.isPlayerCivilization()}) {
|
||||
|
@ -17,25 +17,27 @@ class GameInfo {
|
||||
var gameParameters=GameParameters()
|
||||
var turns = 0
|
||||
var oneMoreTurnMode=false
|
||||
var currentPlayer=""
|
||||
|
||||
//region pure functions
|
||||
fun clone(): GameInfo {
|
||||
val toReturn = GameInfo()
|
||||
toReturn.tileMap = tileMap.clone()
|
||||
toReturn.civilizations.addAll(civilizations.map { it.clone() })
|
||||
toReturn.currentPlayer=currentPlayer
|
||||
toReturn.turns = turns
|
||||
toReturn.difficulty=difficulty
|
||||
toReturn.gameParameters = gameParameters
|
||||
return toReturn
|
||||
}
|
||||
|
||||
fun getPlayerCivilization(): CivilizationInfo = civilizations[0]
|
||||
fun getBarbarianCivilization(): CivilizationInfo = civilizations[1]
|
||||
fun getCurrentPlayerCivilization(): CivilizationInfo = civilizations.first { it.civName==currentPlayer }
|
||||
fun getBarbarianCivilization(): CivilizationInfo = civilizations.first { it.civName=="Barbarians" }
|
||||
fun getDifficulty() = GameBasics.Difficulties[difficulty]!!
|
||||
//endregion
|
||||
|
||||
fun nextTurn() {
|
||||
val player = getPlayerCivilization()
|
||||
val currentPlayer = getCurrentPlayerCivilization()
|
||||
|
||||
for (civInfo in civilizations) {
|
||||
if (civInfo.tech.techsToResearch.isEmpty()) { // should belong in automation? yes/no?
|
||||
@ -49,7 +51,7 @@ class GameInfo {
|
||||
// We need to update the stats after ALL the cities are done updating because
|
||||
// maybe one of them has a wonder that affects the stats of all the rest of the cities
|
||||
|
||||
for (civInfo in civilizations.filterNot { it == player || (it.isDefeated() && !it.isBarbarianCivilization()) }) {
|
||||
for (civInfo in civilizations.filterNot { it == currentPlayer || (it.isDefeated() && !it.isBarbarianCivilization()) }) {
|
||||
civInfo.startTurn()
|
||||
NextTurnAutomation().automateCivMoves(civInfo)
|
||||
}
|
||||
@ -60,18 +62,18 @@ class GameInfo {
|
||||
|
||||
// Start our turn immediately before the player can made decisions - affects whether our units can commit automated actions and then be attacked immediately etc.
|
||||
|
||||
player.startTurn()
|
||||
currentPlayer.startTurn()
|
||||
|
||||
val enemyUnitsCloseToTerritory = player.viewableTiles
|
||||
val enemyUnitsCloseToTerritory = currentPlayer.viewableTiles
|
||||
.filter {
|
||||
it.militaryUnit != null && it.militaryUnit!!.civInfo != player
|
||||
&& player.isAtWarWith(it.militaryUnit!!.civInfo)
|
||||
&& (it.getOwner() == player || it.neighbors.any { neighbor -> neighbor.getOwner() == player })
|
||||
it.militaryUnit != null && it.militaryUnit!!.civInfo != currentPlayer
|
||||
&& currentPlayer.isAtWarWith(it.militaryUnit!!.civInfo)
|
||||
&& (it.getOwner() == currentPlayer || it.neighbors.any { neighbor -> neighbor.getOwner() == currentPlayer })
|
||||
}
|
||||
for (enemyUnitTile in enemyUnitsCloseToTerritory) {
|
||||
val inOrNear = if (enemyUnitTile.getOwner() == player) "in" else "near"
|
||||
val inOrNear = if (enemyUnitTile.getOwner() == currentPlayer) "in" else "near"
|
||||
val unitName = enemyUnitTile.militaryUnit!!.name
|
||||
player.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", enemyUnitTile.position, Color.RED)
|
||||
currentPlayer.addNotification("An enemy [$unitName] was spotted $inOrNear our territory", enemyUnitTile.position, Color.RED)
|
||||
}
|
||||
|
||||
turns++
|
||||
@ -94,15 +96,17 @@ class GameInfo {
|
||||
tileMap.gameInfo = this
|
||||
tileMap.setTransients()
|
||||
|
||||
if(currentPlayer=="") currentPlayer=civilizations[0].civName
|
||||
|
||||
// this is separated into 2 loops because when we activate updateViewableTiles in civ.setTransients,
|
||||
// we try to find new civs, and we check if civ is barbarian, which we can't know unless the gameInfo is already set.
|
||||
for (civInfo in civilizations) civInfo.gameInfo = this
|
||||
|
||||
// PlayerType was only added in 2.11.1, so we need to adjust for older saved games
|
||||
if(civilizations.all { it.playerType==PlayerType.AI })
|
||||
getPlayerCivilization().playerType=PlayerType.Human
|
||||
if(getPlayerCivilization().difficulty!="Chieftain")
|
||||
difficulty= getPlayerCivilization().difficulty
|
||||
getCurrentPlayerCivilization().playerType=PlayerType.Human
|
||||
if(getCurrentPlayerCivilization().difficulty!="Chieftain")
|
||||
difficulty= getCurrentPlayerCivilization().difficulty
|
||||
|
||||
for (civInfo in civilizations) civInfo.setTransients()
|
||||
|
||||
|
@ -93,7 +93,7 @@ class CityStats {
|
||||
|
||||
val civ = cityInfo.civInfo
|
||||
if (!civ.isPlayerCivilization()) {
|
||||
val modifier = civ.gameInfo.getPlayerCivilization().getDifficulty().aiYieldModifier
|
||||
val modifier = civ.gameInfo.getCurrentPlayerCivilization().getDifficulty().aiYieldModifier
|
||||
stats.production += modifier
|
||||
stats.science += modifier
|
||||
stats.food += modifier
|
||||
@ -143,7 +143,7 @@ class CityStats {
|
||||
val newHappinessList = LinkedHashMap<String,Float>()
|
||||
var unhappinessModifier = civInfo.getDifficulty().unhappinessModifier
|
||||
if(!civInfo.isPlayerCivilization())
|
||||
unhappinessModifier *= civInfo.gameInfo.getPlayerCivilization().getDifficulty().aiUnhappinessModifier
|
||||
unhappinessModifier *= civInfo.gameInfo.getDifficulty().aiUnhappinessModifier
|
||||
|
||||
newHappinessList ["Cities"] = -3f * unhappinessModifier
|
||||
|
||||
|
@ -40,7 +40,7 @@ class PopulationManager {
|
||||
// civ v math, civilization.wikia
|
||||
var foodRequired = 15 + 6 * (population - 1) + Math.floor(Math.pow((population - 1).toDouble(), 1.8))
|
||||
if(!cityInfo.civInfo.isPlayerCivilization())
|
||||
foodRequired *= cityInfo.civInfo.gameInfo.getPlayerCivilization().getDifficulty().aiCityGrowthModifier
|
||||
foodRequired *= cityInfo.civInfo.gameInfo.getDifficulty().aiCityGrowthModifier
|
||||
return foodRequired.toInt()
|
||||
}
|
||||
|
||||
|
@ -87,13 +87,13 @@ class CivilizationInfo {
|
||||
|
||||
//region pure functions
|
||||
fun getDifficulty():Difficulty {
|
||||
if(playerType==PlayerType.AI) return GameBasics.Difficulties["Chieftain"]!!
|
||||
else return gameInfo.getDifficulty()
|
||||
if (isPlayerCivilization()) return gameInfo.getDifficulty()
|
||||
return GameBasics.Difficulties["Chieftain"]!!
|
||||
}
|
||||
|
||||
fun getNation() = GameBasics.Nations[civName]!!
|
||||
fun getCapital()=cities.first { it.isCapital() }
|
||||
fun isPlayerCivilization() = gameInfo.getPlayerCivilization()==this
|
||||
fun isPlayerCivilization() = playerType==PlayerType.Human
|
||||
fun isBarbarianCivilization() = gameInfo.getBarbarianCivilization()==this
|
||||
|
||||
fun getStatsForNextTurn():Stats{
|
||||
@ -152,7 +152,7 @@ class CivilizationInfo {
|
||||
var cost = baseUnitCost*totalPaidUnits*(1+gameProgress)
|
||||
cost = cost.pow(1+gameProgress/3) // Why 3? To spread 1 to 1.33
|
||||
if(!isPlayerCivilization())
|
||||
cost *= gameInfo.getPlayerCivilization().getDifficulty().aiUnitMaintenanceModifier
|
||||
cost *= gameInfo.getDifficulty().aiUnitMaintenanceModifier
|
||||
if(policies.isAdopted("Autocracy")) cost *= 0.66f
|
||||
return cost.toInt()
|
||||
}
|
||||
@ -313,7 +313,7 @@ class CivilizationInfo {
|
||||
victoryManager.currentsSpaceshipParts = scienceVictory.currentParts
|
||||
|
||||
for (cityInfo in cities) {
|
||||
cityInfo.civInfo = this // must be before the city's setTransients because it depends on the tilemap, that comes from the playerCivInfo
|
||||
cityInfo.civInfo = this // must be before the city's setTransients because it depends on the tilemap, that comes from the currentPlayerCivInfo
|
||||
cityInfo.setTransients()
|
||||
}
|
||||
setCitiesConnectedToCapitalTransients()
|
||||
|
@ -237,7 +237,7 @@ open class TileInfo {
|
||||
override fun toString(): String {
|
||||
val lineList = ArrayList<String>() // more readable than StringBuilder, with same performance for our use-case
|
||||
val isViewableToPlayer = UnCivGame.Current.viewEntireMapForDebug
|
||||
|| UnCivGame.Current.gameInfo.getPlayerCivilization().viewableTiles.contains(this)
|
||||
|| UnCivGame.Current.gameInfo.getCurrentPlayerCivilization().viewableTiles.contains(this)
|
||||
|
||||
if (isCityCenter()) {
|
||||
val city = getCity()!!
|
||||
@ -249,7 +249,7 @@ open class TileInfo {
|
||||
}
|
||||
lineList += baseTerrain.tr()
|
||||
if (terrainFeature != null) lineList += terrainFeature!!.tr()
|
||||
if (hasViewableResource(tileMap.gameInfo.getPlayerCivilization())) lineList += resource!!.tr()
|
||||
if (hasViewableResource(tileMap.gameInfo.getCurrentPlayerCivilization())) lineList += resource!!.tr()
|
||||
if (roadStatus !== RoadStatus.None && !isCityCenter()) lineList += roadStatus.toString().tr()
|
||||
if (improvement != null) lineList += improvement!!.tr()
|
||||
if (improvementInProgress != null && isViewableToPlayer)
|
||||
|
@ -20,10 +20,10 @@ class Technology : ICivilopedia {
|
||||
lineList += impimpString.tr()
|
||||
}
|
||||
|
||||
val playerCiv = UnCivGame.Current.gameInfo.getPlayerCivilization().civName
|
||||
val currentPlayerCiv = UnCivGame.Current.gameInfo.currentPlayer
|
||||
var enabledUnits = GameBasics.Units.values.filter {
|
||||
it.requiredTech == name &&
|
||||
(it.uniqueTo == null || it.uniqueTo == playerCiv)
|
||||
(it.uniqueTo == null || it.uniqueTo == currentPlayerCiv)
|
||||
}
|
||||
val replacedUnits = enabledUnits.mapNotNull { it.replaces }
|
||||
enabledUnits = enabledUnits.filter { it.name !in replacedUnits }
|
||||
@ -35,7 +35,7 @@ class Technology : ICivilopedia {
|
||||
|
||||
var enabledBuildings = GameBasics.Buildings.values.filter {
|
||||
it.requiredTech == name &&
|
||||
(it.uniqueTo == null || it.uniqueTo == playerCiv)
|
||||
(it.uniqueTo == null || it.uniqueTo == currentPlayerCiv)
|
||||
}
|
||||
val replacedBuildings = enabledBuildings.mapNotNull { it.replaces }
|
||||
enabledBuildings = enabledBuildings.filter { it.name !in replacedBuildings }
|
||||
|
@ -21,7 +21,7 @@ import kotlin.math.roundToInt
|
||||
|
||||
class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
|
||||
val playerCivInfo = UnCivGame.Current.gameInfo.getPlayerCivilization()
|
||||
val currentPlayerCivInfo = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
init {
|
||||
onBackButtonClicked { UnCivGame.Current.setWorldScreen(); dispose() }
|
||||
val topTable = Table().apply { defaults().pad(10f) }
|
||||
@ -92,7 +92,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
|
||||
private fun getTradesTable(): Table {
|
||||
val tradesTable = Table().apply { defaults().pad(10f) }
|
||||
for(diplomacy in playerCivInfo.diplomacy.values)
|
||||
for(diplomacy in currentPlayerCivInfo.diplomacy.values)
|
||||
for(trade in diplomacy.trades)
|
||||
tradesTable.add(createTradeTable(trade,diplomacy.otherCiv())).row()
|
||||
|
||||
@ -101,7 +101,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
|
||||
private fun createTradeTable(trade: Trade, otherCiv:CivilizationInfo): Table {
|
||||
val generalTable = Table(skin)
|
||||
generalTable.add(createOffersTable(playerCivInfo,trade.ourOffers, trade.theirOffers.size))
|
||||
generalTable.add(createOffersTable(currentPlayerCivInfo,trade.ourOffers, trade.theirOffers.size))
|
||||
generalTable.add(createOffersTable(otherCiv, trade.theirOffers, trade.ourOffers.size))
|
||||
return generalTable
|
||||
}
|
||||
@ -128,12 +128,12 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
happinessTable.defaults().pad(5f)
|
||||
happinessTable.add(Label("Happiness".tr(), skin).setFontSize(24)).colspan(2).row()
|
||||
happinessTable.addSeparator()
|
||||
for (entry in playerCivInfo.getHappinessForNextTurn()) {
|
||||
for (entry in currentPlayerCivInfo.getHappinessForNextTurn()) {
|
||||
happinessTable.add(entry.key.tr())
|
||||
happinessTable.add(entry.value.toString()).row()
|
||||
}
|
||||
happinessTable.add("Total".tr())
|
||||
happinessTable.add(playerCivInfo.getHappinessForNextTurn().values.sum().toString())
|
||||
happinessTable.add(currentPlayerCivInfo.getHappinessForNextTurn().values.sum().toString())
|
||||
happinessTable.pack()
|
||||
return happinessTable
|
||||
}
|
||||
@ -144,7 +144,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
goldTable.add(Label("Gold".tr(), skin).setFontSize(24)).colspan(2).row()
|
||||
goldTable.addSeparator()
|
||||
var total=0f
|
||||
for (entry in playerCivInfo.getStatMapForNextTurn()) {
|
||||
for (entry in currentPlayerCivInfo.getStatMapForNextTurn()) {
|
||||
if(entry.value.gold==0f) continue
|
||||
goldTable.add(entry.key.tr())
|
||||
goldTable.add(entry.value.gold.toString()).row()
|
||||
@ -160,9 +160,9 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
private fun getGreatPeopleTable(): Table {
|
||||
val greatPeopleTable = Table(skin)
|
||||
|
||||
val greatPersonPoints = playerCivInfo.greatPeople.greatPersonPoints.toHashMap()
|
||||
val greatPersonPointsPerTurn = playerCivInfo.getGreatPersonPointsForNextTurn().toHashMap()
|
||||
val pointsToGreatPerson = playerCivInfo.greatPeople.pointsForNextGreatPerson
|
||||
val greatPersonPoints = currentPlayerCivInfo.greatPeople.greatPersonPoints.toHashMap()
|
||||
val greatPersonPointsPerTurn = currentPlayerCivInfo.getGreatPersonPointsForNextTurn().toHashMap()
|
||||
val pointsToGreatPerson = currentPlayerCivInfo.greatPeople.pointsForNextGreatPerson
|
||||
|
||||
greatPeopleTable.defaults().pad(5f)
|
||||
greatPeopleTable.add(Label("Great person points".tr(), skin).setFontSize(24)).colspan(3).row()
|
||||
@ -171,14 +171,14 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
greatPeopleTable.add("Current points")
|
||||
greatPeopleTable.add("Points per turn").row()
|
||||
|
||||
val mapping = playerCivInfo.greatPeople.statToGreatPersonMapping
|
||||
val mapping = currentPlayerCivInfo.greatPeople.statToGreatPersonMapping
|
||||
for(entry in mapping){
|
||||
greatPeopleTable.add(entry.value.tr())
|
||||
greatPeopleTable.add(greatPersonPoints[entry.key]!!.toInt().toString()+"/"+pointsToGreatPerson)
|
||||
greatPeopleTable.add(greatPersonPointsPerTurn[entry.key]!!.toInt().toString()).row()
|
||||
}
|
||||
val pointsForGreatGeneral = playerCivInfo.greatPeople.greatGeneralPoints.toInt().toString()
|
||||
val pointsForNextGreatGeneral = playerCivInfo.greatPeople.pointsForNextGreatGeneral.toInt().toString()
|
||||
val pointsForGreatGeneral = currentPlayerCivInfo.greatPeople.greatGeneralPoints.toInt().toString()
|
||||
val pointsForNextGreatGeneral = currentPlayerCivInfo.greatPeople.pointsForNextGreatGeneral.toInt().toString()
|
||||
greatPeopleTable.add("Great General".tr())
|
||||
greatPeopleTable.add(pointsForGreatGeneral+"/"+pointsForNextGreatGeneral).row()
|
||||
greatPeopleTable.pack()
|
||||
@ -208,7 +208,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
val cityInfoTableDetails = Table(skin)
|
||||
cityInfoTableDetails.defaults().pad(padding).minWidth(iconSize).align(Align.left)//we need the min width so we can align the different tables
|
||||
|
||||
for (city in playerCivInfo.cities) {
|
||||
for (city in currentPlayerCivInfo.cities) {
|
||||
cityInfoTableDetails.add(city.name)
|
||||
cityInfoTableDetails.add(city.cityConstructions.getCityProductionTextForCityButton()).actor!!.setAlignment(Align.left)
|
||||
cityInfoTableDetails.add(city.population.population.toString()).actor!!.setAlignment(Align.center)
|
||||
@ -230,13 +230,13 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
cityInfoTableTotal.defaults().pad(padding).minWidth(iconSize)//we need the min width so we can align the different tables
|
||||
|
||||
cityInfoTableTotal.add("Total".tr())
|
||||
cityInfoTableTotal.add(playerCivInfo.cities.sumBy { it.population.population }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(currentPlayerCivInfo.cities.sumBy { it.population.population }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add()//an intended empty space
|
||||
cityInfoTableTotal.add(playerCivInfo.cities.sumBy { it.cityStats.currentCityStats.gold.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(playerCivInfo.cities.sumBy { it.cityStats.currentCityStats.science.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(currentPlayerCivInfo.cities.sumBy { it.cityStats.currentCityStats.gold.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(currentPlayerCivInfo.cities.sumBy { it.cityStats.currentCityStats.science.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add()//an intended empty space
|
||||
cityInfoTableTotal.add(playerCivInfo.cities.sumBy { it.cityStats.currentCityStats.culture.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(playerCivInfo.cities.sumBy { it.cityStats.currentCityStats.happiness.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(currentPlayerCivInfo.cities.sumBy { it.cityStats.currentCityStats.culture.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
cityInfoTableTotal.add(currentPlayerCivInfo.cities.sumBy { it.cityStats.currentCityStats.happiness.toInt() }.toString()).actor!!.setAlignment(Align.center)
|
||||
|
||||
cityInfoTableTotal.pack()
|
||||
|
||||
@ -265,7 +265,7 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
table.row()
|
||||
table.addSeparator()
|
||||
|
||||
for(unit in playerCivInfo.getCivUnits()){
|
||||
for(unit in currentPlayerCivInfo.getCivUnits()){
|
||||
val baseUnit = unit.baseUnit()
|
||||
table.add(unit.name.tr())
|
||||
if(baseUnit.strength>0) table.add(baseUnit.strength.toString()) else table.add()
|
||||
@ -281,10 +281,10 @@ class EmpireOverviewScreen : CameraStageBaseScreen(){
|
||||
|
||||
|
||||
fun playerKnows(civ:CivilizationInfo) = civ.isPlayerCivilization() ||
|
||||
playerCivInfo.diplomacy.containsKey(civ.civName)
|
||||
currentPlayerCivInfo.diplomacy.containsKey(civ.civName)
|
||||
|
||||
fun createDiplomacyGroup(): Group {
|
||||
val relevantCivs = playerCivInfo.gameInfo.civilizations.filter { !it.isBarbarianCivilization() }
|
||||
val relevantCivs = currentPlayerCivInfo.gameInfo.civilizations.filter { !it.isBarbarianCivilization() }
|
||||
val groupSize = 500f
|
||||
val group = Group()
|
||||
group.setSize(groupSize,groupSize)
|
||||
|
@ -12,7 +12,7 @@ import com.unciv.ui.utils.onClick
|
||||
|
||||
class VictoryScreen : PickerScreen() {
|
||||
|
||||
val playerCivInfo = UnCivGame.Current.gameInfo.getPlayerCivilization()
|
||||
val playerCivInfo = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
|
||||
init {
|
||||
topTable.skin=skin
|
||||
|
@ -38,7 +38,7 @@ class CityTileGroup(private val city: CityInfo, tileInfo: TileInfo) : TileGroup(
|
||||
}
|
||||
|
||||
private fun updateYieldGroup() {
|
||||
yieldGroup.setStats(tileInfo.getTileStats(city, city.civInfo.gameInfo.getPlayerCivilization()))
|
||||
yieldGroup.setStats(tileInfo.getTileStats(city, city.civInfo.gameInfo.getCurrentPlayerCivilization()))
|
||||
yieldGroup.setOrigin(Align.center)
|
||||
yieldGroup.setScale(0.7f)
|
||||
yieldGroup.toFront()
|
||||
|
@ -31,7 +31,7 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() {
|
||||
}
|
||||
|
||||
init {
|
||||
val civInfo = game.gameInfo.getPlayerCivilization()
|
||||
val currentPlayerCiv = game.gameInfo.getCurrentPlayerCivilization()
|
||||
|
||||
closeButton.onClick {
|
||||
game.screen = CityScreen(this@ConstructionPickerScreen.city)
|
||||
@ -60,7 +60,7 @@ class ConstructionPickerScreen(val city: CityInfo) : PickerScreen() {
|
||||
if (!building.isBuildable(cityConstructions) && building.name!=cityConstructions.currentConstruction) continue
|
||||
val productionTextButton = getProductionButton(building.name,
|
||||
building.name + "\r\n" + cityConstructions.turnsToConstruction(building.name) + " {turns}".tr(),
|
||||
building.getDescription(true, civInfo.policies.getAdoptedPolicies()),
|
||||
building.getDescription(true, currentPlayerCiv.policies.getAdoptedPolicies()),
|
||||
"Build [${building.name}]".tr())
|
||||
if (building.isWonder)
|
||||
wonders.addActor(productionTextButton)
|
||||
|
@ -34,9 +34,9 @@ class GreatPersonPickerScreen : PickerScreen() {
|
||||
}
|
||||
|
||||
rightSideButton.onClick("choir") {
|
||||
val civInfo = UnCivGame.Current.gameInfo.getPlayerCivilization()
|
||||
civInfo.placeUnitNearTile(civInfo.cities[0].location, theChosenOne!!.name)
|
||||
civInfo.greatPeople.freeGreatPeople--
|
||||
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
currentPlayerCiv.placeUnitNearTile(currentPlayerCiv.cities[0].location, theChosenOne!!.name)
|
||||
currentPlayerCiv.greatPeople.freeGreatPeople--
|
||||
UnCivGame.Current.setWorldScreen()
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,12 @@ class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
|
||||
private var selectedImprovement: TileImprovement? = null
|
||||
|
||||
init {
|
||||
val civInfo = game.gameInfo.getPlayerCivilization()
|
||||
val currentPlayerCiv = game.gameInfo.getCurrentPlayerCivilization()
|
||||
setDefaultCloseAction()
|
||||
|
||||
rightSideButton.setText("Pick improvement")
|
||||
rightSideButton.onClick {
|
||||
tileInfo.startWorkingOnImprovement(selectedImprovement!!, civInfo)
|
||||
tileInfo.startWorkingOnImprovement(selectedImprovement!!, currentPlayerCiv)
|
||||
if(tileInfo.civilianUnit!=null) tileInfo.civilianUnit!!.action=null // this is to "wake up" the worker if it's sleeping
|
||||
game.setWorldScreen()
|
||||
dispose()
|
||||
@ -30,7 +30,7 @@ class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
|
||||
val regularImprovements = VerticalGroup()
|
||||
regularImprovements.space(10f)
|
||||
for (improvement in GameBasics.TileImprovements.values) {
|
||||
if (!tileInfo.canBuildImprovement(improvement, civInfo)) continue
|
||||
if (!tileInfo.canBuildImprovement(improvement, currentPlayerCiv)) continue
|
||||
if(improvement.name == tileInfo.improvement) continue
|
||||
if(improvement.name==tileInfo.improvementInProgress) continue
|
||||
|
||||
@ -40,7 +40,7 @@ class ImprovementPickerScreen(tileInfo: TileInfo) : PickerScreen() {
|
||||
improvementButton.add(ImageGetter.getImage("OtherIcons/Stop.png")).size(30f).pad(10f)
|
||||
else improvementButton.add(ImageGetter.getImprovementIcon(improvement.name,30f)).pad(10f)
|
||||
|
||||
improvementButton.add(Label(improvement.name + " - " + improvement.getTurnsToBuild(civInfo) + " {turns}".tr(),skin)
|
||||
improvementButton.add(Label(improvement.name + " - " + improvement.getTurnsToBuild(currentPlayerCiv) + " {turns}".tr(),skin)
|
||||
.setFontColor(Color.WHITE)).pad(10f)
|
||||
|
||||
improvementButton.onClick {
|
||||
|
@ -44,7 +44,8 @@ class LoadScreen : PickerScreen() {
|
||||
textToSet+="\n{Saved at}: ".tr()+ SimpleDateFormat("dd-MM-yy HH.mm").format(savedAt)
|
||||
try{
|
||||
val game = GameSaver().loadGame(it)
|
||||
textToSet+="\n"+game.getPlayerCivilization().civName.tr()+
|
||||
val playerCivNames = game.civilizations.filter { it.isPlayerCivilization() }.joinToString{it.civName.tr()}
|
||||
textToSet+="\n"+playerCivNames+
|
||||
", "+game.difficulty.tr()+", {Turn} ".tr()+game.turns
|
||||
}catch (ex:Exception){
|
||||
textToSet+="\n{Could not load game}!".tr()
|
||||
|
@ -136,7 +136,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
open fun update(isViewable: Boolean, showResourcesAndImprovements:Boolean, showSubmarine: Boolean) {
|
||||
hideCircle()
|
||||
if (!UnCivGame.Current.viewEntireMapForDebug
|
||||
&& !tileInfo.tileMap.gameInfo.getPlayerCivilization().exploredTiles.contains(tileInfo.position)) {
|
||||
&& !tileInfo.tileMap.gameInfo.getCurrentPlayerCivilization().exploredTiles.contains(tileInfo.position)) {
|
||||
hexagon.color = Color.BLACK
|
||||
return
|
||||
}
|
||||
@ -321,7 +321,7 @@ open class TileGroup(var tileInfo: TileInfo) : Group() {
|
||||
|
||||
private fun updateResourceImage(showResourcesAndImprovements: Boolean) {
|
||||
val shouldDisplayResource = showResourcesAndImprovements
|
||||
&& tileInfo.hasViewableResource(tileInfo.tileMap.gameInfo.getPlayerCivilization())
|
||||
&& tileInfo.hasViewableResource(tileInfo.tileMap.gameInfo.getCurrentPlayerCivilization())
|
||||
|
||||
if (resourceImage != null && !shouldDisplayResource) {
|
||||
resourceImage!!.remove()
|
||||
|
@ -31,8 +31,9 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
&& city!!.civInfo.isPlayerCivilization())
|
||||
addPopulationIcon()
|
||||
|
||||
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
if (UnCivGame.Current.viewEntireMapForDebug
|
||||
|| tileInfo.tileMap.gameInfo.getPlayerCivilization().exploredTiles.contains(tileInfo.position))
|
||||
|| currentPlayerCiv.exploredTiles.contains(tileInfo.position))
|
||||
updateCityButton(city, isViewable || UnCivGame.Current.viewEntireMapForDebug) // needs to be before the update so the units will be above the city button
|
||||
|
||||
super.update(isViewable || UnCivGame.Current.viewEntireMapForDebug,
|
||||
@ -40,7 +41,7 @@ class WorldTileGroup(tileInfo: TileInfo) : TileGroup(tileInfo) {
|
||||
|
||||
yieldGroup.isVisible = !UnCivGame.Current.settings.showResourcesAndImprovements
|
||||
if (yieldGroup.isVisible)
|
||||
yieldGroup.setStats(tileInfo.getTileStats(UnCivGame.Current.gameInfo.getPlayerCivilization()))
|
||||
yieldGroup.setStats(tileInfo.getTileStats(currentPlayerCiv))
|
||||
|
||||
// order by z index!
|
||||
cityImage?.toFront()
|
||||
|
@ -31,11 +31,11 @@ class DiplomacyScreen:CameraStageBaseScreen(){
|
||||
|
||||
private fun updateLeftSideTable() {
|
||||
leftSideTable.clear()
|
||||
val playerCiv = UnCivGame.Current.gameInfo.getPlayerCivilization()
|
||||
val currentPlayerCiv = UnCivGame.Current.gameInfo.getCurrentPlayerCivilization()
|
||||
for (civ in UnCivGame.Current.gameInfo.civilizations
|
||||
.filterNot { it.isDefeated() || it.isPlayerCivilization() || it.isBarbarianCivilization() }) {
|
||||
if (!playerCiv.diplomacy.containsKey(civ.civName)) continue
|
||||
val civDiplomacy = playerCiv.diplomacy[civ.civName]!!
|
||||
if (!currentPlayerCiv.diplomacy.containsKey(civ.civName)) continue
|
||||
val civDiplomacy = currentPlayerCiv.diplomacy[civ.civName]!!
|
||||
|
||||
val civTable = Table().apply { background = ImageGetter.getBackground(civ.getNation().getColor()) }
|
||||
civTable.pad(10f)
|
||||
@ -52,7 +52,7 @@ class DiplomacyScreen:CameraStageBaseScreen(){
|
||||
}
|
||||
civTable.add(tradeButton).row()
|
||||
|
||||
if (!playerCiv.isAtWarWith(civ)) {
|
||||
if (!currentPlayerCiv.isAtWarWith(civ)) {
|
||||
val declareWarButton = TextButton("Declare war".tr(), skin)
|
||||
declareWarButton.color = Color.RED
|
||||
val turnsToPeaceTreaty = civDiplomacy.turnsToPeaceTreaty()
|
||||
|
@ -4,7 +4,6 @@ import com.badlogic.gdx.scenes.scene2d.Stage
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Label
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.Table
|
||||
import com.badlogic.gdx.scenes.scene2d.ui.TextButton
|
||||
import com.unciv.UnCivGame
|
||||
import com.unciv.logic.civilization.CivilizationInfo
|
||||
import com.unciv.logic.trade.TradeLogic
|
||||
import com.unciv.models.gamebasics.tr
|
||||
@ -12,7 +11,8 @@ import com.unciv.ui.utils.CameraStageBaseScreen
|
||||
import com.unciv.ui.utils.onClick
|
||||
|
||||
class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeComplete: () -> Unit): Table(CameraStageBaseScreen.skin){
|
||||
var tradeLogic = TradeLogic(UnCivGame.Current.gameInfo.getPlayerCivilization(),otherCivilization)
|
||||
val currentPlayerCiv = otherCivilization.gameInfo.getCurrentPlayerCivilization()
|
||||
var tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
var offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() }
|
||||
var offerColumnsTableWrapper = Table() // This is so that after a trade has been traded, we can switch out the offers to start anew - this is the easiest way
|
||||
val tradeText = Label("What do you have in mind?".tr(), CameraStageBaseScreen.skin)
|
||||
@ -42,7 +42,7 @@ class TradeTable(val otherCivilization: CivilizationInfo, stage: Stage, onTradeC
|
||||
}
|
||||
else if(offerButton.text.toString() == "Accept".tr()){
|
||||
tradeLogic.acceptTrade()
|
||||
tradeLogic = TradeLogic(UnCivGame.Current.gameInfo.getPlayerCivilization(),otherCivilization)
|
||||
tradeLogic = TradeLogic(currentPlayerCiv,otherCivilization)
|
||||
offerColumnsTable = OfferColumnsTable(tradeLogic, stage) { onChange() }
|
||||
offerColumnsTableWrapper.clear()
|
||||
offerColumnsTableWrapper.add(offerColumnsTable)
|
||||
|
@ -26,7 +26,7 @@ import com.unciv.ui.worldscreen.unit.UnitActionsTable
|
||||
|
||||
class WorldScreen : CameraStageBaseScreen() {
|
||||
val gameInfo = game.gameInfo
|
||||
internal val civInfo: CivilizationInfo = gameInfo.getPlayerCivilization()
|
||||
internal val currentPlayerCiv: CivilizationInfo = gameInfo.getCurrentPlayerCivilization()
|
||||
|
||||
val tileMapHolder: TileMapHolder = TileMapHolder(this, gameInfo.tileMap)
|
||||
val minimapWrapper = MinimapHolder(tileMapHolder)
|
||||
@ -56,7 +56,7 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
techButton.touchable=Touchable.enabled
|
||||
techButton.onClick("paper") {
|
||||
game.screen = TechPickerScreen(civInfo)
|
||||
game.screen = TechPickerScreen(currentPlayerCiv)
|
||||
}
|
||||
|
||||
stage.addActor(tileMapHolder)
|
||||
@ -80,8 +80,8 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
val tileToCenterOn: Vector2 =
|
||||
when {
|
||||
civInfo.cities.isNotEmpty() -> civInfo.getCapital().location
|
||||
civInfo.getCivUnits().isNotEmpty() -> civInfo.getCivUnits().first().getTile().position
|
||||
currentPlayerCiv.cities.isNotEmpty() -> currentPlayerCiv.getCapital().location
|
||||
currentPlayerCiv.getCivUnits().isNotEmpty() -> currentPlayerCiv.getCivUnits().first().getTile().position
|
||||
else -> Vector2.Zero
|
||||
}
|
||||
tileMapHolder.setCenterPosition(tileToCenterOn)
|
||||
@ -97,9 +97,9 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
|
||||
val gameClone = gameInfo.clone()
|
||||
gameClone.setTransients()
|
||||
val cloneCivilization = gameClone.getPlayerCivilization()
|
||||
val cloneCivilization = gameClone.getCurrentPlayerCivilization()
|
||||
kotlin.concurrent.thread {
|
||||
civInfo.happiness = gameClone.getPlayerCivilization().getHappinessForNextTurn().values.sum().toInt()
|
||||
currentPlayerCiv.happiness = gameClone.getCurrentPlayerCivilization().getHappinessForNextTurn().values.sum().toInt()
|
||||
gameInfo.civilizations.forEach { it.setCitiesConnectedToCapitalTransients() }
|
||||
}
|
||||
|
||||
@ -127,10 +127,10 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
}
|
||||
}
|
||||
|
||||
if(gameClone.getPlayerCivilization().getCivUnits().any { it.health<100 })
|
||||
if(gameClone.getCurrentPlayerCivilization().getCivUnits().any { it.health<100 })
|
||||
displayTutorials("InjuredUnits")
|
||||
|
||||
if(gameClone.getPlayerCivilization().getCivUnits().any { it.name=="Worker" })
|
||||
if(gameClone.getCurrentPlayerCivilization().getCivUnits().any { it.name=="Worker" })
|
||||
displayTutorials("WorkerTrained")
|
||||
|
||||
updateTechButton(cloneCivilization)
|
||||
@ -146,17 +146,17 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
// if we use the clone, then when we update viewable tiles
|
||||
// it doesn't update the explored tiles of the civ... need to think about that harder
|
||||
// it causes a bug when we move a unit to an unexplored tile (for instance a cavalry unit which can move far)
|
||||
tileMapHolder.updateTiles(civInfo)
|
||||
tileMapHolder.updateTiles(currentPlayerCiv)
|
||||
|
||||
topBar.update(cloneCivilization)
|
||||
notificationsScroll.update(civInfo.notifications)
|
||||
notificationsScroll.update(currentPlayerCiv.notifications)
|
||||
notificationsScroll.width = stage.width/3
|
||||
notificationsScroll.setPosition(stage.width - notificationsScroll.width - 5f,
|
||||
nextTurnButton.y - notificationsScroll.height - 5f)
|
||||
|
||||
if(!gameInfo.oneMoreTurnMode && civInfo.victoryManager.hasWon()) game.screen = VictoryScreen()
|
||||
else if(civInfo.policies.freePolicies>0) game.screen = PolicyPickerScreen(civInfo)
|
||||
else if(civInfo.greatPeople.freeGreatPeople>0) game.screen = GreatPersonPickerScreen()
|
||||
if(!gameInfo.oneMoreTurnMode && currentPlayerCiv.victoryManager.hasWon()) game.screen = VictoryScreen()
|
||||
else if(currentPlayerCiv.policies.freePolicies>0) game.screen = PolicyPickerScreen(currentPlayerCiv)
|
||||
else if(currentPlayerCiv.greatPeople.freeGreatPeople>0) game.screen = GreatPersonPickerScreen()
|
||||
}
|
||||
|
||||
private fun updateDiplomacyButton(civInfo: CivilizationInfo) {
|
||||
@ -200,16 +200,16 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
private fun createNextTurnButton(): TextButton {
|
||||
val nextTurnButton = TextButton("Next turn".tr(), CameraStageBaseScreen.skin)
|
||||
nextTurnButton.onClick {
|
||||
if (civInfo.tech.freeTechs != 0) {
|
||||
game.screen = TechPickerScreen(true, civInfo)
|
||||
if (currentPlayerCiv.tech.freeTechs != 0) {
|
||||
game.screen = TechPickerScreen(true, currentPlayerCiv)
|
||||
return@onClick
|
||||
} else if (civInfo.policies.shouldOpenPolicyPicker) {
|
||||
game.screen = PolicyPickerScreen(civInfo)
|
||||
civInfo.policies.shouldOpenPolicyPicker = false
|
||||
} else if (currentPlayerCiv.policies.shouldOpenPolicyPicker) {
|
||||
game.screen = PolicyPickerScreen(currentPlayerCiv)
|
||||
currentPlayerCiv.policies.shouldOpenPolicyPicker = false
|
||||
return@onClick
|
||||
}
|
||||
else if (civInfo.tech.currentTechnology() == null && civInfo.cities.isNotEmpty()) {
|
||||
game.screen = TechPickerScreen(civInfo)
|
||||
else if (currentPlayerCiv.tech.currentTechnology() == null && currentPlayerCiv.cities.isNotEmpty()) {
|
||||
game.screen = TechPickerScreen(currentPlayerCiv)
|
||||
return@onClick
|
||||
}
|
||||
|
||||
@ -270,24 +270,24 @@ class WorldScreen : CameraStageBaseScreen() {
|
||||
val shownTutorials = UnCivGame.Current.settings.tutorialsShown
|
||||
displayTutorials("NextTurn")
|
||||
if("BarbarianEncountered" !in shownTutorials
|
||||
&& civInfo.viewableTiles.any { it.getUnits().any { unit -> unit.civInfo.isBarbarianCivilization() } })
|
||||
&& currentPlayerCiv.viewableTiles.any { it.getUnits().any { unit -> unit.civInfo.isBarbarianCivilization() } })
|
||||
displayTutorials("BarbarianEncountered")
|
||||
if(civInfo.cities.size > 2) displayTutorials("SecondCity")
|
||||
if(civInfo.happiness < 0) displayTutorials("Unhappiness")
|
||||
if(civInfo.goldenAges.isGoldenAge()) displayTutorials("GoldenAge")
|
||||
if(currentPlayerCiv.cities.size > 2) displayTutorials("SecondCity")
|
||||
if(currentPlayerCiv.happiness < 0) displayTutorials("Unhappiness")
|
||||
if(currentPlayerCiv.goldenAges.isGoldenAge()) displayTutorials("GoldenAge")
|
||||
if(gameInfo.turns >= 100) displayTutorials("ContactMe")
|
||||
val resources = civInfo.getCivResources()
|
||||
val resources = currentPlayerCiv.getCivResources()
|
||||
if(resources.keys.any { it.resourceType==ResourceType.Luxury }) displayTutorials("LuxuryResource")
|
||||
if(resources.keys.any { it.resourceType==ResourceType.Strategic}) displayTutorials("StrategicResource")
|
||||
if("EnemyCity" !in shownTutorials
|
||||
&& civInfo.exploredTiles.asSequence().map { gameInfo.tileMap[it] }
|
||||
.any { it.isCityCenter() && it.getOwner()!=civInfo })
|
||||
&& currentPlayerCiv.exploredTiles.asSequence().map { gameInfo.tileMap[it] }
|
||||
.any { it.isCityCenter() && it.getOwner()!=currentPlayerCiv })
|
||||
displayTutorials("EnemyCity")
|
||||
if("Enables construction of Spaceship parts" in civInfo.getBuildingUniques())
|
||||
if("Enables construction of Spaceship parts" in currentPlayerCiv.getBuildingUniques())
|
||||
displayTutorials("ApolloProgram")
|
||||
if(civInfo.getCivUnits().any { it.type == UnitType.Siege })
|
||||
if(currentPlayerCiv.getCivUnits().any { it.type == UnitType.Siege })
|
||||
displayTutorials("SiegeUnitTrained")
|
||||
if(civInfo.tech.getUniques().contains("Enables embarkation for land units"))
|
||||
if(currentPlayerCiv.tech.getUniques().contains("Enables embarkation for land units"))
|
||||
displayTutorials("CanEmbark")
|
||||
|
||||
shouldUpdate=false
|
||||
|
@ -58,7 +58,7 @@ class WorldScreenTopBar(val screen: WorldScreen) : Table() {
|
||||
val resourceTable = Table()
|
||||
resourceTable.defaults().pad(5f)
|
||||
val revealedStrategicResources = GameBasics.TileResources.values
|
||||
.filter { it.resourceType == ResourceType.Strategic } // && playerCivInfo.tech.isResearched(it.revealedBy!!) }
|
||||
.filter { it.resourceType == ResourceType.Strategic } // && currentPlayerCivInfo.tech.isResearched(it.revealedBy!!) }
|
||||
for (resource in revealedStrategicResources) {
|
||||
val resourceImage = ImageGetter.getResourceImage(resource.name,20f)
|
||||
resourceImages[resource.name] = resourceImage
|
||||
|
@ -18,7 +18,7 @@ import kotlin.math.max
|
||||
|
||||
class BattleTable(val worldScreen: WorldScreen): Table() {
|
||||
|
||||
private val battle = Battle(worldScreen.civInfo.gameInfo)
|
||||
private val battle = Battle(worldScreen.currentPlayerCiv.gameInfo)
|
||||
init{
|
||||
skin = CameraStageBaseScreen.skin
|
||||
background = ImageGetter.getBackground(ImageGetter.getBlue())
|
||||
@ -45,7 +45,7 @@ class BattleTable(val worldScreen: WorldScreen): Table() {
|
||||
val defender: ICombatant? = Battle(worldScreen.gameInfo).getMapCombatantOfTile(selectedTile)
|
||||
|
||||
if(defender==null ||
|
||||
defender.getCivilization()==worldScreen.civInfo
|
||||
defender.getCivilization()==worldScreen.currentPlayerCiv
|
||||
|| !(UnCivGame.Current.viewEntireMapForDebug
|
||||
|| attacker.getCivilization().exploredTiles.contains(selectedTile.position))) {
|
||||
hide()
|
||||
|
@ -16,7 +16,7 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
|
||||
|
||||
internal fun updateTileTable(tile: TileInfo) {
|
||||
clearChildren()
|
||||
val civInfo = worldScreen.civInfo
|
||||
val civInfo = worldScreen.currentPlayerCiv
|
||||
columnDefaults(0).padRight(10f)
|
||||
|
||||
if (UnCivGame.Current.viewEntireMapForDebug || civInfo.exploredTiles.contains(tile.position)) {
|
||||
@ -34,7 +34,7 @@ class TileInfoTable(private val worldScreen: WorldScreen) : Table() {
|
||||
table.pad(10f)
|
||||
table.defaults().pad(2f)
|
||||
|
||||
for (entry in tile.getTileStats(worldScreen.civInfo).toHashMap().filterNot { it.value == 0f }) {
|
||||
for (entry in tile.getTileStats(worldScreen.currentPlayerCiv).toHashMap().filterNot { it.value == 0f }) {
|
||||
table.add(ImageGetter.getStatIcon(entry.key.toString())).size(20f).align(Align.right)
|
||||
table.add(Label(entry.value.toInt().toString(), skin)).align(Align.left)
|
||||
table.row()
|
||||
|
@ -33,7 +33,7 @@ class WorldScreenOptionsTable internal constructor() : PopupTable() {
|
||||
addButton("Victory status".tr()) { UnCivGame.Current.screen = VictoryScreen() }
|
||||
|
||||
addButton("Social policies".tr()){
|
||||
UnCivGame.Current.screen = PolicyPickerScreen(UnCivGame.Current.gameInfo.getPlayerCivilization())
|
||||
UnCivGame.Current.screen = PolicyPickerScreen(UnCivGame.Current.gameInfo.getCurrentPlayerCivilization())
|
||||
}
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ class IdleUnitButton (internal val unitTable: UnitTable,
|
||||
val image = ImageGetter.getImage("OtherIcons/BackArrow")
|
||||
|
||||
fun getTilesWithIdleUnits() = tileMapHolder.tileMap.values
|
||||
.filter { it.hasIdleUnit() && it.getUnits().first().owner == unitTable.worldScreen.civInfo.civName }
|
||||
.filter { it.hasIdleUnit() && it.getUnits().first().owner == unitTable.worldScreen.currentPlayerCiv.civName }
|
||||
|
||||
init {
|
||||
val imageSize = 25f
|
||||
|
@ -40,7 +40,7 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
||||
|
||||
fun update() {
|
||||
if(selectedUnit!=null) {
|
||||
if (selectedUnit!!.civInfo != worldScreen.civInfo) { // The unit that was selected, was captured. It exists but is no longer ours.
|
||||
if (selectedUnit!!.civInfo != worldScreen.currentPlayerCiv) { // The unit that was selected, was captured. It exists but is no longer ours.
|
||||
selectedUnit = null
|
||||
currentlyExecutingAction = null
|
||||
selectedUnitHasChanged = true
|
||||
@ -136,11 +136,11 @@ class UnitTable(val worldScreen: WorldScreen) : Table(){
|
||||
currentlyExecutingAction = null
|
||||
}
|
||||
|
||||
else if(selectedTile.militaryUnit!=null && selectedTile.militaryUnit!!.civInfo == worldScreen.civInfo
|
||||
else if(selectedTile.militaryUnit!=null && selectedTile.militaryUnit!!.civInfo == worldScreen.currentPlayerCiv
|
||||
&& selectedUnit!=selectedTile.militaryUnit)
|
||||
selectedUnit = selectedTile.militaryUnit
|
||||
|
||||
else if (selectedTile.civilianUnit!=null && selectedTile.civilianUnit!!.civInfo == worldScreen.civInfo
|
||||
else if (selectedTile.civilianUnit!=null && selectedTile.civilianUnit!!.civInfo == worldScreen.currentPlayerCiv
|
||||
&& selectedUnit!=selectedTile.civilianUnit)
|
||||
selectedUnit = selectedTile.civilianUnit
|
||||
|
||||
|
Reference in New Issue
Block a user