2
0
mirror of https://github.com/rehlds/metamod-r.git synced 2025-03-15 23:10:28 +03:00
metamod-r/metamod/src/linkent.cpp

30 lines
809 B
C++
Raw Normal View History

#include "precompiled.h"
// Function to perform common code of LINK_ENTITY_TO_GAME, rather than
// duplicating the code in ~2000 expanded macros. Based on code from Jussi
// Kivilinna <kijuhe00@students.oamk.fi>.
void do_link_ent(ENTITY_FN *pfnEntity, int *missing, const char *entStr, entvars_t *pev)
2016-07-26 23:31:47 +07:00
{
if (*missing)
{
META_DEBUG(9, ("Skipping entity '%s'; was previously found missing", entStr));
return;
}
2016-07-26 23:31:47 +07:00
if (!*pfnEntity)
{
META_DEBUG(9, ("Looking up game entity '%s'", entStr));
2017-01-07 01:24:40 +03:00
*pfnEntity = (ENTITY_FN)GameDLL.sys_module.getsym(entStr);
}
2016-07-26 23:31:47 +07:00
if (!*pfnEntity)
{
2017-01-07 01:24:40 +03:00
META_ERROR("Couldn't find game entity '%s' in game DLL '%s': %s", entStr, GameDLL.name, CSysModule::getloaderror());
2016-07-26 23:31:47 +07:00
*missing = 1;
return;
}
2016-07-26 23:31:47 +07:00
META_DEBUG(8, ("Linking game entity '%s'", entStr));
(*pfnEntity)(pev);
}