From a56dc9107b78d122e87d5de65e2f7664c91eda46 Mon Sep 17 00:00:00 2001 From: silversurfer Date: Fri, 20 Jun 2014 18:42:54 +0000 Subject: [PATCH] Bugfix: Replacing one attachment with another will now cost AP git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7280 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- Tactical/Interface Items.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Tactical/Interface Items.cpp b/Tactical/Interface Items.cpp index fa517c7d..7d640776 100644 --- a/Tactical/Interface Items.cpp +++ b/Tactical/Interface Items.cpp @@ -8171,22 +8171,30 @@ void DeleteItemDescriptionBox( ) //WarmSteel size() is no longer sufficient, because the list contains null objects. unsigned int originalSize = 0; unsigned int newSize = 0; + bool bAttachmentsDiffer = FALSE; attachmentList::iterator originalIter; attachmentList::iterator newIter; for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin(); originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end(); - ++originalIter, ++newIter){ + ++originalIter, ++newIter) + { if(originalIter->exists()){ originalSize++; } if(newIter->exists()){ newSize++; } + // silversurfer: If we replaced one attachment with another the size will not differ so we need to check content too. + if( originalIter->exists() && newIter->exists() ) + { + if( originalIter->usItem != newIter->usItem ) + bAttachmentsDiffer = TRUE; + } } - if (newSize != originalSize) { + if (newSize != originalSize || bAttachmentsDiffer) { //an attachment was changed, find the change for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin(); originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end();