mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Avoid overcrowding when looking for spot to move to
This commit is contained in:
@@ -655,7 +655,7 @@ static void CalculateCoverValue(SOLDIERTYPE* pSoldier, const INT32 sGridNo, cons
|
|||||||
}
|
}
|
||||||
|
|
||||||
// sevenfm: check for nearby friends, add bonus/penalty 10%
|
// sevenfm: check for nearby friends, add bonus/penalty 10%
|
||||||
UINT8 ubNearbyFriends = __max(0, CountNearbyFriends(pSoldier, sGridNo, 7));
|
UINT8 ubNearbyFriends = __max(0, CountNearbyFriends(pSoldier, sGridNo, TACTICAL_RANGE_CLOSE));
|
||||||
iCoverValue -= ubNearbyFriends * abs(iCoverValue) / (6 - ubDiff);
|
iCoverValue -= ubNearbyFriends * abs(iCoverValue) / (6 - ubDiff);
|
||||||
|
|
||||||
// sevenfm: penalize locations with fresh corpses
|
// sevenfm: penalize locations with fresh corpses
|
||||||
@@ -963,6 +963,13 @@ INT32 FindBestNearbyCover(SOLDIERTYPE *pSoldier, INT32 morale, INT32 *piPercentB
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Avoid overcrowding
|
||||||
|
const auto nearbyFriends = CountNearbyFriends(pSoldier, sGridNo, TACTICAL_RANGE_VERYCLOSE);
|
||||||
|
if ( nearbyFriends > 1 && !pSoldier->IsZombie() )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// zombies only want to hide
|
// zombies only want to hide
|
||||||
if (pSoldier->IsZombie() && !SightCoverAtSpot(pSoldier, sGridNo, TRUE))
|
if (pSoldier->IsZombie() && !SightCoverAtSpot(pSoldier, sGridNo, TRUE))
|
||||||
{
|
{
|
||||||
@@ -3122,7 +3129,8 @@ INT32 FindAdvanceSpot(SOLDIERTYPE *pSoldier, INT32 sTargetSpot, INT8 bAction, UI
|
|||||||
}
|
}
|
||||||
|
|
||||||
// avoid overcrowding
|
// avoid overcrowding
|
||||||
if (!pSoldier->IsZombie() && NumberOfTeamMatesAdjacent(pSoldier, sGridNo) > 1)
|
const auto nearbyFriends = CountNearbyFriends(pSoldier, sGridNo, TACTICAL_RANGE_VERYCLOSE);
|
||||||
|
if ( nearbyFriends > 1 && !pSoldier->IsZombie() )
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user