2016-07-26 15:18:32 +03:00
|
|
|
#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>.
|
2017-05-09 19:31:09 +03:00
|
|
|
void NOINLINE do_link_ent(ENTITY_FN* pfnEntity, int* missing, const char* entStr, entvars_t* pev)
|
2016-07-26 23:31:47 +07:00
|
|
|
{
|
2017-05-09 19:31:09 +03:00
|
|
|
if (*missing) {
|
2017-01-09 02:44:49 +03:00
|
|
|
META_DEBUG(9, "Skipping entity '%s'; was previously found missing", entStr);
|
2016-07-26 15:18:32 +03:00
|
|
|
return;
|
|
|
|
}
|
2016-07-26 23:31:47 +07:00
|
|
|
|
2017-05-09 19:31:09 +03:00
|
|
|
if (!*pfnEntity) {
|
2017-01-09 02:44:49 +03:00
|
|
|
META_DEBUG(9, "Looking up game entity '%s'", entStr);
|
2017-01-13 03:00:23 +03:00
|
|
|
*pfnEntity = (ENTITY_FN)g_GameDLL.sys_module.getsym(entStr);
|
2016-07-26 15:18:32 +03:00
|
|
|
}
|
2016-07-26 23:31:47 +07:00
|
|
|
|
2017-05-09 19:31:09 +03:00
|
|
|
if (!*pfnEntity) {
|
2017-01-13 03:00:23 +03:00
|
|
|
META_ERROR("Couldn't find game entity '%s' in game DLL '%s': %s", entStr, g_GameDLL.name, CSysModule::getloaderror());
|
2016-07-26 23:31:47 +07:00
|
|
|
*missing = 1;
|
2016-07-26 15:18:32 +03:00
|
|
|
return;
|
|
|
|
}
|
2016-07-26 23:31:47 +07:00
|
|
|
|
2017-01-09 02:44:49 +03:00
|
|
|
META_DEBUG(8, "Linking game entity '%s'", entStr);
|
2016-07-26 15:18:32 +03:00
|
|
|
(*pfnEntity)(pev);
|
|
|
|
}
|