Correctly detect a game as finished if all pieces are placed
authorJoachim Breitner <mail@joachim-breitner.de>
Sat, 8 Feb 2014 15:26:42 +0000 (15:26 +0000)
committerJoachim Breitner <mail@joachim-breitner.de>
Sat, 8 Feb 2014 15:26:42 +0000 (15:26 +0000)
client/engine.js

index ba6b5ba..211fba5 100644 (file)
@@ -113,11 +113,11 @@ State.prototype.on_interaction = function(input){
 
                                if (this.is_game_finished()) {
                                        this.to_phase(FINISHED)
-                               }
-
-                               if (this.placed[PLAYER1] == this.chosen[PLAYER1] &&
-                                   this.placed[PLAYER2] == this.chosen[PLAYER2]) {
-                                       this.to_phase(CHOOSE);
+                               } else  {
+                                       if (this.placed[PLAYER1] == this.chosen[PLAYER1] &&
+                                           this.placed[PLAYER2] == this.chosen[PLAYER2]) {
+                                               this.to_phase(CHOOSE);
+                                       }
                                }
                        }
                }