Merge pull request #236 from alliedmodders/sdkhooks-noload-crash
Fix SDKHooks causing crash on plugin load/unload or player connect/disconnect if missing gamedata (r=asherkin).
This commit is contained in:
commit
a88d0da1af
@ -219,24 +219,6 @@ bool SDKHooks::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
sharesys->AddDependency(myself, "bintools.ext", true, true);
|
|
||||||
sharesys->AddNatives(myself, g_Natives);
|
|
||||||
sharesys->RegisterLibrary(myself, "sdkhooks");
|
|
||||||
sharesys->AddInterface(myself, &g_Interface);
|
|
||||||
sharesys->AddCapabilityProvider(myself, this, "SDKHook_DmgCustomInOTD");
|
|
||||||
sharesys->AddCapabilityProvider(myself, this, "SDKHook_LogicalEntSupport");
|
|
||||||
|
|
||||||
playerhelpers->AddClientListener(&g_Interface);
|
|
||||||
|
|
||||||
plsys->AddPluginsListener(&g_Interface);
|
|
||||||
|
|
||||||
g_pOnEntityCreated = forwards->CreateForward("OnEntityCreated", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
|
||||||
g_pOnEntityDestroyed = forwards->CreateForward("OnEntityDestroyed", ET_Ignore, 1, NULL, Param_Cell);
|
|
||||||
#ifdef GAMEDESC_CAN_CHANGE
|
|
||||||
g_pOnGetGameNameDescription = forwards->CreateForward("OnGetGameDescription", ET_Hook, 2, NULL, Param_String);
|
|
||||||
#endif
|
|
||||||
g_pOnLevelInit = forwards->CreateForward("OnLevelInit", ET_Hook, 2, NULL, Param_String, Param_String);
|
|
||||||
|
|
||||||
buffer[0] = '\0';
|
buffer[0] = '\0';
|
||||||
if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, buffer, sizeof(buffer)))
|
if (!gameconfs->LoadGameConfigFile("sdkhooks.games", &g_pGameConf, buffer, sizeof(buffer)))
|
||||||
{
|
{
|
||||||
@ -257,6 +239,24 @@ bool SDKHooks::SDK_OnLoad(char *error, size_t maxlength, bool late)
|
|||||||
|
|
||||||
entListeners->AddToTail(this);
|
entListeners->AddToTail(this);
|
||||||
|
|
||||||
|
sharesys->AddDependency(myself, "bintools.ext", true, true);
|
||||||
|
sharesys->AddNatives(myself, g_Natives);
|
||||||
|
sharesys->RegisterLibrary(myself, "sdkhooks");
|
||||||
|
sharesys->AddInterface(myself, &g_Interface);
|
||||||
|
sharesys->AddCapabilityProvider(myself, this, "SDKHook_DmgCustomInOTD");
|
||||||
|
sharesys->AddCapabilityProvider(myself, this, "SDKHook_LogicalEntSupport");
|
||||||
|
|
||||||
|
playerhelpers->AddClientListener(&g_Interface);
|
||||||
|
|
||||||
|
plsys->AddPluginsListener(&g_Interface);
|
||||||
|
|
||||||
|
g_pOnEntityCreated = forwards->CreateForward("OnEntityCreated", ET_Ignore, 2, NULL, Param_Cell, Param_String);
|
||||||
|
g_pOnEntityDestroyed = forwards->CreateForward("OnEntityDestroyed", ET_Ignore, 1, NULL, Param_Cell);
|
||||||
|
#ifdef GAMEDESC_CAN_CHANGE
|
||||||
|
g_pOnGetGameNameDescription = forwards->CreateForward("OnGetGameDescription", ET_Hook, 2, NULL, Param_String);
|
||||||
|
#endif
|
||||||
|
g_pOnLevelInit = forwards->CreateForward("OnLevelInit", ET_Hook, 2, NULL, Param_String, Param_String);
|
||||||
|
|
||||||
SetupHooks();
|
SetupHooks();
|
||||||
|
|
||||||
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
#if SOURCE_ENGINE >= SE_ORANGEBOX
|
||||||
|
Loading…
Reference in New Issue
Block a user