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
This commit is contained in:
silversurfer
2014-06-20 18:42:54 +00:00
parent 68717329fc
commit a56dc9107b
+10 -2
View File
@@ -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();