Sanitizer fixes

This commit is contained in:
erorcun 2021-06-30 03:31:10 +03:00
parent de4699a97e
commit 9f0daee186
4 changed files with 14 additions and 11 deletions

View File

@ -1250,14 +1250,14 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
{ {
ASSERT( nComment < TOTAL_AUDIO_SAMPLES ); ASSERT( nComment < TOTAL_AUDIO_SAMPLES );
int8 slot;
for ( int32 i = 0; i < _TODOCONST(3); i++ ) for ( int32 i = 0; i < _TODOCONST(3); i++ )
{ {
slot = nCurrentPedSlot - i - 1;
#ifdef FIX_BUGS #ifdef FIX_BUGS
int8 slot = (int8)nCurrentPedSlot - i - 1;
if (slot < 0) if (slot < 0)
slot += ARRAY_SIZE(nPedSlotSfx); slot += ARRAY_SIZE(nPedSlotSfx);
#else
uint8 slot = nCurrentPedSlot - i - 1;
#endif #endif
if ( nComment == nPedSlotSfx[slot] ) if ( nComment == nPedSlotSfx[slot] )
return TRUE; return TRUE;
@ -1270,14 +1270,14 @@ cSampleManager::IsPedCommentLoaded(uint32 nComment)
int32 int32
cSampleManager::_GetPedCommentSlot(uint32 nComment) cSampleManager::_GetPedCommentSlot(uint32 nComment)
{ {
int8 slot;
for (int32 i = 0; i < _TODOCONST(3); i++) for (int32 i = 0; i < _TODOCONST(3); i++)
{ {
slot = nCurrentPedSlot - i - 1;
#ifdef FIX_BUGS #ifdef FIX_BUGS
int8 slot = (int8)nCurrentPedSlot - i - 1;
if (slot < 0) if (slot < 0)
slot += ARRAY_SIZE(nPedSlotSfx); slot += ARRAY_SIZE(nPedSlotSfx);
#else
uint8 slot = nCurrentPedSlot - i - 1;
#endif #endif
if (nComment == nPedSlotSfx[slot]) if (nComment == nPedSlotSfx[slot])
return slot; return slot;

View File

@ -644,6 +644,9 @@ CCopPed::ProcessControl(void)
int numCopsNear = 0; int numCopsNear = 0;
for (int i = 0; i < player->m_numNearPeds; ++i) { for (int i = 0; i < player->m_numNearPeds; ++i) {
CPed *nearPed = player->m_nearPeds[i]; CPed *nearPed = player->m_nearPeds[i];
#ifdef FIX_BUGS
if (nearPed)
#endif
if (nearPed->m_nPedType == PEDTYPE_COP && nearPed->m_nPedState != PED_DEAD) if (nearPed->m_nPedType == PEDTYPE_COP && nearPed->m_nPedState != PED_DEAD)
++numCopsNear; ++numCopsNear;
} }

View File

@ -1304,7 +1304,7 @@ CPed::StartFightDefend(uint8 direction, uint8 hitLevel, uint8 unk)
if (IsPlayer()) if (IsPlayer())
moveAssoc->speed = 1.2f; moveAssoc->speed = 1.2f;
m_takeAStepAfterAttack = 0; m_takeAStepAfterAttack = false;
m_fightButtonPressure = 0; m_fightButtonPressure = 0;
} else if (IsPlayer() && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE && } else if (IsPlayer() && GetWeapon()->m_eWeaponType != WEAPONTYPE_UNARMED && GetWeapon()->m_eWeaponType != WEAPONTYPE_BRASSKNUCKLE &&

View File

@ -837,8 +837,8 @@ CPlayerPed::PlayerControlFighter(CPad *padUsed)
if (padMove > 0.0f) { if (padMove > 0.0f) {
m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown) - TheCamera.Orientation; m_fRotationDest = CGeneral::GetRadianAngleBetweenPoints(0.0f, 0.0f, -leftRight, upDown) - TheCamera.Orientation;
m_takeAStepAfterAttack = padMove > 2 * PAD_MOVE_TO_GAME_WORLD_MOVE; m_takeAStepAfterAttack = padMove > (2 * PAD_MOVE_TO_GAME_WORLD_MOVE);
if (padUsed->GetSprint() && padMove > 1 * PAD_MOVE_TO_GAME_WORLD_MOVE) if (padUsed->GetSprint() && padMove > (1 * PAD_MOVE_TO_GAME_WORLD_MOVE))
bIsAttacking = false; bIsAttacking = false;
} }
@ -2081,8 +2081,8 @@ void
CPlayerPed::RemovePedFromMeleeList(CPed *ped) CPlayerPed::RemovePedFromMeleeList(CPed *ped)
{ {
int i = 0; int i = 0;
for (; m_pMeleeList[i] != ped; i++) { while (m_pMeleeList[i] != ped) {
if (i >= ARRAY_SIZE(m_pMeleeList)) if (++i >= ARRAY_SIZE(m_pMeleeList))
return; return;
} }
m_pMeleeList[i] = nil; m_pMeleeList[i] = nil;