From 26f5a83bab1b6565b403d10a749610edeeaf8811 Mon Sep 17 00:00:00 2001 From: ChrisL Date: Thu, 30 Oct 2008 19:58:26 +0000 Subject: [PATCH] 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 --- Tactical/Items.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 23c52cfc..801b03b7 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -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;