Skip to content

Commit 811693e

Browse files
Fixed issue where changing the FocusFollowsClick in the settings wasn't being saved properly
Fixed issue where changing the global setting in the settings wasn't being honored
1 parent 47d61fa commit 811693e

File tree

12 files changed

+60
-17
lines changed

12 files changed

+60
-17
lines changed

Changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
ChangeLog
22

3+
2.1.10.19
4+
Fixed issue where changing the FocusFollowsClick in the settings wasn't being saved properly
5+
Fixed issue where changing the global setting in the settings wasn't being honored
6+
37
2.1.10.18
48
Fixed a memory leak where two game events were beiing used, added a DontDestroyOnLoad to RegisterToolbar
59
Updated version number to avoid dependency issues

ClickThroughBlocker.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"MAJOR": 2,
1111
"MINOR": 1,
1212
"PATCH": 10,
13-
"BUILD": 18
13+
"BUILD": 19
1414
},
1515
"KSP_VERSION_MIN": {
1616
"MAJOR": 1,

ClickThroughBlocker/AssemblyVersion.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55

66
using System.Reflection;
77

8-
[assembly: AssemblyVersion("1.1.10.17")]
9-
[assembly: AssemblyFileVersion("1.1.10.17")]
8+
[assembly: AssemblyVersion("2.1.10.18")]
9+
[assembly: AssemblyFileVersion("2.1.10.18")]
10+
[assembly: KSPAssembly("ClickThroughBlocker", 2, 1, 0)]

ClickThroughBlocker/AssemblyVersion.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,4 @@
9999

100100
[assembly: AssemblyVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
101101
[assembly: AssemblyFileVersion("<#= major #>.<#= minor #>.<#= patch #>.<#= build #>")]
102+
[assembly: KSPAssembly("ClickThroughBlocker", <#= major #>, <#= minor #>, 0)]

ClickThroughBlocker/ClickThroughBlocker.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,21 @@
7474
<LastGenOutput>AssemblyVersion.cs</LastGenOutput>
7575
</Content>
7676
</ItemGroup>
77-
7877
<ItemGroup>
7978
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\Assembly*.dll">
8079
<Private>False</Private>
8180
</Reference>
8281
<Reference Include="$(KSPDIR)\KSP_x64_Data\Managed\UnityEngine*.dll">
8382
<Private>False</Private>
8483
</Reference>
85-
<Reference Include="System" />
84+
<Reference Include="System" />
8685
<Reference Include="ToolbarControl">
8786
<HintPath>$(KSPDIR)\GameData\001_ToolbarControl\Plugins\ToolbarControl.dll</HintPath>
8887
</Reference>
8988
</ItemGroup>
89+
<ItemGroup>
90+
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
91+
</ItemGroup>
9092
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
9193
<PropertyGroup>
9294
<PostBuildEvent>
@@ -116,4 +118,4 @@ if $(ConfigurationName) == Release (
116118
<PreBuildEvent>
117119
"$(DevEnvDir)\texttransform.exe" "$(ProjectDir)AssemblyVersion.tt"</PreBuildEvent>
118120
</PropertyGroup>
119-
</Project>
121+
</Project>

ClickThroughBlocker/OneTimePopup.cs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ void PopUpWindow(int id)
108108
GUILayout.BeginHorizontal();
109109
if (GUILayout.Button("Save as global default for all new saves"))
110110
{
111-
SaveGlobalDefault();
111+
SaveGlobalDefault(focusFollowsClick);
112112
}
113113
if (GUILayout.Button("Accept"))
114114
{
@@ -140,21 +140,27 @@ static string GlobalDefaultFile
140140
return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "/../Global.cfg";
141141
}
142142
}
143-
void SaveGlobalDefault()
143+
static internal void SaveGlobalDefault(bool focusFollowsClick)
144144
{
145145
ConfigNode node = new ConfigNode();
146146
node.AddValue("focusFollowsClick", focusFollowsClick);
147147
node.Save(GlobalDefaultFile);
148148
}
149+
149150
static internal bool GetGlobalDefault(ref bool b)
150151
{
151152
if (System.IO.File.Exists(GlobalDefaultFile))
152153
{
153-
ConfigNode node = ConfigNode.Load(GlobalDefaultFile);
154-
if (node.TryGetValue("focusFollowsClick", ref b))
154+
if (HighLogic.CurrentGame.Parameters.CustomParams<CTB>().global)
155155
{
156-
return true;
156+
ConfigNode node = ConfigNode.Load(GlobalDefaultFile);
157+
if (node.TryGetValue("focusFollowsClick", ref b))
158+
{
159+
return true;
160+
}
157161
}
162+
else
163+
return HighLogic.CurrentGame.Parameters.CustomParams<CTB>().focusFollowsclick;
158164
}
159165
return false;
160166
}

ClickThroughBlocker/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@
3434
// [assembly: AssemblyVersion("1.0.*")]
3535
//[assembly: AssemblyVersion("1.0.0.0")]
3636
//[assembly: AssemblyFileVersion("1.0.0.0")]
37-
//[assembly: KSPAssembly("ClickThroughBlocker",1, 8, 0)]
3837
//[assembly: AssemblyVersion("0.1.7.0")]
38+
//[assembly: KSPAssembly("ClickThroughBlocker", 1, 8, 0)]
3939

ClickThroughBlocker/RegisterToolbar.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,18 @@ void Start()
1313
ToolbarControl.RegisterMod(ClearInputLocks.MODID2, ClearInputLocks.MODNAME2);
1414
GameEvents.onGameNewStart.Add(OnGameNewStart);
1515
GameEvents.onGameStateCreated.Add(OnGameStateCreated);
16+
GameEvents.OnGameSettingsWritten.Add(OnGameSettingsWritten);
1617
DontDestroyOnLoad(this);
1718
}
19+
void OnGameSettingsWritten()
20+
{
21+
if (HighLogic.CurrentGame.Parameters.CustomParams<CTB>().global)
22+
OneTimePopup.SaveGlobalDefault (HighLogic.CurrentGame.Parameters.CustomParams<CTB>().focusFollowsclick);
23+
}
1824

1925
void OnGameNewStart()
2026
{
21-
bool b = false ;
27+
bool b = false;
2228
if (OneTimePopup.GetGlobalDefault(ref b))
2329
{
2430
HighLogic.CurrentGame.Parameters.CustomParams<CTB>().focusFollowsclick = b;

GameData/000_ClickThroughBlocker/ClickThroughBlocker.version

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
"REPOSITORY": "ClickThroughBlocker"
88
},
99
"VERSION": {
10-
"MAJOR": 1,
10+
"MAJOR": 2,
1111
"MINOR": 1,
1212
"PATCH": 10,
13-
"BUILD": 17
13+
"BUILD": 18
1414
},
1515
"KSP_VERSION_MIN": {
1616
"MAJOR": 1,

GameData/000_ClickThroughBlocker/changelog.cfg

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,23 @@ KERBALCHANGELOG
66
author = Linuxgurugamer
77

88

9-
9+
10+
VERSION
11+
{
12+
version = 2.1.10.18
13+
CHANGE
14+
{
15+
change = Fixed a memory leak where two game events were being used, added a DontDestroyOnLoad to RegisterToolbar
16+
change = Updated version number to avoid dependency issues
17+
type = update
18+
}
19+
}
1020
VERSION
1121
{
1222
version = 0.1.10.17
1323
CHANGE
1424
{
15-
change - Added AssemblyFileVersion, needed for new KSP 1.12 dll verification
25+
change = Added AssemblyFileVersion, needed for new KSP 1.12 dll verification
1626
change = Added InstallChecker to ensure installation into correct directory
1727
type = update
1828
}

0 commit comments

Comments
 (0)