- Fixed previous attachment fix (by Realist)

o If you removed grenade launcher incl. grenade from attachments, a "ghost" items slot was crated
o If this fix causes any weird behaviors with attachments, it can be reverted...

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5699 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Wanne
2012-11-25 21:47:42 +00:00
parent cf36441564
commit d3d47da188
+6 -2
View File
@@ -8110,10 +8110,14 @@ BOOLEAN OBJECTTYPE::RemoveAttachment( OBJECTTYPE* pAttachment, OBJECTTYPE * pNew
OBJECTTYPE* pGrenade = FindAttachmentByClass( this, IC_GRENADE );
if (pGrenade->exists())
{
pNewObj->AttachObject(NULL, pGrenade, FALSE, 0, -1, 0);
//ADB ubWeight has been removed, see comments in OBJECTTYPE
//pNewObj->ubWeight = CalculateObjectWeight( pNewObj );
this->RemoveAttachment(pGrenade, NULL, 0, NULL, 1, 0);
// we might have to do it in this order, because if we attach first,
// the object is pretty much gone and RemoveAttachment won't work (returns right away)
OBJECTTYPE tmp;
this->RemoveAttachment(pGrenade, &tmp, 0, NULL, 1, 0);
pNewObj->AttachObject(NULL, &tmp, FALSE, 0, -1, 0);
}
}
//Removing an attachment can alter slots, check them.