diff --git a/Source/KerbalConstructionTime/VesselBuildValidator.cs b/Source/KerbalConstructionTime/VesselBuildValidator.cs index a66f450f2e3..06cb7a5fb75 100644 --- a/Source/KerbalConstructionTime/VesselBuildValidator.cs +++ b/Source/KerbalConstructionTime/VesselBuildValidator.cs @@ -172,14 +172,13 @@ private void ProcessPartAvailability(BuildListVessel blv) double credit = UnlockSubsidyHandler.Instance.GetCreditAmount(partList); double spentCredit = Math.Min(postCMQUnlockCost, credit); - double postCreditTotal = postCMQUnlockCost - spentCredit; cmq.AddDeltaAuthorized(CurrencyRP0.Funds, spentCredit); - int partCount = purchasableParts.Count(); + int partCount = partList.Count; string mode = KCTGameStates.EditorShipEditingMode ? "save edits" : "build vessel"; var buttons = new DialogGUIButton[] { new DialogGUIButton("Acknowledged", () => { _validationResult = ValidationResult.Fail; }), - new DialogGUIButton($"Unlock {partCount} part{(partCount > 1? "s":"")} for {postCreditTotal:N0} and {mode} (spending {spentCredit:N0} credit)", () => + new DialogGUIButton($"Unlock {partCount} part{(partCount > 1? "s":"")} for {Math.Max(0d, -cmq.GetTotal(CurrencyRP0.Funds)):N0} and {mode} (spending {spentCredit:N0} credit)", () => { if (cmq.CanAfford()) { diff --git a/Source/UnlockSubsidyHandler.cs b/Source/UnlockSubsidyHandler.cs index 4365698b468..ba70ef7df61 100644 --- a/Source/UnlockSubsidyHandler.cs +++ b/Source/UnlockSubsidyHandler.cs @@ -203,6 +203,7 @@ private void AddPartToDicts(AvailablePart ap, Dictionary ecmToCo techs = new HashSet(); techs.Add(ap.TechRequired); + ecmToTech[sanitizedName] = techs; } }