Skip to content

Commit 057f2e9

Browse files
committed
Oops
1 parent 881678c commit 057f2e9

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

core/src/com/bombbird/terminalcontrol/entities/runways/RunwayManager.kt

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,30 @@ class RunwayManager(private val airport: Airport) {
131131
for (runway: Runway in airport.landingRunways.values) {
132132
if (MathTools.componentInDirection(windSpd, windHdg, runway.heading) < -5) return true
133133
}
134-
if (!this::latestRunwayConfig.isInitialized) return true
134+
if (!this::latestRunwayConfig.isInitialized) {
135+
//Search for config
136+
var found = false
137+
for (config in dayConfigs) {
138+
if (config.landingRunwayMap.keys == airport.landingRunways.keys && config.takeoffRunwayMap.keys == airport.takeoffRunways.keys) {
139+
found = true
140+
latestRunwayConfig = config
141+
break
142+
}
143+
}
144+
if (!found) {
145+
for (config in nightConfigs) {
146+
if (config.landingRunwayMap.keys == airport.landingRunways.keys && config.takeoffRunwayMap.keys == airport.takeoffRunways.keys) {
147+
found = true
148+
latestRunwayConfig = config
149+
break
150+
}
151+
}
152+
if (!found) {
153+
Gdx.app.log("Runway manager", "Could not find current runway config in all configs! Runway change initialized")
154+
return true
155+
}
156+
}
157+
}
135158
return !availableConfigs.contains(latestRunwayConfig, false) //Even if current config works, if config time no longer applies, needs to be changed also
136159
}
137160

0 commit comments

Comments
 (0)