mirror of
https://github.com/s1lentq/ReGameDLL_CS.git
synced 2025-02-03 17:20:34 +03:00
fixed issues reported by static analyzer
This commit is contained in:
parent
8a77bba94d
commit
6f0d17bb74
@ -464,6 +464,7 @@ bool BotPhraseManager::Initialize(const char *filename, int bankIndex)
|
||||
phraseData = SharedParse(phraseData);
|
||||
if (!phraseData)
|
||||
{
|
||||
if (phrase) delete phrase;
|
||||
CONSOLE_ECHO("Error parsing '%s' - expected identifier\n", filename);
|
||||
FREE_FILE(phraseDataFile);
|
||||
return false;
|
||||
|
@ -260,7 +260,7 @@ void CCareerTask::OnEvent(GameEventType event, CBasePlayer *pVictim, CBasePlayer
|
||||
|
||||
while ((pHostage = UTIL_FindEntityByClassname(pHostage, "hostage_entity")))
|
||||
{
|
||||
if (pHostage && pHostage->IsDead())
|
||||
if (pHostage->IsDead())
|
||||
hostagesCount++;
|
||||
}
|
||||
|
||||
@ -389,7 +389,6 @@ void CCareerTaskManager::Reset(bool deleteTasks)
|
||||
delete task;
|
||||
|
||||
m_tasks.clear();
|
||||
m_nextId = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -397,6 +396,7 @@ void CCareerTaskManager::Reset(bool deleteTasks)
|
||||
task->Reset();
|
||||
}
|
||||
|
||||
m_nextId = 0;
|
||||
m_finishedTaskTime = 0;
|
||||
m_finishedTaskRound = 0;
|
||||
m_shouldLatchRoundEndMessage = false;
|
||||
|
@ -811,7 +811,9 @@ void Host_Say(edict_t *pEntity, BOOL teamonly)
|
||||
if (*p == '"')
|
||||
{
|
||||
p++;
|
||||
p[Q_strlen(p) - 1] = '\0';
|
||||
size_t len = Q_strlen(p);
|
||||
if (len > 0)
|
||||
p[len - 1] = '\0';
|
||||
}
|
||||
|
||||
// Check if buffer contains an invalid unicode sequence
|
||||
|
@ -285,8 +285,6 @@ void RadiusDamage(Vector vecSrc, entvars_t *pevInflictor, entvars_t *pevAttacker
|
||||
damageRatio = GetAmountOfPlayerVisible(vecSrc, pEntity);
|
||||
}
|
||||
|
||||
damageRatio = GetAmountOfPlayerVisible(vecSrc, pEntity);
|
||||
|
||||
float length;
|
||||
#ifdef REGAMEDLL_ADD
|
||||
// allow to damage breakable objects
|
||||
|
@ -130,6 +130,10 @@ inline edict_t *EntityHandle<T>::Set(edict_t *pEdict)
|
||||
{
|
||||
m_serialnumber = pEdict->serialnumber;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_serialnumber = 0;
|
||||
}
|
||||
|
||||
return pEdict;
|
||||
}
|
||||
|
@ -302,7 +302,7 @@ void CFuncTank::ControllerPostFrame()
|
||||
|
||||
Assert(m_pController != nullptr);
|
||||
|
||||
if (m_pController->pev->button & IN_ATTACK)
|
||||
if (m_pController && m_pController->pev->button & IN_ATTACK)
|
||||
{
|
||||
Vector vecForward;
|
||||
UTIL_MakeVectorsPrivate(pev->angles, vecForward, nullptr, nullptr);
|
||||
|
@ -624,7 +624,7 @@ void CHostage::TraceAttack(entvars_t *pevAttacker, float flDamage, Vector vecDir
|
||||
BOOL CHostage::TakeDamage(entvars_t *pevInflictor, entvars_t *pevAttacker, float flDamage, int bitsDamageType)
|
||||
{
|
||||
#ifdef REGAMEDLL_ADD
|
||||
if (!CanTakeDamage(pevAttacker))
|
||||
if (pevAttacker && !CanTakeDamage(pevAttacker))
|
||||
return FALSE;
|
||||
#endif
|
||||
|
||||
|
@ -78,7 +78,7 @@ void HostageIdleState::OnUpdate(CHostageImprov *improv)
|
||||
}
|
||||
}
|
||||
|
||||
if (m_moveState && improv->IsAtMoveGoal())
|
||||
if (m_moveState != NotMoving && improv->IsAtMoveGoal())
|
||||
{
|
||||
m_moveState = NotMoving;
|
||||
|
||||
|
@ -5158,12 +5158,9 @@ void CBasePlayer::UpdatePlayerSound()
|
||||
m_iExtraSoundTypes = 0;
|
||||
}
|
||||
|
||||
if (pSound)
|
||||
{
|
||||
pSound->m_vecOrigin = pev->origin;
|
||||
pSound->m_iVolume = iVolume;
|
||||
pSound->m_iType |= (bits_SOUND_PLAYER | m_iExtraSoundTypes);
|
||||
}
|
||||
pSound->m_vecOrigin = pev->origin;
|
||||
pSound->m_iVolume = iVolume;
|
||||
pSound->m_iType |= (bits_SOUND_PLAYER | m_iExtraSoundTypes);
|
||||
|
||||
// keep track of virtual muzzle flash
|
||||
m_iWeaponFlash -= 256 * gpGlobals->frametime;
|
||||
@ -5913,7 +5910,7 @@ void EXT_FUNC CBasePlayer::__API_HOOK(Spawn)()
|
||||
TheBots->OnEvent(EVENT_PLAYER_SPAWNED, this);
|
||||
}
|
||||
|
||||
m_allowAutoFollowTime = false;
|
||||
m_allowAutoFollowTime = 0.0f;
|
||||
|
||||
for (i = 0; i < COMMANDS_TO_TRACK; i++)
|
||||
m_flLastCommandTime[i] = -1;
|
||||
@ -8470,7 +8467,7 @@ void CBasePlayer::__API_HOOK(SwitchTeam)()
|
||||
|
||||
UpdateLocation(true);
|
||||
|
||||
if (m_iTeam)
|
||||
if (m_iTeam != UNASSIGNED)
|
||||
{
|
||||
SetScoreboardAttributes();
|
||||
}
|
||||
@ -9682,7 +9679,7 @@ void CBasePlayer::PrioritizeAutoBuyString(char (&autobuyString)[MAX_AUTOBUY_LENG
|
||||
int newStringPos = 0;
|
||||
char priorityToken[32];
|
||||
|
||||
if (!priorityString || !autobuyString)
|
||||
if (!priorityString)
|
||||
return;
|
||||
|
||||
const char *priorityChar = priorityString;
|
||||
|
@ -250,10 +250,10 @@ edict_t *CSaveRestoreBuffer::EntityFromIndex(int entityIndex)
|
||||
|
||||
int CSaveRestoreBuffer::EntityFlagsSet(int entityIndex, int flags)
|
||||
{
|
||||
if (!m_pData || entityIndex < 0)
|
||||
if (!m_pData)
|
||||
return 0;
|
||||
|
||||
if (!m_pData || entityIndex < 0 || entityIndex > m_pData->tableCount)
|
||||
if (entityIndex < 0 || entityIndex > m_pData->tableCount)
|
||||
return 0;
|
||||
|
||||
m_pData->pTable[entityIndex].flags |= flags;
|
||||
|
@ -1362,7 +1362,7 @@ void SENTENCEG_Init()
|
||||
|
||||
i = 0;
|
||||
|
||||
while (rgsentenceg[i].count && i < MAX_SENTENCE_GROUPS)
|
||||
while (i < MAX_SENTENCE_GROUPS && rgsentenceg[i].count)
|
||||
{
|
||||
USENTENCEG_InitLRU(&(rgsentenceg[i].rgblru[0]), rgsentenceg[i].count);
|
||||
i++;
|
||||
@ -1380,11 +1380,7 @@ int SENTENCEG_Lookup(const char *sample, char (&sentencenum)[32])
|
||||
{
|
||||
if (!Q_stricmp(gszallsentencenames[i], sample + 1))
|
||||
{
|
||||
if (sentencenum)
|
||||
{
|
||||
Q_snprintf(sentencenum, sizeof(sentencenum), "!%d", i);
|
||||
}
|
||||
|
||||
Q_snprintf(sentencenum, sizeof(sentencenum), "!%d", i);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ void PlayCDTrack(edict_t *pClient, int iTrack)
|
||||
if (!pClient)
|
||||
return;
|
||||
|
||||
if (iTrack < -1 || iTrack > 30)
|
||||
if (iTrack < -1 || iTrack >= (int)ARRAYSIZE(g_szMP3trackFileMap))
|
||||
{
|
||||
ALERT(at_console, "TriggerCDAudio - Track %d out of range\n", iTrack);
|
||||
return;
|
||||
|
@ -343,15 +343,20 @@ void CFuncVehicle::CheckTurning()
|
||||
if (pev->speed > 0)
|
||||
{
|
||||
UTIL_TraceLine(m_vFrontRight, m_vFrontRight - (gpGlobals->v_right * 16.0), ignore_monsters, dont_ignore_glass, ENT(pev), &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
m_iTurnAngle = 1;
|
||||
}
|
||||
}
|
||||
else if (pev->speed < 0)
|
||||
{
|
||||
UTIL_TraceLine(m_vBackLeft, m_vBackLeft + (gpGlobals->v_right * 16.0), ignore_monsters, dont_ignore_glass, ENT(pev), &tr);
|
||||
}
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
m_iTurnAngle = 1;
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
m_iTurnAngle = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (m_iTurnAngle > 0)
|
||||
@ -359,15 +364,20 @@ void CFuncVehicle::CheckTurning()
|
||||
if (pev->speed > 0)
|
||||
{
|
||||
UTIL_TraceLine(m_vFrontLeft, m_vFrontLeft + (gpGlobals->v_right * 16.0), ignore_monsters, dont_ignore_glass, ENT(pev), &tr);
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
m_iTurnAngle = -1;
|
||||
}
|
||||
}
|
||||
else if (pev->speed < 0)
|
||||
{
|
||||
UTIL_TraceLine(m_vBackRight, m_vBackRight - (gpGlobals->v_right * 16.0), ignore_monsters, dont_ignore_glass, ENT(pev), &tr);
|
||||
}
|
||||
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
m_iTurnAngle = -1;
|
||||
if (tr.flFraction != 1.0f)
|
||||
{
|
||||
m_iTurnAngle = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1333,7 +1333,6 @@ private:
|
||||
|
||||
const float M3_MAX_SPEED = 230.0f;
|
||||
const float M3_DAMAGE = 20.0f;
|
||||
const Vector M3_CONE_VECTOR = Vector(0.0675, 0.0675, 0.0); // special shotgun spreads
|
||||
|
||||
enum m3_e
|
||||
{
|
||||
@ -1764,7 +1763,6 @@ private:
|
||||
|
||||
const float XM1014_MAX_SPEED = 240.0f;
|
||||
const float XM1014_DAMAGE = 20.0f;
|
||||
const Vector XM1014_CONE_VECTOR = Vector(0.0725, 0.0725, 0.0); // special shotgun spreads
|
||||
|
||||
enum xm1014_e
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
const Vector M3_CONE_VECTOR = {0.0675, 0.0675, 0.0}; // special shotgun spreads
|
||||
|
||||
LINK_ENTITY_TO_CLASS(weapon_m3, CM3, CCSM3)
|
||||
|
||||
void CM3::Spawn()
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include "precompiled.h"
|
||||
|
||||
const Vector XM1014_CONE_VECTOR = {0.0725, 0.0725, 0.0}; // special shotgun spreads
|
||||
|
||||
LINK_ENTITY_TO_CLASS(weapon_xm1014, CXM1014, CCSXM1014)
|
||||
|
||||
void CXM1014::Spawn()
|
||||
|
@ -67,7 +67,7 @@ Place PlaceDirectory::EntryToPlace(EntryType entry) const
|
||||
return UNDEFINED_PLACE;
|
||||
|
||||
unsigned int i = entry - 1;
|
||||
if (i > m_directory.size())
|
||||
if (i >= m_directory.size())
|
||||
{
|
||||
DbgAssert(false && "PlaceDirectory::EntryToPlace: Invalid entry");
|
||||
return UNDEFINED_PLACE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user