Skip to content

Commit

Permalink
Fix crash when player in settlement and enter then exit ebt
Browse files Browse the repository at this point in the history
  • Loading branch information
LiZhenhuan1019 committed Aug 31, 2022
1 parent 0a87b56 commit eb5369a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/resources/config.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
GAME_VERSION=e1.8.0
GAME_BRANCH=beta
MOD_VERSION=v3.0.0
MOD_VERSION=v3.0.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Module>
<Name value="EnhancedBattleTest"/>
<Id value="EnhancedBattleTest"/>
<Version value="v3.0.0"/>
<Version value="v3.0.1"/>
<SingleplayerModule value="true"/>
<MultiplayerModule value="false"/>
<DependedModules>
Expand Down
10 changes: 3 additions & 7 deletions source/EnhancedBattleTest/src/EnhancedBattleTestSubModule.cs
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
using System;
using System.IO;
using System.Reflection;
using EnhancedBattleTest.Data;
using EnhancedBattleTest.GameMode;
using EnhancedBattleTest.Patch;
using EnhancedBattleTest.Patch.Fix;
using EnhancedBattleTest.SinglePlayer;
using EnhancedBattleTest.UI;
using HarmonyLib;
using System;
using System.IO;
using System.Reflection;
using TaleWorlds.Core;
using TaleWorlds.Library;
using TaleWorlds.Localization;
using TaleWorlds.ModuleManager;
using TaleWorlds.MountAndBlade;
using Campaign = TaleWorlds.CampaignSystem.Campaign;
using Module = TaleWorlds.MountAndBlade.Module;
using MultiplayerGame = EnhancedBattleTest.GameMode.MultiplayerGame;

namespace EnhancedBattleTest
Expand Down
10 changes: 10 additions & 0 deletions source/EnhancedBattleTest/src/Patch/Patch_MapScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using TaleWorlds.CampaignSystem;
using TaleWorlds.CampaignSystem.Encounters;
using TaleWorlds.CampaignSystem.Party;
using TaleWorlds.Core;
using TaleWorlds.Localization;
using TaleWorlds.MountAndBlade.ViewModelCollection.EscapeMenu;
Expand Down Expand Up @@ -37,6 +40,13 @@ public static void Postfix_GetEscapeMenuItems(MapScreen __instance, List<EscapeM
o =>
{
__instance.CloseEscapeMenu();
if (PlayerEncounter.Current != null)
{
PlayerEncounter.Finish();
typeof(MapScreen).GetMethod("ExitMenuContext", BindingFlags.Instance | BindingFlags.NonPublic)
.Invoke(__instance, new object[] { });
}
Game.Current.GameStateManager.PushState(Game.Current.GameStateManager.CreateState<EnhancedBattleTestState>());
}, null, () => new Tuple<bool, TextObject>(false, TextObject.Empty)));
}
Expand Down

0 comments on commit eb5369a

Please sign in to comment.