Skip to content

Commit

Permalink
Fix Facility Upgrades resetting when activating cancellation dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
severedsolo committed Jan 28, 2020
1 parent c447465 commit 89e636b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
12 changes: 5 additions & 7 deletions Bureaucracy/Facilities/FacilityManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,12 @@ public void StartUpgrade(UpgradeableFacility facility)
if (facilityToUpgrade.IsPriority)
{
warningDialog = DrawWarningDialog(facilityToUpgrade);
}
else
{
Debug.Log("[Bureaucracy]: " + facility.id + " is already being upgraded. Prioritising");
SetPriority(facilityToUpgrade, true);
ScreenMessages.PostScreenMessage("Upgrade of " + facilityToUpgrade.Name + " prioritised");
return;
}
Debug.Log("[Bureaucracy]: " + facility.id + " is already being upgraded. Prioritising");
SetPriority(facilityToUpgrade, true);
ScreenMessages.PostScreenMessage("Upgrade of " + facilityToUpgrade.Name + " prioritised");
return;
}

facilityToUpgrade.StartUpgrade(facility);
Expand All @@ -161,7 +159,7 @@ public void StartUpgrade(UpgradeableFacility facility)
private PopupDialog DrawWarningDialog(BureaucracyFacility facility)
{
List<DialogGUIBase> dialogElements = new List<DialogGUIBase>();
dialogElements.Add(new DialogGUILabel("Upgrade of "+facility.Name+" will be cancelled. "+(facility.Upgrade.RemainingInvestment-facility.Upgrade.OriginalCost+" will be lost. Are you sure?")));
dialogElements.Add(new DialogGUILabel("Upgrade of "+facility.Name+" will be cancelled. "+(facility.Upgrade.OriginalCost-facility.Upgrade.RemainingInvestment+" will be lost. Are you sure?")));
dialogElements.Add(new DialogGUIButton("Yes", facility.CancelUpgrade, true));
dialogElements.Add(new DialogGUIButton("No", () => { }, true));
return PopupDialog.SpawnPopupDialog(new Vector2(0.5f, 0.5f), new Vector2(0.5f, 0.5f), new MultiOptionDialog("CancelUpgradeDialog", "", "Bureaucracy: Cancel Upgrade", UISkinManager.GetSkin("MainMenuSkin"), new Rect(0.5f, 0.5f, 210, 100), dialogElements.ToArray()), false, UISkinManager.GetSkin("MainMenuSkin"));
Expand Down
2 changes: 1 addition & 1 deletion GameData/Bureaucracy/Bureaucracy.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
{
"MAJOR" : 1,
"MINOR" : 1,
"PATCH" : 1,
"PATCH" : 2,
"BUILD" : 0
},
"KSP_VERSION" :
Expand Down
7 changes: 7 additions & 0 deletions GameData/Bureaucracy/Changelog.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,13 @@ KERBALCHANGELOG
showChangelog = True
modName = Bureaucracy

VERSION
{
version = 1.1.2
change = Fixed issue where accidentally activating the Facilty Upgrade cancellation dialog would reset upgrade progress to 0.
change = Fixed Facility Upgrade dialog showing incorrect amount to be lost on cancellation.
}

VERSION
{
version = 1.1.1
Expand Down

0 comments on commit 89e636b

Please sign in to comment.