diff --git a/CREDITS.md b/CREDITS.md index 599ca1b29a..3175ec6150 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -543,6 +543,7 @@ This page lists all the individual contributions to the project by their author. - Jumpjet Climbing Logic Enhancement - Fix for pathfinding crashes on big maps due to too small pathfinding node buffer - Fix an issue that units' `LaserTrails` will always lags behind by one frame + - Fix an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos - **Ollerus**: - Build limit group enhancement - Customizable rocker amplitude diff --git a/docs/Fixed-or-Improved-Logics.md b/docs/Fixed-or-Improved-Logics.md index 65c014bcd4..a4c6d957bc 100644 --- a/docs/Fixed-or-Improved-Logics.md +++ b/docs/Fixed-or-Improved-Logics.md @@ -261,6 +261,7 @@ This page describes all ingame logics that are fixed or improved in Phobos witho - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true`. Keep in mind `Reverse` uses `LoopEnd` for frame amount instead of `End` even without `LoopCount` > 1. - `DeployingAnim` using unit drawer now also tint accordingly with the unit. - Fixed an issue that jumpjets in air can not correctly spawn missiles. +- Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos. ## Fixes / interactions with other extensions diff --git a/docs/Whats-New.md b/docs/Whats-New.md index 432a86fe92..020767ac50 100644 --- a/docs/Whats-New.md +++ b/docs/Whats-New.md @@ -463,6 +463,7 @@ Vanilla fixes: - `DeployingAnim` now supports both `Normalized=true` and `Reverse=true` (by Starkku) - `DeployingAnim` using unit drawer now also tint accordingly with the unit (by Starkku) - Jumpjets in air now can correctly spawn missiles (by TaranDahl) +- Fixed an issue that the currently hovered planning node not update up-to-date, such as using hotkeys to select technos (by CrimRecya) Phobos fixes: - Fixed the bug that `AllowAirstrike=no` cannot completely prevent air strikes from being launched against it (by NetsuNegi) diff --git a/src/Misc/Hooks.BugFixes.cpp b/src/Misc/Hooks.BugFixes.cpp index da8dd19ed7..253ee235f7 100644 --- a/src/Misc/Hooks.BugFixes.cpp +++ b/src/Misc/Hooks.BugFixes.cpp @@ -2542,3 +2542,33 @@ DEFINE_PATCH(0x42C36B, 0xB7); // movsx eax, word ptr [eax+esi*2] -> movzx eax, word ptr [eax+esi*2] #pragma endregion + +#pragma region FixPlanningNodeConnect + +// Restore the original three pop to prevent stack imbalance +void NAKED _PlanningNodeClass_UpdateHoverNode_FixCheckValidity_RET() +{ + POP_REG(EDI); + POP_REG(EBP); + POP_REG(EBX); + JMP(0x638F2A); +} +DEFINE_HOOK(0x638F1E, PlanningNodeClass_UpdateHoverNode_FixCheckValidity, 0x5) +{ + // Newly added checks to prevent not in-time updates + return PlanningNodeClass::PlanningModeActive ? (int)_PlanningNodeClass_UpdateHoverNode_FixCheckValidity_RET : 0; +} + +DEFINE_HOOK(0x638F70, PlanningNodeClass_UpdateHoverNode_SkipDuplicateLog, 0x8) +{ + enum { SkipLogString = 0x638F81 }; + + GET(const PlanningNodeClass* const, pCurrentNode, ESI); + + const auto& pHoveringNode = Make_Global(0xAC4CCC); + + // Only output logs when they are not the same, to avoid outputting every frame + return (pCurrentNode != pHoveringNode) ? 0 : SkipLogString; +} + +#pragma endregion