Fixed bug where plugin aliases defined in VDF files on core (Orange Box and L4D engines) didn't work.
Fixed bug where plugin aliases defined in VDF files on core (Orange Box and L4D engines) didn't work.
1.1 --- a/core/metamod.cpp Sun Dec 07 23:50:23 2008 -0600
1.2 +++ b/core/metamod.cpp Mon Dec 22 22:55:55 2008 -0600
1.3 @@ -1114,7 +1114,7 @@
1.4 {
1.5 PluginId id;
1.6 bool already;
1.7 - char alias[24], file[255], error[255];
1.8 + char alias[24], file[255], full_path[255], error[255];
1.9
1.10 if (!provider->ProcessVDF(path, file, sizeof(file), alias, sizeof(alias)))
1.11 {
1.12 @@ -1125,7 +1125,31 @@
1.13 if (alias[0] != '\0')
1.14 g_PluginMngr.SetAlias(alias, file);
1.15
1.16 - id = g_PluginMngr.Load(file, Pl_File, already, error, sizeof(error));
1.17 + /* Attempt to find a file extension */
1.18 + if (UTIL_GetExtension(file) == NULL)
1.19 + {
1.20 + g_pMetamod->PathFormat(full_path,
1.21 + sizeof(full_path),
1.22 + "%s/%s%s",
1.23 + g_pMetamod->GetBaseDir(),
1.24 + file,
1.25 +#if defined WIN32 || defined _WIN32
1.26 + ".dll"
1.27 +#else
1.28 + "_i486.so"
1.29 +#endif
1.30 + );
1.31 + }
1.32 + else
1.33 + {
1.34 + g_pMetamod->PathFormat(full_path,
1.35 + sizeof(full_path),
1.36 + "%s/%s",
1.37 + g_pMetamod->GetBaseDir(),
1.38 + file);
1.39 + }
1.40 +
1.41 + id = g_PluginMngr.Load(full_path, Pl_File, already, error, sizeof(error));
1.42 skipped = already;
1.43 if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
1.44 {
2.1 --- a/core/provider/provider_ep2.cpp Sun Dec 07 23:50:23 2008 -0600
2.2 +++ b/core/provider/provider_ep2.cpp Mon Dec 22 22:55:55 2008 -0600
2.3 @@ -417,6 +417,8 @@
2.4 return false;
2.5 }
2.6
2.7 + UTIL_Format(path, path_len, "%s", plugin_file);
2.8 +
2.9 if ((p_alias = pValues->GetString("alias", NULL)) != NULL)
2.10 {
2.11 UTIL_Format(alias, alias_len, "%s", p_alias);
2.12 @@ -426,30 +428,6 @@
2.13 UTIL_Format(alias, alias_len, "");
2.14 }
2.15
2.16 - /* Attempt to find a file extension */
2.17 - if (UTIL_GetExtension(plugin_file) == NULL)
2.18 - {
2.19 - g_pMetamod->PathFormat(path,
2.20 - path_len,
2.21 - "%s/%s%s",
2.22 - g_pMetamod->GetBaseDir(),
2.23 - plugin_file,
2.24 -#if defined WIN32 || defined _WIN32
2.25 - ".dll"
2.26 -#else
2.27 - "_i486.so"
2.28 -#endif
2.29 - );
2.30 - }
2.31 - else
2.32 - {
2.33 - g_pMetamod->PathFormat(path,
2.34 - path_len,
2.35 - "%s/%s",
2.36 - g_pMetamod->GetBaseDir(),
2.37 - plugin_file);
2.38 - }
2.39 -
2.40 pValues->deleteThis();
2.41
2.42 return true;