From 7bd0a03caba70d3aef0db0ad8f545f1f2f019928 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Mon, 24 Jun 2024 23:13:33 +0300 Subject: [PATCH] Remove unused parameters --- .../com/unciv/logic/city/managers/CityConquestFunctions.kt | 5 +++-- core/src/com/unciv/models/ruleset/Building.kt | 2 -- .../unciv/ui/screens/cityscreen/ConstructionInfoTable.kt | 6 ++---- .../com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt | 2 +- .../com/unciv/ui/screens/newgamescreen/NewGameScreen.kt | 7 +++---- core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt | 2 +- server/build.gradle.kts | 2 +- 7 files changed, 11 insertions(+), 15 deletions(-) diff --git a/core/src/com/unciv/logic/city/managers/CityConquestFunctions.kt b/core/src/com/unciv/logic/city/managers/CityConquestFunctions.kt index 52a981ad53..5fcf4b09e4 100644 --- a/core/src/com/unciv/logic/city/managers/CityConquestFunctions.kt +++ b/core/src/com/unciv/logic/city/managers/CityConquestFunctions.kt @@ -47,8 +47,9 @@ class CityConquestFunctions(val city: City) { } } - private fun removeBuildingsOnMoveToCiv(oldCiv: Civilization) { + private fun removeBuildingsOnMoveToCiv() { // Remove all buildings provided for free to this city + // At this point, the city has *not* yet moved to the new civ for (building in city.civ.civConstructions.getFreeBuildingNames(city)) { city.cityConstructions.removeBuilding(building) } @@ -266,7 +267,7 @@ class CityConquestFunctions(val city: City) { city.resetWLTKD() // Remove their free buildings from this city and remove free buildings provided by the city from their cities - removeBuildingsOnMoveToCiv(oldCiv) + removeBuildingsOnMoveToCiv() // Place palace for newCiv if this is the only city they have. if (newCiv.cities.size == 1) newCiv.moveCapitalTo(city, null) diff --git a/core/src/com/unciv/models/ruleset/Building.kt b/core/src/com/unciv/models/ruleset/Building.kt index 4d2d327a82..bb1efa1070 100644 --- a/core/src/com/unciv/models/ruleset/Building.kt +++ b/core/src/com/unciv/models/ruleset/Building.kt @@ -18,7 +18,6 @@ import com.unciv.models.ruleset.unique.UniqueTarget import com.unciv.models.ruleset.unique.UniqueType import com.unciv.models.stats.Stat import com.unciv.models.stats.Stats -import com.unciv.models.translations.fillPlaceholders import com.unciv.ui.components.extensions.getNeedMoreAmountString import com.unciv.ui.components.extensions.toPercent import com.unciv.ui.objectdescriptions.BuildingDescriptions @@ -260,7 +259,6 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction { override fun getRejectionReasons(cityConstructions: CityConstructions): Sequence = sequence { val cityCenter = cityConstructions.city.getCenterTile() val civ = cityConstructions.city.civ - val ruleSet = civ.gameInfo.ruleset if (cityConstructions.isBuilt(name)) yield(RejectionReasonType.AlreadyBuilt.toInstance()) diff --git a/core/src/com/unciv/ui/screens/cityscreen/ConstructionInfoTable.kt b/core/src/com/unciv/ui/screens/cityscreen/ConstructionInfoTable.kt index d2b4d00476..9626e26f1c 100644 --- a/core/src/com/unciv/ui/screens/cityscreen/ConstructionInfoTable.kt +++ b/core/src/com/unciv/ui/screens/cityscreen/ConstructionInfoTable.kt @@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Table -import com.unciv.UncivGame import com.unciv.models.UncivSound import com.unciv.models.ruleset.Building import com.unciv.models.ruleset.IConstruction @@ -23,7 +22,6 @@ import com.unciv.ui.images.ImageGetter import com.unciv.ui.popups.ConfirmPopup import com.unciv.ui.popups.closeAllPopups import com.unciv.ui.screens.basescreen.BaseScreen -import com.unciv.ui.screens.civilopediascreen.CivilopediaScreen class ConstructionInfoTable(val cityScreen: CityScreen) : Table() { private val selectedConstructionTable = Table() @@ -108,7 +106,7 @@ class ConstructionInfoTable(val cityScreen: CityScreen) : Table() { sellBuildingButton.isEnabled = enableSell if (sellBuildingButton.isEnabled) sellBuildingButton.onClick(UncivSound.Coin) { sellBuildingButton.disable() - sellBuildingClicked(construction, isFree, sellText) + sellBuildingClicked(construction, sellText) } if (cityScreen.city.hasSoldBuildingThisTurn && !cityScreen.city.civ.gameInfo.gameParameters.godMode @@ -119,7 +117,7 @@ class ConstructionInfoTable(val cityScreen: CityScreen) : Table() { } } - private fun sellBuildingClicked(construction: Building, isFree: Boolean, sellText: String) { + private fun sellBuildingClicked(construction: Building, sellText: String) { cityScreen.closeAllPopups() ConfirmPopup( diff --git a/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt b/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt index ce04cee1c1..7911cb7d29 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/MapOptionsTable.kt @@ -7,7 +7,7 @@ import com.unciv.ui.components.input.onChange import com.unciv.ui.components.widgets.TranslatedSelectBox import com.unciv.ui.screens.basescreen.BaseScreen -class MapOptionsTable(private val newGameScreen: NewGameScreen, isReset: Boolean = true) : Table() { +class MapOptionsTable(private val newGameScreen: NewGameScreen) : Table() { private val mapParameters = newGameScreen.gameSetupInfo.mapParameters private var mapTypeSpecificTable = Table() diff --git a/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt b/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt index 7ce7b4f3f1..b018878925 100644 --- a/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt +++ b/core/src/com/unciv/ui/screens/newgamescreen/NewGameScreen.kt @@ -48,8 +48,7 @@ import kotlin.math.floor import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane class NewGameScreen( - defaultGameSetupInfo: GameSetupInfo? = null, - isReset: Boolean = false + defaultGameSetupInfo: GameSetupInfo? = null ): IPreviousScreen, PickerScreen(), RecreateOnResize { override val gameSetupInfo = defaultGameSetupInfo ?: GameSetupInfo.fromSettings() @@ -79,7 +78,7 @@ class NewGameScreen( updatePlayerPickerTable = { desiredCiv -> playerPickerTable.update(desiredCiv) }, updatePlayerPickerRandomLabel = { playerPickerTable.updateRandomNumberLabel() } ) - mapOptionsTable = MapOptionsTable(this, isReset) + mapOptionsTable = MapOptionsTable(this) closeButton.onActivation { mapOptionsTable.cancelBackgroundJobs() game.popScreen() @@ -102,7 +101,7 @@ class NewGameScreen( "Are you sure you want to reset all game options to defaults?", "Reset to defaults", ) { - game.replaceCurrentScreen(NewGameScreen(GameSetupInfo(), isReset = true)) + game.replaceCurrentScreen(NewGameScreen(GameSetupInfo())) }.open(true) } } diff --git a/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt b/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt index cb75c33a88..d153d2f7ec 100644 --- a/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt +++ b/core/src/com/unciv/ui/screens/worldscreen/WorldScreen.kt @@ -291,7 +291,7 @@ class WorldScreen( fun openDeveloperConsole() { // No cheating unless you're by yourself if (gameInfo.civilizations.count { it.isHuman() } > 1) return - val consolePopup = DevConsolePopup(this) + DevConsolePopup(this) } private fun toggleUI() { diff --git a/server/build.gradle.kts b/server/build.gradle.kts index 0e163de653..6384b39d8c 100644 --- a/server/build.gradle.kts +++ b/server/build.gradle.kts @@ -136,7 +136,7 @@ for (platform in Platform.values()) { val platformNameForPackrCmd = if (platform == Platform.MacOS) "mac" - else platform.name.toLowerCase() + else platform.name.lowercase() val command = "java -jar $rootDir/packr-all-4.0.0.jar" + " --platform $platformNameForPackrCmd" +