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
This commit is contained in:
Sevenfm
2021-02-13 05:48:17 +00:00
parent 169e909b56
commit 0ccecc472c
2 changed files with 5 additions and 5 deletions
+4 -4
View File
@@ -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;
+1 -1
View File
@@ -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));
}
}