Skip to content

Commit

Permalink
Added check for game mode before displaying the "rush build" button.…
Browse files Browse the repository at this point in the history
… Currently only allowd in Career & SCIENCE_SANDBOX

 Fixed a small memory leak
n
  • Loading branch information
linuxgurugamer committed Dec 26, 2022
1 parent d90e363 commit 494cfd3
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 15 deletions.
4 changes: 2 additions & 2 deletions KerbalConstructionTime-180.version
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"MAJOR": 1,
"MINOR": 4,
"PATCH": 11,
"BUILD": 3
"BUILD": 4
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
"PATCH": 4
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
Expand Down
26 changes: 26 additions & 0 deletions KerbalConstructionTime-180.version.1-12-3
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"NAME": "Kerbal Construction Time",
"URL": "http://ksp.spacetux.net/avc/KerbalConstructionTime-180",
"DOWNLOAD": "https://forum.kerbalspaceprogram.com/index.php?/topic/182877-151-161-kerbal-construction-time-unrapid-planned-assembly/",
"GITHUB": {
"USERNAME": "linuxgurugamer",
"REPOSITORY": "KCT",
"ALLOW_PRE_RELEASE": false
},
"VERSION": {
"MAJOR": 1,
"MINOR": 4,
"PATCH": 11,
"BUILD": 3
},
"KSP_VERSION": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 3
},
"KSP_VERSION_MIN": {
"MAJOR": 1,
"MINOR": 12,
"PATCH": 0
}
}
4 changes: 2 additions & 2 deletions Kerbal_Construction_Time/AssemblyVersion-1.8.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@

using System.Reflection;

[assembly: AssemblyVersion("1.4.11.2")]
[assembly: AssemblyFileVersion("1.4.11.2")]
[assembly: AssemblyVersion("1.4.11.3")]
[assembly: AssemblyFileVersion("1.4.11.3")]
16 changes: 8 additions & 8 deletions Kerbal_Construction_Time/KCT_GUI_BuildList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,6 @@ internal static void InitBuildListVars()

public static void DrawBuildListWindow(int windowID)
{
#if false
if (!buildListVarsInitted)
InitBuildListVars();
#endif
int width1 = 120;
int width2 = 100;
int butW = 20;
Expand Down Expand Up @@ -1407,11 +1403,15 @@ private static void DrawBLPlusWindow(int windowID)
KCT_GameStates.ActiveKSC.SPHList.Insert(0, b);
}
}
if (!b.isFinished
&& (KCT_PresetManager.Instance.ActivePreset.generalSettings.MaxRushClicks == 0 || b.rushBuildClicks < KCT_PresetManager.Instance.ActivePreset.generalSettings.MaxRushClicks)
&& GUILayout.Button("Rush Build 10%\n√" + Math.Round(b.GetRushCost())))
if (HighLogic.CurrentGame.Mode == Game.Modes.CAREER ||
HighLogic.CurrentGame.Mode == Game.Modes.SCIENCE_SANDBOX)
{
b.DoRushBuild();
if (!b.isFinished
&& (KCT_PresetManager.Instance.ActivePreset.generalSettings.MaxRushClicks == 0 || b.rushBuildClicks < KCT_PresetManager.Instance.ActivePreset.generalSettings.MaxRushClicks)
&& GUILayout.Button("Rush Build 10%\n√" + Math.Round(b.GetRushCost())))
{
b.DoRushBuild();
}
}
#if false
if ((b.type == KCT_BuildListVessel.ListType.SPH || b.type == KCT_BuildListVessel.ListType.VAB) &&
Expand Down
3 changes: 0 additions & 3 deletions Kerbal_Construction_Time/KCT_GUI_Presets.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public static partial class KCT_GUI

public static void DrawPresetWindow(int windowID)
{
GUIStyle yellowText = new GUIStyle(GUI.skin.label);
yellowText.normal.textColor = Color.yellow;

if (WorkingPreset == null)
{
SetNewWorkingPreset(new KCT_Preset(KCT_PresetManager.Instance.ActivePreset), false); //might need to copy instead of assign here
Expand Down
6 changes: 6 additions & 0 deletions LGG-Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
ChangeLog

1.4.11.4
Added check for game mode before displaying the "rush build" button. Currently only allowd in Career & SCIENCE_SANDBOX
Fixed a small memory leak
Thanks to user @TheJesuit for this:
Added new Preset: AngleCan Progression

1.4.11.3
Fixed three lines where GUIStyle was being allocated during an OnGUI call multiple times, leading to memory leaks
Thanks to github user @monstrim for this:
Expand Down

0 comments on commit 494cfd3

Please sign in to comment.