From d4c26bc4a2a2200e0aa58cb62fc409767e544e27 Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Mon, 14 May 2012 19:44:21 +0000 Subject: [PATCH] Enabled default attachments to be loaded on soldiers' items, even if the attachments are added after placing the soldiers in the map editor git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5272 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- SaveLoadGame.cpp | 14 ++++++++++++++ Tactical/XML_Drugs.cpp | 2 +- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/SaveLoadGame.cpp b/SaveLoadGame.cpp index 667488e4..5cc29458 100644 --- a/SaveLoadGame.cpp +++ b/SaveLoadGame.cpp @@ -2585,7 +2585,21 @@ BOOLEAN OBJECTTYPE::Load( INT8** hBuffer, float dMajorMapVersion, UINT8 ubMinorM LOADDATA( &OldSavedObject101, *hBuffer, sizeof(OLD_OBJECTTYPE_101) ); (*this) = OldSavedObject101; } + RemoveProhibitedAttachments(NULL, this, (*this).usItem); + + //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 [ (*this).usItem ].defaultattachments[cnt] == 0) + break; + + OBJECTTYPE defaultAttachment; + CreateItem(Item [ (*this).usItem ].defaultattachments[cnt],100,&defaultAttachment); + this->AttachObject(NULL,&defaultAttachment, FALSE); + } + return TRUE; } diff --git a/Tactical/XML_Drugs.cpp b/Tactical/XML_Drugs.cpp index e919c5bb..e53f9f6c 100644 --- a/Tactical/XML_Drugs.cpp +++ b/Tactical/XML_Drugs.cpp @@ -110,7 +110,7 @@ drugsEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "name") == 0) { pData->curElement = ELEMENT; - // not needed, but its there :-( + // not needed, but its there for informational purposes } else if(strcmp(name, "ubDrugTravelRate") == 0) {