mirror of
https://github.com/1dot13/source.git
synced 2026-09-02 14:36:06 +02:00
Fix: VS2008 & VS2005 compatibility
git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6064 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -13687,43 +13687,46 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
|
|||||||
{
|
{
|
||||||
// if we have any active flashlights (in our hands for simplicity), drain their batteries
|
// if we have any active flashlights (in our hands for simplicity), drain their batteries
|
||||||
// do this check for both hands
|
// do this check for both hands
|
||||||
UINT16 firstslot = HANDPOS;
|
// we do not lower a battery's status all the time - as an INT8, it would reach 0 way to fast. Instead we only have 5% chance of doing so, thereby increasing a battery's life
|
||||||
UINT16 lastslot = VESTPOCKPOS;
|
if ( Chance(5) )
|
||||||
for (UINT16 invpos = firstslot; invpos < lastslot; ++invpos)
|
|
||||||
{
|
{
|
||||||
OBJECTTYPE* pObj = &(this->inv[invpos]);
|
UINT16 firstslot = HANDPOS;
|
||||||
|
UINT16 lastslot = VESTPOCKPOS;
|
||||||
|
for (UINT16 invpos = firstslot; invpos < lastslot; ++invpos)
|
||||||
|
{
|
||||||
|
OBJECTTYPE* pObj = &(this->inv[invpos]);
|
||||||
|
|
||||||
if ( !pObj || !(pObj->exists()) )
|
if ( !pObj || !(pObj->exists()) )
|
||||||
// can't use this, end
|
// can't use this, end
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
OBJECTTYPE* pBattery = FindAttachedBatteries(pObj);
|
OBJECTTYPE* pBattery = FindAttachedBatteries(pObj);
|
||||||
if ( !pBattery )
|
if ( !pBattery )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
BOOLEAN flashlightfound = FALSE;
|
BOOLEAN flashlightfound = FALSE;
|
||||||
if ( Item [ pObj->usItem ].usFlashLightRange )
|
if ( Item [ pObj->usItem ].usFlashLightRange )
|
||||||
flashlightfound = TRUE;
|
|
||||||
|
|
||||||
if ( !flashlightfound )
|
|
||||||
{
|
|
||||||
attachmentList::iterator iterend = (*pObj)[0]->attachments.end();
|
|
||||||
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter)
|
|
||||||
flashlightfound = TRUE;
|
flashlightfound = TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
if ( flashlightfound )
|
if ( !flashlightfound )
|
||||||
{
|
{
|
||||||
// 5% chance to lose 1 point
|
attachmentList::iterator iterend = (*pObj)[0]->attachments.end();
|
||||||
if ( pBattery && Chance(5) )
|
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter)
|
||||||
|
flashlightfound = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( flashlightfound )
|
||||||
|
{
|
||||||
|
// lose 1 point
|
||||||
(*pBattery)[0]->data.objectStatus -= 1;
|
(*pBattery)[0]->data.objectStatus -= 1;
|
||||||
|
|
||||||
if ( (*pBattery)[0]->data.objectStatus <= 0 )
|
if ( (*pBattery)[0]->data.objectStatus <= 0 )
|
||||||
{
|
{
|
||||||
// destroy batteries
|
// destroy batteries
|
||||||
pBattery->RemoveObjectsFromStack(1);
|
pBattery->RemoveObjectsFromStack(1);
|
||||||
if (pBattery->exists() == false)
|
if (pBattery->exists() == false)
|
||||||
this->inv[HANDPOS].RemoveAttachment(pBattery);
|
this->inv[HANDPOS].RemoveAttachment(pBattery);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -16278,9 +16281,9 @@ void SOLDIERTYPE::HandleFlashLights()
|
|||||||
// depending on our direction, alter range
|
// depending on our direction, alter range
|
||||||
if ( this->ubDirection == NORTHEAST || this->ubDirection == NORTHWEST || this->ubDirection == SOUTHEAST || this->ubDirection == SOUTHWEST )
|
if ( this->ubDirection == NORTHEAST || this->ubDirection == NORTHWEST || this->ubDirection == SOUTHEAST || this->ubDirection == SOUTHWEST )
|
||||||
{
|
{
|
||||||
flashlightrange = std::sqrt( (FLOAT)flashlightrange*(FLOAT)flashlightrange / 2.0f );
|
flashlightrange = sqrt( (FLOAT)flashlightrange*(FLOAT)flashlightrange / 2.0f );
|
||||||
firstexpand = std::sqrt( (FLOAT)firstexpand*(FLOAT)firstexpand / 2.0f );
|
firstexpand = sqrt( (FLOAT)firstexpand*(FLOAT)firstexpand / 2.0f );
|
||||||
secondexpand = std::sqrt( (FLOAT)secondexpand*(FLOAT)secondexpand / 2.0f );
|
secondexpand = sqrt( (FLOAT)secondexpand*(FLOAT)secondexpand / 2.0f );
|
||||||
}
|
}
|
||||||
|
|
||||||
// if no flashlight is found, this will be 0
|
// if no flashlight is found, this will be 0
|
||||||
|
|||||||
Reference in New Issue
Block a user