Skip to content

Commit e286e28

Browse files
authored
Fix log error when trading on the world map (#166)
* Fix log error when trading on the map
1 parent 6e08f94 commit e286e28

4 files changed

Lines changed: 19 additions & 8 deletions

File tree

About/About.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<name>Level Up!</name>
44
<author>krafs</author>
55
<packageId>Krafs.LevelUp</packageId>
6-
<modVersion>5.1.0</modVersion>
6+
<modVersion>5.1.1</modVersion>
77
<description>Level up notifications!</description>
88
<url>https://github.com/krafs/LevelUp</url>
99
<modIconPath>LevelUp/Icon</modIconPath>

LevelUp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</ItemGroup>
1717

1818
<ItemGroup>
19-
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.6.4488-beta" />
19+
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.6.4518" />
2020
<PackageReference Include="Lib.Harmony" Version="2.3.6" ExcludeAssets="runtime" />
2121
</ItemGroup>
2222

Source/ActionMaker.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,6 @@ public sealed class ActionMaker : IExposable
1313

1414
internal void ExecuteActions(LevelingInfo levelingInfo)
1515
{
16-
if (!levelingInfo.Pawn.IsFreeColonist)
17-
{
18-
return;
19-
}
20-
2116
foreach (LevelingAction action in actions)
2217
{
2318
if (action.active)

Source/Patcher.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,25 @@ internal static void ApplyPatches(Harmony harmony)
3030
}
3131

3232
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Harmony naming convention")]
33-
private static void Prefix(out int __state, SkillRecord __instance)
33+
private static void Prefix(out int __state, SkillRecord __instance, Pawn ___pawn)
3434
{
35+
if (!___pawn.IsFreeColonist)
36+
{
37+
__state = -1;
38+
return;
39+
}
40+
3541
__state = __instance.Level;
3642
}
3743

3844
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Harmony naming convention")]
3945
private static void DirtyAptitudesPostfix(int __state, SkillRecord __instance, Pawn ___pawn)
4046
{
47+
if (__state == -1)
48+
{
49+
return;
50+
}
51+
4152
// DirtyAptitudes can be called on the Create Character-screen if Biotech is used,
4253
// and either crashes or makes it impossible to move forward.
4354
// This causes the mod to try and display notifications for a colonist when not yet in a playable program state.
@@ -66,6 +77,11 @@ private static void DirtyAptitudesPostfix(int __state, SkillRecord __instance, P
6677
[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Harmony naming convention")]
6778
private static void LearnPostfix(int __state, SkillRecord __instance, Pawn ___pawn, bool direct)
6879
{
80+
if (__state == -1)
81+
{
82+
return;
83+
}
84+
6985
int previousLevel = __state;
7086
int currentLevel = __instance.Level;
7187

0 commit comments

Comments
 (0)