mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- In the vain hopes of finally killing that stupid "Battle Scope" bug, I have changed the inventory creation to do an extra check for attachment validity before creating the attachments w/out displaying any messages.
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@205 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -666,7 +666,6 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
|
|||||||
usScopeIndex = PickARandomAttachment(SCOPE,usGunIndex,bAttachClass,FALSE);
|
usScopeIndex = PickARandomAttachment(SCOPE,usGunIndex,bAttachClass,FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Choose attachment
|
//Choose attachment
|
||||||
if( bAttachClass && ( fAttachment ))
|
if( bAttachClass && ( fAttachment ))
|
||||||
{
|
{
|
||||||
@@ -842,21 +841,21 @@ void ChooseWeaponForSoldierCreateStruct( SOLDIERCREATE_STRUCT *pp, INT8 bWeaponC
|
|||||||
|
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ChooseWeaponForSoldierCreateStruct: Gun Created");
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,"ChooseWeaponForSoldierCreateStruct: Gun Created");
|
||||||
|
|
||||||
if( usScopeIndex > 0 )
|
if( usScopeIndex > 0 && ValidItemAttachment(&(pp->Inv[ HANDPOS ]),usScopeIndex,TRUE,FALSE) )
|
||||||
{
|
{
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create Scope %d",usScopeIndex));
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create Scope %d",usScopeIndex));
|
||||||
CreateItem( usScopeIndex, 100, &Object );
|
CreateItem( usScopeIndex, 100, &Object );
|
||||||
Object.fFlags |= OBJECT_UNDROPPABLE;
|
Object.fFlags |= OBJECT_UNDROPPABLE;
|
||||||
AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object );
|
AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object );
|
||||||
}
|
}
|
||||||
if( usAttachIndex > 0 )
|
if( usAttachIndex > 0 && ValidItemAttachment(&(pp->Inv[ HANDPOS ]),usAttachIndex,TRUE,FALSE))
|
||||||
{
|
{
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create Attachment %d",usAttachIndex));
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create Attachment %d",usAttachIndex));
|
||||||
CreateItem( usAttachIndex, 100, &Object );
|
CreateItem( usAttachIndex, 100, &Object );
|
||||||
Object.fFlags |= OBJECT_UNDROPPABLE;
|
Object.fFlags |= OBJECT_UNDROPPABLE;
|
||||||
AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object );
|
AttachObject( NULL, &(pp->Inv[ HANDPOS ]), &Object );
|
||||||
}
|
}
|
||||||
if( usAttachIndex2 > 0 )
|
if( usAttachIndex2 > 0 && ValidItemAttachment(&(pp->Inv[ HANDPOS ]),usAttachIndex2,TRUE,FALSE))
|
||||||
{
|
{
|
||||||
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create 2nd Attachment %d",usAttachIndex2));
|
DebugMsg (TOPIC_JA2,DBG_LEVEL_3,String("ChooseWeaponForSoldierCreateStruct: Create 2nd Attachment %d",usAttachIndex2));
|
||||||
CreateItem( usAttachIndex2, 100, &Object );
|
CreateItem( usAttachIndex2, 100, &Object );
|
||||||
|
|||||||
+6
-2
@@ -1806,6 +1806,10 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem )
|
|||||||
//be possible to have this attachment on this item, but may already have an attachment on
|
//be possible to have this attachment on this item, but may already have an attachment on
|
||||||
//it which doesn't work simultaneously with the new attachment (like a silencer and duckbill).
|
//it which doesn't work simultaneously with the new attachment (like a silencer and duckbill).
|
||||||
BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment )
|
BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment )
|
||||||
|
{
|
||||||
|
return ValidItemAttachment ( pObj, usAttachment, fAttemptingAttachment, TRUE );
|
||||||
|
}
|
||||||
|
BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment, BOOLEAN fDisplayMessage )
|
||||||
{
|
{
|
||||||
BOOLEAN fSameItem = FALSE, fSimilarItems = FALSE;
|
BOOLEAN fSameItem = FALSE, fSimilarItems = FALSE;
|
||||||
UINT16 usSimilarItem = NOTHING;
|
UINT16 usSimilarItem = NOTHING;
|
||||||
@@ -1959,12 +1963,12 @@ BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAt
|
|||||||
{
|
{
|
||||||
if (fSameItem)
|
if (fSameItem)
|
||||||
{
|
{
|
||||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_ATTACHMENT_ALREADY ] );
|
if (fDisplayMessage) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_ATTACHMENT_ALREADY ] );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
else if (fSimilarItems)
|
else if (fSimilarItems)
|
||||||
{
|
{
|
||||||
ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_CANT_USE_TWO_ITEMS ], ItemNames[ usSimilarItem ], ItemNames[ usAttachment ] );
|
if (fDisplayMessage) ScreenMsg( FONT_MCOLOR_LTYELLOW, MSG_UI_FEEDBACK, Message[ STR_CANT_USE_TWO_ITEMS ], ItemNames[ usSimilarItem ], ItemNames[ usAttachment ] );
|
||||||
return( FALSE );
|
return( FALSE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,6 +115,7 @@ BOOLEAN ItemHasAttachments( OBJECTTYPE *pItem );
|
|||||||
//be possible to have this attachment on this item, but may already have an attachment on
|
//be possible to have this attachment on this item, but may already have an attachment on
|
||||||
//it which doesn't work simultaneously with the new attachment (like a silencer and duckbill).
|
//it which doesn't work simultaneously with the new attachment (like a silencer and duckbill).
|
||||||
BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment );
|
BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment );
|
||||||
|
BOOLEAN ValidItemAttachment( OBJECTTYPE * pObj, UINT16 usAttachment, BOOLEAN fAttemptingAttachment, BOOLEAN fDisplayMessage );
|
||||||
|
|
||||||
// Determines if it is possible to merge an item with any item whose class
|
// Determines if it is possible to merge an item with any item whose class
|
||||||
// is the same as the indicated item
|
// is the same as the indicated item
|
||||||
|
|||||||
Reference in New Issue
Block a user