diff --git a/info.toml b/info.toml index 8baae80..95b6110 100755 --- a/info.toml +++ b/info.toml @@ -2,7 +2,7 @@ name = "Run History" author = "Vanawy" category = "Overlay" -version = "0.6.0" +version = "0.6.1" [script] dependencies = ["MLHook", "MLFeedRaceData"] diff --git a/src/main.as b/src/main.as index 0c980d5..cc018ea 100755 --- a/src/main.as +++ b/src/main.as @@ -44,6 +44,7 @@ bool autoChangeTarget = true; uint championMedalUpdateAttempts = 0; +CTrackMania@ trackmania = cast(GetApp()); void Main() { @@ -51,10 +52,11 @@ void Main() string lastMapId = ""; string lastGhostId = ""; + print("App loaded"); + // init delta thresholds table thresholdsTable.FromString(settingDeltasSerialized); - #if DEPENDENCY_WARRIORMEDALS print("WarriorMedals detected"); targets.InsertAt(1, warrior); @@ -72,7 +74,7 @@ void Main() while(true) { - sleep(1000); + yield(); auto gd = MLFeed::GetGhostData(); if (gd !is null && gd.Ghosts_V2 !is null && gd.NbGhosts != 0) { @@ -83,21 +85,16 @@ void Main() } } - CTrackMania@ trackmania = cast(GetApp()); - if (trackmania !is null) { - auto map = @trackmania.RootMap; - if (map !is null && lastMapId != map.MapInfo.MapUid) { - lastMapId = map.MapInfo.MapUid; - OnMapChange(map); - } + auto map = @trackmania.RootMap; + if (map !is null && lastMapId != map.MapInfo.MapUid) { + lastMapId = map.MapInfo.MapUid; + OnMapChange(map); } } } void Render() -{ - auto trackmania = cast(GetApp()); - +{ auto map = trackmania.RootMap; if(!UI::IsGameUIVisible()) { @@ -198,8 +195,8 @@ void RenderAddTargetPopup() void RenderMenu() { - if (UI::BeginMenu(ICON_MENU + " " + TEXT_PLUGIN_NAME)) { + if (UI::BeginMenu(ICON_MENU + " " + TEXT_PLUGIN_NAME)) { string toggleVisibilityText = settingWindowHide ? Icons::Eye + " Show window" : Icons::EyeSlash + " Hide window";