-externalized AP costs for attachments or an attachment-by-attachment basis

-added APCost to Attachments.xml

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@475 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
MaddMugsy
2006-08-25 22:54:52 +00:00
parent ace3863569
commit d2c2963bfb
6 changed files with 37 additions and 8 deletions
+20 -2
View File
@@ -516,7 +516,7 @@ AttachmentInfoStruct AttachmentInfo[MAXITEMS+1];// =
// { 0, 0 }
//};
UINT16 Attachment[MAXATTACHMENTS][2];// =
UINT16 Attachment[MAXATTACHMENTS][3];// =
//{
// {SILENCER, GLOCK_17},
// {SILENCER, GLOCK_18},
@@ -1773,9 +1773,10 @@ INT8 GetAttachmentInfoIndex( UINT16 usItem )
}
//Determine if it is possible to add this attachment to the item.
BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem )
BOOLEAN internalValidAttachment( UINT16 usAttachment, UINT16 usItem, UINT8 * pubAPCost )
{
INT32 iLoop = 0;
*pubAPCost = (UINT8)AP_RELOAD_GUN; //default value
// look for the section of the array pertaining to this attachment...
while( 1 )
@@ -1796,6 +1797,7 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem )
{
if (Attachment[iLoop][1] == usItem)
{
*pubAPCost = (UINT8)Attachment[iLoop][2]; //Madd: get ap cost of attaching items :)
break;
}
iLoop++;
@@ -1808,6 +1810,22 @@ BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem )
return( TRUE );
}
//Determine if it is possible to add this attachment to the item.
BOOLEAN ValidAttachment( UINT16 usAttachment, UINT16 usItem )
{
UINT8 ubAPCost;
return internalValidAttachment( usAttachment, usItem, &ubAPCost);
}
UINT8 AttachmentAPCost( UINT16 usAttachment, UINT16 usItem )
{
UINT8 ubAPCost;
internalValidAttachment( usAttachment, usItem, &ubAPCost);
return ubAPCost;
}
//Determine if this item can receive this attachment. This is different, in that it may
//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).