pushed old commit
This commit is contained in:
parent
6c93b75f34
commit
3113935751
3 changed files with 10 additions and 9 deletions
|
|
@ -140,15 +140,16 @@ public:
|
||||||
|
|
||||||
return m_ptr;
|
return m_ptr;
|
||||||
}
|
}
|
||||||
void *GetFunctionAddr (const char *functionName)
|
|
||||||
|
template <typename R> R GetFuncAddr (const char *function)
|
||||||
{
|
{
|
||||||
if (!IsLoaded ())
|
if (!IsLoaded ())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
#ifdef PLATFORM_WIN32
|
#ifdef PLATFORM_WIN32
|
||||||
return GetProcAddress ((HMODULE) m_ptr, functionName);
|
return reinterpret_cast <R> (GetProcAddress (static_cast <HMODULE> (m_ptr), function));
|
||||||
#else
|
#else
|
||||||
return dlsym (m_ptr, functionName);
|
return reinterpret_cast <R> (dlsym (m_ptr, function));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3105,10 +3105,10 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *functionTable, globalvars_t
|
||||||
else
|
else
|
||||||
AddLogEntry (true, LL_FATAL | LL_IGNORE, "Mod that you has started, not supported by this bot (gamedir: %s)", GetModName ());
|
AddLogEntry (true, LL_FATAL | LL_IGNORE, "Mod that you has started, not supported by this bot (gamedir: %s)", GetModName ());
|
||||||
|
|
||||||
g_funcPointers = (FuncPointers_t) g_gameLib->GetFunctionAddr ("GiveFnptrsToDll");
|
g_funcPointers = g_gameLib->GetFuncAddr <FuncPointers_t> ("GiveFnptrsToDll");
|
||||||
g_entityAPI = (EntityAPI_t) g_gameLib->GetFunctionAddr ("GetEntityAPI");
|
g_entityAPI = g_gameLib->GetFuncAddr <EntityAPI_t> ("GetEntityAPI");
|
||||||
g_getNewEntityAPI = (NewEntityAPI_t) g_gameLib->GetFunctionAddr ("GetNewDLLFunctions");
|
g_getNewEntityAPI = g_gameLib->GetFuncAddr <NewEntityAPI_t> ("GetNewDLLFunctions");
|
||||||
g_serverBlendingAPI = (BlendAPI_t) g_gameLib->GetFunctionAddr ("Server_GetBlendingInterface");
|
g_serverBlendingAPI = g_gameLib->GetFuncAddr <BlendAPI_t> ("Server_GetBlendingInterface");
|
||||||
|
|
||||||
if (!g_funcPointers || !g_entityAPI)
|
if (!g_funcPointers || !g_entityAPI)
|
||||||
TerminateOnMalloc ();
|
TerminateOnMalloc ();
|
||||||
|
|
@ -3189,7 +3189,7 @@ export void entityFunction (entvars_t *pev) \
|
||||||
static EntityPtr_t entity_addr = NULL; \
|
static EntityPtr_t entity_addr = NULL; \
|
||||||
\
|
\
|
||||||
if (entity_addr == NULL) \
|
if (entity_addr == NULL) \
|
||||||
entity_addr = reinterpret_cast <EntityPtr_t> (g_gameLib->GetFunctionAddr (#entityFunction)); \
|
entity_addr = g_gameLib->GetFuncAddr <EntityPtr_t> (#entityFunction); \
|
||||||
\
|
\
|
||||||
if (entity_addr == NULL) \
|
if (entity_addr == NULL) \
|
||||||
return; \
|
return; \
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ void BotManager::CallGameEntity (entvars_t *vars)
|
||||||
static EntityPtr_t playerFunction = NULL;
|
static EntityPtr_t playerFunction = NULL;
|
||||||
|
|
||||||
if (playerFunction == NULL)
|
if (playerFunction == NULL)
|
||||||
playerFunction = (EntityPtr_t) g_gameLib->GetFunctionAddr ("player");
|
playerFunction = g_gameLib->GetFuncAddr <EntityPtr_t> ("player");
|
||||||
|
|
||||||
if (playerFunction != NULL)
|
if (playerFunction != NULL)
|
||||||
(*playerFunction) (vars);
|
(*playerFunction) (vars);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue