diff --git a/WebContent/game.jsp b/WebContent/game.jsp
index b7c0b86..33375be 100644
--- a/WebContent/game.jsp
+++ b/WebContent/game.jsp
@@ -286,14 +286,12 @@ HttpSession hSession = request.getSession(true);
-
diff --git a/WebContent/js/cah.game.js b/WebContent/js/cah.game.js
index 8070c2a..5bf666f 100644
--- a/WebContent/js/cah.game.js
+++ b/WebContent/js/cah.game.js
@@ -1085,8 +1085,8 @@ cah.Game.prototype.updateOptionsEnabled_ = function() {
cah.Game.prototype.optionChanged_ = function(e) {
cah.Ajax.build(cah.$.AjaxOperation.CHANGE_GAME_OPTIONS).withGameId(this.id_).withScoreLimit(
$(".score_limit", this.optionsElement_).val()).withPlayerLimit(
- $(".player_limit", this.optionsElement_).val()).withCardSet(0).run();
- // $(".card_set", this.optionsElement_).val()).run();
+ $(".player_limit", this.optionsElement_).val()).withCardSet(
+ $(".card_set", this.optionsElement_).val()).run();
};
/**
diff --git a/src/net/socialgamer/cah/data/BlackDeck.java b/src/net/socialgamer/cah/data/BlackDeck.java
index bd25e47..168422c 100644
--- a/src/net/socialgamer/cah/data/BlackDeck.java
+++ b/src/net/socialgamer/cah/data/BlackDeck.java
@@ -48,12 +48,18 @@ public class BlackDeck {
* Create a new black card deck, loading the cards from the database and shuffling them.
*/
@SuppressWarnings("unchecked")
- public BlackDeck() {
+ public BlackDeck(final int cardSet) {
final Session session = HibernateUtil.instance.sessionFactory.openSession();
final Transaction transaction = session.beginTransaction();
transaction.begin();
// TODO option to restrict to only stock cards or allow customs
- deck = session.createQuery("from BlackCard order by random()").setReadOnly(true).list();
+ String query = "from BlackCard order by random()";
+ if (1 == cardSet) {
+ query = "from BlackCard where in_v1 = true order by random()";
+ } else if (2 == cardSet) {
+ query = "from BlackCard where in_v2 = true order by random()";
+ }
+ deck = session.createQuery(query).setReadOnly(true).list();
dealt = new ArrayList();
discard = new ArrayList();
transaction.commit();
diff --git a/src/net/socialgamer/cah/data/Game.java b/src/net/socialgamer/cah/data/Game.java
index 3235837..160dadf 100644
--- a/src/net/socialgamer/cah/data/Game.java
+++ b/src/net/socialgamer/cah/data/Game.java
@@ -121,7 +121,7 @@ public class Game {
private Timer nextRoundTimer;
private final Object nextRoundTimerLock = new Object();
private int scoreGoal = 8;
- private int cardSet = 0;
+ private int cardSet = 2;
/**
* Create a new game.
@@ -484,8 +484,8 @@ public class Game {
if (players.size() >= 3) {
// Pick a random start judge, though the "next" judge will actually go first.
judgeIndex = (int) (Math.random() * players.size());
- blackDeck = new BlackDeck();
- whiteDeck = new WhiteDeck();
+ blackDeck = new BlackDeck(cardSet);
+ whiteDeck = new WhiteDeck(cardSet);
startNextRound();
return true;
} else {
diff --git a/src/net/socialgamer/cah/data/WhiteDeck.java b/src/net/socialgamer/cah/data/WhiteDeck.java
index 3acbbef..5e62b86 100644
--- a/src/net/socialgamer/cah/data/WhiteDeck.java
+++ b/src/net/socialgamer/cah/data/WhiteDeck.java
@@ -48,12 +48,18 @@ public class WhiteDeck {
* Create a new white card deck, loading the cards from the database and shuffling them.
*/
@SuppressWarnings("unchecked")
- public WhiteDeck() {
+ public WhiteDeck(final int cardSet) {
final Session session = HibernateUtil.instance.sessionFactory.openSession();
final Transaction transaction = session.beginTransaction();
transaction.begin();
// TODO option to restrict to only stock cards or allow customs
- deck = session.createQuery("from WhiteCard order by random()").setReadOnly(true).list();
+ String query = "from WhiteCard order by random()";
+ if (1 == cardSet) {
+ query = "from WhiteCard where in_v1 = true order by random()";
+ } else if (2 == cardSet) {
+ query = "from WhiteCard where in_v2 = true order by random()";
+ }
+ deck = session.createQuery(query).setReadOnly(true).list();
dealt = new ArrayList();
discard = new ArrayList();
transaction.commit();