replaced new RuntimeException(ex.getMessage()) with new RuntimeException(ex)
parent
9c434d4089
commit
51181c43b5
|
@ -94,11 +94,7 @@ public class DeckStrCal {
|
|||
|
||||
private static MagicTournament setupTournament() {
|
||||
// Load cards and cubes.
|
||||
try {
|
||||
MagicMain.initializeEngine();
|
||||
} catch (final IOException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
}
|
||||
MagicMain.initializeEngine();
|
||||
|
||||
// Set number of games.
|
||||
final TournamentConfig config=new TournamentConfig();
|
||||
|
|
|
@ -53,35 +53,35 @@ public class MagicMain {
|
|||
return getGamePath()+File.separatorChar+MODS_PATH;
|
||||
}
|
||||
|
||||
public static void initializeEngine() throws IOException {
|
||||
CardDefinitions.getInstance().loadCardDefinitions();
|
||||
CubeDefinitions.getInstance().loadCubeDefinitions();
|
||||
KeywordDefinitions.getInstance().loadKeywordDefinitions();
|
||||
TriggerDefinitions.addTriggers();
|
||||
LocalVariableDefinitions.addLocalVariables();
|
||||
ManaActivationDefinitions.addManaActivations();
|
||||
PermanentActivationDefinitions.addPermanentActivations();
|
||||
CardEventDefinitions.setCardEvents();
|
||||
MagicStaticLocalVariable.initializeCardDefinitions();
|
||||
public static void initializeEngine() {
|
||||
try {
|
||||
CardDefinitions.getInstance().loadCardDefinitions();
|
||||
CubeDefinitions.getInstance().loadCubeDefinitions();
|
||||
KeywordDefinitions.getInstance().loadKeywordDefinitions();
|
||||
TriggerDefinitions.addTriggers();
|
||||
LocalVariableDefinitions.addLocalVariables();
|
||||
ManaActivationDefinitions.addManaActivations();
|
||||
PermanentActivationDefinitions.addPermanentActivations();
|
||||
CardEventDefinitions.setCardEvents();
|
||||
MagicStaticLocalVariable.initializeCardDefinitions();
|
||||
} catch (final IOException ex) {
|
||||
System.err.println("ERROR! Unable to initialize the engine due to IO problems");
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
try {
|
||||
boolean madeGamePath = new File(getGamePath()).mkdir();
|
||||
if (!madeGamePath) {
|
||||
System.err.println("Unable to create directory " + getGamePath());
|
||||
}
|
||||
boolean madeGamePath = new File(getGamePath()).mkdir();
|
||||
if (!madeGamePath) {
|
||||
System.err.println("Unable to create directory " + getGamePath());
|
||||
}
|
||||
|
||||
boolean madeModsPath = new File(getModsPath()).mkdir();
|
||||
if (!madeModsPath) {
|
||||
System.err.println("Unable to create directory " + getModsPath());
|
||||
}
|
||||
|
||||
DeckUtils.createDeckFolder();
|
||||
initializeEngine();
|
||||
} catch (final IOException ex) {
|
||||
System.err.println("ERROR! Unable to initialize the engine");
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
}
|
||||
boolean madeModsPath = new File(getModsPath()).mkdir();
|
||||
if (!madeModsPath) {
|
||||
System.err.println("Unable to create directory " + getModsPath());
|
||||
}
|
||||
|
||||
DeckUtils.createDeckFolder();
|
||||
initializeEngine();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,14 +24,12 @@ public class ArtificialWorker {
|
|||
private int maxGames;
|
||||
|
||||
public ArtificialWorker(final int id,final MagicGame game,final ArtificialScoreBoard scoreBoard) {
|
||||
|
||||
this.id=id;
|
||||
this.game=game;
|
||||
this.scoreBoard=scoreBoard;
|
||||
}
|
||||
|
||||
private ArtificialScore runGame(final Object nextChoiceResults[],final ArtificialPruneScore pruneScore,int depth) {
|
||||
|
||||
if (depth>maxDepth) {
|
||||
throw new MaximumExceededException();
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ public class ArtificialWorkerPool {
|
|||
try {
|
||||
wait();
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
final ArtificialWorker worker=workers.removeLast();
|
||||
|
@ -179,7 +179,7 @@ public class ArtificialWorkerPool {
|
|||
try {
|
||||
wait();
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ public class MMAB implements MagicAI {
|
|||
try {
|
||||
wait();
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
final ArtificialWorker worker=workers.removeLast();
|
||||
|
@ -163,7 +163,7 @@ public class MMAB implements MagicAI {
|
|||
try {
|
||||
wait();
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,13 +95,13 @@ public class TestGameBuilder {
|
|||
game = gb.getGame();
|
||||
} catch (final ClassNotFoundException ex) {
|
||||
System.err.println("ERROR! Unable to build game " + id);
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
} catch (final InstantiationException ex) {
|
||||
System.err.println("ERROR! Unable to build game " + id);
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
} catch (final IllegalAccessException ex) {
|
||||
System.err.println("ERROR! Unable to build game " + id);
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
return game;
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ public final class DelayedViewersThread extends Thread {
|
|||
//wait for 100ms
|
||||
wait(100);
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ public class GameController {
|
|||
try {
|
||||
Thread.sleep(t);
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,9 +100,9 @@ public class GameController {
|
|||
try {
|
||||
SwingUtilities.invokeAndWait(task);
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
} catch (final InvocationTargetException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -116,7 +116,7 @@ public class GameController {
|
|||
}
|
||||
return false;
|
||||
} catch (final InterruptedException ex) {
|
||||
throw new RuntimeException(ex.getMessage());
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue