Conversation
IsDragging() defaults to aStopIfConditionNotSatisfied=true, so these read-only cost queries could call CancelDrag() and reposition the dragged body mid-pathfind, corrupting FindBestPath's view of the world and freezing the game. Pass false so they only read state.
Same IsDragging() side-effect as the path fix: these read-only queries (movement noise, face drag icon, carried weight) must not cancel the drag or reposition the dragged body. Pass false.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes the intermittent soft-lock / ghosted-merc bug when dragging unconscious mercenaries in tactical combat.
SOLDIERTYPE::IsDragging()defaults toaStopIfConditionNotSatisfied = true, which makes it callCancelDrag()— and reposition the dragged body viaEVENT_InternalSetSoldierPosition— whenever the drag condition isn't currently satisfied. That side effect was being triggered from read-only consumers including the pathfinding cost loops inFindBestPath/PlotPath, AP cost queries, movement noise, the drag face icon, and carried weight.Two consequences in combat:
IsDragging(true), which kept cancelling the drag and yanking the body back to tile-center, so the drag never visibly "stuck."FindBestPathmutatesgpWorldLevelDatawhile the path search is iterating it.FindBestPathisn't re-entrant — that corrupts the search state and the engine ends up waiting on a move that never completes.Fix: pass
falseat the 8 read-only call sites so they only read state. A genuinely-dragging soldier still has the body adjacent, soIsDragging(false)returnsTRUEand the drag AP/noise/weight modifiers still apply. Only the spurious "condition not satisfied → cancel + teleport body" branch is removed. The genuine state-changing callers (the move executor atSoldier Control.cpp:11519, the ESC handler atTurn Based Input.cpp:2224) keep the cancelling form.Touches:
PATHAI.cpp×3,Points.cpp×2,opplist.cpp,Faces.cpp,Items.cpp. +16/-8 lines. Mechanical one-token edit per site.Related: commit
3d529400("Copy drag info to dummy soldier (1dot13#255)") already patched one symptom of the sameIsDragging/pathfinding collision (1-tile location shift on load with A* pathfinding).Test plan