Fix (by Ocular):

Removing attached grenade launchers makes their grenades vanish under NAS. This fix removes the grenades first and then the launcher.
http://www.ja-galaxy-forum.com/ubbthreads.php/topics/336539/[PATCH]_Fix_missing_UGL_grenad#Post336539


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@7550 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
silversurfer
2014-10-11 09:10:34 +00:00
parent 06367419c0
commit 64f85b6c9b
2 changed files with 15 additions and 6 deletions
@@ -4931,11 +4931,15 @@ void SortSectorInventorySeparateAttachments()
// Iterate through stacks
for (int x = 0; x < pInventoryPoolList[uiLoop].object.ubNumberOfObjects; ++x)
{
UINT8 cnt = 0, uiLoopCnt = 0;
UINT8 size = 0, cnt = 0, uiLoopCnt = 0;
while(pInventoryPoolList[uiLoop].object[x]->attachments.size() != cnt)
// Iterate backwards through attachments in order to detach grenades from underbarrel
// launchers before detaching the launchers (and their grenade slots) themselves.
// Since the size of the attachmentList remains constant under NAS but decrements by one
// under OAS, recheck the list size every iteration in order to calculate an rindex.
while((size = pInventoryPoolList[uiLoop].object[x]->attachments.size()) != cnt)
{
gTempObject = *(pInventoryPoolList[uiLoop].object[x]->GetAttachmentAtIndex(cnt));
gTempObject = *(pInventoryPoolList[uiLoop].object[x]->GetAttachmentAtIndex(size - 1 - cnt));
//WarmSteel - This actually still works with NAS, be it by accident
if (pInventoryPoolList[uiLoop].object.RemoveAttachment(&gTempObject,0,x))
+8 -3
View File
@@ -6653,13 +6653,18 @@ void SeperateItems()
// from AddItemToPool, resets gWorldItems when it increases it's size. This means
// iter loses it's relationship which causes a CTD if we use this hotkey and there
// aren't enough open WorldItems to accomodate all the attachments we're seperating.
UINT8 cnt = 0, uiLoopCnt = 0;
UINT8 size = 0, cnt = 0, uiLoopCnt = 0;
// uiLoopCnt is an extra failsafe. I think I've already managed to eliminate the
// infinite loop, but just in case, we'll use uiLoopCnt to force a break after a
// certain point.
while(gWorldItems[uiLoop].object[x]->attachments.size() != cnt)
// Iterate backwards through attachments in order to detach grenades from underbarrel
// launchers before detaching the launchers (and their grenade slots) themselves.
// Since the size of the attachmentList remains constant under NAS but decrements by one
// under OAS, recheck the list size every iteration in order to calculate an rindex.
while((size = gWorldItems[uiLoop].object[x]->attachments.size()) != cnt)
{
gTempObject = *gWorldItems[uiLoop].object[x]->GetAttachmentAtIndex(cnt);
gTempObject = *gWorldItems[uiLoop].object[x]->GetAttachmentAtIndex(size - 1 - cnt);
//WarmSteel - This actually still works with NAS, be it by accident
if (gWorldItems[ uiLoop ].object.RemoveAttachment(&gTempObject,0,x))