From 81f0c26a81f63704809d76d71fa1389e607d47a4 Mon Sep 17 00:00:00 2001 From: NathanKell Date: Thu, 9 Apr 2015 04:21:12 -0400 Subject: [PATCH] Fix a couple avionics bugs Thanks, chrisl * Was locking when current crew > required crew, rather than < * Was skipping avionics modules that weren't on the same part as a command module. --- GameData/RP-0/Plugins/RP0.dll | Bin 20992 -> 20992 bytes Source/ControlLocker.cs | 12 +++++------- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/GameData/RP-0/Plugins/RP0.dll b/GameData/RP-0/Plugins/RP0.dll index 26eced490b55ee4531eefe880602106cb7d823fb..9067a3a7967d53e3abaf52b147cdd700b729e486 100644 GIT binary patch delta 1519 zcmY+De{54#6vxj!_g=d8^}W7sWi8vlm1RG{K`BfIBePqwSVlIcFk$QuhWyw93UkcJ zH0cJoA0ZNIMMI{6g_*eoC#K1Ogz!rsXw(dX#E8U942mwnMGcb3@Vwh5X77)0zn^o? zJ@>r(ZaW8A=O8=O%L65O(F5&9Su;Q_(9;R9nn(Rv-S~ukK9d{Va{i04Z0-5w0iK>FiEJXb#%)_yZ}YCxY`AkXfTMil z)RQNoM%I*IdXcwi4i;>oXwh8s7HqRjd_+5)7CBOA?a=Kr&DZVbt~+kTs3U6m>yAE`|(PlcYNN z6=cHKiY}|3S-?uHE|0;=72CxY2RQSraEup zdVJgV9qBUX9c;pK=TGQ|u(O}FqJg(q7w&cbjV%~;O5TUZof?l)+|7@W`pBPgW|Lk~ zI_A6qQ5+}j!#`E!W9N+sbfH7f=UwQd8`Fh(%9rRt@+(xNS}*4VxYs^Ho2{cr3vMRu z0|VFaLQ)?Lu-Ejhd>DK5?Ysr75eL{|{Z;r3Pw4G@030HV{5idYvUl{o{0#oCJD`*u zwe|ACi-^WSDl)L2U$>@)04y|wxX((BVRoN2*zIDHRT!?=@!Z0B&xkr~H*R78Vn&4+ z#|HazA^@XCt(YXgmi+fdqhP$jzA5%FH;1*xGV^jGn)LIa!z}~cz}d1CtSi8xSu0S&>u~p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{K`IJ@Sjk}sb8AoUa2{brfJg>6E&nqbNBp{h|&E|oaJn5WcB($bjSKbw*LTI<1ifn diff --git a/Source/ControlLocker.cs b/Source/ControlLocker.cs index 34fd868fcd2..d4cae51848b 100644 --- a/Source/ControlLocker.cs +++ b/Source/ControlLocker.cs @@ -50,10 +50,8 @@ public static bool ShouldLock(List parts, bool countClamps, out float maxM // if we count clamps, they can give control. If we don't, this works only if the part isn't a clamp. if ((countClamps || !clamp) && cmd && !science && !avionics) return false; - if (cmd && avionics) // check if need crew { - bool flag = true; if (mC.minimumCrew > 0) // if we need crew { if (crewCount < 0) // see if we cached crew @@ -64,14 +62,14 @@ public static bool ShouldLock(List parts, bool countClamps, out float maxM crewCount = CMAssignmentDialog.Instance.GetManifest().GetAllCrew(false).Count; else crewCount = 0; // or assume no crew (should never trip this) } - if (mC.minimumCrew < crewCount) - flag = false; + if (mC.minimumCrew > crewCount) + avionics = false; // not operational } - if(flag) - maxMass += partAvionicsMass; } + if (avionics) + maxMass += partAvionicsMass; } - if (maxMass >= vesselMass) // will only be reached if the best we have is avionics. + if (maxMass > vesselMass) // will only be reached if the best we have is avionics. return false; // unlock if our max avionics mass is >= vessel mass // NOTE: we don't update for fuel burnt, because avionics needs to be able to handle the size // as well as the fuel.