Add trace log for a particular case.

Enable RTTI
This commit is contained in:
s1lent 2018-02-14 16:02:00 +07:00
parent 60b6cf9160
commit 7064fa31e2
No known key found for this signature in database
GPG Key ID: 0FE401DC73916B5C
5 changed files with 51 additions and 1 deletions

View File

@ -119,7 +119,7 @@ void setupToolchain(NativeBinarySpec b)
cfg.compilerOptions.enhancedInstructionsSet = EnhancedInstructionsSet.DISABLED
}
else {
cfg.compilerOptions.args '/Oi', '/GF', '/GS-', '/GR-'
cfg.compilerOptions.args '/Oi', '/GF', '/GS-'
}
cfg.projectLibpath(project, '/lib')

View File

@ -1438,6 +1438,28 @@ void OnFreeEntPrivateData(edict_t *pEnt)
if (!pEntity)
return;
#ifdef REGAMEDLL_FIXES
for (int i = 1; i <= gpGlobals->maxClients; i++)
{
CBasePlayer *pPlayer = UTIL_PlayerByIndex(i);
if (!pPlayer)
continue;
if (FNullEnt(pPlayer->edict()))
continue;
if (pPlayer->IsDormant())
continue;
if (pPlayer->m_pActiveItem && pPlayer->m_pActiveItem == pEntity)
{
ALERT(at_warning, "Trying to release the entity: (%s : `%s`) without pre-reset m_pActiveItem\n", pEntity->GetClassname(), pEntity->pev->model.str());
pPlayer->m_pActiveItem = nullptr;
}
}
#endif
#ifdef REGAMEDLL_API
pEntity->OnDestroy();
#endif

View File

@ -4610,8 +4610,19 @@ int EXT_FUNC GetWeaponData(edict_t *pEdict, struct weapon_data_s *info)
auto pPlayerItem = pPlayer->m_rgpPlayerItems[i];
while (pPlayerItem)
{
#ifdef REGAMEDLL_FIXES
// Make sure that entity is CBasePlayerItem
auto pItem = dynamic_cast<CBasePlayerItem *>(pPlayerItem);
if (pItem = nullptr)
{
ALERT(at_error, "GetWeaponData: m_rgpPlayerItems[%i] is non-item, entity: (%s `%s`), (%s)\n", i, pPlayerItem->GetClassname(), pPlayerItem->pev->model.str(), typeid(pPlayer->m_pActiveItem).name());
return 0;
}
#endif
// there's a weapon here. Should I pack it?
auto weapon = (CBasePlayerWeapon *)pPlayerItem->GetWeaponPtr();
if (weapon && weapon->UseDecrement())
{
// Get The ID
@ -4749,6 +4760,16 @@ void EXT_FUNC UpdateClientData(const edict_t *ent, int sendweapons, struct clien
ItemInfo II;
Q_memset(&II, 0, sizeof(II));
#ifdef REGAMEDLL_FIXES
// Make sure that entity is CBasePlayerItem
auto pItem = dynamic_cast<CBasePlayerItem *>(pPlayer->m_pActiveItem);
if (pItem = nullptr)
{
ALERT(at_error, "GetWeaponData: m_pActiveItem is non-item, entity: (%s `%s`), (%s)\n", pPlayer->m_pActiveItem->GetClassname(), pPlayer->m_pActiveItem->pev->model.str(), typeid(pPlayer->m_pActiveItem).name());
return;
}
#endif
CBasePlayerWeapon *weapon = (CBasePlayerWeapon *)pPlayer->m_pActiveItem->GetWeaponPtr();
if (weapon && weapon->UseDecrement() && weapon->GetItemInfo(&II))
{

View File

@ -28,6 +28,8 @@
#pragma once
#include <typeinfo>
// custom enum
enum ChooseTeamMenuSlot
{

View File

@ -911,6 +911,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -953,6 +954,7 @@
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WholeProgramOptimization>true</WholeProgramOptimization>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -998,6 +1000,7 @@
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking>
<WholeProgramOptimization>true</WholeProgramOptimization>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -1037,6 +1040,7 @@
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
@ -1072,6 +1076,7 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>precompiled.h</PrecompiledHeaderFile>
<EnableEnhancedInstructionSet>NoExtensions</EnableEnhancedInstructionSet>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>