From c237ca4dff474e39ef5acf6252d18d05a93d25fb Mon Sep 17 00:00:00 2001 From: MaddMugsy Date: Tue, 1 May 2012 19:08:03 +0000 Subject: [PATCH] Inseparable boolean field for items changed to UINT8 0 = removable (as before) 1 = inseparable (as before) 2+ = replaceable = inseparable, but can be replaced by a similar item git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@5247 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Items.cpp | 2 +- Tactical/Item Types.h | 6 +++++- Tactical/Items.cpp | 2 +- Utils/XML_Items.cpp | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index a3db4145..ed109665 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -5733,7 +5733,7 @@ void ItemDescAttachmentsCallback( MOUSE_REGION * pRegion, INT32 iReason ) if ( !gpItemPointerSoldier || EnoughPoints( gpItemPointerSoldier, AttachmentAPCost( gpItemPointer->usItem, gpItemDescObject, gpItemPointerSoldier ), 0, TRUE ) ) { // if ( (Item[ gpItemPointer->usItem ].fFlags & ITEM_INSEPARABLE) && ValidAttachment( gpItemPointer->usItem, gpItemDescObject->usItem ) ) - if ( (Item[ gpItemPointer->usItem ].inseparable ) && ValidAttachment( gpItemPointer->usItem, gpItemDescObject ) ) + if ( (Item[ gpItemPointer->usItem ].inseparable == 1) && ValidAttachment( gpItemPointer->usItem, gpItemDescObject ) ) { iItemPosition = uiItemPos; gbMessageBoxSubObject = (UINT8)ubStatusIndex; diff --git a/Tactical/Item Types.h b/Tactical/Item Types.h index 57a52c20..6abcc924 100644 --- a/Tactical/Item Types.h +++ b/Tactical/Item Types.h @@ -806,7 +806,11 @@ typedef struct BOOLEAN defaultundroppable; BOOLEAN unaerodynamic; BOOLEAN electronic; - BOOLEAN inseparable; + UINT8 inseparable; //Madd:Normally, an inseparable attachment can never be removed. + //But now we will make it so that these items can be replaced, but still not removed directly. + //0 = removeable (as before) + //1 = inseparable (as before) + //2 = inseparable, but replaceable CHAR16 szLongItemName[80]; CHAR16 szItemDesc[400]; diff --git a/Tactical/Items.cpp b/Tactical/Items.cpp index 7d53ced8..9e2f4b8e 100644 --- a/Tactical/Items.cpp +++ b/Tactical/Items.cpp @@ -2308,7 +2308,7 @@ BOOLEAN ValidItemAttachmentSlot( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN ubSlotIndex = usAttachmentSlotIndexVector[slotCount]; //WarmSteel - does this particular slot already hold an item? :( If we have a pAttachInSlot we're trying to switch, so then it doesn't matter. - if(!fIgnoreAttachmentInSlot && pAttachment->exists() && fAttemptingAttachment && (!ppAttachInSlot || Item[pAttachment->usItem].inseparable)){ + if(!fIgnoreAttachmentInSlot && pAttachment->exists() && fAttemptingAttachment && (!ppAttachInSlot || Item[pAttachment->usItem].inseparable == 1)){ //If we have a parameter to return pAttachment to, store it, else the item does not attach to this slot. fSimilarItems = TRUE; usSimilarItem = pAttachment->usItem; diff --git a/Utils/XML_Items.cpp b/Utils/XML_Items.cpp index 075292e5..9f973c84 100644 --- a/Utils/XML_Items.cpp +++ b/Utils/XML_Items.cpp @@ -701,7 +701,7 @@ itemEndElementHandle(void *userData, const XML_Char *name) else if(strcmp(name, "Inseparable") == 0) { pData->curElement = ELEMENT; - pData->curItem.inseparable = (BOOLEAN) atol(pData->szCharData); + pData->curItem.inseparable = (UINT8) atol(pData->szCharData); } else if(strcmp(name, "BR_NewInventory") == 0) {