use of games.strategy.engine.delegate.DefaultDelegateBridge in project triplea by triplea-game.
the class ServerGame method startPersistentDelegates.
private void startPersistentDelegates() {
for (final IDelegate delegate : gameData.getDelegateList()) {
if (!(delegate instanceof IPersistentDelegate)) {
continue;
}
final DefaultDelegateBridge bridge = new DefaultDelegateBridge(gameData, this, new DelegateHistoryWriter(channelMessenger), randomStats, delegateExecutionManager);
if (delegateRandomSource == null) {
delegateRandomSource = (IRandomSource) delegateExecutionManager.createOutboundImplementation(randomSource, new Class<?>[] { IRandomSource.class });
}
bridge.setRandomSource(delegateRandomSource);
delegateExecutionManager.enterDelegateExecution();
try {
delegate.setDelegateBridgeAndPlayer(bridge);
delegate.start();
} finally {
delegateExecutionManager.leaveDelegateExecution();
}
}
}
use of games.strategy.engine.delegate.DefaultDelegateBridge in project triplea by triplea-game.
the class ServerGame method startStep.
private void startStep(final boolean stepIsRestoredFromSavedGame) {
// dont save if we just loaded
final DefaultDelegateBridge bridge = new DefaultDelegateBridge(gameData, this, new DelegateHistoryWriter(channelMessenger), randomStats, delegateExecutionManager);
if (delegateRandomSource == null) {
delegateRandomSource = (IRandomSource) delegateExecutionManager.createOutboundImplementation(randomSource, new Class<?>[] { IRandomSource.class });
}
bridge.setRandomSource(delegateRandomSource);
// node is created.
if (needToInitialize) {
addPlayerTypesToGameData(gamePlayers.values(), playerManager, bridge);
}
notifyGameStepChanged(stepIsRestoredFromSavedGame);
delegateExecutionManager.enterDelegateExecution();
try {
final IDelegate delegate = getCurrentStep().getDelegate();
delegate.setDelegateBridgeAndPlayer(bridge);
delegate.start();
} finally {
delegateExecutionManager.leaveDelegateExecution();
}
}
Aggregations