From abe648b9d6b3e5b602f686dfe1917ebe6ec36800 Mon Sep 17 00:00:00 2001 From: s1lentq Date: Thu, 14 Dec 2023 03:16:27 +0700 Subject: [PATCH] Use custom assert instead normal --- regamedll/dlls/bot/cs_bot_pathfind.cpp | 2 +- regamedll/dlls/bot/states/cs_bot_idle.cpp | 2 +- regamedll/dlls/buttons.cpp | 10 ++++----- regamedll/dlls/doors.cpp | 14 ++++++------ regamedll/dlls/ehandle.h | 6 +++--- regamedll/dlls/func_tank.cpp | 6 +++--- regamedll/dlls/multiplay_gamerules.cpp | 6 +++--- regamedll/dlls/pathcorner.cpp | 2 +- regamedll/dlls/plats.cpp | 10 ++++----- regamedll/dlls/player.cpp | 9 -------- regamedll/dlls/saverestore.cpp | 4 ++-- regamedll/dlls/subs.cpp | 8 +++---- regamedll/dlls/triggers.cpp | 2 +- regamedll/dlls/weapons.cpp | 2 +- regamedll/game_shared/bitvec.h | 6 +++--- regamedll/game_shared/bot/nav_file.cpp | 7 +++--- regamedll/pm_shared/pm_shared.cpp | 6 +++--- regamedll/public/interface.cpp | 2 +- regamedll/public/regamedll/API/CSPlayer.h | 2 +- regamedll/public/utlsymbol.cpp | 2 +- regamedll/public/utlvector.h | 26 +++++++++++------------ 21 files changed, 62 insertions(+), 72 deletions(-) diff --git a/regamedll/dlls/bot/cs_bot_pathfind.cpp b/regamedll/dlls/bot/cs_bot_pathfind.cpp index 3b733ea1..00386be7 100644 --- a/regamedll/dlls/bot/cs_bot_pathfind.cpp +++ b/regamedll/dlls/bot/cs_bot_pathfind.cpp @@ -1294,7 +1294,7 @@ CCSBot::PathResult CCSBot::UpdatePathMovement(bool allowSpeedChange) if (IsOnLadder()) Jump(MUST_JUMP); - assert(m_pathIndex < m_pathLength); + Assert(m_pathIndex < m_pathLength); // Check if reached the end of the path bool nearEndOfPath = false; diff --git a/regamedll/dlls/bot/states/cs_bot_idle.cpp b/regamedll/dlls/bot/states/cs_bot_idle.cpp index 125d5fee..e38bde88 100644 --- a/regamedll/dlls/bot/states/cs_bot_idle.cpp +++ b/regamedll/dlls/bot/states/cs_bot_idle.cpp @@ -353,7 +353,7 @@ void IdleState::OnUpdate(CCSBot *me) } } - assert((0, "A CT bot doesn't know what to do while the bomb is planted!\n")); + DbgAssert(!"A CT bot doesn't know what to do while the bomb is planted!\n"); } // if we have a sniper rifle, we like to camp, whether rogue or not diff --git a/regamedll/dlls/buttons.cpp b/regamedll/dlls/buttons.cpp index 36e2ff1b..8e38b369 100644 --- a/regamedll/dlls/buttons.cpp +++ b/regamedll/dlls/buttons.cpp @@ -671,7 +671,7 @@ void CBaseButton::ButtonActivate() PlayLockSounds(pev, &m_ls, FALSE, TRUE); } - assert(m_toggle_state == TS_AT_BOTTOM); + DbgAssert(m_toggle_state == TS_AT_BOTTOM); m_toggle_state = TS_GOING_UP; SetMoveDone(&CBaseButton::TriggerAndWait); @@ -688,7 +688,7 @@ void CBaseButton::ButtonActivate() // Button has reached the "in/up" position. Activate its "targets", and pause before "popping out". void CBaseButton::TriggerAndWait() { - assert(m_toggle_state == TS_GOING_UP); + DbgAssert(m_toggle_state == TS_GOING_UP); if (!UTIL_IsMasterTriggered(m_sMaster, m_hActivator)) return; @@ -724,7 +724,7 @@ void CBaseButton::TriggerAndWait() // Starts the button moving "out/down". void CBaseButton::ButtonReturn() { - //assert(m_toggle_state == TS_AT_TOP); + DbgAssert(m_toggle_state == TS_AT_TOP); m_toggle_state = TS_GOING_DOWN; SetMoveDone(&CBaseButton::ButtonBackHome); @@ -763,7 +763,7 @@ void CBaseButton::Restart() // Button has returned to start state. Quiesce it. void CBaseButton::ButtonBackHome() { - assert(m_toggle_state == TS_GOING_DOWN); + DbgAssert(m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_AT_BOTTOM; if (pev->spawnflags & SF_BUTTON_TOGGLE @@ -884,7 +884,7 @@ void CRotButton::Spawn() m_vecAngle1 = pev->angles; m_vecAngle2 = pev->angles + pev->movedir * m_flMoveDistance; - assert(("rotating button start/end positions are equal", m_vecAngle1 != m_vecAngle2)); + DbgAssertMsg(m_vecAngle1 != m_vecAngle2, "rotating button start/end positions are equal"); m_fStayPushed = (m_flWait == -1 ? TRUE : FALSE); m_fRotating = TRUE; diff --git a/regamedll/dlls/doors.cpp b/regamedll/dlls/doors.cpp index c16fe008..ada7e6a8 100644 --- a/regamedll/dlls/doors.cpp +++ b/regamedll/dlls/doors.cpp @@ -215,7 +215,7 @@ void CBaseDoor::Spawn() // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(real_t(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(real_t(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(real_t(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); - assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2)); + DbgAssertMsg(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal"); if (pev->spawnflags & SF_DOOR_START_OPEN) { @@ -494,7 +494,7 @@ void CBaseDoor::DoorGoUp() bool isReversing = (m_toggle_state == TS_GOING_DOWN); // It could be going-down, if blocked. - assert(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN); + DbgAssert(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN); // emit door moving and stop sounds on CHAN_STATIC so that the multicast doesn't // filter them out and leave a client stuck with looping door sounds! @@ -634,7 +634,7 @@ void CBaseDoor::DoorHitTop() EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseArrived), VOL_NORM, ATTN_NORM); } - assert(m_toggle_state == TS_GOING_UP); + DbgAssert(m_toggle_state == TS_GOING_UP); m_toggle_state = TS_AT_TOP; // toggle-doors don't come down automatically, they wait for refire. @@ -696,7 +696,7 @@ void CBaseDoor::DoorGoDown() } #ifdef DOOR_ASSERT - assert(m_toggle_state == TS_AT_TOP); + DbgAssert(m_toggle_state == TS_AT_TOP); #endif m_toggle_state = TS_GOING_DOWN; @@ -724,7 +724,7 @@ void CBaseDoor::DoorHitBottom() EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseArrived), VOL_NORM, ATTN_NORM); } - assert(m_toggle_state == TS_GOING_DOWN); + DbgAssert(m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_AT_BOTTOM; // Re-instate touch method, cycle is complete @@ -927,7 +927,7 @@ void CRotDoor::Spawn() m_vecAngle1 = pev->angles; m_vecAngle2 = pev->angles + pev->movedir * m_flMoveDistance; - assert(("rotating door start/end positions are equal", m_vecAngle1 != m_vecAngle2)); + DbgAssertMsg(m_vecAngle1 != m_vecAngle2, "rotating door start/end positions are equal"); if (pev->spawnflags & SF_DOOR_PASSABLE) pev->solid = SOLID_NOT; @@ -1011,7 +1011,7 @@ void CMomentaryDoor::Spawn() // Subtract 2 from size because the engine expands bboxes by 1 in all directions making the size too big m_vecPosition2 = m_vecPosition1 + (pev->movedir * (Q_fabs(real_t(pev->movedir.x * (pev->size.x - 2))) + Q_fabs(real_t(pev->movedir.y * (pev->size.y - 2))) + Q_fabs(real_t(pev->movedir.z * (pev->size.z - 2))) - m_flLip)); - assert(("door start/end positions are equal", m_vecPosition1 != m_vecPosition2)); + DbgAssertMsg(m_vecPosition1 != m_vecPosition2, "door start/end positions are equal"); if (pev->spawnflags & SF_DOOR_START_OPEN) { diff --git a/regamedll/dlls/ehandle.h b/regamedll/dlls/ehandle.h index 66897fbb..9a871782 100644 --- a/regamedll/dlls/ehandle.h +++ b/regamedll/dlls/ehandle.h @@ -176,7 +176,7 @@ inline int EntityHandle::GetSerialNumber() const template inline bool EntityHandle::operator==(T *pEntity) const { - assert(("EntityHandle::operator==: got a nullptr pointer!", pEntity != nullptr)); + DbgAssertMsg(pEntity != nullptr, "EntityHandle::operator==: got a nullptr pointer!"); if (m_serialnumber != pEntity->edict()->serialnumber) { @@ -221,10 +221,10 @@ template inline T *EntityHandle::operator->() { edict_t *pEdict = Get(); - assert(("EntityHandle::operator->: pointer is nullptr!", pEdict != nullptr)); + DbgAssertMsg(pEdict != nullptr, "EntityHandle::operator->: pointer is nullptr!"); T *pEntity = GET_PRIVATE(pEdict); - assert(("EntityHandle::operator->: pvPrivateData is nullptr!", pEntity != nullptr)); + DbgAssertMsg(pEntity != nullptr, "EntityHandle::operator->: pvPrivateData is nullptr!"); return pEntity; } diff --git a/regamedll/dlls/func_tank.cpp b/regamedll/dlls/func_tank.cpp index 1ca0e966..e12c9076 100644 --- a/regamedll/dlls/func_tank.cpp +++ b/regamedll/dlls/func_tank.cpp @@ -297,11 +297,11 @@ void CFuncTank::StopControl() void CFuncTank::ControllerPostFrame() { - assert(m_pController != nullptr); - if (gpGlobals->time < m_flNextAttack) return; + Assert(m_pController != nullptr); + if (m_pController->pev->button & IN_ATTACK) { Vector vecForward; @@ -879,7 +879,7 @@ void CFuncTankControls::Use(CBaseEntity *pActivator, CBaseEntity *pCaller, USE_T } // if this fails, most likely means save/restore hasn't worked properly - assert(m_pTank != nullptr); + DbgAssert(m_pTank != nullptr); } void CFuncTankControls::Think() diff --git a/regamedll/dlls/multiplay_gamerules.cpp b/regamedll/dlls/multiplay_gamerules.cpp index 6f79f70f..c403c084 100644 --- a/regamedll/dlls/multiplay_gamerules.cpp +++ b/regamedll/dlls/multiplay_gamerules.cpp @@ -4878,7 +4878,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(ChangeLevel)() // find the map to change to char *mapcfile = (char *)CVAR_GET_STRING("mapcyclefile"); - assert(mapcfile != nullptr); + Assert(mapcfile != nullptr); szCommands[0] = '\0'; szRules[0] = '\0'; @@ -4914,7 +4914,7 @@ void EXT_FUNC CHalfLifeMultiplay::__API_HOOK(ChangeLevel)() { keeplooking = false; - assert(item != nullptr); + Assert(item != nullptr); if (item->minplayers != 0) { @@ -5276,7 +5276,7 @@ int CHalfLifeMultiplay::GetRarityOfKill(CBaseEntity *pKiller, CBasePlayer *pVict // That is done so that the domination and revenge will be calculated prior // to the death message being sent to the clients int iAttackerEntityIndex = pKillerPlayer->entindex(); - assert(iAttackerEntityIndex > 0 && iAttackerEntityIndex <= MAX_CLIENTS); + Assert(iAttackerEntityIndex > 0 && iAttackerEntityIndex <= MAX_CLIENTS); int iKillsUnanswered = pVictim->CSPlayer()->m_iNumKilledByUnanswered[iAttackerEntityIndex - 1] + 1; if (iKillsUnanswered == CS_KILLS_FOR_DOMINATION || pKillerPlayer->CSPlayer()->IsPlayerDominated(pVictim->entindex() - 1)) diff --git a/regamedll/dlls/pathcorner.cpp b/regamedll/dlls/pathcorner.cpp index 062d1716..306c2819 100644 --- a/regamedll/dlls/pathcorner.cpp +++ b/regamedll/dlls/pathcorner.cpp @@ -23,7 +23,7 @@ void CPathCorner::KeyValue(KeyValueData *pkvd) void CPathCorner::Spawn() { - assert(("path_corner without a targetname", !pev->targetname.IsNull())); + DbgAssertMsg(!pev->targetname.IsNull(), "path_corner without a targetname"); } TYPEDESCRIPTION CPathTrack::m_SaveData[] = diff --git a/regamedll/dlls/plats.cpp b/regamedll/dlls/plats.cpp index 75a0e96d..f0735053 100644 --- a/regamedll/dlls/plats.cpp +++ b/regamedll/dlls/plats.cpp @@ -382,7 +382,7 @@ void CFuncPlat::GoDown() EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMovement), m_volume, ATTN_NORM); } - assert(m_toggle_state == TS_AT_TOP || m_toggle_state == TS_GOING_UP); + DbgAssert(m_toggle_state == TS_AT_TOP || m_toggle_state == TS_GOING_UP); m_toggle_state = TS_GOING_DOWN; SetMoveDone(&CFuncPlat::CallHitBottom); LinearMove(m_vecPosition2, pev->speed); @@ -401,7 +401,7 @@ void CFuncPlat::HitBottom() EMIT_SOUND(ENT(pev), CHAN_WEAPON, (char *)STRING(pev->noiseStopMoving), m_volume, ATTN_NORM); } - assert(m_toggle_state == TS_GOING_DOWN); + DbgAssert(m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_AT_BOTTOM; } @@ -413,7 +413,7 @@ void CFuncPlat::GoUp() EMIT_SOUND(ENT(pev), CHAN_STATIC, (char *)STRING(pev->noiseMovement), m_volume, ATTN_NORM); } - assert(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN); + DbgAssert(m_toggle_state == TS_AT_BOTTOM || m_toggle_state == TS_GOING_DOWN); m_toggle_state = TS_GOING_UP; SetMoveDone(&CFuncPlat::CallHitTop); LinearMove(m_vecPosition1, pev->speed); @@ -432,7 +432,7 @@ void CFuncPlat::HitTop() EMIT_SOUND(ENT(pev), CHAN_WEAPON, (char *)STRING(pev->noiseStopMoving), m_volume, ATTN_NORM); } - assert(m_toggle_state == TS_GOING_UP); + DbgAssert(m_toggle_state == TS_GOING_UP); m_toggle_state = TS_AT_TOP; if (!IsTogglePlat()) @@ -456,7 +456,7 @@ void CFuncPlat::Blocked(CBaseEntity *pOther) } // Send the platform back where it came from - assert(m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN); + DbgAssert(m_toggle_state == TS_GOING_UP || m_toggle_state == TS_GOING_DOWN); if (m_toggle_state == TS_GOING_UP) { diff --git a/regamedll/dlls/player.cpp b/regamedll/dlls/player.cpp index e2e185a6..0b0ac740 100644 --- a/regamedll/dlls/player.cpp +++ b/regamedll/dlls/player.cpp @@ -6504,8 +6504,6 @@ void EXT_FUNC CBasePlayer::__API_HOOK(ImpulseCommands)() else iOn = 0; - assert(gmsgLogo > 0); - MESSAGE_BEGIN(MSG_ONE, gmsgLogo, nullptr, pev); WRITE_BYTE(iOn); MESSAGE_END(); @@ -7143,9 +7141,6 @@ void CBasePlayer::SendAmmoUpdate() { m_rgAmmoLast[i] = m_rgAmmo[i]; - assert(m_rgAmmo[i] >= 0); - assert(m_rgAmmo[i] <= 255); - // send "Ammo" update message MESSAGE_BEGIN(MSG_ONE, gmsgAmmoX, nullptr, pev); WRITE_BYTE(i); @@ -7427,8 +7422,6 @@ void EXT_FUNC CBasePlayer::__API_HOOK(UpdateClientData)() { m_iClientBattery = int(pev->armorvalue); - assert(gmsgBattery > 0); - // send "armor" update message MESSAGE_BEGIN(MSG_ONE, gmsgBattery, nullptr, pev); WRITE_SHORT(int(pev->armorvalue)); @@ -7510,8 +7503,6 @@ void EXT_FUNC CBasePlayer::__API_HOOK(UpdateClientData)() if (m_iTrain & TRAIN_NEW) { - assert(gmsgTrain > 0); - // send "train hud" update message MESSAGE_BEGIN(MSG_ONE, gmsgTrain, nullptr, pev); WRITE_BYTE(m_iTrain & 0xF); diff --git a/regamedll/dlls/saverestore.cpp b/regamedll/dlls/saverestore.cpp index a8e63d12..a3a55c7f 100644 --- a/regamedll/dlls/saverestore.cpp +++ b/regamedll/dlls/saverestore.cpp @@ -955,10 +955,10 @@ void CGlobalState::DumpGlobals() void CGlobalState::EntityAdd(string_t globalname, string_t mapName, GLOBALESTATE state) { - assert(!Find(globalname)); + DbgAssert(!Find(globalname)); globalentity_t *pNewEntity = (globalentity_t *)calloc(sizeof(globalentity_t), 1); - assert(pNewEntity != nullptr); + DbgAssert(pNewEntity != nullptr); pNewEntity->pNext = m_pList; m_pList = pNewEntity; diff --git a/regamedll/dlls/subs.cpp b/regamedll/dlls/subs.cpp index ad269c06..4c938c27 100644 --- a/regamedll/dlls/subs.cpp +++ b/regamedll/dlls/subs.cpp @@ -330,8 +330,8 @@ void CBaseToggle::KeyValue(KeyValueData *pkvd) // pev->origin traveling at flSpeed void CBaseToggle::LinearMove(Vector vecDest, float flSpeed) { - assert(("LinearMove: no speed is defined!", flSpeed != 0)); - //assert(("LinearMove: no post-move function defined", m_pfnCallWhenMoveDone != nullptr)); + DbgAssertMsg(flSpeed != 0, "LinearMove: no speed is defined!"); + //DbgAssertMsg(m_pfnCallWhenMoveDone != nullptr, "LinearMove: no post-move function defined"); m_vecFinalDest = vecDest; @@ -382,8 +382,8 @@ NOXREF BOOL CBaseToggle::IsLockedByMaster() // Just like LinearMove, but rotational. void CBaseToggle::AngularMove(Vector vecDestAngle, float flSpeed) { - assert(("AngularMove: no speed is defined!", flSpeed != 0)); - //assert(("AngularMove: no post-move function defined", m_pfnCallWhenMoveDone != nullptr)); + DbgAssertMsg(flSpeed != 0, "AngularMove: no speed is defined!"); + //DbgAssertMsg(m_pfnCallWhenMoveDone != nullptr, "AngularMove: no post-move function defined"); m_vecFinalAngle = vecDestAngle; diff --git a/regamedll/dlls/triggers.cpp b/regamedll/dlls/triggers.cpp index 49819a0e..c4af258c 100644 --- a/regamedll/dlls/triggers.cpp +++ b/regamedll/dlls/triggers.cpp @@ -971,7 +971,7 @@ void CTriggerMultiple::Spawn() InitTrigger(); - assert(("trigger_multiple with health", pev->health == 0)); + DbgAssertMsg(pev->health == 0, "trigger_multiple with health"); //UTIL_SetOrigin(pev, pev->origin); //SET_MODEL(ENT(pev), STRING(pev->model)); diff --git a/regamedll/dlls/weapons.cpp b/regamedll/dlls/weapons.cpp index 3baa8a44..ee35153f 100644 --- a/regamedll/dlls/weapons.cpp +++ b/regamedll/dlls/weapons.cpp @@ -236,7 +236,7 @@ int AddAmmoNameToAmmoRegistry(const char *szAmmoname) } giAmmoIndex++; - assert(giAmmoIndex < MAX_AMMO_SLOTS); + DbgAssert(giAmmoIndex < MAX_AMMO_SLOTS); if (giAmmoIndex >= MAX_AMMO_SLOTS) giAmmoIndex = 1; diff --git a/regamedll/game_shared/bitvec.h b/regamedll/game_shared/bitvec.h index 52f91b53..36c6b738 100644 --- a/regamedll/game_shared/bitvec.h +++ b/regamedll/game_shared/bitvec.h @@ -127,7 +127,7 @@ inline CBitVec &CBitVec::operator=(CBitVec const & template inline CBitVecAccessor CBitVec::operator[](int i) { - assert(i >= 0 && i < GetNumBits()); + DbgAssert(i >= 0 && i < GetNumBits()); return CBitVecAccessor(m_DWords, i); } @@ -152,13 +152,13 @@ inline bool CBitVec::operator!=(CBitVec const &other) template inline uint32 CBitVec::GetDWord(int i) { - assert(i >= 0 && i < NUM_DWORDS); + DbgAssert(i >= 0 && i < NUM_DWORDS); return m_DWords[i]; } template inline void CBitVec::SetDWord(int i, uint32 val) { - assert(i >= 0 && i < NUM_DWORDS); + DbgAssert(i >= 0 && i < NUM_DWORDS); m_DWords[i] = val; } diff --git a/regamedll/game_shared/bot/nav_file.cpp b/regamedll/game_shared/bot/nav_file.cpp index 1e8bf717..ad04f52c 100644 --- a/regamedll/game_shared/bot/nav_file.cpp +++ b/regamedll/game_shared/bot/nav_file.cpp @@ -15,7 +15,6 @@ #include #include -#include #ifndef _WIN32 #include @@ -42,7 +41,7 @@ PlaceDirectory::EntryType PlaceDirectory::GetEntry(Place place) const auto it = std::find(m_directory.begin(), m_directory.end(), place); if (it == m_directory.end()) { - assert(false && "PlaceDirectory::GetEntry failure"); + DbgAssert(false && "PlaceDirectory::GetEntry failure"); return 0; } @@ -54,7 +53,7 @@ void PlaceDirectory::AddPlace(Place place) if (place == UNDEFINED_PLACE) return; - assert(place < 1000); + DbgAssert(place < 1000); if (IsKnown(place)) return; @@ -70,7 +69,7 @@ Place PlaceDirectory::EntryToPlace(EntryType entry) const unsigned int i = entry - 1; if (i > m_directory.size()) { - assert(false && "PlaceDirectory::EntryToPlace: Invalid entry"); + DbgAssert(false && "PlaceDirectory::EntryToPlace: Invalid entry"); return UNDEFINED_PLACE; } diff --git a/regamedll/pm_shared/pm_shared.cpp b/regamedll/pm_shared/pm_shared.cpp index c452e406..b41a2392 100644 --- a/regamedll/pm_shared/pm_shared.cpp +++ b/regamedll/pm_shared/pm_shared.cpp @@ -138,7 +138,7 @@ char EXT_FUNC PM_FindTextureType(char *name) int left, right, pivot; int val; - assert(pm_shared_initialized); + DbgAssert(pm_shared_initialized); left = 0; right = pm_gcTextures - 1; @@ -3272,7 +3272,7 @@ LINK_HOOK_VOID_CHAIN(PM_Move, (struct playermove_s *ppmove, int server), ppmove, // and client. This will ensure that prediction behaves appropriately. void EXT_FUNC __API_HOOK(PM_Move)(struct playermove_s *ppmove, int server) { - assert(pm_shared_initialized); + DbgAssert(pm_shared_initialized); pmove = ppmove; @@ -3317,7 +3317,7 @@ LINK_HOOK_VOID_CHAIN(PM_Init, (struct playermove_s *ppmove), ppmove) void EXT_FUNC __API_HOOK(PM_Init)(struct playermove_s *ppmove) { - assert(!pm_shared_initialized); + DbgAssert(!pm_shared_initialized); pmove = ppmove; diff --git a/regamedll/public/interface.cpp b/regamedll/public/interface.cpp index 8c6dd0cc..d1cf9283 100644 --- a/regamedll/public/interface.cpp +++ b/regamedll/public/interface.cpp @@ -230,7 +230,7 @@ void *InitializeInterface(char const *interfaceName, CreateInterfaceFn *factoryL } // No provider for requested interface!!! - // assert(!"No provider for requested interface!!!"); + // Assert(!"No provider for requested interface!!!"); return nullptr; } diff --git a/regamedll/public/regamedll/API/CSPlayer.h b/regamedll/public/regamedll/API/CSPlayer.h index a975bcc9..dd44697e 100644 --- a/regamedll/public/regamedll/API/CSPlayer.h +++ b/regamedll/public/regamedll/API/CSPlayer.h @@ -207,6 +207,6 @@ inline bool CCSPlayer::IsPlayerDominated(int iPlayerIndex) const inline void CCSPlayer::SetPlayerDominated(CBasePlayer *pPlayer, bool bDominated) { int iPlayerIndex = pPlayer->entindex(); - assert(iPlayerIndex > 0 && iPlayerIndex <= MAX_CLIENTS); + Assert(iPlayerIndex > 0 && iPlayerIndex <= MAX_CLIENTS); m_bPlayerDominated[iPlayerIndex - 1] = bDominated; } diff --git a/regamedll/public/utlsymbol.cpp b/regamedll/public/utlsymbol.cpp index 1299d785..078ff67d 100644 --- a/regamedll/public/utlsymbol.cpp +++ b/regamedll/public/utlsymbol.cpp @@ -126,7 +126,7 @@ const char *CUtlSymbolTable::String(CUtlSymbol id) const if (!id.IsValid()) return ""; - assert(m_Lookup.IsValidIndex((UtlSymId_t)id)); + DbgAssert(m_Lookup.IsValidIndex((UtlSymId_t)id)); return &m_Strings[id]; } diff --git a/regamedll/public/utlvector.h b/regamedll/public/utlvector.h index 70ed7984..e3f34e58 100644 --- a/regamedll/public/utlvector.h +++ b/regamedll/public/utlvector.h @@ -144,7 +144,7 @@ public: protected: // Can't copy this unless we explicitly do it! - CUtlVector(CUtlVector const &vec) { assert(0); } + CUtlVector(CUtlVector const &vec) { Assert(0); } // Grows the vector void GrowVector(int num = 1); @@ -203,28 +203,28 @@ inline CUtlVector &CUtlVector::operator=(const CUtlVector &other) template inline T &CUtlVector::operator[](int i) { - assert(IsValidIndex(i)); + DbgAssert(IsValidIndex(i)); return m_Memory[i]; } template inline T const &CUtlVector::operator[](int i) const { - assert(IsValidIndex(i)); + DbgAssert(IsValidIndex(i)); return m_Memory[i]; } template inline T &CUtlVector::Element(int i) { - assert(IsValidIndex(i)); + DbgAssert(IsValidIndex(i)); return m_Memory[i]; } template inline T const &CUtlVector::Element(int i) const { - assert(IsValidIndex(i)); + DbgAssert(IsValidIndex(i)); return m_Memory[i]; } @@ -301,7 +301,7 @@ void CUtlVector::EnsureCount(int num) template void CUtlVector::ShiftElementsRight(int elem, int num) { - assert(IsValidIndex(elem) || (m_Size == 0) || (num == 0)); + DbgAssert(IsValidIndex(elem) || (m_Size == 0) || (num == 0)); int numToMove = m_Size - elem - num; if ((numToMove > 0) && (num > 0)) memmove(&Element(elem+num), &Element(elem), numToMove * sizeof(T)); @@ -310,7 +310,7 @@ void CUtlVector::ShiftElementsRight(int elem, int num) template void CUtlVector::ShiftElementsLeft(int elem, int num) { - assert(IsValidIndex(elem) || (m_Size == 0) || (num == 0)); + DbgAssert(IsValidIndex(elem) || (m_Size == 0) || (num == 0)); int numToMove = m_Size - elem - num; if ((numToMove > 0) && (num > 0)) { @@ -345,7 +345,7 @@ template int CUtlVector::InsertBefore(int elem) { // Can insert at the end - assert((elem == Count()) || IsValidIndex(elem)); + DbgAssert((elem == Count()) || IsValidIndex(elem)); GrowVector(); ShiftElementsRight(elem); @@ -376,7 +376,7 @@ template< class T > int CUtlVector::InsertBefore(int elem, T const &src) { // Can insert at the end - assert((elem == Count()) || IsValidIndex(elem)); + DbgAssert((elem == Count()) || IsValidIndex(elem)); GrowVector(); ShiftElementsRight(elem); @@ -450,7 +450,7 @@ inline int CUtlVector::InsertMultipleBefore(int elem, int num, const T *pToIn return elem; // Can insert at the end - assert((elem == Count()) || IsValidIndex(elem)); + DbgAssert((elem == Count()) || IsValidIndex(elem)); GrowVector(num); ShiftElementsRight(elem, num); @@ -496,7 +496,7 @@ bool CUtlVector::HasElement(T const &src) template void CUtlVector::FastRemove(int elem) { - assert(IsValidIndex(elem)); + DbgAssert(IsValidIndex(elem)); Destruct(&Element(elem)); if (m_Size > 0) @@ -527,8 +527,8 @@ void CUtlVector::FindAndRemove(T const &src) template void CUtlVector::RemoveMultiple(int elem, int num) { - assert(IsValidIndex(elem)); - assert(elem + num <= Count()); + DbgAssert(IsValidIndex(elem)); + DbgAssert(elem + num <= Count()); for (int i = elem + num; --i >= elem;) Destruct(&Element(i));