ADB's fix for wandering shopkeepers and other civs

Fix for medics in autobandage trying to open locked or trapped doors and causing UI lockup due to door open menu popup


git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@1550 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
Overhaul
2007-10-25 09:20:28 +00:00
parent a1ac43ee58
commit 51539605f5
3 changed files with 26 additions and 1 deletions
+7
View File
@@ -386,6 +386,13 @@ void InteractWithOpenableStruct( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, U
// Pull Up Menu
if ( !fTrapsFound )
{
// In autobandage mode, assuming no traps are found, try to automatically unlock the door. If we can't, then we can't
if (gTacticalStatus.fAutoBandageMode)
{
AttemptToUnlockDoor( pSoldier, pDoor);
return;
}
InitDoorOpenMenu( pSoldier, pStructure, ubDirection, FALSE );
}
else
+6
View File
@@ -2161,6 +2161,12 @@ BOOLEAN InitDoorOpenMenu( SOLDIERTYPE *pSoldier, STRUCTURE *pStructure, UINT8 ub
INT16 sHeight, sWidth;
INT16 sScreenX, sScreenY;
// Can't bring up this menu if in autobandage mode
if (gTacticalStatus.fAutoBandageMode)
{
return FALSE;
}
// Erase other menus....
EraseInterfaceMenus( TRUE );
+13 -1
View File
@@ -1528,7 +1528,19 @@ INT8 DecideActionYellow(SOLDIERTYPE *pSoldier)
// However, civilians with no profile (and likely no weapons) do not need to be seeking out noises. Most don't
// even have the body type for it (can't climb or jump).
//if ( !( pSoldier->bTeam == CIV_TEAM && pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
if ( pSoldier->bTeam != CIV_TEAM || ( pSoldier->ubProfile != NO_PROFILE && pSoldier->ubProfile != ELDIN ) )
//if ( pSoldier->bTeam != CIV_TEAM || ( !pSoldier->bNeutral && pSoldier->ubProfile != ELDIN ) )
// ADB: Eldin is the only neutral civilian who should be seeking out noises. As the museum curator, he can be
// available to talk to. As the night watchman, he needs to look for thieves.
bool onCivTeam = (pSoldier->bTeam == CIV_TEAM);
bool isNamedCiv = (pSoldier->ubProfile != NO_PROFILE);
bool isEldin = (pSoldier->ubProfile == ELDIN);//logically flipped from the original, isNotEldin == false is confusing
// For purpose of seeking noise, cowardly civs are neutral, even if attacked by your thugs
bool isNeutral = pSoldier->bNeutral || pSoldier->uiStatusFlags & SOLDIER_COWERING;
if (
(onCivTeam == false) || //true #1
(onCivTeam == true && isNamedCiv == true && isNeutral == false) || //true #2
(onCivTeam == true && isEldin == true)//true #3
)
{
// IF WE ARE MILITIA/CIV IN REALTIME, CLOSE TO NOISE, AND CAN SEE THE SPOT WHERE THE NOISE CAME FROM, FORGET IT
if ( fReachable && !fClimb && !gfTurnBasedAI && (pSoldier->bTeam == MILITIA_TEAM || pSoldier->bTeam == CIV_TEAM )&& PythSpacesAway( pSoldier->sGridNo, sNoiseGridNo ) < 5 )