Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
codenamecpp committed Jun 7, 2020
1 parent 7008935 commit aab159d
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ clean:
make -C .build clean

run:
./bin/glkeeper-debug -gamedir ../games/dk2
./bin/glkeeper-debug $(ARGS)

builddir:
test -d .build || mkdir .build
Expand Down
13 changes: 11 additions & 2 deletions src/GameMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,17 @@ bool GameMain::Initialize()

// set initial gamestate
//SwitchToGameState(&mMeshViewGamestate);
gGameWorld.LoadScenario("null");
SwitchToGameState(&mGameplayGamestate);
if (!gSystem.mStartupParams.mStartupMapName.empty())
{
if (gGameWorld.LoadScenario(gSystem.mStartupParams.mStartupMapName))
{
SwitchToGameState(&mGameplayGamestate);
}
}
else
{
gConsole.LogMessage(eLogMessage_Info, "Startup map is not specified");
}

//SwitchToGameState(&mGuiTestGamestate);

Expand Down
9 changes: 9 additions & 0 deletions src/SystemSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ bool SystemStartupParams::ParseStartupParams(int argc, char *argv[])
continue;
}

if (cxx_stricmp(argv[iarg], "-mapname") == 0 && (argc > iarg + 1))
{
mStartupMapName.assign(argv[iarg + 1]);

iarg += 2;
continue;
}

++iarg;
}

Expand All @@ -74,4 +82,5 @@ void SystemStartupParams::Clear()
{
mCustomConfigFileName.clear();
mDungeonKeeperGamePath.clear();
mStartupMapName.clear();
}
3 changes: 3 additions & 0 deletions src/SystemSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ struct SystemStartupParams
// full path to dungeon keeper game folder
std::string mDungeonKeeperGamePath;

// custom map name to load
std::string mStartupMapName;

public:
SystemStartupParams() = default;

Expand Down

0 comments on commit aab159d

Please sign in to comment.