mirror of
https://github.com/1dot13/source.git
synced 2026-09-09 14:46:05 +02:00
- Bugfix: Fixed a bug (not mine) where item stacks with 128+ items in them would cause an endless loop when trying to sell the entire stack with ALT-SHIFT-CLICK (or, in my case, when displaying the price of the stack) (fix by Headrock)
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@4854 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -2672,17 +2672,17 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier )
|
|||||||
{
|
{
|
||||||
//we are selling ammo
|
//we are selling ammo
|
||||||
UINT16 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize;
|
UINT16 magSize = Magazine[ Item[ usItemType ].ubClassIndex ].ubMagSize;
|
||||||
for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++)
|
for (UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
|
||||||
{
|
{
|
||||||
iPrice += (INT32)( itemPrice * (float) object[bLoop]->data.ubShotsLeft / magSize );
|
iPrice += (INT32)( itemPrice * (float) object[ubLoop]->data.ubShotsLeft / magSize );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//CHRISL: If we're dealing with money, we want to use the money's amount and just return that value with no modification
|
//CHRISL: If we're dealing with money, we want to use the money's amount and just return that value with no modification
|
||||||
else if(Item[usItemType].usItemClass == IC_MONEY)
|
else if(Item[usItemType].usItemClass == IC_MONEY)
|
||||||
{
|
{
|
||||||
for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++)
|
for (UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
|
||||||
{
|
{
|
||||||
iPrice += (INT32)(object[bLoop]->data.money.uiMoneyAmount);
|
iPrice += (INT32)(object[ubLoop]->data.money.uiMoneyAmount);
|
||||||
}
|
}
|
||||||
return iPrice;
|
return iPrice;
|
||||||
}
|
}
|
||||||
@@ -2690,11 +2690,11 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier )
|
|||||||
{
|
{
|
||||||
//CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell
|
//CHRISL: If we're selling an LBE Item, we need to verify if it's an LBENODE, first. If it is, we need to sell
|
||||||
// everything stored in the LBENODE before we sell teh LBE Item itself.
|
// everything stored in the LBENODE before we sell teh LBE Item itself.
|
||||||
for(INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++)
|
for(UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
|
||||||
{
|
{
|
||||||
if(object.IsActiveLBE(bLoop) == true)
|
if(object.IsActiveLBE(ubLoop) == true)
|
||||||
{
|
{
|
||||||
LBENODE* pLBE = object.GetLBEPointer(bLoop);
|
LBENODE* pLBE = object.GetLBEPointer(ubLoop);
|
||||||
if(pLBE)
|
if(pLBE)
|
||||||
{
|
{
|
||||||
for(unsigned int x = 0; x < pLBE->inv.size(); x++)
|
for(unsigned int x = 0; x < pLBE->inv.size(); x++)
|
||||||
@@ -2706,8 +2706,8 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
iPrice += ( itemPrice * object[bLoop]->data.objectStatus / 100 );
|
iPrice += ( itemPrice * object[ubLoop]->data.objectStatus / 100 );
|
||||||
for (attachmentList::iterator iter = object[bLoop]->attachments.begin(); iter != object[bLoop]->attachments.end(); ++iter) {
|
for (attachmentList::iterator iter = object[ubLoop]->attachments.begin(); iter != object[ubLoop]->attachments.end(); ++iter) {
|
||||||
if(iter->exists())
|
if(iter->exists())
|
||||||
iPrice += SellItem(*iter, FALSE);
|
iPrice += SellItem(*iter, FALSE);
|
||||||
}
|
}
|
||||||
@@ -2716,10 +2716,10 @@ INT32 SellItem( OBJECTTYPE& object, BOOLEAN useModifier )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//we are selling a gun or something - it could be stacked or single, and if single it could have attachments
|
//we are selling a gun or something - it could be stacked or single, and if single it could have attachments
|
||||||
for (INT8 bLoop = 0; bLoop < object.ubNumberOfObjects; bLoop++)
|
for (UINT8 ubLoop = 0; ubLoop < object.ubNumberOfObjects; ubLoop++)
|
||||||
{
|
{
|
||||||
iPrice += ( itemPrice * object[bLoop]->data.objectStatus / 100 );
|
iPrice += ( itemPrice * object[ubLoop]->data.objectStatus / 100 );
|
||||||
for (attachmentList::iterator iter = object[bLoop]->attachments.begin(); iter != object[bLoop]->attachments.end(); ++iter) {
|
for (attachmentList::iterator iter = object[ubLoop]->attachments.begin(); iter != object[ubLoop]->attachments.end(); ++iter) {
|
||||||
if(iter->exists())
|
if(iter->exists())
|
||||||
iPrice += SellItem(*iter, FALSE);
|
iPrice += SellItem(*iter, FALSE);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user