2
0
mirror of https://github.com/rehlds/reapi.git synced 2024-12-29 08:05:36 +03:00

Fix to get first edict (part 2)

This commit is contained in:
s1lentq 2016-12-13 00:13:40 +07:00
parent 61460e962b
commit 33f85c765a
3 changed files with 12 additions and 1 deletions

View File

@ -9,7 +9,7 @@ DLL_FUNCTIONS gFunctionTable =
NULL, // pfnUse NULL, // pfnUse
NULL, // pfnTouch NULL, // pfnTouch
NULL, // pfnBlocked NULL, // pfnBlocked
NULL, // pfnKeyValue &KeyValue, // pfnKeyValue
NULL, // pfnSave NULL, // pfnSave
NULL, // pfnRestore NULL, // pfnRestore
NULL, // pfnSetAbsBox NULL, // pfnSetAbsBox

View File

@ -59,10 +59,20 @@ void ServerDeactivate_Post()
api_cfg.ServerDeactivate(); api_cfg.ServerDeactivate();
g_hookManager.clearHandlers(); g_hookManager.clearHandlers();
g_pFunctionTable->pfnSpawn = DispatchSpawn; g_pFunctionTable->pfnSpawn = DispatchSpawn;
g_pFunctionTable->pfnKeyValue = KeyValue;
SET_META_RESULT(MRES_IGNORED); SET_META_RESULT(MRES_IGNORED);
} }
void KeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd)
{
// get the first edict worldspawn
if (FClassnameIs(pentKeyvalue, "worldspawn")) {
g_pEdicts = pentKeyvalue;
g_pFunctionTable->pfnKeyValue = nullptr;
}
}
CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain) CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain)
{ {
return g_pGameRules = chain->callNext(); return g_pGameRules = chain->callNext();

View File

@ -17,5 +17,6 @@ void ServerActivate_Post(edict_t *pEdictList, int edictCount, int clientMax);
void ServerDeactivate_Post(); void ServerDeactivate_Post();
int DispatchSpawn(edict_t* pEntity); int DispatchSpawn(edict_t* pEntity);
void ResetGlobalState(); void ResetGlobalState();
void KeyValue(edict_t *pentKeyvalue, KeyValueData *pkvd);
CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain); CGameRules *InstallGameRules(IReGameHook_InstallGameRules *chain);