mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
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:
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user