mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
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:
@@ -8171,22 +8171,30 @@ void DeleteItemDescriptionBox( )
|
|||||||
//WarmSteel size() is no longer sufficient, because the list contains null objects.
|
//WarmSteel size() is no longer sufficient, because the list contains null objects.
|
||||||
unsigned int originalSize = 0;
|
unsigned int originalSize = 0;
|
||||||
unsigned int newSize = 0;
|
unsigned int newSize = 0;
|
||||||
|
bool bAttachmentsDiffer = FALSE;
|
||||||
attachmentList::iterator originalIter;
|
attachmentList::iterator originalIter;
|
||||||
attachmentList::iterator newIter;
|
attachmentList::iterator newIter;
|
||||||
|
|
||||||
for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin();
|
for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin();
|
||||||
originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end();
|
originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end();
|
||||||
++originalIter, ++newIter){
|
++originalIter, ++newIter)
|
||||||
|
{
|
||||||
if(originalIter->exists()){
|
if(originalIter->exists()){
|
||||||
originalSize++;
|
originalSize++;
|
||||||
}
|
}
|
||||||
if(newIter->exists()){
|
if(newIter->exists()){
|
||||||
newSize++;
|
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
|
//an attachment was changed, find the change
|
||||||
for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin();
|
for (originalIter = gOriginalAttachments.begin(), newIter = (*gpItemDescObject)[0]->attachments.begin();
|
||||||
originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end();
|
originalIter != gOriginalAttachments.end() && newIter != (*gpItemDescObject)[0]->attachments.end();
|
||||||
|
|||||||
Reference in New Issue
Block a user