- Fixed CTD that could happen when removing attachments (by Realist)

o The CTD always happened in Old Attachment System (OAS)

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5697 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-11-22 23:16:03 +00:00
parent bb9baf1af6
commit e0d028bed2
+7 -4
View File
@@ -7981,7 +7981,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
{
removedAttachment = *pAttachment;
iter = (*this)[subObject]->RemoveAttachmentAtIter(iter);
pAttachment = NULL;
objDeleted = TRUE;
break;
}
@@ -7995,7 +7995,7 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
{
removedAttachment = *pAttachment;
iter = (*this)[subObject]->RemoveAttachmentAtIter(iter);
pAttachment = NULL;
objDeleted = TRUE;
break;
}
@@ -8097,8 +8097,11 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
if(pNewObj != NULL)
*pNewObj = removedAttachment;
if(pAttachment->exists() && (pAttachment->usItem == 0 || pAttachment->usItem == removedAttachment.usItem ))
*pAttachment = removedAttachment;
// Why is this here? By now, the object, pAttachment had been pointing to, has already been deconstructed via RemoveAttachmentAtIter.
// (Commenting out the following two lines)
//if(pAttachment->exists() && (pAttachment->usItem == 0 || pAttachment->usItem == removedAttachment.usItem ))
// *pAttachment = removedAttachment;
if (pNewObj->exists() && Item[pNewObj->usItem].grenadelauncher )//UNDER_GLAUNCHER)
{