Skip to content

Commit 7a0f736

Browse files
committed
Fix Radio Navigation range computations
They were never applied to the NavAids unless the user opened the MAS config dialog in the Space Center and pressed okay. Issue reported and diagnosed by vulkans22. Issue #325
1 parent a43185b commit 7a0f736

File tree

3 files changed

+18
-7
lines changed

3 files changed

+18
-7
lines changed

Source/MASConfig.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
* The MIT License (MIT)
33
*
4-
* Copyright (c) 2016-2019 MOARdV
4+
* Copyright (c) 2016-2020 MOARdV
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to
@@ -130,6 +130,8 @@ public override void OnLoad(ConfigNode node)
130130
{
131131
navigation.DMEPropagation = 1.4f;
132132
}
133+
134+
MASLoader.UpdateHorizonDistance();
133135
}
134136

135137
/// <summary>

Source/MASLoader.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,19 @@ internal static Font GetFont(string fontName)
175175
}
176176
}
177177

178+
/// <summary>
179+
/// Convenience function to update navaid horizon distances when propagation
180+
/// values change.
181+
/// </summary>
182+
static public void UpdateHorizonDistance()
183+
{
184+
int numNavAids = navaids.Count;
185+
for (int i = 0; i < numNavAids; ++i)
186+
{
187+
navaids[i].UpdateHorizonDistance();
188+
}
189+
}
190+
178191
/// <summary>
179192
/// Awake() - Load components used by the mod.
180193
/// </summary>

Source/MASSettings.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*****************************************************************************
22
* The MIT License (MIT)
33
*
4-
* Copyright (c) 2017-2019 MOARdV
4+
* Copyright (c) 2017-2020 MOARdV
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to
@@ -198,11 +198,7 @@ private void ApplyChanges()
198198
MASConfig.navigation.VORPropagation = VORPropagation;
199199
MASConfig.navigation.DMEPropagation = DMEPropagation;
200200

201-
int numNavAids = MASLoader.navaids.Count;
202-
for (int i = 0; i < numNavAids; ++i)
203-
{
204-
MASLoader.navaids[i].UpdateHorizonDistance();
205-
}
201+
MASLoader.UpdateHorizonDistance();
206202
}
207203

208204
private void onAppLauncherShow()

0 commit comments

Comments
 (0)