1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2025-01-19 08:52:34 +01:00

Fixed bug where plugin aliases defined in VDF files on core (Orange Box and L4D engines) didn't work.

This commit is contained in:
Scott Ehlert 2008-12-22 22:55:55 -06:00
parent fde79ae26d
commit 774af58103
2 changed files with 28 additions and 26 deletions

View File

@ -1114,7 +1114,7 @@ ProcessVDF(const char *path, bool &skipped)
{
PluginId id;
bool already;
char alias[24], file[255], error[255];
char alias[24], file[255], full_path[255], error[255];
if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias)))
{
@ -1125,7 +1125,31 @@ ProcessVDF(const char *path, bool &skipped)
if (alias[0] != '\0')
g_PluginMngr.SetAlias(alias, file);
id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
/* Attempt to find a file extension */
if (UTIL_GetExtension(file) == NULL)
{
g_pMetamod->PathFormat(full_path,
sizeof(full_path),
"%s/%s%s",
g_pMetamod->GetBaseDir(),
file,
#if defined WIN32 || defined _WIN32
".dll"
#else
"_i486.so"
#endif
);
}
else
{
g_pMetamod->PathFormat(full_path,
sizeof(full_path),
"%s/%s",
g_pMetamod->GetBaseDir(),
file);
}
id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
skipped = already;
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
{

View File

@ -417,6 +417,8 @@ bool BaseProvider::ProcessVDF(const char *file, char path[], size_t path_len, ch
return false;
}
UTIL_Format(path, path_len, "%s", plugin_file);
if ((p_alias = pValues->GetString("alias", NULL)) != NULL)
{
UTIL_Format(alias, alias_len, "%s", p_alias);
@ -426,30 +428,6 @@ bool BaseProvider::ProcessVDF(const char *file, char path[], size_t path_len, ch
UTIL_Format(alias, alias_len, "");
}
/* Attempt to find a file extension */
if (UTIL_GetExtension(plugin_file) == NULL)
{
g_pMetamod->PathFormat(path,
path_len,
"%s/%s%s",
g_pMetamod->GetBaseDir(),
plugin_file,
#if defined WIN32 || defined _WIN32
".dll"
#else
"_i486.so"
#endif
);
}
else
{
g_pMetamod->PathFormat(path,
path_len,
"%s/%s",
g_pMetamod->GetBaseDir(),
plugin_file);
}
pValues->deleteThis();
return true;