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:
Flugente
2013-05-05 14:16:36 +00:00
parent 0078b01d9b
commit 9d2da7e440
+8 -5
View File
@@ -13687,6 +13687,9 @@ 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
// 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
if ( Chance(5) )
{
UINT16 firstslot = HANDPOS; UINT16 firstslot = HANDPOS;
UINT16 lastslot = VESTPOCKPOS; UINT16 lastslot = VESTPOCKPOS;
for (UINT16 invpos = firstslot; invpos < lastslot; ++invpos) for (UINT16 invpos = firstslot; invpos < lastslot; ++invpos)
@@ -13714,8 +13717,7 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
if ( flashlightfound ) if ( flashlightfound )
{ {
// 5% chance to lose 1 point // lose 1 point
if ( pBattery && Chance(5) )
(*pBattery)[0]->data.objectStatus -= 1; (*pBattery)[0]->data.objectStatus -= 1;
if ( (*pBattery)[0]->data.objectStatus <= 0 ) if ( (*pBattery)[0]->data.objectStatus <= 0 )
@@ -13727,6 +13729,7 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
} }
} }
} }
}
// handle flashlight. This is necessary in this location, as we need to do this at least once per turn // handle flashlight. This is necessary in this location, as we need to do this at least once per turn
this->HandleFlashLights(); this->HandleFlashLights();
@@ -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