From cf1affb1ab83b9bad4064df0dcb6d9f441690441 Mon Sep 17 00:00:00 2001 From: forteri76 Date: Tue, 13 May 2014 02:55:38 +0000 Subject: [PATCH] Fixed synchronization issue at game startup. --- src/org/jfedor/frozenbubble/FrozenGame.java | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/org/jfedor/frozenbubble/FrozenGame.java b/src/org/jfedor/frozenbubble/FrozenGame.java index 4455bfa..b1b6eb7 100644 --- a/src/org/jfedor/frozenbubble/FrozenGame.java +++ b/src/org/jfedor/frozenbubble/FrozenGame.java @@ -909,14 +909,9 @@ else if (fixedBubbles == 7) { } /* - * If this is a network game, process bubble grid and compressor - * synchronization tasks. + * Perform game synchronization tasks. */ - if ((movingBubble == null) && (networkManager != null)) { - setGrid(); - lowerCompressorSteps(newSteps == 1); - } - + synchronizeNetworkGame(); synchronizeBubbleManager(); /* @@ -1336,6 +1331,7 @@ public void setGrid(byte[][] newGrid) { this.newGrid[i][j] = newGrid[i][j]; } } + synchronizeNetworkGame(); } public void setLaunchBubbleColors(int current, int next, int newNext) { @@ -1439,6 +1435,17 @@ public void synchronizeBubbleManager() { } } + /** + * If this is a network game, process bubble grid and compressor + * synchronization tasks. + */ + private void synchronizeNetworkGame() { + if ((movingBubble == null) && (networkManager != null)) { + setGrid(); + lowerCompressorSteps(newSteps == 1); + } + } + public void updatePenguinState(double dx) { if (dx < 0) { penguin.updateState(PenguinSprite.STATE_TURN_LEFT);