add number of players to GameSummary. Changes DB but it's already

changed since last beta so I'm not upping the version.
This commit is contained in:
Andy2 2010-11-06 18:24:44 -07:00
parent 9fccbcc6b4
commit f36b253ae7
4 changed files with 13 additions and 4 deletions

View file

@ -992,6 +992,7 @@ Java_org_eehouse_android_xw4_jni_XwJNI_game_1summarize
XWJNI_START();
XP_S16 nMoves = model_getNMoves( state->game.model );
setInt( env, jsummary, "nMoves", nMoves );
setInt( env, jsummary, "nPlayers", nPlayers );
XP_Bool gameOver = server_getGameIsOver( state->game.server );
setBool( env, jsummary, "gameOver", gameOver );

View file

@ -32,6 +32,7 @@ public class DBHelper extends SQLiteOpenHelper {
public static final String FILE_NAME = "FILE_NAME";
public static final String NUM_MOVES = "NUM_MOVES";
public static final String NUM_PLAYERS = "NUM_PLAYERS";
public static final String GAME_OVER = "GAME_OVER";
public static final String SCORES = "SCORES";
// GAMEID: this isn't used yet but we'll want it to look up games
@ -59,9 +60,10 @@ public class DBHelper extends SQLiteOpenHelper {
public void onCreate( SQLiteDatabase db )
{
db.execSQL( "CREATE TABLE " + TABLE_NAME + " ("
+ FILE_NAME + " TEXT PRIMARY KEY,"
+ NUM_MOVES + " INTEGER,"
+ GAME_OVER + " INTEGER,"
+ FILE_NAME + " TEXT PRIMARY KEY,"
+ NUM_MOVES + " INTEGER,"
+ NUM_PLAYERS + " INTEGER,"
+ GAME_OVER + " INTEGER,"
+ CONTYPE + " INTEGER,"
+ ROOMNAME + " TEXT,"

View file

@ -43,7 +43,8 @@ public class DBUtils {
synchronized( s_dbHelper ) {
SQLiteDatabase db = s_dbHelper.getReadableDatabase();
String[] columns = { DBHelper.NUM_MOVES, DBHelper.GAME_OVER,
String[] columns = { DBHelper.NUM_MOVES, DBHelper.NUM_PLAYERS,
DBHelper.GAME_OVER,
DBHelper.CONTYPE, DBHelper.ROOMNAME,
DBHelper.RELAYID, DBHelper.SMSPHONE,
DBHelper.SCORES, DBHelper.HASMSGS
@ -56,6 +57,9 @@ public class DBUtils {
summary = new GameSummary();
summary.nMoves = cursor.getInt(cursor.
getColumnIndex(DBHelper.NUM_MOVES));
summary.nPlayers =
cursor.getInt(cursor.
getColumnIndex(DBHelper.NUM_PLAYERS));
int tmp = cursor.getInt(cursor.
getColumnIndex(DBHelper.GAME_OVER));
summary.gameOver = tmp == 0 ? false : true;
@ -116,6 +120,7 @@ public class DBUtils {
ContentValues values = new ContentValues();
values.put( DBHelper.FILE_NAME, path );
values.put( DBHelper.NUM_MOVES, summary.nMoves );
values.put( DBHelper.NUM_PLAYERS, summary.nPlayers );
values.put( DBHelper.GAME_OVER, summary.gameOver );
if ( null != summary.scores ) {

View file

@ -26,6 +26,7 @@ package org.eehouse.android.xw4.jni;
*/
public class GameSummary {
public int nMoves;
public int nPlayers;
public int[] scores;
public boolean gameOver;
public CommsAddrRec.CommsConnType conType;