mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- cleanup of -map setup.
This commit is contained in:
parent
cb051b44ea
commit
ec96ae8992
4 changed files with 37 additions and 37 deletions
|
@ -47,6 +47,7 @@
|
|||
#endif
|
||||
#endif
|
||||
#include "cmdlib.h"
|
||||
#include "compat.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
|
@ -757,3 +758,17 @@ bool IsAbsPath(const char *name)
|
|||
#endif /* _WIN32 */
|
||||
return 0;
|
||||
}
|
||||
|
||||
//==========================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==========================================================================
|
||||
|
||||
void NormalizeFileName(FString &str)
|
||||
{
|
||||
auto strp = str.LockBuffer();
|
||||
Bcorrectfilename(strp, false);
|
||||
str.UnlockBuffer();
|
||||
}
|
||||
|
||||
|
|
|
@ -27,6 +27,7 @@ bool DirEntryExists (const char *pathname, bool *isdir = nullptr);
|
|||
extern FString progdir;
|
||||
|
||||
void DefaultExtension (FString &path, const char *extension);
|
||||
void NormalizeFileName(FString &str);
|
||||
|
||||
FString ExtractFilePath (const char *path);
|
||||
FString ExtractFileBase (const char *path, bool keep_extension=false);
|
||||
|
|
|
@ -5656,38 +5656,30 @@ static void G_Startup(void)
|
|||
|
||||
if (userConfig.CommandMap.IsNotEmpty())
|
||||
{
|
||||
FString startupMap;
|
||||
if (VOLUMEONE)
|
||||
{
|
||||
initprintf("The -map option is available in the registered version only!\n");
|
||||
boardfilename[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *dot, *slash;
|
||||
startupMap = userConfig.CommandMap;
|
||||
if (startupMap.IndexOfAny("/\\") < 0) startupMap.Insert(0, "/");
|
||||
DefaultExtension(startupMap, ".map");
|
||||
startupMap.Substitute("\\", "/");
|
||||
NormalizeFileName(startupMap);
|
||||
|
||||
boardfilename[0] = '/';
|
||||
boardfilename[1] = 0;
|
||||
Bstrcat(boardfilename, userConfig.CommandMap);
|
||||
|
||||
dot = Bstrrchr(boardfilename,'.');
|
||||
slash = Bstrrchr(boardfilename,'/');
|
||||
if (!slash) slash = Bstrrchr(boardfilename,'\\');
|
||||
|
||||
if ((!slash && !dot) || (slash && dot < slash))
|
||||
Bstrcat(boardfilename,".map");
|
||||
|
||||
Bcorrectfilename(boardfilename,0);
|
||||
|
||||
if (fileSystem.FileExists(boardfilename))
|
||||
if (fileSystem.FileExists(startupMap))
|
||||
{
|
||||
initprintf("Using level: \"%s\".\n",boardfilename);
|
||||
initprintf("Using level: \"%s\".\n",startupMap.GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("Level \"%s\" not found.\n",boardfilename);
|
||||
initprintf("Level \"%s\" not found.\n",startupMap.GetChars());
|
||||
boardfilename[0] = 0;
|
||||
}
|
||||
}
|
||||
strncpy(boardfilename, startupMap, BMAX_PATH);
|
||||
}
|
||||
|
||||
for (i=0; i<MAXPLAYERS; i++)
|
||||
|
|
|
@ -7094,38 +7094,30 @@ static void G_Startup(void)
|
|||
|
||||
if (userConfig.CommandMap.IsNotEmpty())
|
||||
{
|
||||
FString startupMap;
|
||||
if (VOLUMEONE)
|
||||
{
|
||||
initprintf("The -map option is available in the registered version only!\n");
|
||||
boardfilename[0] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *dot, *slash;
|
||||
startupMap = userConfig.CommandMap;
|
||||
if (startupMap.IndexOfAny("/\\") < 0) startupMap.Insert(0, "/");
|
||||
DefaultExtension(startupMap, ".map");
|
||||
startupMap.Substitute("\\", "/");
|
||||
NormalizeFileName(startupMap);
|
||||
|
||||
boardfilename[0] = '/';
|
||||
boardfilename[1] = 0;
|
||||
Bstrcat(boardfilename, userConfig.CommandMap);
|
||||
|
||||
dot = Bstrrchr(boardfilename,'.');
|
||||
slash = Bstrrchr(boardfilename,'/');
|
||||
if (!slash) slash = Bstrrchr(boardfilename,'\\');
|
||||
|
||||
if ((!slash && !dot) || (slash && dot < slash))
|
||||
Bstrcat(boardfilename,".map");
|
||||
|
||||
Bcorrectfilename(boardfilename,0);
|
||||
|
||||
if (fileSystem.FileExists(boardfilename))
|
||||
{
|
||||
initprintf("Using level: \"%s\".\n",boardfilename);
|
||||
if (fileSystem.FileExists(startupMap))
|
||||
{
|
||||
initprintf("Using level: \"%s\".\n",startupMap.GetChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
initprintf("Level \"%s\" not found.\n",boardfilename);
|
||||
initprintf("Level \"%s\" not found.\n",startupMap.GetChars());
|
||||
boardfilename[0] = 0;
|
||||
}
|
||||
}
|
||||
strncpy(boardfilename, startupMap, BMAX_PATH);
|
||||
}
|
||||
|
||||
for (i=0; i<MAXPLAYERS; i++)
|
||||
|
|
Loading…
Reference in a new issue