add option to load snapshot from command line
parent
83b36734e7
commit
679bfafb7e
3
Makefile
3
Makefile
|
@ -200,6 +200,9 @@ release/Magarena-%.jar:
|
|||
tags: $(SRC)
|
||||
ctags -R src
|
||||
|
||||
%.game.run: $(MAG)
|
||||
$(DEBUG) -DsaveGame=$*.game -Dmagarena.dir=`pwd`/release -jar $^ 2>&1
|
||||
|
||||
Test%.run: $(MAG)
|
||||
$(DEBUG) -DtestGame=Test$* -Dmagarena.dir=`pwd`/release -jar $^ 2>&1 | tee Test$*.log
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@ import magic.ui.SplashProgressReporter;
|
|||
import magic.data.DuelConfig;
|
||||
import magic.data.GeneralConfig;
|
||||
import magic.test.TestGameBuilder;
|
||||
import magic.game.state.GameLoader;
|
||||
import magic.ui.ScreenController;
|
||||
import magic.ui.helpers.LaFHelper;
|
||||
import magic.ui.UiExceptionHandler;
|
||||
|
@ -45,7 +46,7 @@ public class MagicMain {
|
|||
}
|
||||
|
||||
LaFHelper.setDefaultLookAndFeel();
|
||||
|
||||
|
||||
reporter.setMessage("Starting UI...");
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
public void run() {
|
||||
|
@ -87,6 +88,14 @@ public class MagicMain {
|
|||
return;
|
||||
}
|
||||
|
||||
// -DsaveGame=X, where X is the path to a snapshot.game
|
||||
final String saveGame = System.getProperty("saveGame");
|
||||
if (saveGame != null) {
|
||||
final File f = new File(saveGame);
|
||||
ScreenController.showDuelGameScreen(GameLoader.loadSavedGame(f));
|
||||
return;
|
||||
}
|
||||
|
||||
// -DselfMode=true
|
||||
if (MagicSystem.isAiVersusAi()) {
|
||||
final DuelConfig config = DuelConfig.getInstance();
|
||||
|
|
|
@ -19,7 +19,7 @@ public class DuelGameScreen extends MScreen {
|
|||
showScreen(duel.nextGame());
|
||||
}
|
||||
|
||||
// CTR - called when using -DtestGame=X argument.
|
||||
// CTR - called when using -DtestGame=X or -DsaveGame=X
|
||||
public DuelGameScreen(final MagicGame game) {
|
||||
showScreen(game);
|
||||
}
|
||||
|
|
|
@ -88,7 +88,7 @@ final public class MagicSystem {
|
|||
}
|
||||
|
||||
public static boolean isTestGame() {
|
||||
return (System.getProperty("testGame") != null && !System.getProperty("testGame").isEmpty());
|
||||
return System.getProperty("testGame") != null || System.getProperty("saveGame") != null;
|
||||
}
|
||||
|
||||
public static boolean isDevMode() {
|
||||
|
|
Loading…
Reference in New Issue