Fixed attachments so that trying to attach a loaded UGL onto a weapon that already has 3 attachments will fail instead of causing an assertion error.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2391 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-10-30 19:58:26 +00:00
parent 8c437af085
commit 26f5a83bab
+5
View File
@@ -3501,6 +3501,11 @@ BOOLEAN OBJECTTYPE::AttachObject( SOLDIERTYPE * pSoldier, OBJECTTYPE * pAttachme
if ((*this)[subObject]->attachments.size() >= MAX_ATTACHMENTS) {
return FALSE;
}
//CHRISL: If we're adding a loaded UGL, then we have to make sure there are actually 2 open attachment slots instead of 1
if(Item[pAttachment->usItem].grenadelauncher && (*pAttachment)[0]->attachments.size() > 0) {
if ((*this)[subObject]->attachments.size() >= (MAX_ATTACHMENTS-1))
return FALSE;
}
static OBJECTTYPE attachmentObject;