- Blood: Add some nullptr checks to the aiPatrol*() inline bools.

This commit is contained in:
Mitchell Richters 2021-07-25 15:37:50 +10:00
parent 7329cb8f1f
commit ffe62da3c7

View file

@ -435,19 +435,19 @@ inline int aiPatrolGetVelocity(int speed, int value) {
} }
inline bool aiPatrolWaiting(AISTATE* pAiState) { inline bool aiPatrolWaiting(AISTATE* pAiState) {
return (pAiState->stateType >= kAiStatePatrolWaitL && pAiState->stateType <= kAiStatePatrolWaitW); return (pAiState && pAiState->stateType >= kAiStatePatrolWaitL && pAiState->stateType <= kAiStatePatrolWaitW);
} }
inline bool aiPatrolMoving(AISTATE* pAiState) { inline bool aiPatrolMoving(AISTATE* pAiState) {
return (pAiState->stateType >= kAiStatePatrolMoveL && pAiState->stateType <= kAiStatePatrolMoveW); return (pAiState && pAiState->stateType >= kAiStatePatrolMoveL && pAiState->stateType <= kAiStatePatrolMoveW);
} }
inline bool aiPatrolTurning(AISTATE* pAiState) { inline bool aiPatrolTurning(AISTATE* pAiState) {
return (pAiState->stateType >= kAiStatePatrolTurnL && pAiState->stateType <= kAiStatePatrolTurnW); return (pAiState && pAiState->stateType >= kAiStatePatrolTurnL && pAiState->stateType <= kAiStatePatrolTurnW);
} }
inline bool aiInPatrolState(AISTATE* pAiState) { inline bool aiInPatrolState(AISTATE* pAiState) {
return (pAiState->stateType >= kAiStatePatrolBase && pAiState->stateType < kAiStatePatrolMax); return (pAiState && pAiState->stateType >= kAiStatePatrolBase && pAiState->stateType < kAiStatePatrolMax);
} }
inline bool aiInPatrolState(int nAiStateType) { inline bool aiInPatrolState(int nAiStateType) {