Remove goto from ExtensionSys.cpp (#729)

This commit is contained in:
Ruben Gonzalez 2018-05-25 09:49:10 -04:00 committed by GitHub
parent 7f552e4d75
commit e2767a3c80
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -73,22 +73,24 @@ CLocalExtension::CLocalExtension(const char *filename, bool bRequired)
/* Special case for new bintools binary */ /* Special case for new bintools binary */
if (strcmp(filename, "bintools.ext") == 0) if (strcmp(filename, "bintools.ext") == 0)
{ {
goto normal; g_pSM->BuildPath(Path_SM,
path,
PLATFORM_MAX_PATH,
"extensions/%s." PLATFORM_LIB_EXT,
filename);
} }
else
{
/* Zeroth, see if there is an engine specific build in the new place. */ /* Zeroth, see if there is an engine specific build in the new place. */
g_pSM->BuildPath(Path_SM, g_pSM->BuildPath(Path_SM,
path, path,
PLATFORM_MAX_PATH, PLATFORM_MAX_PATH,
"extensions/" PLATFORM_ARCH_FOLDER "%s.%s." PLATFORM_LIB_EXT, "extensions/%s.%s." PLATFORM_LIB_EXT,
filename, filename,
bridge->gamesuffix); bridge->gamesuffix);
if (libsys->IsPathFile(path)) if (!libsys->IsPathFile(path))
{ {
goto found;
}
/* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */ /* COMPAT HACK: One-halfth, if ep2v, see if there is an engine specific build in the new place with old naming */
if (strcmp(bridge->gamesuffix, "2.tf2") == 0 if (strcmp(bridge->gamesuffix, "2.tf2") == 0
|| strcmp(bridge->gamesuffix, "2.dods") == 0 || strcmp(bridge->gamesuffix, "2.dods") == 0
@ -98,48 +100,41 @@ CLocalExtension::CLocalExtension(const char *filename, bool bRequired)
g_pSM->BuildPath(Path_SM, g_pSM->BuildPath(Path_SM,
path, path,
PLATFORM_MAX_PATH, PLATFORM_MAX_PATH,
"extensions/" PLATFORM_ARCH_FOLDER "%s.2.ep2v." PLATFORM_LIB_EXT, "extensions/%s.2.ep2v." PLATFORM_LIB_EXT,
filename); filename);
if (libsys->IsPathFile(path))
{
goto found;
}
} }
else if (strcmp(bridge->gamesuffix, "2.nd") == 0) else if (strcmp(bridge->gamesuffix, "2.nd") == 0)
{ {
g_pSM->BuildPath(Path_SM, g_pSM->BuildPath(Path_SM,
path, path,
PLATFORM_MAX_PATH, PLATFORM_MAX_PATH,
"extensions/" PLATFORM_ARCH_FOLDER "%s.2.l4d2." PLATFORM_LIB_EXT, "extensions/%s.2.l4d2." PLATFORM_LIB_EXT,
filename); filename);
}
if (libsys->IsPathFile(path)) //Try further
if (!libsys->IsPathFile(path))
{ {
goto found;
}
}
/* First see if there is an engine specific build! */ /* First see if there is an engine specific build! */
g_pSM->BuildPath(Path_SM, g_pSM->BuildPath(Path_SM,
path, path,
PLATFORM_MAX_PATH, PLATFORM_MAX_PATH,
"extensions/" PLATFORM_ARCH_FOLDER "auto.%s/%s." PLATFORM_LIB_EXT, "extensions/auto.%s/%s." PLATFORM_LIB_EXT,
filename, filename,
bridge->gamesuffix); bridge->gamesuffix);
/* Try the "normal" version */ /* Try the "normal" version */
if (!libsys->IsPathFile(path)) if (!libsys->IsPathFile(path))
{ {
normal:
g_pSM->BuildPath(Path_SM, g_pSM->BuildPath(Path_SM,
path, path,
PLATFORM_MAX_PATH, PLATFORM_MAX_PATH,
"extensions/" PLATFORM_ARCH_FOLDER "%s." PLATFORM_LIB_EXT, "extensions/%s." PLATFORM_LIB_EXT,
filename); filename);
} }
}
found: }
}
Initialize(filename, path, bRequired); Initialize(filename, path, bRequired);
} }