Skip to content

Commit

Permalink
Merge branch 'FixFakeFailuresInVPG' into TEST
Browse files Browse the repository at this point in the history
  • Loading branch information
siimav committed Dec 4, 2023
2 parents 37e3d08 + 051cd15 commit d675cd9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions source/ContractConfigurator/Parameter/VesselParameter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,12 @@ protected virtual bool SetState(Vessel vessel, Contracts.ParameterState state)
// Force to failure if failWhenUnmet is set
if (failWhenUnmet && state == ParameterState.Incomplete)
{
SetState(ParameterState.Failed);
// but when using VPG logic only do it when the vessel is the one being tracked
VesselParameterGroup vpg = GetParameterGroupHost();
if (vpg == null || vpg.TrackedVessel == vessel)
{
SetState(ParameterState.Failed);
}
}

// Set the state
Expand Down Expand Up @@ -642,8 +647,9 @@ protected virtual void CheckVessel(Vessel vessel, bool forceStateChange = false)
if (vpg != null)
{
// Set the craft specific state
bool stateChanged = SetState(vessel, VesselMeetsCondition(vessel) ?
Contracts.ParameterState.Complete : Contracts.ParameterState.Incomplete) || forceStateChange;
ParameterState newState = VesselMeetsCondition(vessel) ?
Contracts.ParameterState.Complete : Contracts.ParameterState.Incomplete;
bool stateChanged = SetState(vessel, newState) || forceStateChange;

// Update the group
if (stateChanged)
Expand Down

0 comments on commit d675cd9

Please sign in to comment.