From 136f03da768fcdaebbc2898a35af813d38335724 Mon Sep 17 00:00:00 2001 From: Shang Yi Ku Date: Sat, 1 Jun 2024 18:55:24 +0800 Subject: [PATCH] Fix aircraft min max optimal speed not getting updated on route status change causing occasional weird speed behaviour, hide last played time if parsing failed --- .../com/bombbird/terminalcontrol2/screens/LoadGame.kt | 9 +++++++-- .../com/bombbird/terminalcontrol2/systems/AISystem.kt | 5 +++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/core/src/main/kotlin/com/bombbird/terminalcontrol2/screens/LoadGame.kt b/core/src/main/kotlin/com/bombbird/terminalcontrol2/screens/LoadGame.kt index 0889005b..06509a6b 100644 --- a/core/src/main/kotlin/com/bombbird/terminalcontrol2/screens/LoadGame.kt +++ b/core/src/main/kotlin/com/bombbird/terminalcontrol2/screens/LoadGame.kt @@ -16,6 +16,7 @@ import ktx.collections.* import ktx.scene2d.* import java.time.ZonedDateTime import java.time.format.DateTimeFormatter +import java.time.format.DateTimeParseException /** Screen for searching game saves in the user app data */ class LoadGame: BasicUIScreen() { @@ -241,8 +242,12 @@ class LoadGame: BasicUIScreen() { val defaultDetails = "${meta.mainName} - Score: ${meta.score} High score: ${meta.highScore}\nLanded: ${meta.landed} Departed: ${meta.departed}" val configDetails = meta.configNames ?: "" val lastPlayedString = meta.lastPlayedDatetime?.let { - val playedTemporal = ZonedDateTime.parse(it, DateTimeFormatter.ISO_ZONED_DATE_TIME) - getDatetimeDifferenceString(playedTemporal, ZonedDateTime.now()) + try { + val playedTemporal = ZonedDateTime.parse(it, DateTimeFormatter.ISO_ZONED_DATE_TIME) + getDatetimeDifferenceString(playedTemporal, ZonedDateTime.now()) + } catch (e: DateTimeParseException) { + null + } } val lastPlayed = if (lastPlayedString != null) "\nLast played: $lastPlayedString" else "" val saveButton = textButton(defaultDetails, "NewLoadGameAirport").cell(growX = true) diff --git a/core/src/main/kotlin/com/bombbird/terminalcontrol2/systems/AISystem.kt b/core/src/main/kotlin/com/bombbird/terminalcontrol2/systems/AISystem.kt index 134d131d..f2f649d3 100644 --- a/core/src/main/kotlin/com/bombbird/terminalcontrol2/systems/AISystem.kt +++ b/core/src/main/kotlin/com/bombbird/terminalcontrol2/systems/AISystem.kt @@ -1092,6 +1092,11 @@ class AISystem: EntitySystem() { return@apply } } + + val spds = getMinMaxOptimalIAS(entity) + actingClearance.minIas = spds.first + actingClearance.maxIas = spds.second + actingClearance.optimalIas = spds.third } /**