Skip to content

Commit

Permalink
fix ambiguous method call in new versions of the game
Browse files Browse the repository at this point in the history
  • Loading branch information
BillyGalbreath committed Jan 24, 2024
1 parent fb19d5c commit 4c0152e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion resources/modinfo.json
Expand Up @@ -2,7 +2,7 @@
"type": "code",
"name": "Sharable Waypoints",
"modid": "sharablewaypoints",
"version": "1.5.0",
"version": "1.5.1",
"description": "Share your waypoints with your group/friends",
"website": "https://github.com/BillyGalbreath/VS-SharableWaypoints",
"authors": [ "BillyGalbreath" ],
Expand Down
13 changes: 11 additions & 2 deletions src/Client/SharableWaypointsClient.cs
@@ -1,3 +1,4 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Reflection;
Expand All @@ -21,8 +22,16 @@ public class SharableWaypointsClient : Common.SharableWaypoints {
Harmony.Patch(typeof(GuiDialogAddWayPoint).GetMethod("onSave", BindingFlags.Instance | BindingFlags.NonPublic),
postfix: typeof(SharableWaypointsClient).GetMethod("PostOnAddSave"));

Harmony.Patch(typeof(GuiDialogEditWayPoint).GetMethod("TryOpen", BindingFlags.Instance | BindingFlags.Public),
prefix: typeof(SharableWaypointsClient).GetMethod("PreEditTryOpen"));
try {
Harmony.Patch(typeof(GuiDialogEditWayPoint).GetMethod("TryOpen", BindingFlags.Instance | BindingFlags.Public, Array.Empty<Type>()),
prefix: typeof(SharableWaypointsClient).GetMethod("PreEditTryOpen"));
} catch (Exception) {
// Harmony is weird and wont take `typeof(bool)` as a valid type. it required `typeof(System.Boolean)`
// ReSharper disable once BuiltInTypeReferenceStyle
Harmony.Patch(typeof(GuiDialogEditWayPoint).GetMethod("TryOpen", BindingFlags.Instance | BindingFlags.Public, new[] { typeof(Boolean) }),
prefix: typeof(SharableWaypointsClient).GetMethod("PreEditTryOpen"));
}

Harmony.Patch(typeof(GuiDialogEditWayPoint).GetMethod("onDelete", BindingFlags.Instance | BindingFlags.NonPublic),
prefix: typeof(SharableWaypointsClient).GetMethod("PreOnEditDelete"));
Harmony.Patch(typeof(GuiDialogEditWayPoint).GetMethod("onSave", BindingFlags.Instance | BindingFlags.NonPublic),
Expand Down

0 comments on commit 4c0152e

Please sign in to comment.