Interkarma / daggerfall-unity

Open source recreation of Daggerfall in the Unity engine
http://www.dfworkshop.net
MIT License
2.7k stars 327 forks source link

Fast travel gold fix #2592

Closed John-Leitch closed 6 months ago

John-Leitch commented 6 months ago

This PR fixes the following issue: #2591 (Fast Travel deducts gold even if travel is canceled)

Pretty straight forward. Moved the code to deduct the gold into a separate method, DaggerfallTravelPopUp.DeductFastTravelGold. Rather than invoking directly from update, I opted to do so in DaggerfallTravelPopUp.performFastTravel, as that method seemed to be where most of the other related changes to GameManager.Instance.PlayerEntity state occur. The only concern I have is related to the DaggerfallTravelPopUp.OnPreFastTravel and DaggerfallTravelPopUp.OnPostFastTravel events. Previously, the gold was deducted prior to either event being fired. In performFastTravel, I put it after OnPreFastTravel, as that seemed to make the most sense. Looking at the codebase, I did not see any subscribers to OnPreFastTravel, so I don't think this will break anything.