Correctly abort network games

git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@541 72836036-5685-4462-b002-a69064685172
This commit is contained in:
Matthias Schiffer 2011-06-21 04:42:34 +02:00
parent 853f29536a
commit d59f0eb27a
2 changed files with 15 additions and 5 deletions

View file

@ -32,7 +32,7 @@ public class ApplicationControl {
* Creates a new application control * Creates a new application control
* *
* @param view * @param view
* the view to use * the view to use
*/ */
public ApplicationControl(final IView view) { public ApplicationControl(final IView view) {
this.view = view; this.view = view;
@ -101,11 +101,10 @@ public class ApplicationControl {
saveControl.getLoadEvent().add( saveControl.getLoadEvent().add(
new IListener3<GameSettings, GameState, IRoundState>() { new IListener3<GameSettings, GameState, IRoundState>() {
@Override @Override
public void handle(GameSettings settings, public void handle(GameSettings settings, GameState gameState,
GameState gameState, IRoundState roundState) { IRoundState roundState) {
abortControls(); abortControls();
gameControl = new GameControl(settings, saveControl, gameControl = new GameControl(settings, saveControl, view);
view);
addGameControlListeners(gameControl); addGameControlListeners(gameControl);
gameControl.continueGame(gameState, roundState); gameControl.continueGame(gameState, roundState);
} }
@ -155,6 +154,10 @@ public class ApplicationControl {
networkControl.abort(); networkControl.abort();
networkControl = null; networkControl = null;
} }
view.showSidePanel(false);
view.showScorePanel(false);
view.setBottomPanel(BottomPanelType.START_GAME_PANEL);
} }
/** /**

View file

@ -240,12 +240,19 @@ public class NetworkControl {
if (settingsControl != null) { if (settingsControl != null) {
settingsControl.abort(); settingsControl.abort();
settingsControl = null;
} }
if (gameOfferControl != null) { if (gameOfferControl != null) {
gameOfferControl.abort(); gameOfferControl.abort();
gameOfferControl = null;
} }
if (gameJoinControl != null) { if (gameJoinControl != null) {
gameJoinControl.abort(); gameJoinControl.abort();
gameJoinControl = null;
}
if (gameControl != null) {
gameControl.abortGame();
gameControl = null;
} }
connectionControl.disconnect(); connectionControl.disconnect();