Treat compilation warnings (#11741)

* Treat compilation warnings

* Finish treating compiler warnings for now
This commit is contained in:
SomeTroglodyte
2024-06-27 22:26:26 +02:00
committed by GitHub
parent 8da58ed34a
commit bebc769120
7 changed files with 20 additions and 17 deletions

View File

@ -277,6 +277,7 @@ class ConstructionAutomation(val cityConstructions: CityConstructions) {
}
@Suppress("UNUSED_PARAMETER") // stub for future use
private fun applyOnetimeUniqueBonuses(building: Building): Float {
var value = 0f
// TODO: Add specific Uniques here

View File

@ -31,6 +31,7 @@ class RoadToAutomation(val civInfo: Civilization) {
*/
// TODO: Caching
// TODO: Hide the automate road button if road is not unlocked
@Suppress("UNUSED_PARAMETER") // tilesWhereWeWillBeCaptured may be useful in the future
fun automateConnectRoad(unit: MapUnit, tilesWhereWeWillBeCaptured: Set<Tile>){
if (actualBestRoadAvailable == RoadStatus.None) return

View File

@ -517,7 +517,7 @@ object UnitAutomation {
.sortedBy { unit.getTile().aerialDistanceTo(it.city1.getCenterTile()) }
// Move to the closest city with a tile we can enter nearby
for ((city, enemyCity) in citiesToDefend) {
for ((city, _) in citiesToDefend) {
if (unit.getTile().aerialDistanceTo(city.getCenterTile()) <= 2) return true
val tileToMoveTo = city.getCenterTile().getTilesInDistance(2).firstOrNull { unit.movement.canMoveTo(it) && unit.movement.canReach(it) } ?: continue
unit.movement.headTowards(tileToMoveTo)

View File

@ -14,6 +14,7 @@ object MapPathing {
* to upgrade it to a railroad, we consider it to be a railroad for pathing since it will be upgraded.
* Otherwise, we set every tile to have equal value since building a road on any of them makes the original movement cost irrelevant.
*/
@Suppress("UNUSED_PARAMETER") // While `from` is unused, this function should stay close to the signatures expected by the AStar and getPath `heuristic` parameter.
private fun roadPreferredMovementCost(unit: MapUnit, from: Tile, to: Tile): Float{
// hasRoadConnection accounts for civs that treat jungle/forest as roads
// Ignore road over river penalties.
@ -51,9 +52,8 @@ object MapPathing {
startTile,
endTile,
::isValidRoadPathTile,
::roadPreferredMovementCost,
{_, _, _ -> 0f}
)
::roadPreferredMovementCost
) { _, _, _ -> 0f }
}
/**
@ -109,9 +109,9 @@ object MapPathing {
): List<Tile>? {
val astar = AStar(
startTile,
{ tile -> predicate(civ, tile) },
{ from, to -> 1f },
{ from, to -> from.aerialDistanceTo(to).toFloat() }
predicate = { tile -> predicate(civ, tile) },
cost = { _, _ -> 1f },
heuristic = { from, to -> from.aerialDistanceTo(to).toFloat() }
)
while (true) {
if (astar.hasEnded()) {

View File

@ -199,7 +199,7 @@ class Nation : RulesetObject() {
if (building.replaces != null && ruleset.buildings.containsKey(building.replaces!!)) {
val originalBuilding = ruleset.buildings[building.replaces!!]!!
yield(FormattedLine("Replaces [${originalBuilding.name}]", link = originalBuilding.makeLink(), indent = 1))
yieldAll(BuildingDescriptions.getDifferences(ruleset, originalBuilding, building))
yieldAll(BuildingDescriptions.getDifferences(originalBuilding, building))
yield(FormattedLine())
} else if (building.replaces != null) {
yield(FormattedLine("Replaces [${building.replaces}], which is not found in the ruleset!", indent = 1))

View File

@ -118,7 +118,7 @@ object BuildingDescriptions {
* @param replacementBuilding The "uniqueTo" Building
*/
fun getDifferences(
ruleset: Ruleset, originalBuilding: Building, replacementBuilding: Building
originalBuilding: Building, replacementBuilding: Building
): Sequence<FormattedLine> = sequence {
for ((key, value) in replacementBuilding)
if (value != originalBuilding[key])

View File

@ -104,7 +104,8 @@ class ConstructionInfoTable(val cityScreen: CityScreen) : Table() {
cityScreen.canChangeState &&
(!cityScreen.city.hasSoldBuildingThisTurn || cityScreen.city.civ.gameInfo.gameParameters.godMode)
sellBuildingButton.isEnabled = enableSell
if (sellBuildingButton.isEnabled) sellBuildingButton.onClick(UncivSound.Coin) {
if (enableSell)
sellBuildingButton.onClick(UncivSound.Coin) {
sellBuildingButton.disable()
sellBuildingClicked(construction, sellText)
}