use of games.strategy.engine.random.InternalDiceServer in project triplea by triplea-game.
the class PbemSetupPanel method loadDiceServer.
/**
* Load the dice rollers from cache, if the game was a save game, the dice roller store is selected.
*
* @param data
* the game data
*/
private void loadDiceServer(final GameData data) {
final List<IRemoteDiceServer> diceRollers = new ArrayList<>(PropertiesDiceRoller.loadFromFile());
diceRollers.add(new InternalDiceServer());
for (final IRemoteDiceServer diceRoller : diceRollers) {
final IRemoteDiceServer cached = (IRemoteDiceServer) LocalBeanCache.INSTANCE.getSerializable(diceRoller.getDisplayName());
if (cached != null) {
diceRoller.setCcAddress(cached.getCcAddress());
diceRoller.setToAddress(cached.getToAddress());
diceRoller.setGameId(cached.getGameId());
}
}
diceServerEditor.setBeans(diceRollers);
if (gameSelectorModel.isSavedGame()) {
// get the dice roller from the save game, if any
final IRemoteDiceServer roller = (IRemoteDiceServer) data.getProperties().get(DICE_ROLLER);
if (roller != null) {
diceServerEditor.setSelectedBean(roller);
}
}
}
Aggregations