From 0ccecc472c060acd12e4f491f6958b29445c6a42 Mon Sep 17 00:00:00 2001 From: Sevenfm Date: Sat, 13 Feb 2021 05:48:17 +0000 Subject: [PATCH] Fix: UI attack handling prioritised interactive structures over target soldiers even if target soldier was explicitly provided causing deadlocks e.g. when trying to punch enemy overlapped by a door (by anv). ReInitMergedItem: show item id, attachment id when doing assert. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8935 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Handle UI.cpp | 8 ++++---- Tactical/Items.cpp | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Tactical/Handle UI.cpp b/Tactical/Handle UI.cpp index 6e3a7e34..dffb0eb6 100644 --- a/Tactical/Handle UI.cpp +++ b/Tactical/Handle UI.cpp @@ -2742,7 +2742,7 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, IN INT32 sTargetGridNo; INT8 bTargetLevel; UINT16 usItem; - LEVELNODE* pIntNode; + LEVELNODE* pIntNode = NULL; STRUCTURE* pStructure; INT32 sGridNo, sNewGridNo; UINT8 ubItemCursor; @@ -2767,9 +2767,6 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, IN } } - // ATE: Check if we are targeting an interactive tile, and adjust gridno accordingly... - pIntNode = GetCurInteractiveTileGridNoAndStructure( &sGridNo, &pStructure ); - if ( pTargetSoldier != NULL ) { sTargetGridNo = pTargetSoldier->sGridNo; @@ -2777,6 +2774,9 @@ void UIHandleMercAttack( SOLDIERTYPE *pSoldier , SOLDIERTYPE *pTargetSoldier, IN } else { + // ATE: Check if we are targeting an interactive tile, and adjust gridno accordingly... + pIntNode = GetCurInteractiveTileGridNoAndStructure(&sGridNo, &pStructure); + sTargetGridNo = usMapPos; bTargetLevel = (INT8)gsInterfaceLevel; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index b3dba983..4b5d6990 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -6101,7 +6101,7 @@ attachmentList ReInitMergedItem(SOLDIERTYPE* pSoldier, OBJECTTYPE* pObj, UINT16 if(Item[Item[pObj->usItem].defaultattachments[cnt]].inseparable == 1){ OBJECTTYPE defaultAttachment; CreateItem(Item [ pObj->usItem ].defaultattachments[cnt],(*pObj)[ubStatusIndex]->data.objectStatus,&defaultAttachment); - AssertMsg(pObj->AttachObject(NULL,&defaultAttachment, FALSE, ubStatusIndex, -1, FALSE), "A default attachment could not be attached after merging, this should not be possible."); + AssertMsg(pObj->AttachObject(NULL, &defaultAttachment, FALSE, ubStatusIndex, -1, FALSE), String("A default attachment could not be attached after merging, this should not be possible. item %d attachment %d", pObj->usItem, defaultAttachment.usItem)); } }