head 1.16; access; symbols pre_resize_mods:1.16.2.2 networkedPlayers:1.16.0.2 priorToNetworkedPlayers:1.16 release1_2:1.12 release1_1:1.12 release1_0:1.12 reorg:1.12.0.2 preReorg:1.12 version1_0_0:1.6; locks; strict; comment @# @; 1.16 date 2014.01.01.00.11.55; author jra; state Exp; branches 1.16.2.1; next 1.15; deltatype text; commitid 10052C35D4A11ADECBF; 1.15 date 2013.11.05.00.33.07; author jra; state Exp; branches; next 1.14; deltatype text; commitid 10052783CC211FA8F64; 1.14 date 2013.10.21.00.01.51; author jra; state Exp; branches; next 1.13; deltatype text; commitid 10052646EEF1DB40C9E; 1.13 date 2013.10.08.19.47.39; author jra; state Exp; branches; next 1.12; deltatype text; commitid 100525461570BAFEE1C; 1.12 date 2013.10.02.14.44.18; author jra; state Exp; branches; next 1.11; deltatype text; commitid 100524C31420D3B5F59; 1.11 date 2013.08.19.16.14.20; author jra; state Exp; branches; next 1.10; deltatype text; commitid 10052124459105012EE; 1.10 date 2013.07.31.17.30.19; author jra; state Exp; branches; next 1.9; deltatype text; commitid 10051F949AA10732D4A; 1.9 date 2013.07.18.03.39.13; author jra; state Exp; branches; next 1.8; deltatype text; commitid 10051E7635F11ECC1E3; 1.8 date 2013.07.17.02.55.11; author jra; state Exp; branches; next 1.7; deltatype text; commitid 10051E6078D18046FA6; 1.7 date 2013.07.07.04.00.11; author jra; state Exp; branches; next 1.6; deltatype text; commitid 10051D8E7C72B29D458; 1.6 date 2013.06.14.12.43.26; author jra; state Exp; branches; next 1.5; deltatype text; commitid 10051BB0FEC125BB459; 1.5 date 2013.06.14.03.04.11; author jra; state Exp; branches; next 1.4; deltatype text; commitid 10051BA882A13672BEB; 1.4 date 2013.06.13.22.18.43; author jra; state Exp; branches; next 1.3; deltatype text; commitid 10051BA45420DA75D49; 1.3 date 2013.06.13.00.50.02; author jra; state Exp; branches; next 1.2; deltatype text; commitid 10051B9173911105A84; 1.2 date 2013.06.11.00.55.13; author jra; state Exp; branches; next 1.1; deltatype text; commitid 10051B6756C103A7740; 1.1 date 2013.06.10.17.37.59; author jra; state Exp; branches; next ; deltatype text; commitid 10051B60EF40CC19D07; 1.16.2.1 date 2014.07.09.01.58.42; author jra; state Exp; branches; next 1.16.2.2; deltatype text; commitid 10053BCA1CF24C89D9D; 1.16.2.2 date 2014.12.04.20.21.25; author jra; state Exp; branches; next 1.16.2.3; deltatype text; commitid 1005480C2450F2841F3; 1.16.2.3 date 2014.12.13.00.04.49; author jra; state Exp; branches; next 1.16.2.4; deltatype text; commitid 100548B829C20914CE6; 1.16.2.4 date 2014.12.13.01.53.30; author jra; state Exp; branches; next ; deltatype text; permissions 644; commitid dec548b9c166c3b; kopt kv; filename @UpdateStacks.java@; desc @@ 1.16 log @Restored previously removed code that called CardPane.remove(). This is needed to keep wildCount correct. Added code to UpdateStacks to keep vertical pane colors correct. @ text @/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package handandfoot.runnables; import handandfoot.CardImageView; import handandfoot.CardVertPaneInterface; import handandfoot.GameModel; import handandfoot.HandAndFoot; import handandfoot.Player; import java.util.Collections; import org.jra.cards.Card; /** * * @@author jra */ public class UpdateStacks implements Runnable { @@Override public void run() { if (HandAndFoot.debug.get(HandAndFoot.DEBUG_LOG)) { GameModel.log("In updateStacks"); } Card card = GameModel.discardStack.peek(); if (card == null) { GameModel.discardView.setVisible(false); } else { GameModel.discardView.setCard(card); GameModel.discardView.setVisible(true); } if (HandAndFoot.debug.get(HandAndFoot.DEBUG_LOG)) { GameModel.log("in UpdateStacks: myHand size is " + GameModel.hands.get(Player.Me).size()); } Collections.sort(GameModel.hands.get(Player.Me)); GameModel.myHandPane.getChildren().clear(); if (HandAndFoot.debug.get(HandAndFoot.DEBUG_LOG)) { GameModel.log("\tcardsDrawn = " + GameModel.cardsDrawn.get()); } for (int i = 0; i < GameModel.hands.get(Player.Me).size(); i++) { Card c = GameModel.hands.get(Player.Me).get(i); CardImageView iv = new CardImageView(c); if (GameModel.currentPlayer == Player.Me && // HandAndFoot.cardNotUsable != c && GameModel.cardsDrawn.get() > 1) { if (HandAndFoot.debug.get(HandAndFoot.DEBUG_LOG)) { GameModel.log("\tsetting OnDragDetected for " + c); } iv.setOnDragDetected(HandAndFoot.MyHandDragDetector); } else { if (HandAndFoot.debug.get(HandAndFoot.DEBUG_LOG)) { GameModel.log("\tunsetting OnDragDetected for " + c); } iv.setOnDragDetected(null); } GameModel.myHandPane.getChildren().add(iv); iv.setId(c.toString()); iv.setX(1.0); iv.setY(1.0 + HandAndFoot.HAND_VERT_OVERLAP * i); GameModel.myHandPane.setMouseTransparent(false); } for (CardVertPaneInterface cvpi : GameModel.myVertCanastas) { if (cvpi.getWildCount() > 0) { cvpi.setStyle("-fx-background-color: black;"); } else { cvpi.setStyle("-fx-background-color: red;"); } } for (CardVertPaneInterface cvpi : GameModel.theirVertCanastas) { if (cvpi.getWildCount() > 0) { cvpi.setStyle("-fx-background-color: black;"); } else { cvpi.setStyle("-fx-background-color: red;"); } } // if (HandAndFoot.debug.get(HandAndFoot.DEBUG_SHOW_HANDS)) { // GameModel.handDisplays[Player.West.ordinal() - 1].displayHand(GameModel.westHand); // GameModel.handDisplays[Player.North.ordinal() - 1].displayHand(GameModel.partnerHand); // GameModel.handDisplays[Player.East.ordinal() - 1].displayHand(GameModel.eastHand); // } synchronized (HandAndFoot.updateStacksLock) { HandAndFoot.updateStacksLock.notifyAll(); } if (HandAndFoot.debug.get(HandAndFoot.DEBUG_LOG)) { GameModel.log("end of UpdateStacks"); } } } @ 1.16.2.1 log @Hand can now be unsorted @ text @a11 1 import handandfoot.config.Config; d37 1 a37 3 if (Config.keepHandSorted.get()) { Collections.sort(GameModel.hands.get(Player.Me)); } @ 1.16.2.2 log @Minor mod with hope of eliminating CME. @ text @d61 1 d65 1 a65 1 GameModel.myHandPane.getChildren().add(iv); a66 1 GameModel.myHandPane.setMouseTransparent(false); @ 1.16.2.3 log @Improved board layout for dynamic resizing. @ text @d63 1 a63 1 iv.setY(1.0 + HandAndFoot.HAND_VERT_OVERLAP.doubleValue() * i); @ 1.16.2.4 log @myHandPane is now toFront(). @ text @a65 1 GameModel.myHandPane.toFront(); @ 1.15 log @Changed cardsDrawn check to ">1". @ text @d8 1 d65 15 @ 1.14 log @Eliminated HandAndFoot.unusableCard. Fixed exit via "X" button to kill pileHandlerThread @ text @d46 1 a46 1 GameModel.cardsDrawn.get() == 2) { @ 1.13 log @Fixed bug with hand and feet getting confused. now all references should be through GameModel.hands map. @ text @d39 1 a39 1 GameModel.log("\tcardNotUsable = " + HandAndFoot.cardNotUsable + ", cardsDrawn = " + GameModel.cardsDrawn.get()); d45 1 a45 1 HandAndFoot.cardNotUsable != c && @ 1.12 log @Some more code cleanup. @ text @d34 1 a34 1 GameModel.log("in UpdateStacks: myHand size is " + GameModel.myHand.size()); d36 1 a36 1 Collections.sort(GameModel.myHand); d41 2 a42 2 for (int i = 0; i < GameModel.myHand.size(); i++) { Card c = GameModel.myHand.get(i); @ 1.11 log @now uses notifyAll() instead of notify() (suggested by findbugs) @ text @d64 5 a68 5 if (HandAndFoot.debug.get(HandAndFoot.DEBUG_SHOW_HANDS)) { GameModel.handDisplays[Player.West.ordinal() - 1].displayHand(GameModel.westHand); GameModel.handDisplays[Player.North.ordinal() - 1].displayHand(GameModel.partnerHand); GameModel.handDisplays[Player.East.ordinal() - 1].displayHand(GameModel.eastHand); } @ 1.10 log @Fixed bug: Undoing move after play from discard stack results in card drawn from pile being unplayable. @ text @d70 1 a70 1 HandAndFoot.updateStacksLock.notify(); @ 1.9 log @Code to prevent card from pile (after using discard) from being played. @ text @d38 3 d47 3 d52 3 @ 1.8 log @improved discard logic. HandAndFoot.debug is now aa BitSet. @ text @d41 3 a43 1 if (GameModel.currentPlayer == Player.Me && GameModel.cardsDrawn.get() == 2) { @ 1.7 log @Added pop up for laydown points. @ text @d22 1 a22 1 if (HandAndFoot.debug) { d33 1 a33 1 if (HandAndFoot.debug) { d53 1 a53 1 if (HandAndFoot.debug) { d61 1 a61 1 if (HandAndFoot.debug) { @ 1.6 log @added max wait times @ text @a11 2 import java.util.logging.Level; import java.util.logging.Logger; d52 6 a57 5 // try { // Thread.sleep(200); // need sleep here to let caller get into its synchronized block before us // } catch (InterruptedException ex) { // Logger.getLogger(UpdateStacks.class.getName()).log(Level.SEVERE, null, ex); // } @ 1.5 log @added a couple short sleeps to insure that calling thread gets to synchronized block before the Application Thread. @ text @d54 5 a58 5 try { Thread.sleep(200); // need sleep here to let caller get into its synchronized block before us } catch (InterruptedException ex) { Logger.getLogger(UpdateStacks.class.getName()).log(Level.SEVERE, null, ex); } @ 1.4 log @more logging @ text @d12 2 d35 24 a59 19 if (HandAndFoot.debug) { GameModel.log("in UpdateStacks: myHand size is " + GameModel.myHand.size()); } Collections.sort(GameModel.myHand); GameModel.myHandPane.getChildren().clear(); for (int i = 0; i < GameModel.myHand.size(); i++) { Card c = GameModel.myHand.get(i); CardImageView iv = new CardImageView(c); if (GameModel.currentPlayer == Player.Me && GameModel.cardsDrawn.get() == 2) { iv.setOnDragDetected(HandAndFoot.MyHandDragDetector); } else { iv.setOnDragDetected(null); } GameModel.myHandPane.getChildren().add(iv); iv.setId(c.toString()); iv.setX(1.0); iv.setY(1.0 + HandAndFoot.HAND_VERT_OVERLAP * i); GameModel.myHandPane.setMouseTransparent(false); } @ 1.3 log @Added check to eliminate trying to play too many wild cards in AutoPlay.playOnExistingCanastas(). Added lock object for UpdateStacks @ text @d22 3 d55 3 @ 1.2 log @protected log messages with "If(debug)". fixed some bugs. @ text @d30 1 a30 1 synchronized (GameModel.root) { d50 1 a50 1 GameModel.root.notify(); @ 1.1 log @improved concurrency and locking @ text @d31 3 a33 1 GameModel.log("in UpdateStacks: myHand size is " + GameModel.myHand.size()); @