- Fix: crash when switching to bayonet while aimed

- Fix: batteries were drained for inactive flashlights

git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6067 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Flugente
2013-05-06 23:35:17 +00:00
parent ccc6bea3be
commit 59646b9dcd
3 changed files with 22 additions and 15 deletions
+1 -1
View File
@@ -669,7 +669,7 @@ extern OBJECTTYPE gTempObject;
#define AC_FEEDER 0x00800000 //8388608 // allow external feeding
#define AC_MODPOUCH 0x01000000 //16777216 // for new modular pouches
#define AC_RIFLEGRENADE 0x02000000 //33554432 // GL, needs a bullet and blocks other firing modes
#define AC_MISC15 0x04000000 //67108864
#define AC_BAYONET 0x04000000 //67108864
#define AC_MISC16 0x08000000 //134217728
#define AC_MISC17 0x10000000 //268435456
#define AC_MISC18 0x20000000 //536870912
+17 -14
View File
@@ -13717,8 +13717,11 @@ void SOLDIERTYPE::SoldierInventoryCoolDown(void)
if ( !flashlightfound )
{
attachmentList::iterator iterend = (*pObj)[0]->attachments.end();
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter)
flashlightfound = TRUE;
for (attachmentList::iterator iter = (*pObj)[0]->attachments.begin(); iter != iterend; ++iter)
{
if ( Item [ iter->usItem ].usFlashLightRange )
flashlightfound = TRUE;
}
}
if ( flashlightfound )
@@ -16294,21 +16297,21 @@ void SOLDIERTYPE::HandleFlashLights()
{
UINT8 flashlightrange = this->GetBestEquippedFlashLightRange();
// the range at which we create additional light sources to the side
UINT8 firstexpand = 8;
UINT8 secondexpand = 12;
// depending on our direction, alter range
if ( this->ubDirection == NORTHEAST || this->ubDirection == NORTHWEST || this->ubDirection == SOUTHEAST || this->ubDirection == SOUTHWEST )
{
flashlightrange = sqrt( (FLOAT)flashlightrange*(FLOAT)flashlightrange / 2.0f );
firstexpand = sqrt( (FLOAT)firstexpand*(FLOAT)firstexpand / 2.0f );
secondexpand = sqrt( (FLOAT)secondexpand*(FLOAT)secondexpand / 2.0f );
}
// if no flashlight is found, this will be 0
if ( flashlightrange )
{
// the range at which we create additional light sources to the side
UINT8 firstexpand = 8;
UINT8 secondexpand = 12;
// depending on our direction, alter range
if ( this->ubDirection == NORTHEAST || this->ubDirection == NORTHWEST || this->ubDirection == SOUTHEAST || this->ubDirection == SOUTHWEST )
{
flashlightrange = sqrt( (FLOAT)flashlightrange*(FLOAT)flashlightrange / 2.0f );
firstexpand = sqrt( (FLOAT)firstexpand*(FLOAT)firstexpand / 2.0f );
secondexpand = sqrt( (FLOAT)secondexpand*(FLOAT)secondexpand / 2.0f );
}
// we determine the height of the next tile in our direction. Because of the way structures are handled, we sometimes have to take the very tile we're occupying right now
INT32 nextGridNoinSight = this->sGridNo;
+4
View File
@@ -1628,6 +1628,10 @@ UINT8 HandleKnifeCursor( SOLDIERTYPE *pSoldier, INT32 sGridNo, BOOLEAN fActivate
// DRAW PATH TO GUY
HandleUIMovementCursor( pSoldier, uiCursorFlags, sGridNo, MOVEUI_TARGET_MERCS );
// Flugente: if we are using a bayonet, adjust aimtime
if ( pSoldier->bWeaponMode == WM_ATTACHED_BAYONET && pSoldier->aiData.bShownAimTime != REFINE_KNIFE_1 )
pSoldier->aiData.bShownAimTime = REFINE_KNIFE_2;
if ( fActivated )
{
DetermineCursorBodyLocation( pSoldier->ubID, TRUE, TRUE );