Skip to content

Commit a43185b

Browse files
committed
Fis Multi-Mode Engine toggling
Stupid indexing error that I missed. Reporteed and diagnosed by vulkans22. Issue #324
1 parent 70edd3f commit a43185b

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

Source/MASFlightComputerProxy.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4636,7 +4636,7 @@ public double SetGimbalYaw(bool enable)
46364636
public double SetMultiModeEngineMode(bool runPrimary)
46374637
{
46384638
bool anyChanged = false;
4639-
for (int i = vc.multiModeEngines.Length; i >= 0; --i)
4639+
for (int i = vc.multiModeEngines.Length - 1; i >= 0; --i)
46404640
{
46414641
if (vc.multiModeEngines[i].runningPrimary != runPrimary)
46424642
{
@@ -4645,6 +4645,11 @@ public double SetMultiModeEngineMode(bool runPrimary)
46454645
}
46464646
}
46474647

4648+
if (anyChanged)
4649+
{
4650+
vc.InvalidateModules();
4651+
}
4652+
46484653
return (anyChanged) ? 1.0 : 0.0;
46494654
}
46504655

@@ -4817,10 +4822,13 @@ public double ToggleGimbalYaw()
48174822
/// <returns>1 if any engines were toggled, 0 if no multi-mode engines are installed.</returns>
48184823
public double ToggleMultiModeEngineMode()
48194824
{
4820-
for (int i = vc.multiModeEngines.Length; i >= 0; --i)
4825+
for (int i = vc.multiModeEngines.Length - 1; i >= 0; --i)
48214826
{
48224827
vc.multiModeEngines[i].ToggleMode();
48234828
}
4829+
4830+
vc.InvalidateModules();
4831+
48244832
return (vc.multiModeEngines.Length > 0) ? 1.0 : 0.0;
48254833
}
48264834
#endregion

Source/MASVesselComputerModules.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1371,7 +1371,7 @@ private void UpdateGear()
13711371
/// Mark modules as potentially invalid to force reiterating over the
13721372
/// part and module lists.
13731373
/// </summary>
1374-
private void InvalidateModules()
1374+
internal void InvalidateModules()
13751375
{
13761376
modulesInvalidated = true;
13771377
camerasReset = true;

0 commit comments

Comments
 (0)