Remove unused parameters

This commit is contained in:
Yair Morgenstern 2024-06-24 23:13:33 +03:00
parent 77f02600fd
commit 7bd0a03cab
7 changed files with 11 additions and 15 deletions

View File

@ -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 // 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)) { for (building in city.civ.civConstructions.getFreeBuildingNames(city)) {
city.cityConstructions.removeBuilding(building) city.cityConstructions.removeBuilding(building)
} }
@ -266,7 +267,7 @@ class CityConquestFunctions(val city: City) {
city.resetWLTKD() city.resetWLTKD()
// Remove their free buildings from this city and remove free buildings provided by the city from their cities // 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. // Place palace for newCiv if this is the only city they have.
if (newCiv.cities.size == 1) newCiv.moveCapitalTo(city, null) if (newCiv.cities.size == 1) newCiv.moveCapitalTo(city, null)

View File

@ -18,7 +18,6 @@ import com.unciv.models.ruleset.unique.UniqueTarget
import com.unciv.models.ruleset.unique.UniqueType import com.unciv.models.ruleset.unique.UniqueType
import com.unciv.models.stats.Stat import com.unciv.models.stats.Stat
import com.unciv.models.stats.Stats 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.getNeedMoreAmountString
import com.unciv.ui.components.extensions.toPercent import com.unciv.ui.components.extensions.toPercent
import com.unciv.ui.objectdescriptions.BuildingDescriptions import com.unciv.ui.objectdescriptions.BuildingDescriptions
@ -260,7 +259,6 @@ class Building : RulesetStatsObject(), INonPerpetualConstruction {
override fun getRejectionReasons(cityConstructions: CityConstructions): Sequence<RejectionReason> = sequence { override fun getRejectionReasons(cityConstructions: CityConstructions): Sequence<RejectionReason> = sequence {
val cityCenter = cityConstructions.city.getCenterTile() val cityCenter = cityConstructions.city.getCenterTile()
val civ = cityConstructions.city.civ val civ = cityConstructions.city.civ
val ruleSet = civ.gameInfo.ruleset
if (cityConstructions.isBuilt(name)) if (cityConstructions.isBuilt(name))
yield(RejectionReasonType.AlreadyBuilt.toInstance()) yield(RejectionReasonType.AlreadyBuilt.toInstance())

View File

@ -4,7 +4,6 @@ import com.badlogic.gdx.graphics.Color
import com.badlogic.gdx.scenes.scene2d.Touchable import com.badlogic.gdx.scenes.scene2d.Touchable
import com.badlogic.gdx.scenes.scene2d.ui.Label import com.badlogic.gdx.scenes.scene2d.ui.Label
import com.badlogic.gdx.scenes.scene2d.ui.Table import com.badlogic.gdx.scenes.scene2d.ui.Table
import com.unciv.UncivGame
import com.unciv.models.UncivSound import com.unciv.models.UncivSound
import com.unciv.models.ruleset.Building import com.unciv.models.ruleset.Building
import com.unciv.models.ruleset.IConstruction 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.ConfirmPopup
import com.unciv.ui.popups.closeAllPopups import com.unciv.ui.popups.closeAllPopups
import com.unciv.ui.screens.basescreen.BaseScreen import com.unciv.ui.screens.basescreen.BaseScreen
import com.unciv.ui.screens.civilopediascreen.CivilopediaScreen
class ConstructionInfoTable(val cityScreen: CityScreen) : Table() { class ConstructionInfoTable(val cityScreen: CityScreen) : Table() {
private val selectedConstructionTable = Table() private val selectedConstructionTable = Table()
@ -108,7 +106,7 @@ class ConstructionInfoTable(val cityScreen: CityScreen) : Table() {
sellBuildingButton.isEnabled = enableSell sellBuildingButton.isEnabled = enableSell
if (sellBuildingButton.isEnabled) sellBuildingButton.onClick(UncivSound.Coin) { if (sellBuildingButton.isEnabled) sellBuildingButton.onClick(UncivSound.Coin) {
sellBuildingButton.disable() sellBuildingButton.disable()
sellBuildingClicked(construction, isFree, sellText) sellBuildingClicked(construction, sellText)
} }
if (cityScreen.city.hasSoldBuildingThisTurn && !cityScreen.city.civ.gameInfo.gameParameters.godMode 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() cityScreen.closeAllPopups()
ConfirmPopup( ConfirmPopup(

View File

@ -7,7 +7,7 @@ import com.unciv.ui.components.input.onChange
import com.unciv.ui.components.widgets.TranslatedSelectBox import com.unciv.ui.components.widgets.TranslatedSelectBox
import com.unciv.ui.screens.basescreen.BaseScreen 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 val mapParameters = newGameScreen.gameSetupInfo.mapParameters
private var mapTypeSpecificTable = Table() private var mapTypeSpecificTable = Table()

View File

@ -48,8 +48,7 @@ import kotlin.math.floor
import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane import com.unciv.ui.components.widgets.AutoScrollPane as ScrollPane
class NewGameScreen( class NewGameScreen(
defaultGameSetupInfo: GameSetupInfo? = null, defaultGameSetupInfo: GameSetupInfo? = null
isReset: Boolean = false
): IPreviousScreen, PickerScreen(), RecreateOnResize { ): IPreviousScreen, PickerScreen(), RecreateOnResize {
override val gameSetupInfo = defaultGameSetupInfo ?: GameSetupInfo.fromSettings() override val gameSetupInfo = defaultGameSetupInfo ?: GameSetupInfo.fromSettings()
@ -79,7 +78,7 @@ class NewGameScreen(
updatePlayerPickerTable = { desiredCiv -> playerPickerTable.update(desiredCiv) }, updatePlayerPickerTable = { desiredCiv -> playerPickerTable.update(desiredCiv) },
updatePlayerPickerRandomLabel = { playerPickerTable.updateRandomNumberLabel() } updatePlayerPickerRandomLabel = { playerPickerTable.updateRandomNumberLabel() }
) )
mapOptionsTable = MapOptionsTable(this, isReset) mapOptionsTable = MapOptionsTable(this)
closeButton.onActivation { closeButton.onActivation {
mapOptionsTable.cancelBackgroundJobs() mapOptionsTable.cancelBackgroundJobs()
game.popScreen() game.popScreen()
@ -102,7 +101,7 @@ class NewGameScreen(
"Are you sure you want to reset all game options to defaults?", "Are you sure you want to reset all game options to defaults?",
"Reset to defaults", "Reset to defaults",
) { ) {
game.replaceCurrentScreen(NewGameScreen(GameSetupInfo(), isReset = true)) game.replaceCurrentScreen(NewGameScreen(GameSetupInfo()))
}.open(true) }.open(true)
} }
} }

View File

@ -291,7 +291,7 @@ class WorldScreen(
fun openDeveloperConsole() { fun openDeveloperConsole() {
// No cheating unless you're by yourself // No cheating unless you're by yourself
if (gameInfo.civilizations.count { it.isHuman() } > 1) return if (gameInfo.civilizations.count { it.isHuman() } > 1) return
val consolePopup = DevConsolePopup(this) DevConsolePopup(this)
} }
private fun toggleUI() { private fun toggleUI() {

View File

@ -136,7 +136,7 @@ for (platform in Platform.values()) {
val platformNameForPackrCmd = val platformNameForPackrCmd =
if (platform == Platform.MacOS) "mac" if (platform == Platform.MacOS) "mac"
else platform.name.toLowerCase() else platform.name.lowercase()
val command = "java -jar $rootDir/packr-all-4.0.0.jar" + val command = "java -jar $rootDir/packr-all-4.0.0.jar" +
" --platform $platformNameForPackrCmd" + " --platform $platformNameForPackrCmd" +