Skip to content

Commit 596456b

Browse files
committed
Fix #148: fix AGMEMO system that broke in last release
1 parent 16985e7 commit 596456b

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@ Discord support server: https://discord.gg/vBDzZAq3AF.
44

55
Please always post your [KSP.log file](https://gist.github.com/JonnyOThan/04c2074b56f78e56d115621effee30f9) when reporting issues.
66

7+
## Unreleased
8+
9+
### Bug Fixes
10+
11+
- Fixed AGMEMO system (did I even test this?)
12+
713
## 1.0.1 - 2024-09-13
814

915
### New Features

RasterPropMonitor/Core/RasterPropMonitorComputer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,11 @@ public void Start()
392392
string[] descriptionStrings = vesselDescription.UnMangleConfigText().Split(JUtil.LineSeparator, StringSplitOptions.None);
393393
for (int i = 0; i < descriptionStrings.Length; i++)
394394
{
395-
var matches = x_agmemoRegex.Matches(descriptionStrings[i]);
396-
if (matches.Count == 2 && uint.TryParse(matches[0].Value, out uint groupID) && groupID < actionGroupMemo.Length)
395+
var match = x_agmemoRegex.Match(descriptionStrings[i]);
396+
if (match.Success && match.Groups.Count == 3 && uint.TryParse(match.Groups[1].Value, out uint groupID) && groupID < actionGroupMemo.Length)
397397
{
398398
descriptionStrings[i] = string.Empty;
399-
actionGroupMemo[groupID] = matches[1].Value;
399+
actionGroupMemo[groupID] = match.Groups[2].Value;
400400
}
401401
}
402402

RasterPropMonitor/Core/UtilityFunctions.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,12 +1357,19 @@ public static string EnforceSlashes(this string input)
13571357

13581358
public static string UnMangleConfigText(this string input)
13591359
{
1360-
return input.Replace("<=", "{").Replace("=>", "}").Replace("$$$", Environment.NewLine);
1360+
return input
1361+
.Replace("<=", "{")
1362+
.Replace("=>", "}")
1363+
.Replace("$$$", Environment.NewLine);
13611364
}
13621365

13631366
public static string MangleConfigText(this string input)
13641367
{
1365-
return input.Replace("{", "<=").Replace("}", "=>").Replace(Environment.NewLine, "$$$");
1368+
return input
1369+
.Replace("{", "<=")
1370+
.Replace("}", "=>")
1371+
.Replace("\n", "$$$")
1372+
.Replace("\r", string.Empty);
13661373
}
13671374

13681375
public static T Clamp<T>(this T val, T min, T max) where T : IComparable<T>

0 commit comments

Comments
 (0)