Bugfix for IMP attributes.

Fixed loop/crash that occurred when handing MADLAB a weapon with a permanent attachment.

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@2369 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
ChrisL
2008-10-07 22:35:48 +00:00
parent 7e1d4a2d89
commit 1278c52d9a
2 changed files with 13 additions and 1 deletions
+1 -1
View File
@@ -988,7 +988,7 @@ void RenderAttributeBoxes( void )
INT32 iCnt=STRENGTH_ATTRIBUTE;
INT16 sX = 0;
INT16 sY = 0;
CHAR16 sString[3];
CHAR16 sString[4];
// set last char to null
sString[2] = 0;
+12
View File
@@ -5968,11 +5968,23 @@ BOOLEAN PlaceObjectInSoldierProfile( UINT8 ubProfile, OBJECTTYPE *pObject )
{
if ( pSoldier->ubProfile == MADLAB )
{
// remove ammo and drop
pSoldier->pTempObject = new OBJECTTYPE;
EmptyWeaponMagazine( pObject, pSoldier->pTempObject );
AddItemToPool( pSoldier->sGridNo, pSoldier->pTempObject, 1, 0, 0, 0 );
pSoldier->pTempObject = NULL;
// remove attachments and drop them
for (attachmentList::iterator iter = (*pObject)[0]->attachments.begin(); iter != (*pObject)[0]->attachments.end();) {
//CHRISL: Because MADLAB needs to remove all attachments, even inseparable ones, we need to temporarily
// make all attachments removable.
BOOLEAN old_inseparable = FALSE;
UINT32 old_item = iter->usItem;
// drop it in Madlab's tile
AddItemToPool( pSoldier->sGridNo, &(*iter), 1, 0, 0, 0 );
old_inseparable = Item[old_item].inseparable;
Item[old_item].inseparable = FALSE;
pObject->RemoveAttachment(&(*iter));
Item[old_item].inseparable = old_inseparable;
if ((*pObject)[0]->attachments.empty() == true) {
break;
}