- Fix `-map` command-line argument not working.

* Fixes #441.
This commit is contained in:
Mitchell Richters 2021-06-24 18:49:26 +10:00
parent 6018213c71
commit 9645009b28
3 changed files with 11 additions and 6 deletions

View File

@ -435,12 +435,6 @@ CCMD(map)
auto map = FindMapByName(mapname);
if (map == nullptr)
{
// got a user map
if (g_gameType & GAMEFLAG_SHAREWARE)
{
Printf(PRINT_BOLD, "Cannot use user maps in shareware.\n");
return;
}
map = SetupUserMap(mapfilename, g_gameType & GAMEFLAG_DUKE? "dethtoll.mid" : nullptr);
}
if (map)

View File

@ -681,6 +681,10 @@ void MainLoop ()
if (userConfig.CommandMap.IsNotEmpty())
{
auto maprecord = FindMapByName(userConfig.CommandMap);
if (maprecord == nullptr)
{
maprecord = SetupUserMap(userConfig.CommandMap, g_gameType & GAMEFLAG_DUKE? "dethtoll.mid" : nullptr);
}
userConfig.CommandMap = "";
if (maprecord)
{

View File

@ -38,6 +38,7 @@
#include "raze_music.h"
#include "filesystem.h"
#include "printf.h"
#include "gamecontrol.h"
#include "raze_sound.h"
FString gSkillNames[MAXSKILLS];
@ -203,6 +204,12 @@ MapRecord *AllocateMap()
MapRecord* SetupUserMap(const char* boardfilename, const char *defaultmusic)
{
if (g_gameType & GAMEFLAG_SHAREWARE)
{
Printf(PRINT_BOLD, "Cannot use user maps in shareware.\n");
return nullptr;
}
for (auto& map : mapList)
{
if (map->fileName.CompareNoCase(boardfilename) == 0)