From 021a8fc85fb09801ea20651501c61642f1ef06bc Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Thu, 3 May 2012 18:46:36 +0000 Subject: [PATCH] Made it so default attachments are added to items even if they are not present when the map is created in the map editor git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5255 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/World Items.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Tactical/World Items.cpp b/Tactical/World Items.cpp index f34c7362..9bb5fdda 100644 --- a/Tactical/World Items.cpp +++ b/Tactical/World Items.cpp @@ -674,6 +674,20 @@ void LoadWorldItemsFromMap( INT8 **hBuffer, float dMajorMapVersion, int ubMinorM { //all armed bombs are buried dummyItem.bVisible = BURIED; } + + //Madd: ok, so this drives me nuts -- why bother with default attachments if the map isn't going to load them for you? + //this should fix that... + for(UINT8 cnt = 0; cnt < MAX_DEFAULT_ATTACHMENTS; cnt++) + { + if(Item [ dummyItem.object.usItem ].defaultattachments[cnt] == 0) + break; + + //cannot use gTempObject + static OBJECTTYPE defaultAttachment; + CreateItem(Item [ dummyItem.object.usItem ].defaultattachments[cnt],100,&defaultAttachment); + dummyItem.object.AttachObject(NULL,&defaultAttachment, FALSE); + } + AddItemToPoolAndGetIndex( dummyItem.sGridNo, &dummyItem.object, dummyItem.bVisible, dummyItem.ubLevel, dummyItem.usFlags, dummyItem.bRenderZHeightAboveLevel, dummyItem.soldierID, &iItemIndex ); gWorldItems[ iItemIndex ].ubNonExistChance = dummyItem.ubNonExistChance; }