Skip to content

Commit

Permalink
Fixed broken completeInSequence.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrossignol committed Mar 20, 2015
1 parent 40358c7 commit edec0e9
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Contract Configurator 0.7.1
- Support for notes in most contract parameters.
- Weight in contract types now only applies within a contract group, and all contract groups are given equal preference. This means that one contract group (or contract pack) can't cause contract starvation in another group.
- Fix NullReferenceException when using TextGen without an agent specified (thanks AppoloFunghi).
- Fix broken completeInSequence attribute.
- Minor bug fixes.

Contract Configurator 0.7.0
Expand Down
Binary file modified GameData/ContractConfigurator/CC_RemoteTech.dll
Binary file not shown.
Binary file modified GameData/ContractConfigurator/CC_SCANsat.dll
Binary file not shown.
Binary file modified GameData/ContractConfigurator/ContractConfigurator.dll
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ protected sealed override void OnSave(ConfigNode node)
}
node.AddValue("title", title ?? "");
node.AddValue("notes", notes ?? "");
node.AddValue("completeInSequence", completeInSequence);
OnParameterSave(node);
}
catch (Exception e)
Expand All @@ -68,6 +69,7 @@ protected sealed override void OnLoad(ConfigNode node)
{
title = ConfigNodeUtil.ParseValue<string>(node, "title", "");
notes = ConfigNodeUtil.ParseValue<string>(node, "notes", "");
completeInSequence = ConfigNodeUtil.ParseValue<bool?>(node, "completeInSequence", (bool?)false).Value;
OnParameterLoad(node);
}
catch (Exception e)
Expand All @@ -94,7 +96,7 @@ protected sealed override void OnLoad(ConfigNode node)
/// it will check if all previous parameters in the sequence have been completed.
/// </summary>
/// <returns>True if the parameter is ready to complete.</returns>
private bool ReadyToComplete()
protected bool ReadyToComplete()
{
if (!completeInSequence)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ protected override void OnParameterLoad(ConfigNode node)
/// in the sequence have been completed.
/// </summary>
/// <returns>True if the parameter is ready to complete.</returns>
private bool ReadyToComplete()
private new bool ReadyToComplete()
{
// Go through the parent's parameters
for (int i = 0; i < Parent.ParameterCount; i++)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,13 @@ protected virtual bool SetState(Vessel vessel, Contracts.ParameterState state)
return false;
}

// Check if the transition is allowed
if (state == ParameterState.Complete && !ReadyToComplete())
{
LoggingUtil.LogVerbose(this, "Not setting state for vessel " + vessel.id + ", not ready to complete!");
return false;
}

LoggingUtil.LogVerbose(this, "SetState to " + state + " for vessel " + vessel.id);

// Before we wreck anything, don't allow the default disable on state change logic
Expand Down

0 comments on commit edec0e9

Please sign in to comment.