From 61311772133cb3a9af991efe6f5d142c830583ee Mon Sep 17 00:00:00 2001 From: kkgobkk <79253828+kkgobkk@users.noreply.github.com> Date: Fri, 30 May 2025 11:49:50 +0200 Subject: [PATCH] ImmersiveTravel compatibility - ensured a cast in TravelOptionsMapWindow.ClickHandler() only happens if it's valid (aka if ImmersiveTravel hasn't overridden the DaggerfallTravelPopUp class) - ensured travel outside of location using the "allow targeting map coordinates" option still works if ImmersiveTravel is active --- TravelOptions/Scripts/TravelOptionsMapWindow.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/TravelOptions/Scripts/TravelOptionsMapWindow.cs b/TravelOptions/Scripts/TravelOptionsMapWindow.cs index d9d85f1..b429d6f 100644 --- a/TravelOptions/Scripts/TravelOptionsMapWindow.cs +++ b/TravelOptions/Scripts/TravelOptionsMapWindow.cs @@ -513,12 +513,14 @@ protected override void ClickHandler(BaseScreenComponent sender, Vector2 positio if (position.x < 0 || position.x > regionTextureOverlayPanelRect.width || position.y < 0 || position.y > regionTextureOverlayPanelRect.height) return; - if (popUp == null) + if (popUp == null || (popUp as TravelOptionsPopUp == null)) //the second check ensures travelling outside of locations still works when another mod replaces the travel popup { - popUp = (DaggerfallTravelPopUp)UIWindowFactory.GetInstanceWithArgs(UIWindowType.TravelPopUp, new object[] { uiManager, uiManager.TopWindow, this }); + //popUp = (DaggerfallTravelPopUp)UIWindowFactory.GetInstanceWithArgs(UIWindowType.TravelPopUp, new object[] { uiManager, uiManager.TopWindow, this }); + popUp = new TravelOptionsPopUp(uiManager, uiManager.TopWindow, this); } ((TravelOptionsPopUp)popUp).EndPos = GetClickMPCoords(); uiManager.PushWindow(popUp); + popUp = null; //ensures the next travel popup will be created from scratch so that if another mod has replaced it, TO's popup ONLY appears during non-location travel } else { @@ -526,7 +528,8 @@ protected override void ClickHandler(BaseScreenComponent sender, Vector2 positio } // Set scale factors into popup, except when teleport travelling if (popUp != null && !teleportationTravel) - ((TravelOptionsPopUp)popUp).SetScaleFactors(TravelOptionsMod.Instance.FastTravelCostScaleFactor, TravelOptionsMod.Instance.ShipTravelCostScaleFactor); + if(popUp as TravelOptionsPopUp != null) //ensures the map doesn't break when another mod has replaced the travel popup + ((TravelOptionsPopUp)popUp).SetScaleFactors(TravelOptionsMod.Instance.FastTravelCostScaleFactor, TravelOptionsMod.Instance.ShipTravelCostScaleFactor); } protected void MarkLocationHandler(BaseScreenComponent sender, Vector2 position)