mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
Merged revision(s) 6826-6828 from branches/ja2_source_official_2014:
- Minor code improvements and cleanup - Fix from r6775 is no longer necessary. - Code improvement: Instead of calling inv.size() repeatedly, just call it once and remember that value git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@6829 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
@@ -1070,7 +1070,8 @@ UINT32 SOLDIERTYPE::GetChecksum( )
|
||||
uiChecksum *= (this->stats.bExpLevel + 1);
|
||||
uiChecksum += (this->ubProfile + 1);
|
||||
|
||||
for ( uiLoop = 0; uiLoop < this->inv.size(); uiLoop++ )
|
||||
UINT32 invsize = this->inv.size();
|
||||
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||
{
|
||||
uiChecksum += this->inv[ uiLoop ].usItem;
|
||||
uiChecksum += this->inv[ uiLoop ].ubNumberOfObjects;
|
||||
@@ -1221,7 +1222,8 @@ UINT32 MERCPROFILESTRUCT::GetChecksum( )
|
||||
// put in some multipliers too!
|
||||
uiChecksum *= (this->bExpLevel + 1);
|
||||
|
||||
for ( uiLoop = 0; uiLoop < this->inv.size(); uiLoop++ )
|
||||
UINT32 invsize = this->inv.size();
|
||||
for ( uiLoop = 0; uiLoop < invsize; ++uiLoop )
|
||||
{
|
||||
uiChecksum += this->inv[ uiLoop ];
|
||||
uiChecksum += this->bInvNumber[ uiLoop ];
|
||||
@@ -20614,11 +20616,13 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
||||
// check if within distance
|
||||
// if both have extended ear, the distance is bigger and they don't need to sea each other
|
||||
// note that enemy always get the bonus if within distance, regardless of extended ears
|
||||
if (((( HasExtendedEarOn( pSoldier ) && HasExtendedEarOn( MercPtrs[ cnt ] )) || ( pSoldier->bTeam == ENEMY_TEAM ) ) && (PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) ) ||
|
||||
// Flugente: moved around arguments for speed reason
|
||||
if ( fDontCheckDistance ||
|
||||
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) ||
|
||||
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
||||
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
||||
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) ||
|
||||
fDontCheckDistance )
|
||||
( ( pSoldier->bTeam == ENEMY_TEAM || (HasExtendedEarOn( pSoldier ) && HasExtendedEarOn( MercPtrs[ cnt ] ) ) ) && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar )
|
||||
)
|
||||
{
|
||||
// If checking for higher level SL
|
||||
// also count in already aquired level increses from other SLs
|
||||
@@ -20631,6 +20635,7 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
||||
{
|
||||
ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[ cnt ], SQUADLEADER_NT );
|
||||
}
|
||||
|
||||
if (ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses)
|
||||
break;
|
||||
}
|
||||
@@ -20640,18 +20645,20 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
||||
// special loop for militia - they can get a bonus from our mercs
|
||||
if ( pSoldier->bTeam == MILITIA_TEAM && ubNumberSL < gSkillTraitValues.ubSLMaxBonuses )
|
||||
{
|
||||
for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ; cnt++ )
|
||||
for ( cnt = gTacticalStatus.Team[ OUR_TEAM ].bFirstID ; cnt <= gTacticalStatus.Team[ OUR_TEAM ].bLastID ; ++cnt )
|
||||
{
|
||||
// Get active conscious soldier
|
||||
if (MercPtrs[ cnt ] != pSoldier && MercPtrs[ cnt ]->bActive && //MercPtrs[ cnt ]->aiData.bShock < 20 &&
|
||||
MercPtrs[ cnt ]->stats.bLife >= OKLIFE && HAS_SKILL_TRAIT( MercPtrs[ cnt ], SQUADLEADER_NT ))
|
||||
{
|
||||
// check if within distance
|
||||
if (((HasExtendedEarOn( MercPtrs[ cnt ] ) && (PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) ) ||
|
||||
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
||||
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
||||
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal)) ||
|
||||
fDontCheckDistance )
|
||||
// Flugente: moved around arguments for speed reason
|
||||
if ( fDontCheckDistance ||
|
||||
(PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusNormal) ||
|
||||
//((SoldierToVirtualSoldierLineOfSightTest( MercPtrs[ cnt ], pSoldier->sGridNo, pSoldier->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ||
|
||||
//SoldierToVirtualSoldierLineOfSightTest( pSoldier, MercPtrs[ cnt ]->sGridNo, MercPtrs[ cnt ]->pathing.bLevel, ANIM_STAND, TRUE, CALC_FROM_ALL_DIRS ) ) &&
|
||||
((HasExtendedEarOn( MercPtrs[ cnt ] ) && PythSpacesAway( pSoldier->sGridNo, MercPtrs[ cnt ]->sGridNo ) <= gSkillTraitValues.usSLRadiusExtendedEar) )
|
||||
)
|
||||
{
|
||||
// If checking for higher level SL
|
||||
// also count in already aquired level increses from other SLs
|
||||
@@ -20664,6 +20671,7 @@ UINT8 GetSquadleadersCountInVicinity( SOLDIERTYPE * pSoldier, BOOLEAN fWithHighe
|
||||
{
|
||||
ubNumberSL += NUM_SKILL_TRAITS( MercPtrs[ cnt ], SQUADLEADER_NT );
|
||||
}
|
||||
|
||||
if (ubNumberSL >= gSkillTraitValues.ubSLMaxBonuses)
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user