Search in sources :

Example 1 with PlainRandomSource

use of games.strategy.engine.random.PlainRandomSource in project triplea by triplea-game.

the class LauncherFactory method getLocalLaunchers.

/**
 * Creates a launcher for a single player local (no network) game.
 */
public static ILauncher getLocalLaunchers(final GameSelectorModel gameSelectorModel, final Collection<? extends PlayerCountrySelection> playerRows) {
    final Map<String, String> playerTypes = playerRows.stream().collect(Collectors.toMap(PlayerCountrySelection::getPlayerName, PlayerCountrySelection::getPlayerType));
    final Map<String, Boolean> playersEnabled = playerRows.stream().collect(Collectors.toMap(PlayerCountrySelection::getPlayerName, PlayerCountrySelection::isPlayerEnabled));
    // we don't need the playerToNode list, the disable-able players, or the alliances
    // list, for a local game
    final PlayerListing pl = new PlayerListing(null, playersEnabled, playerTypes, gameSelectorModel.getGameData().getGameVersion(), gameSelectorModel.getGameName(), gameSelectorModel.getGameRound(), null, null);
    return new LocalLauncher(gameSelectorModel, new PlainRandomSource(), pl);
}
Also used : PlainRandomSource(games.strategy.engine.random.PlainRandomSource) PlayerListing(games.strategy.engine.framework.message.PlayerListing)

Aggregations

PlayerListing (games.strategy.engine.framework.message.PlayerListing)1 PlainRandomSource (games.strategy.engine.random.PlainRandomSource)1