From 68c2763ea7a87cc736d880263f0b3615838012e6 Mon Sep 17 00:00:00 2001 From: Yair Morgenstern Date: Thu, 25 Apr 2019 10:37:46 +0300 Subject: [PATCH] Code cleanup --- .../logic/automation/WorkerAutomation.kt | 19 ------------------- .../logic/civilization/CivilizationInfo.kt | 3 +-- core/src/com/unciv/ui/CivilopediaScreen.kt | 8 ++++---- core/src/com/unciv/ui/EmpireOverviewScreen.kt | 4 ++-- core/src/com/unciv/ui/LanguagePickerScreen.kt | 2 +- .../ui/cityscreen/CityScreenTileTable.kt | 15 +++++++-------- .../com/unciv/ui/mapeditor/MapEditorScreen.kt | 7 ------- .../unciv/ui/pickerscreens/PickerScreen.kt | 6 +++--- .../ui/pickerscreens/PolicyPickerScreen.kt | 4 ++-- core/src/com/unciv/ui/saves/LoadScreen.kt | 2 +- core/src/com/unciv/ui/utils/ImageGetter.kt | 6 +++--- core/src/com/unciv/ui/utils/Sounds.kt | 2 +- .../unciv/ui/worldscreen/WorldScreenTopBar.kt | 2 -- 13 files changed, 25 insertions(+), 55 deletions(-) diff --git a/core/src/com/unciv/logic/automation/WorkerAutomation.kt b/core/src/com/unciv/logic/automation/WorkerAutomation.kt index b5bd141ae6..950c78a92f 100644 --- a/core/src/com/unciv/logic/automation/WorkerAutomation.kt +++ b/core/src/com/unciv/logic/automation/WorkerAutomation.kt @@ -158,23 +158,4 @@ class WorkerAutomation(val unit: MapUnit) { return GameBasics.TileImprovements[improvementString]!! } - // todo: is this neccesary? Worker automation does something else to build roads. - // Either generalize or delete - fun constructRoadTo(destination:TileInfo) { - val currentTile = unit.getTile() - if (currentTile.roadStatus == RoadStatus.None) - return currentTile.startWorkingOnImprovement(GameBasics.TileImprovements["Road"]!!, unit.civInfo) - - val pathToDestination = unit.movementAlgs().getShortestPath(destination) - val destinationThisTurn = pathToDestination.first() - val fullPathToCurrentDestination = unit.movementAlgs().getFullPathToCloseTile(destinationThisTurn) - val firstTileWithoutRoad = fullPathToCurrentDestination.firstOrNull { it.roadStatus == RoadStatus.None && unit.canMoveTo(it) } - if (firstTileWithoutRoad == null) - return unit.moveToTile(destinationThisTurn) - - unit.moveToTile(firstTileWithoutRoad) - if (unit.currentMovement > 0) - firstTileWithoutRoad.startWorkingOnImprovement(GameBasics.TileImprovements["Road"]!!, unit.civInfo) - } - } \ No newline at end of file diff --git a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt index ce50a0ecce..4f1cf567dc 100644 --- a/core/src/com/unciv/logic/civilization/CivilizationInfo.kt +++ b/core/src/com/unciv/logic/civilization/CivilizationInfo.kt @@ -36,8 +36,7 @@ enum class PlayerType{ class TradeRequest(val requestingCiv:String, /** Their offers are what they offer us, and our offers are what they want in return */ - val trade: Trade){ -} + val trade: Trade) class CivilizationInfo { @Transient lateinit var gameInfo: GameInfo diff --git a/core/src/com/unciv/ui/CivilopediaScreen.kt b/core/src/com/unciv/ui/CivilopediaScreen.kt index db8e22b9af..fafb809381 100644 --- a/core/src/com/unciv/ui/CivilopediaScreen.kt +++ b/core/src/com/unciv/ui/CivilopediaScreen.kt @@ -21,7 +21,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { val buttonTable = Table() buttonTable.pad(15f) val entryTable = Table() - val splitPane = SplitPane(buttonTable, entryTable, true, CameraStageBaseScreen.skin) + val splitPane = SplitPane(buttonTable, entryTable, true, skin) splitPane.splitAmount = 0.2f splitPane.setFillParent(true) @@ -30,7 +30,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { val label = "".toLabel() label.setWrap(true) - val goToGameButton = TextButton("Close".tr(), CameraStageBaseScreen.skin) + val goToGameButton = TextButton("Close".tr(), skin) goToGameButton.onClick { game.setWorldScreen() dispose() @@ -51,7 +51,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { categoryToInfos["Units"] = GameBasics.Units.values categoryToInfos["Technologies"] = GameBasics.Technologies.values - val nameList = List(CameraStageBaseScreen.skin) + val nameList = List(skin) val nameListClickListener = { if(nameList.selected!=null) label.setText(nameList.selected.description) @@ -64,7 +64,7 @@ class CivilopediaScreen : CameraStageBaseScreen() { val buttons = ArrayList