-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't allow loading saves with maps that aren't installed
- Loading branch information
Showing
4 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Linq; | ||
using DV.Common; | ||
using DV.UI; | ||
using HarmonyLib; | ||
using Mapify.Editor; | ||
using Mapify.Map; | ||
using Mapify.Utils; | ||
|
||
namespace Mapify.Patches | ||
{ | ||
[HarmonyPatch(typeof(AScenarioProvider), nameof(AScenarioProvider.CanStartNewSession))] | ||
public static class AScenarioProvider_CanStartNewSession_Patch | ||
{ | ||
private static bool Prefix(IGameSession session, ref (bool canRun, string reasonLocKey) __result) | ||
{ | ||
BasicMapInfo basicMapInfo = session.GameData.GetBasicMapInfo(); | ||
if (Maps.AllMapNames.Contains(basicMapInfo.mapName)) | ||
return true; | ||
__result = (false, Locale.LAUNCHER__SESSION_MAP_NOT_INSTALLED); | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters