mirror of
https://github.com/alliedmodders/metamod-source.git
synced 2025-02-26 19:54:14 +01:00
Fixed amb1952: Crash when first plugin listed in metaplugins.ini had an alias and was not on the first line of the file.
--HG-- branch : sourcemm-1.4.x extra : convert_revision : svn%3Ac2935e3e-5518-0410-8daf-afa5dab7d4e3/branches/sourcemm-1.4.x%40708
This commit is contained in:
parent
63e584fa28
commit
3a7197038d
@ -1,3 +1,7 @@
|
|||||||
|
2008/??/?? 1.4.5:
|
||||||
|
- Fixed amb1952: Crash when first plugin listed in metaplugins.ini had an alias
|
||||||
|
and was not on the first line of the file.
|
||||||
|
|
||||||
2008/07/26 1.4.4:
|
2008/07/26 1.4.4:
|
||||||
- Fixed a bug where loading plugins built for MM:S 1.3 or older (API ver <= 9)
|
- Fixed a bug where loading plugins built for MM:S 1.3 or older (API ver <= 9)
|
||||||
would cause a crash.
|
would cause a crash.
|
||||||
|
@ -826,21 +826,22 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
char buffer[255], error[255], full_path[255];
|
char buffer[255], error[255], full_path[255];
|
||||||
const char *ptr, *ext, *file;
|
const char *ptr, *ext, *file;
|
||||||
size_t length;
|
size_t length;
|
||||||
while (!feof(fp))
|
while (!feof(fp) && fgets(buffer, sizeof(buffer), fp) != NULL)
|
||||||
{
|
{
|
||||||
buffer[0] = '\0';
|
|
||||||
fgets(buffer, sizeof(buffer), fp);
|
|
||||||
length = strlen(buffer);
|
|
||||||
if (!length)
|
|
||||||
continue;
|
|
||||||
if (buffer[length-1] == '\n')
|
|
||||||
buffer[--length] = '\0';
|
|
||||||
|
|
||||||
UTIL_TrimLeft(buffer);
|
UTIL_TrimLeft(buffer);
|
||||||
UTIL_TrimRight(buffer);
|
UTIL_TrimRight(buffer);
|
||||||
|
|
||||||
if (buffer[0] == '\0' || buffer[0] == ';' || strncmp(buffer, "//", 2) == 0)
|
length = strlen(buffer);
|
||||||
|
if (!length)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (buffer[0] == '\0' || buffer[0] == ';' || strncmp(buffer, "//", 2) == 0)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
file = buffer;
|
file = buffer;
|
||||||
if (buffer[0] == '"')
|
if (buffer[0] == '"')
|
||||||
{
|
{
|
||||||
@ -856,7 +857,9 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
}
|
}
|
||||||
cptr++;
|
cptr++;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
char *cptr = buffer;
|
char *cptr = buffer;
|
||||||
while (*cptr)
|
while (*cptr)
|
||||||
{
|
{
|
||||||
@ -864,7 +867,9 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
{
|
{
|
||||||
char *optr = cptr;
|
char *optr = cptr;
|
||||||
while (*cptr && isspace(*cptr))
|
while (*cptr && isspace(*cptr))
|
||||||
|
{
|
||||||
cptr++;
|
cptr++;
|
||||||
|
}
|
||||||
*optr = '\0';
|
*optr = '\0';
|
||||||
UTIL_TrimRight(cptr);
|
UTIL_TrimRight(cptr);
|
||||||
if (*cptr && isalpha(*cptr))
|
if (*cptr && isalpha(*cptr))
|
||||||
@ -889,13 +894,21 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
|
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
|
||||||
{
|
{
|
||||||
LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
|
LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
|
||||||
} else {
|
|
||||||
if (already)
|
|
||||||
skipped++;
|
|
||||||
else
|
|
||||||
total++;
|
|
||||||
}
|
}
|
||||||
} else {
|
else
|
||||||
|
{
|
||||||
|
if (already)
|
||||||
|
{
|
||||||
|
skipped++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
total++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
/* Attempt to find a file extension */
|
/* Attempt to find a file extension */
|
||||||
ptr = UTIL_GetExtension(file);
|
ptr = UTIL_GetExtension(file);
|
||||||
/* Add an extension if there's none there */
|
/* Add an extension if there's none there */
|
||||||
@ -906,7 +919,9 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
#else
|
#else
|
||||||
ext = "_i486.so";
|
ext = "_i486.so";
|
||||||
#endif
|
#endif
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
ext = "";
|
ext = "";
|
||||||
}
|
}
|
||||||
/* Format the new path */
|
/* Format the new path */
|
||||||
@ -915,11 +930,17 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
|
if (id < Pl_MinId || g_PluginMngr.FindById(id)->m_Status < Pl_Paused)
|
||||||
{
|
{
|
||||||
LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
|
LogMessage("[META] Failed to load plugin %s. %s", buffer, error);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
if (already)
|
if (already)
|
||||||
|
{
|
||||||
skipped++;
|
skipped++;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
total++;
|
total++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -928,13 +949,16 @@ int LoadPluginsFromFile(const char *_file)
|
|||||||
if (skipped)
|
if (skipped)
|
||||||
{
|
{
|
||||||
LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped);
|
LogMessage("[META] Loaded %d plugins from file (%d already loaded)", total, skipped);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
LogMessage("[META] Loaded %d plugins from file.", total);
|
LogMessage("[META] Loaded %d plugins from file.", total);
|
||||||
}
|
}
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Wrapper function. This is called when the GameDLL thinks it's using
|
/* Wrapper function. This is called when the GameDLL thinks it's using
|
||||||
* the engine's real engineFactory.
|
* the engine's real engineFactory.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user