From 8b58f9a1bfc368d690bd6b708edd6fb435c3e45e Mon Sep 17 00:00:00 2001 From: silversurfer Date: Sun, 2 Dec 2018 14:59:08 +0000 Subject: [PATCH] Fixes (by Sevenfm): - wrong level calculation for suppression resistance with friends - incorrect buddy handling - incorrect PoW, medic, wounded determination git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8643 3b4a5df2-a311-0410-b5c6-a8a6f20db521 --- GameVersion.cpp | 4 ++-- Tactical/Overhead.cpp | 12 ++++++------ Tactical/Soldier Profile.cpp | 2 +- TacticalAI/AIUtils.cpp | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/GameVersion.cpp b/GameVersion.cpp index 50687f9a..4a7246af 100644 --- a/GameVersion.cpp +++ b/GameVersion.cpp @@ -55,8 +55,8 @@ #endif -CHAR8 czVersionNumber[16] = { "Build 18.10.11" }; //YY.MM.DD +CHAR8 czVersionNumber[16] = { "Build 18.12.02" }; //YY.MM.DD CHAR16 zTrackingNumber[16] = { L"Z" }; -CHAR16 zRevisionNumber[16] = { L"Revision 8640" }; +CHAR16 zRevisionNumber[16] = { L"Revision 8643" }; // SAVE_GAME_VERSION is defined in header, change it there diff --git a/Tactical/Overhead.cpp b/Tactical/Overhead.cpp index 10a37f9e..da0ad7b6 100644 --- a/Tactical/Overhead.cpp +++ b/Tactical/Overhead.cpp @@ -10274,7 +10274,7 @@ INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier ) UINT16 usEffectiveRangeToLeader = 0; INT16 usBestLeader = 0; INT16 usFriendBonus = 0; - UINT8 ubLevelDifference = 0; + INT8 bLevelDifference = 0; // Run through each friendly. for ( UINT8 iCounter = gTacticalStatus.Team[ pSoldier->bTeam ].bFirstID ; iCounter <= gTacticalStatus.Team[ pSoldier->bTeam ].bLastID ; iCounter ++ ) @@ -10285,25 +10285,25 @@ INT8 CheckStatusNearbyFriendlies( SOLDIERTYPE *pSoldier ) if (pLeader != pSoldier && pLeader->bActive && pLeader->aiData.bShock < pLeader->stats.bLeadership/5 && pLeader->stats.bLife >= OKLIFE ) { - ubLevelDifference = (pLeader->stats.bExpLevel - pSoldier->stats.bExpLevel ); + bLevelDifference = pLeader->stats.bExpLevel - pSoldier->stats.bExpLevel; // Calculate character's leadership and range/3 - usEffectiveLeadership = ((EffectiveLeadership( pLeader ) - 25) / 15); + usEffectiveLeadership = (EffectiveLeadership( pLeader ) - 25) / 15; usEffectiveRangeToLeader = PythSpacesAway( pSoldier->sGridNo, pLeader->sGridNo ) / 3; // SANDRO - add effective leadership and level to determine if we can help our friend to feel better :) if ( gGameOptions.fNewTraitSystem && HAS_SKILL_TRAIT( pLeader, SQUADLEADER_NT ) ) { - ubLevelDifference += (gSkillTraitValues.ubSLEffectiveLevelAsStandby * NUM_SKILL_TRAITS( pLeader, SQUADLEADER_NT )); + bLevelDifference += (gSkillTraitValues.ubSLEffectiveLevelAsStandby * NUM_SKILL_TRAITS( pLeader, SQUADLEADER_NT )); usEffectiveLeadership += (gSkillTraitValues.ubSLEffectiveLevelAsStandby * NUM_SKILL_TRAITS( pLeader, SQUADLEADER_NT )); } - if ( ubLevelDifference >= 0 ) + if ( bLevelDifference >= 0 ) { // If leader is within range of his leadership stat if (usEffectiveRangeToLeader <= usEffectiveLeadership+1) { // The difference in experience level is important! - usEffectiveLeadership += ubLevelDifference; + usEffectiveLeadership += bLevelDifference; // Reduce effective leadership with every 3 tiles of distance usEffectiveLeadership -= usEffectiveRangeToLeader-1; diff --git a/Tactical/Soldier Profile.cpp b/Tactical/Soldier Profile.cpp index 8568854b..2941f94c 100644 --- a/Tactical/Soldier Profile.cpp +++ b/Tactical/Soldier Profile.cpp @@ -2151,7 +2151,7 @@ BOOLEAN DoesMercHaveABuddyOnTheTeam( UINT8 ubMercID ) } //If its not a valid 'buddy' - if( bBuddyID < 0 ) + if( bBuddyID == NUM_PROFILES ) continue; if( IsMercOnTeam( bBuddyID, FALSE, FALSE ) ) diff --git a/TacticalAI/AIUtils.cpp b/TacticalAI/AIUtils.cpp index 5981c6ec..51f58658 100644 --- a/TacticalAI/AIUtils.cpp +++ b/TacticalAI/AIUtils.cpp @@ -3166,7 +3166,7 @@ UINT8 GetClosestFlaggedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au // this is not for tanks if ( ARMED_VEHICLE( pFriend ) ) - return FALSE; + continue; // skip if this guy is dead if ( pFriend->stats.bLife <= 0 ) @@ -3219,7 +3219,7 @@ UINT8 GetClosestWoundedSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 au // this is not for tanks if ( ARMED_VEHICLE( pFriend ) ) - return FALSE; + continue; // skip if this guy is dead, or not wounded (enough) if ( pFriend->stats.bLife <= 0 || pFriend->iHealableInjury < gGameExternalOptions.sEnemyMedicsWoundMinAmount ) @@ -3268,7 +3268,7 @@ UINT8 GetClosestMedicSoldierID( SOLDIERTYPE * pSoldier, INT16 aRange, UINT8 auTe // this is not for tanks if ( ARMED_VEHICLE( pFriend ) ) - return FALSE; + continue; // skip this guy if he is dead or unconscious if ( pFriend->stats.bLife < OKLIFE )