summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/rustanddust/menu/PlayMenu.java8
-rw-r--r--core/src/ch/asynk/rustanddust/util/DB.java6
2 files changed, 8 insertions, 6 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
index 7e93325..977b56f 100644
--- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java
@@ -67,7 +67,7 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel
@Override
public MenuCtrl.MenuType prepare()
{
- game.db.loadGames();
+ game.db.loadGames(game.config.gameMode.i);
game.config.gameId = game.db.NO_RECORD;
if (GameRecord.list.size() <= 0)
@@ -140,9 +140,11 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel
setConfig();
return MenuCtrl.MenuType.RESUME;
} else if (list.hit(x, y)) {
- if (i != getList().getIdx())
+ if (i != getList().getIdx()) {
game.playType();
- showBtns(getList().getIdx() != null);
+ GameRecord r = (GameRecord) getList().getSelected();
+ showBtns((r != null) && (r.canPlay()));
+ }
return MenuCtrl.MenuType.NONE;
}
diff --git a/core/src/ch/asynk/rustanddust/util/DB.java b/core/src/ch/asynk/rustanddust/util/DB.java
index f841912..21d87ed 100644
--- a/core/src/ch/asynk/rustanddust/util/DB.java
+++ b/core/src/ch/asynk/rustanddust/util/DB.java
@@ -343,14 +343,14 @@ public class DB
private static final String LOAD_BASE = "select g._id, g.mode, g.battle, g.opponent, g.turn, g.currentPlayer, g.ts, g.synched";
private static final String LOAD_GAMES = LOAD_BASE + ", null, null, null, null, null, null, p.name, b.name"
- + " from games g inner join players p on (p._id=g.opponent) inner join battles b on (b._id=g.battle);";
+ + " from games g inner join players p on (p._id=g.opponent) inner join battles b on (b._id=g.battle) where g.mode=%d;";
- public void loadGames()
+ public void loadGames(int mode)
{
RustAndDust.debug("loadGames");
GameRecord.clearList();
try {
- DatabaseCursor cursor = query(LOAD_GAMES);
+ DatabaseCursor cursor = query(String.format(LOAD_GAMES, mode));
if (cursor.getCount() > 0) {
while(cursor.next()) {
GameRecord r = gameRecordFrom(cursor);