2020-01-31 21:29:45 +01:00
|
|
|
/* -*- compile-command: "make MEMDEBUG=TRUE -j5"; -*- */
|
2003-11-01 06:35:29 +01:00
|
|
|
/*
|
2020-01-31 21:29:45 +01:00
|
|
|
* Copyright 2000 - 2020 by Eric House (xwords@eehouse.org). All rights
|
2006-11-09 07:05:40 +01:00
|
|
|
* reserved.
|
2003-11-01 06:35:29 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
#ifdef PLATFORM_NCURSES
|
|
|
|
|
|
|
|
#include <ncurses.h>
|
|
|
|
#include <signal.h>
|
|
|
|
#include <assert.h>
|
|
|
|
#include <ctype.h>
|
2013-06-25 03:37:49 +02:00
|
|
|
#include <sys/time.h>
|
|
|
|
#include <time.h>
|
2023-11-18 04:39:45 +01:00
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <sys/un.h>
|
2003-11-01 06:35:29 +01:00
|
|
|
|
|
|
|
#include <netdb.h> /* gethostbyname */
|
|
|
|
#include <errno.h>
|
|
|
|
//#include <net/netinet.h>
|
|
|
|
|
|
|
|
#include <sys/poll.h>
|
2020-01-31 21:29:45 +01:00
|
|
|
#include <sys/ioctl.h>
|
2003-11-01 06:35:29 +01:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <fcntl.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
2023-11-18 04:39:45 +01:00
|
|
|
#include <cjson/cJSON.h>
|
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
#include "linuxmain.h"
|
2008-06-30 05:39:27 +02:00
|
|
|
#include "linuxutl.h"
|
2013-01-08 05:40:46 +01:00
|
|
|
#include "linuxdict.h"
|
2003-11-01 06:35:29 +01:00
|
|
|
#include "cursesmain.h"
|
|
|
|
#include "cursesask.h"
|
2003-11-16 18:17:04 +01:00
|
|
|
#include "cursesletterask.h"
|
2006-09-19 05:39:08 +02:00
|
|
|
#include "linuxbt.h"
|
2003-11-01 06:35:29 +01:00
|
|
|
#include "model.h"
|
|
|
|
#include "draw.h"
|
|
|
|
#include "board.h"
|
|
|
|
#include "engine.h"
|
|
|
|
/* #include "compipe.h" */
|
|
|
|
#include "xwstream.h"
|
|
|
|
#include "xwstate.h"
|
2011-09-30 15:32:21 +02:00
|
|
|
#include "strutils.h"
|
2003-11-01 06:35:29 +01:00
|
|
|
#include "server.h"
|
|
|
|
#include "memstream.h"
|
|
|
|
#include "util.h"
|
2006-11-07 06:46:44 +01:00
|
|
|
#include "dbgutil.h"
|
2009-01-13 14:33:56 +01:00
|
|
|
#include "linuxsms.h"
|
|
|
|
#include "linuxudp.h"
|
2013-01-24 16:49:49 +01:00
|
|
|
#include "gamesdb.h"
|
|
|
|
#include "relaycon.h"
|
2020-05-20 22:58:53 +02:00
|
|
|
#include "mqttcon.h"
|
2018-07-06 06:40:56 +02:00
|
|
|
#include "smsproto.h"
|
2020-01-08 19:19:01 +01:00
|
|
|
#include "device.h"
|
2020-01-24 18:05:16 +01:00
|
|
|
#include "cursesmenu.h"
|
|
|
|
#include "cursesboard.h"
|
|
|
|
#include "curgamlistwin.h"
|
|
|
|
#include "gsrcwrap.h"
|
2008-02-02 17:56:20 +01:00
|
|
|
|
|
|
|
#ifndef CURSES_CELL_HT
|
|
|
|
# define CURSES_CELL_HT 1
|
|
|
|
#endif
|
|
|
|
#ifndef CURSES_CELL_WIDTH
|
|
|
|
# define CURSES_CELL_WIDTH 2
|
|
|
|
#endif
|
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
#define INFINITE_TIMEOUT -1
|
2008-02-02 17:56:20 +01:00
|
|
|
#define BOARD_SCORE_PADDING 3
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
struct CursesAppGlobals {
|
|
|
|
CommonAppGlobals cag;
|
|
|
|
CursesMenuState* menuState;
|
|
|
|
CursGameList* gameList;
|
|
|
|
CursesBoardState* cbState;
|
|
|
|
WINDOW* mainWin;
|
|
|
|
int winWidth, winHeight;
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
XP_U16 nLinesMenu;
|
|
|
|
gchar* lastErr;
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
short statusLine;
|
|
|
|
|
|
|
|
struct sockaddr_in listenerSockAddr;
|
|
|
|
#ifdef USE_GLIBLOOP
|
|
|
|
GMainLoop* loop;
|
|
|
|
GList* sources;
|
|
|
|
int quitpipe[2];
|
2020-01-31 21:29:45 +01:00
|
|
|
int winchpipe[2];
|
2020-01-24 18:05:16 +01:00
|
|
|
#else
|
|
|
|
XP_Bool timeToExit;
|
|
|
|
short fdCount;
|
|
|
|
struct pollfd fdArray[FD_MAX]; /* one for stdio, one for listening socket */
|
|
|
|
int timepipe[2]; /* for reading/writing "user events" */
|
2008-02-02 21:58:44 +01:00
|
|
|
#endif
|
2020-01-24 18:05:16 +01:00
|
|
|
};
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static bool handleOpenGame( void* closure, int key );
|
|
|
|
static bool handleNewGame( void* closure, int key );
|
|
|
|
static bool handleDeleteGame( void* closure, int key );
|
|
|
|
static bool handleSel( void* closure, int key );
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2008-02-16 16:49:03 +01:00
|
|
|
const MenuList g_sharedMenuList[] = {
|
2008-02-02 17:56:20 +01:00
|
|
|
{ handleQuit, "Quit", "Q", 'Q' },
|
2020-01-24 18:05:16 +01:00
|
|
|
{ handleNewGame, "New Game", "N", 'N' },
|
|
|
|
{ handleOpenGame, "Open Sel.", "O", 'O' },
|
|
|
|
{ handleDeleteGame, "Delete Sel.", "D", 'D' },
|
|
|
|
{ handleSel, "Select up", "J", 'J' },
|
|
|
|
{ handleSel, "Select down", "K", 'K' },
|
|
|
|
/* { handleResend, "Resend", "R", 'R' }, */
|
|
|
|
/* { handleSpace, "Raise focus", "<spc>", ' ' }, */
|
|
|
|
/* { handleRet, "Click/tap", "<ret>", '\r' }, */
|
|
|
|
/* { handleHint, "Hint", "?", '?' }, */
|
|
|
|
|
|
|
|
/* #ifdef KEYBOARD_NAV */
|
|
|
|
/* { handleLeft, "Left", "H", 'H' }, */
|
|
|
|
/* { handleRight, "Right", "L", 'L' }, */
|
|
|
|
/* { handleUp, "Up", "J", 'J' }, */
|
|
|
|
/* { handleDown, "Down", "K", 'K' }, */
|
|
|
|
/* #endif */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* { handleCommit, "Commit move", "C", 'C' }, */
|
|
|
|
/* { handleFlip, "Flip", "F", 'F' }, */
|
|
|
|
/* { handleToggleValues, "Show values", "V", 'V' }, */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* { handleBackspace, "Remove from board", "<del>", 8 }, */
|
|
|
|
/* { handleUndo, "Undo prev", "U", 'U' }, */
|
|
|
|
/* { handleReplace, "uNdo cur", "N", 'N' }, */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
|
|
|
{ NULL, NULL, NULL, '\0'}
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef CURSES_SMALL_SCREEN
|
2008-02-16 16:49:03 +01:00
|
|
|
const MenuList g_rootMenuListShow[] = {
|
2008-02-02 17:56:20 +01:00
|
|
|
{ handleRootKeyShow, "Press . for menu", "", '.' },
|
|
|
|
{ NULL, NULL, NULL, '\0'}
|
|
|
|
};
|
|
|
|
|
2008-02-16 16:49:03 +01:00
|
|
|
const MenuList g_rootMenuListHide[] = {
|
2008-02-02 17:56:20 +01:00
|
|
|
{ handleRootKeyHide, "Clear menu", ".", '.' },
|
|
|
|
{ NULL, NULL, NULL, '\0'}
|
|
|
|
};
|
|
|
|
#endif
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2008-02-02 17:56:20 +01:00
|
|
|
|
|
|
|
static CursesAppGlobals g_globals; /* must be global b/c of SIGWINCH_handler */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2010-07-09 15:49:32 +02:00
|
|
|
#ifdef KEYBOARD_NAV
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void changeMenuForFocus( CursesAppGlobals* globals, */
|
|
|
|
/* BoardObjectType obj ); */
|
|
|
|
/* static XP_Bool handleLeft( CursesAppGlobals* globals ); */
|
|
|
|
/* static XP_Bool handleRight( CursesAppGlobals* globals ); */
|
|
|
|
/* static XP_Bool handleUp( CursesAppGlobals* globals ); */
|
|
|
|
/* static XP_Bool handleDown( CursesAppGlobals* globals ); */
|
|
|
|
/* static XP_Bool handleFocusKey( CursesAppGlobals* globals, XP_Key key ); */
|
2010-07-09 15:49:32 +02:00
|
|
|
#else
|
|
|
|
# define handleFocusKey( g, k ) XP_FALSE
|
|
|
|
#endif
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void countMenuLines( const MenuList** menuLists, int maxX, int padding, */
|
|
|
|
/* int* nLinesP, int* nColsP ); */
|
|
|
|
/* static void drawMenuFromList( WINDOW* win, const MenuList** menuLists, */
|
|
|
|
/* int nLines, int padding ); */
|
|
|
|
/* static CursesMenuHandler getHandlerForKey( const MenuList* list, char ch ); */
|
2006-11-07 06:46:44 +01:00
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
|
|
|
|
#ifdef MEM_DEBUG
|
2013-01-07 15:10:44 +01:00
|
|
|
# define MEMPOOL cGlobals->util->mpool,
|
2003-11-01 06:35:29 +01:00
|
|
|
#else
|
|
|
|
# define MEMPOOL
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/* extern int errno; */
|
|
|
|
|
|
|
|
static void
|
2020-01-24 18:05:16 +01:00
|
|
|
initCurses( CursesAppGlobals* aGlobals )
|
2003-11-01 06:35:29 +01:00
|
|
|
{
|
|
|
|
/* ncurses man page says most apps want this sequence */
|
2020-02-14 06:43:46 +01:00
|
|
|
if ( !aGlobals->cag.params->closeStdin ) {
|
|
|
|
aGlobals->mainWin = initscr();
|
|
|
|
cbreak();
|
|
|
|
noecho();
|
|
|
|
nonl();
|
|
|
|
intrflush(stdscr, FALSE);
|
|
|
|
keypad(stdscr, TRUE); /* effects wgetch only? */
|
|
|
|
|
|
|
|
getmaxyx( aGlobals->mainWin, aGlobals->winHeight, aGlobals->winWidth );
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "getmaxyx()->w:%d; h:%d", aGlobals->winWidth,
|
|
|
|
aGlobals->winHeight );
|
2020-02-14 06:43:46 +01:00
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* globals->statusLine = height - MENU_WINDOW_HEIGHT - 1; */
|
|
|
|
/* globals->menuWin = newwin( MENU_WINDOW_HEIGHT, width, */
|
|
|
|
/* height-MENU_WINDOW_HEIGHT, 0 ); */
|
|
|
|
/* nodelay(globals->menuWin, 1); /\* don't block on getch *\/ */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
|
|
|
} /* initCurses */
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
showStatus( CursesAppGlobals* globals )
|
|
|
|
{
|
|
|
|
char* str;
|
|
|
|
|
|
|
|
switch ( globals->state ) {
|
|
|
|
case XW_SERVER_WAITING_CLIENT_SIGNON:
|
|
|
|
str = "Waiting for client[s] to connnect";
|
|
|
|
break;
|
|
|
|
case XW_SERVER_READY_TO_PLAY:
|
|
|
|
str = "It's somebody's move";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
str = "unknown state";
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
standout();
|
|
|
|
mvaddstr( globals->statusLine, 0, str );
|
|
|
|
/* clrtoeol(); */
|
|
|
|
standend();
|
|
|
|
|
|
|
|
refresh();
|
|
|
|
} /* showStatus */
|
|
|
|
#endif
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
bool
|
|
|
|
handleQuit( void* closure, int XP_UNUSED(key) )
|
2003-11-01 06:35:29 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
CursesAppGlobals* globals = (CursesAppGlobals*)closure;
|
2011-08-30 05:24:15 +02:00
|
|
|
g_main_loop_quit( globals->loop );
|
2003-11-01 06:35:29 +01:00
|
|
|
return XP_TRUE;
|
|
|
|
} /* handleQuit */
|
|
|
|
|
2023-08-14 17:10:29 +02:00
|
|
|
static void
|
|
|
|
invokeQuit( void* data )
|
|
|
|
{
|
|
|
|
LaunchParams* params = (LaunchParams*)data;
|
|
|
|
CursesAppGlobals* globals = (CursesAppGlobals*)params->appGlobals;
|
|
|
|
handleQuit( globals, 0 );
|
|
|
|
}
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static void
|
2020-01-29 19:59:57 +01:00
|
|
|
figureDims( CursesAppGlobals* aGlobals, cb_dims* dims )
|
2010-03-28 18:08:54 +02:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
LaunchParams* params = aGlobals->cag.params;
|
2020-01-29 19:59:57 +01:00
|
|
|
dims->width = aGlobals->winWidth;
|
|
|
|
dims->top = params->cursesListWinHt;
|
|
|
|
dims->height = aGlobals->winHeight - params->cursesListWinHt - MENU_WINDOW_HEIGHT;
|
2010-03-28 18:08:54 +02:00
|
|
|
}
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static bool
|
|
|
|
handleOpenGame( void* closure, int XP_UNUSED(key) )
|
2006-11-08 06:05:11 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
LOG_FUNC();
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
|
|
|
const GameInfo* gi = cgl_getSel( aGlobals->gameList );
|
2020-02-14 06:43:46 +01:00
|
|
|
XP_ASSERT( !!gi );
|
|
|
|
cb_dims dims;
|
|
|
|
figureDims( aGlobals, &dims );
|
|
|
|
cb_open( aGlobals->cbState, gi->rowid, &dims );
|
2020-01-24 18:05:16 +01:00
|
|
|
return XP_TRUE;
|
2006-11-08 06:05:11 +01:00
|
|
|
}
|
|
|
|
|
2022-01-18 05:00:04 +01:00
|
|
|
static bool
|
|
|
|
canMakeFromGI( const CurGameInfo* gi )
|
|
|
|
{
|
|
|
|
LOG_FUNC();
|
|
|
|
bool result = 0 < gi->nPlayers
|
2023-08-11 00:26:39 +02:00
|
|
|
&& !!gi->isoCodeStr[0]
|
2022-01-18 05:00:04 +01:00
|
|
|
;
|
|
|
|
bool haveDict = !!gi->dictName;
|
|
|
|
bool allHaveDicts = true;
|
|
|
|
for ( int ii = 0; result && ii < gi->nPlayers; ++ii ) {
|
|
|
|
const LocalPlayer* lp = &gi->players[ii];
|
|
|
|
result = !lp->isLocal || (!!lp->name && '\0' != lp->name[0]);
|
|
|
|
if ( allHaveDicts ) {
|
|
|
|
allHaveDicts = !!lp->dictName;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
result = result && (haveDict || allHaveDicts);
|
|
|
|
|
|
|
|
LOG_RETURNF( "%s", boolToStr(result) );
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static bool
|
|
|
|
handleNewGame( void* closure, int XP_UNUSED(key) )
|
2003-11-01 06:35:29 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
LOG_FUNC();
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
2006-11-08 06:05:11 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
// aGlobals->cag.params->needsNewGame = XP_FALSE;
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-29 19:59:57 +01:00
|
|
|
cb_dims dims;
|
|
|
|
figureDims( aGlobals, &dims );
|
2022-01-18 05:00:04 +01:00
|
|
|
|
|
|
|
const CurGameInfo* gi = &aGlobals->cag.params->pgi;
|
|
|
|
if ( !canMakeFromGI(gi) ) {
|
|
|
|
ca_inform( aGlobals->mainWin, "Unable to create game (check params?)" );
|
2023-11-30 20:03:27 +01:00
|
|
|
} else if ( !cb_new( aGlobals->cbState, &dims, NULL, NULL ) ) {
|
2022-01-18 05:00:04 +01:00
|
|
|
XP_ASSERT(0);
|
2020-01-29 18:52:23 +01:00
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
return XP_TRUE;
|
2020-01-24 18:05:16 +01:00
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static bool
|
|
|
|
handleDeleteGame( void* closure, int XP_UNUSED(key) )
|
2003-11-01 06:35:29 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
|
|
|
const char* question = "Are you sure you want to delete the "
|
|
|
|
"selected game? This action cannot be undone";
|
|
|
|
const char* buttons[] = { "Cancel", "Ok", };
|
|
|
|
if ( 1 == cursesask( aGlobals->mainWin, question, /* ?? */
|
|
|
|
VSIZE(buttons), buttons ) ) {
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
const GameInfo* gib = cgl_getSel( aGlobals->gameList );
|
|
|
|
if ( !!gib ) {
|
2020-09-25 05:56:46 +02:00
|
|
|
gdb_deleteGame( aGlobals->cag.params->pDb, gib->rowid );
|
2020-01-24 18:05:16 +01:00
|
|
|
cgl_remove( aGlobals->gameList, gib->rowid );
|
|
|
|
}
|
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
return XP_TRUE;
|
2020-01-24 18:05:16 +01:00
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static bool
|
|
|
|
handleSel( void* closure, int key )
|
2003-11-01 06:35:29 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
|
|
|
XP_ASSERT( key == 'K' || key == 'J' );
|
|
|
|
bool down = key == 'J';
|
|
|
|
cgl_moveSel( aGlobals->gameList, down );
|
|
|
|
return true;
|
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static XP_Bool */
|
|
|
|
/* handleResend( CursesAppGlobals* globals ) */
|
|
|
|
/* { */
|
|
|
|
/* if ( !!globals->cGlobals.game.comms ) { */
|
|
|
|
/* comms_resendAll( globals->cGlobals.game.comms, COMMS_CONN_NONE, */
|
|
|
|
/* XP_TRUE ); */
|
|
|
|
/* } */
|
|
|
|
/* return XP_TRUE; */
|
|
|
|
/* } */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* #ifdef KEYBOARD_NAV */
|
|
|
|
/* static void */
|
|
|
|
/* checkAssignFocus( BoardCtxt* board ) */
|
|
|
|
/* { */
|
|
|
|
/* if ( OBJ_NONE == board_getFocusOwner(board) ) { */
|
|
|
|
/* board_focusChanged( board, OBJ_BOARD, XP_TRUE ); */
|
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
/* #else */
|
|
|
|
/* # define checkAssignFocus(b) */
|
|
|
|
/* #endif */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static XP_Bool */
|
|
|
|
/* handleSpace( CursesAppGlobals* globals ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_Bool handled; */
|
|
|
|
/* checkAssignFocus( globals->cGlobals.game.board ); */
|
|
|
|
|
|
|
|
/* globals->doDraw = board_handleKey( globals->cGlobals.game.board, */
|
|
|
|
/* XP_RAISEFOCUS_KEY, &handled ); */
|
|
|
|
/* return XP_TRUE; */
|
|
|
|
/* } /\* handleSpace *\/ */
|
|
|
|
|
|
|
|
/* static XP_Bool */
|
|
|
|
/* handleRet( CursesAppGlobals* globals ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_Bool handled; */
|
|
|
|
/* globals->doDraw = board_handleKey( globals->cGlobals.game.board, */
|
|
|
|
/* XP_RETURN_KEY, &handled ); */
|
|
|
|
/* return XP_TRUE; */
|
|
|
|
/* } /\* handleRet *\/ */
|
|
|
|
|
|
|
|
/* static XP_Bool */
|
|
|
|
/* handleHint( CursesAppGlobals* globals ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_Bool redo; */
|
|
|
|
/* globals->doDraw = board_requestHint( globals->cGlobals.game.board, */
|
|
|
|
/* #ifdef XWFEATURE_SEARCHLIMIT */
|
|
|
|
/* XP_FALSE, */
|
|
|
|
/* #endif */
|
|
|
|
/* XP_FALSE, &redo ); */
|
|
|
|
/* return XP_TRUE; */
|
|
|
|
/* } /\* handleHint *\/ */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2008-02-02 17:56:20 +01:00
|
|
|
#ifdef CURSES_SMALL_SCREEN
|
|
|
|
static XP_Bool
|
|
|
|
handleRootKeyShow( CursesAppGlobals* globals )
|
|
|
|
{
|
|
|
|
WINDOW* win;
|
|
|
|
MenuList* lists[] = { g_sharedMenuList, globals->menuList,
|
|
|
|
g_rootMenuListHide, NULL };
|
|
|
|
int winMaxY, winMaxX;
|
|
|
|
|
|
|
|
wclear( globals->menuWin );
|
|
|
|
wrefresh( globals->menuWin );
|
|
|
|
|
|
|
|
getmaxyx( globals->boardWin, winMaxY, winMaxX );
|
|
|
|
|
|
|
|
int border = 2;
|
|
|
|
int width = winMaxX - (border * 2);
|
|
|
|
int padding = 1; /* for the box */
|
|
|
|
int nLines, nCols;
|
|
|
|
countMenuLines( lists, width, padding, &nLines, &nCols );
|
|
|
|
|
|
|
|
if ( width > nCols ) {
|
|
|
|
width = nCols;
|
|
|
|
}
|
|
|
|
|
|
|
|
win = newwin( nLines+(padding*2), width+(padding*2),
|
|
|
|
((winMaxY-nLines-padding-padding)/2), (winMaxX-width)/2 );
|
|
|
|
wclear( win );
|
|
|
|
box( win, '|', '-');
|
|
|
|
|
|
|
|
drawMenuFromList( win, lists, nLines, padding );
|
|
|
|
wrefresh( win );
|
|
|
|
|
|
|
|
CursesMenuHandler handler = NULL;
|
|
|
|
while ( !handler ) {
|
|
|
|
int ch = fgetc( stdin );
|
|
|
|
|
|
|
|
int i;
|
|
|
|
for ( i = 0; !!lists[i]; ++i ) {
|
|
|
|
handler = getHandlerForKey( lists[i], ch );
|
|
|
|
if ( !!handler ) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delwin( win );
|
|
|
|
|
|
|
|
touchwin( globals->boardWin );
|
|
|
|
wrefresh( globals->boardWin );
|
|
|
|
MenuList* ml[] = { g_rootMenuListShow, NULL };
|
|
|
|
drawMenuFromList( globals->menuWin, ml, 1, 0 );
|
|
|
|
wrefresh( globals->menuWin );
|
|
|
|
|
|
|
|
return handler != NULL && (*handler)(globals);
|
|
|
|
} /* handleRootKeyShow */
|
|
|
|
|
|
|
|
static XP_Bool
|
|
|
|
handleRootKeyHide( CursesAppGlobals* globals )
|
|
|
|
{
|
|
|
|
globals->doDraw = XP_TRUE;
|
|
|
|
return XP_TRUE;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2006-11-17 14:41:13 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void */
|
|
|
|
/* fmtMenuItem( const MenuList* item, char* buf, int maxLen ) */
|
|
|
|
/* { */
|
|
|
|
/* snprintf( buf, maxLen, "%s %s", item->keyDesc, item->desc ); */
|
|
|
|
/* } */
|
2006-11-17 14:41:13 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void */
|
|
|
|
/* countMenuLines( const MenuList** menuLists, int maxX, int padding, */
|
|
|
|
/* int* nLinesP, int* nColsP ) */
|
|
|
|
/* { */
|
|
|
|
/* int nCols = 0; */
|
|
|
|
/* /\* The menu space should be wider rather than taller, but line up by */
|
|
|
|
/* column. So we want to use as many columns as possible to minimize the */
|
|
|
|
/* number of lines. So start with one line and lay out. If that doesn't */
|
|
|
|
/* fit, try two. Given the number of lines, get the max width of each */
|
|
|
|
/* column. */
|
|
|
|
/* *\/ */
|
|
|
|
|
|
|
|
/* maxX -= padding * 2; /\* on left and right side *\/ */
|
|
|
|
|
|
|
|
/* int nLines; */
|
|
|
|
/* for ( nLines = 1; ; ++nLines ) { */
|
|
|
|
/* short line = 0; */
|
|
|
|
/* XP_Bool tooFewLines = XP_FALSE; */
|
|
|
|
/* int maxThisCol = 0; */
|
|
|
|
/* int i; */
|
|
|
|
/* nCols = 0; */
|
|
|
|
|
|
|
|
/* for ( i = 0; !tooFewLines && (NULL != menuLists[i]); ++i ) { */
|
|
|
|
/* const MenuList* entry; */
|
|
|
|
/* for ( entry = menuLists[i]; !tooFewLines && !!entry->handler; */
|
|
|
|
/* ++entry ) { */
|
|
|
|
/* int width; */
|
|
|
|
/* char buf[32]; */
|
|
|
|
|
|
|
|
/* /\* time to switch to new column? *\/ */
|
|
|
|
/* if ( line == nLines ) { */
|
|
|
|
/* nCols += maxThisCol; */
|
|
|
|
/* if ( nCols > maxX ) { */
|
|
|
|
/* tooFewLines = XP_TRUE; */
|
|
|
|
/* break; */
|
|
|
|
/* } */
|
|
|
|
/* maxThisCol = 0; */
|
|
|
|
/* line = 0; */
|
|
|
|
/* } */
|
2006-11-22 14:49:14 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* fmtMenuItem( entry, buf, sizeof(buf) ); */
|
|
|
|
/* width = strlen(buf) + 2; /\* padding *\/ */
|
2006-11-17 14:41:13 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* if ( maxThisCol < width ) { */
|
|
|
|
/* maxThisCol = width; */
|
|
|
|
/* } */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* ++line; */
|
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
/* /\* If we get here without running out of space, we're done *\/ */
|
|
|
|
/* nCols += maxThisCol; */
|
|
|
|
/* if ( !tooFewLines && (nCols < maxX) ) { */
|
|
|
|
/* break; */
|
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* *nColsP = nCols; */
|
|
|
|
/* *nLinesP = nLines; */
|
|
|
|
/* } /\* countMenuLines *\/ */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void */
|
|
|
|
/* drawMenuFromList( WINDOW* win, const MenuList** menuLists, */
|
|
|
|
/* int nLines, int padding ) */
|
|
|
|
/* { */
|
|
|
|
/* short line = 0, col, i; */
|
|
|
|
/* int winMaxY, winMaxX; */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* getmaxyx( win, winMaxY, winMaxX ); */
|
|
|
|
/* XP_USE(winMaxY); */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* int maxColWidth = 0; */
|
|
|
|
/* if ( 0 == nLines ) { */
|
|
|
|
/* int ignore; */
|
|
|
|
/* countMenuLines( menuLists, winMaxX, padding, &nLines, &ignore ); */
|
|
|
|
/* } */
|
|
|
|
/* col = 0; */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* for ( i = 0; NULL != menuLists[i]; ++i ) { */
|
|
|
|
/* const MenuList* entry; */
|
|
|
|
/* for ( entry = menuLists[i]; !!entry->handler; ++entry ) { */
|
|
|
|
/* char buf[32]; */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* fmtMenuItem( entry, buf, sizeof(buf) ); */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* mvwaddstr( win, line+padding, col+padding, buf ); */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* int width = strlen(buf) + 2; */
|
|
|
|
/* if ( width > maxColWidth ) { */
|
|
|
|
/* maxColWidth = width; */
|
|
|
|
/* } */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* if ( ++line == nLines ) { */
|
|
|
|
/* line = 0; */
|
|
|
|
/* col += maxColWidth; */
|
|
|
|
/* maxColWidth = 0; */
|
|
|
|
/* } */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
/* } /\* drawMenuFromList *\/ */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-31 21:29:45 +01:00
|
|
|
static void
|
|
|
|
writeToPipe( int pipe )
|
|
|
|
{
|
|
|
|
if ( 1 != write( pipe, "!", 1 ) ) {
|
|
|
|
XP_ASSERT(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
readFromPipe( GIOChannel* source )
|
|
|
|
{
|
|
|
|
int pipe = g_io_channel_unix_get_fd( source );
|
|
|
|
char ch;
|
2020-02-10 05:27:12 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
ssize_t nRead =
|
|
|
|
#endif
|
|
|
|
read( pipe, &ch, sizeof(ch) );
|
2020-01-31 21:29:45 +01:00
|
|
|
XP_ASSERT( nRead == sizeof(ch) && ch == '!' );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2003-11-01 06:35:29 +01:00
|
|
|
SIGWINCH_handler( int signal )
|
|
|
|
{
|
|
|
|
assert( signal == SIGWINCH );
|
|
|
|
|
2020-01-31 21:29:45 +01:00
|
|
|
/* Write to pipe to force update */
|
|
|
|
writeToPipe( g_globals.winchpipe[1] );
|
2003-11-01 06:35:29 +01:00
|
|
|
} /* SIGWINCH_handler */
|
|
|
|
|
2009-07-29 06:29:29 +02:00
|
|
|
static void
|
2009-08-30 17:23:05 +02:00
|
|
|
SIGINTTERM_handler( int XP_UNUSED(signal) )
|
2009-07-29 06:29:29 +02:00
|
|
|
{
|
2020-01-31 21:29:45 +01:00
|
|
|
writeToPipe( g_globals.quitpipe[1] );
|
2009-07-29 06:29:29 +02:00
|
|
|
}
|
|
|
|
|
2011-08-30 05:24:15 +02:00
|
|
|
#ifdef USE_GLIBLOOP
|
2013-05-25 06:19:20 +02:00
|
|
|
static gboolean
|
2020-01-31 21:29:45 +01:00
|
|
|
handle_quitwrite( GIOChannel* source, GIOCondition XP_UNUSED(condition), gpointer data )
|
2013-05-25 06:19:20 +02:00
|
|
|
{
|
2020-02-08 08:11:20 +01:00
|
|
|
LOG_FUNC();
|
2020-01-31 21:29:45 +01:00
|
|
|
readFromPipe( source );
|
2020-02-08 08:11:20 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)data;
|
|
|
|
handleQuit( aGlobals, 0 );
|
2013-05-25 06:19:20 +02:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2020-01-31 21:29:45 +01:00
|
|
|
static gboolean
|
2020-02-10 05:27:12 +01:00
|
|
|
handle_winchwrite( GIOChannel* source, GIOCondition XP_UNUSED_DBG(condition), gpointer data )
|
2020-01-31 21:29:45 +01:00
|
|
|
{
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "(condition=%x)", condition );
|
2020-01-31 21:29:45 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)data;
|
|
|
|
|
|
|
|
/* Read from the pipe so it won't call again */
|
|
|
|
readFromPipe( source );
|
|
|
|
|
|
|
|
struct winsize ws;
|
|
|
|
ioctl( STDIN_FILENO, TIOCGWINSZ, &ws );
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "lines %d, columns %d", ws.ws_row, ws.ws_col );
|
2020-01-31 21:29:45 +01:00
|
|
|
aGlobals->winHeight = ws.ws_row;
|
|
|
|
aGlobals->winWidth = ws.ws_col;
|
|
|
|
|
|
|
|
resize_term( ws.ws_row, ws.ws_col );
|
|
|
|
|
|
|
|
cgl_resized( aGlobals->gameList, g_globals.winWidth,
|
|
|
|
g_globals.cag.params->cursesListWinHt );
|
2020-02-06 02:04:22 +01:00
|
|
|
if ( !!aGlobals->menuState ) {
|
|
|
|
cmenu_resized( aGlobals->menuState );
|
|
|
|
}
|
2020-01-31 21:29:45 +01:00
|
|
|
|
|
|
|
cb_dims dims;
|
|
|
|
figureDims( aGlobals, &dims );
|
|
|
|
cb_resized( aGlobals->cbState, &dims );
|
|
|
|
|
|
|
|
LOG_RETURN_VOID();
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-08-30 05:24:15 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef USE_GLIBLOOP
|
2009-02-01 16:50:58 +01:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2005-09-09 05:14:11 +02:00
|
|
|
static int
|
2007-12-05 07:28:51 +01:00
|
|
|
figureTimeout( CursesAppGlobals* globals )
|
2005-09-09 05:14:11 +02:00
|
|
|
{
|
|
|
|
int result = INFINITE_TIMEOUT;
|
2009-07-10 07:04:04 +02:00
|
|
|
XWTimerReason ii;
|
|
|
|
XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util );
|
|
|
|
|
|
|
|
now *= 1000;
|
|
|
|
|
|
|
|
for ( ii = 0; ii < NUM_TIMERS_PLUS_ONE; ++ii ) {
|
|
|
|
TimerInfo* tip = &globals->cGlobals.timerInfo[ii];
|
|
|
|
if ( !!tip->proc ) {
|
|
|
|
XP_U32 then = tip->when * 1000;
|
|
|
|
if ( now >= then ) {
|
|
|
|
result = 0;
|
|
|
|
break; /* if one's immediate, we're done */
|
|
|
|
} else {
|
|
|
|
then -= now;
|
|
|
|
if ( result == -1 || then < result ) {
|
|
|
|
result = then;
|
|
|
|
}
|
|
|
|
}
|
2005-09-09 05:14:11 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
} /* figureTimeout */
|
2008-01-02 02:43:45 +01:00
|
|
|
#else
|
|
|
|
# define figureTimeout(g) INFINITE_TIMEOUT
|
|
|
|
#endif
|
2005-09-09 05:14:11 +02:00
|
|
|
|
2009-08-21 14:15:40 +02:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2009-07-10 07:04:04 +02:00
|
|
|
static void
|
|
|
|
fireCursesTimer( CursesAppGlobals* globals )
|
|
|
|
{
|
|
|
|
XWTimerReason ii;
|
|
|
|
TimerInfo* smallestTip = NULL;
|
|
|
|
|
|
|
|
for ( ii = 0; ii < NUM_TIMERS_PLUS_ONE; ++ii ) {
|
|
|
|
TimerInfo* tip = &globals->cGlobals.timerInfo[ii];
|
|
|
|
if ( !!tip->proc ) {
|
|
|
|
if ( !smallestTip ) {
|
|
|
|
smallestTip = tip;
|
|
|
|
} else if ( tip->when < smallestTip->when ) {
|
|
|
|
smallestTip = tip;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( !!smallestTip ) {
|
2009-08-21 14:15:40 +02:00
|
|
|
XP_U32 now = util_getCurSeconds( globals->cGlobals.params->util ) ;
|
|
|
|
if ( now >= smallestTip->when ) {
|
2010-01-25 01:28:30 +01:00
|
|
|
if ( linuxFireTimer( &globals->cGlobals,
|
|
|
|
smallestTip - globals->cGlobals.timerInfo ) ){
|
|
|
|
board_draw( globals->cGlobals.game.board );
|
|
|
|
}
|
2009-08-21 14:15:40 +02:00
|
|
|
} else {
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "skipping timer: now (%ld) < when (%ld)",
|
|
|
|
now, smallestTip->when );
|
2009-08-21 14:15:40 +02:00
|
|
|
}
|
2009-07-10 07:04:04 +02:00
|
|
|
}
|
2009-08-21 14:15:40 +02:00
|
|
|
} /* fireCursesTimer */
|
|
|
|
#endif
|
2011-08-30 05:24:15 +02:00
|
|
|
#endif
|
2009-07-10 07:04:04 +02:00
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
/*
|
|
|
|
* Ok, so this doesn't block yet....
|
|
|
|
*/
|
2011-08-30 05:24:15 +02:00
|
|
|
#ifndef USE_GLIBLOOP
|
2014-12-10 16:47:36 +01:00
|
|
|
/* static XP_Bool */
|
|
|
|
/* blocking_gotEvent( CursesAppGlobals* globals, int* ch ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_Bool result = XP_FALSE; */
|
|
|
|
/* int numEvents, ii; */
|
|
|
|
/* short fdIndex; */
|
|
|
|
/* XP_Bool redraw = XP_FALSE; */
|
|
|
|
|
|
|
|
/* int timeout = figureTimeout( globals ); */
|
|
|
|
/* numEvents = poll( globals->fdArray, globals->fdCount, timeout ); */
|
|
|
|
|
|
|
|
/* if ( timeout != INFINITE_TIMEOUT && numEvents == 0 ) { */
|
|
|
|
/* #ifdef XWFEATURE_RELAY */
|
|
|
|
/* fireCursesTimer( globals ); */
|
|
|
|
/* #endif */
|
|
|
|
/* } else if ( numEvents > 0 ) { */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2014-12-10 16:47:36 +01:00
|
|
|
/* /\* stdin first *\/ */
|
|
|
|
/* if ( (globals->fdArray[FD_STDIN].revents & POLLIN) != 0 ) { */
|
|
|
|
/* int evtCh = wgetch(globals->mainWin); */
|
|
|
|
/* XP_LOGF( "%s: got key: %x", __func__, evtCh ); */
|
|
|
|
/* *ch = evtCh; */
|
|
|
|
/* result = XP_TRUE; */
|
|
|
|
/* --numEvents; */
|
|
|
|
/* } */
|
|
|
|
/* if ( (globals->fdArray[FD_STDIN].revents & ~POLLIN ) ) { */
|
|
|
|
/* XP_LOGF( "some other events set on stdin" ); */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* if ( (globals->fdArray[FD_TIMEEVT].revents & POLLIN) != 0 ) { */
|
|
|
|
/* char ch; */
|
|
|
|
/* if ( 1 != read(globals->fdArray[FD_TIMEEVT].fd, &ch, 1 ) ) { */
|
|
|
|
/* XP_ASSERT(0); */
|
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* fdIndex = FD_FIRSTSOCKET; */
|
|
|
|
|
|
|
|
/* if ( numEvents > 0 ) { */
|
|
|
|
/* if ( (globals->fdArray[fdIndex].revents & ~POLLIN ) ) { */
|
|
|
|
/* XP_LOGF( "some other events set on socket %d", */
|
|
|
|
/* globals->fdArray[fdIndex].fd ); */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* if ( (globals->fdArray[fdIndex].revents & POLLIN) != 0 ) { */
|
|
|
|
|
|
|
|
/* --numEvents; */
|
|
|
|
|
|
|
|
/* if ( globals->fdArray[fdIndex].fd */
|
|
|
|
/* == globals->csInfo.server.serverSocket ) { */
|
|
|
|
/* /\* It's the listening socket: call platform's accept() */
|
|
|
|
/* wrapper *\/ */
|
|
|
|
/* (*globals->cGlobals.acceptor)( globals->fdArray[fdIndex].fd, */
|
|
|
|
/* globals ); */
|
|
|
|
/* } else { */
|
|
|
|
/* #ifndef XWFEATURE_STANDALONE_ONLY */
|
|
|
|
/* unsigned char buf[1024]; */
|
|
|
|
/* int nBytes; */
|
|
|
|
/* CommsAddrRec addrRec; */
|
|
|
|
/* CommsAddrRec* addrp = NULL; */
|
|
|
|
|
|
|
|
/* /\* It's a normal data socket *\/ */
|
|
|
|
/* switch ( globals->cGlobals.params->conType ) { */
|
|
|
|
/* #ifdef XWFEATURE_RELAY */
|
|
|
|
/* case COMMS_CONN_RELAY: */
|
|
|
|
/* nBytes = linux_relay_receive( &globals->cGlobals, buf, */
|
|
|
|
/* sizeof(buf) ); */
|
|
|
|
/* break; */
|
|
|
|
/* #endif */
|
|
|
|
/* #ifdef XWFEATURE_SMS */
|
|
|
|
/* case COMMS_CONN_SMS: */
|
|
|
|
/* addrp = &addrRec; */
|
|
|
|
/* nBytes = linux_sms_receive( &globals->cGlobals, */
|
|
|
|
/* globals->fdArray[fdIndex].fd, */
|
|
|
|
/* buf, sizeof(buf), addrp ); */
|
|
|
|
/* break; */
|
|
|
|
/* #endif */
|
|
|
|
/* #ifdef XWFEATURE_BLUETOOTH */
|
|
|
|
/* case COMMS_CONN_BT: */
|
|
|
|
/* nBytes = linux_bt_receive( globals->fdArray[fdIndex].fd, */
|
|
|
|
/* buf, sizeof(buf) ); */
|
|
|
|
/* break; */
|
|
|
|
/* #endif */
|
|
|
|
/* default: */
|
|
|
|
/* XP_ASSERT( 0 ); /\* fired *\/ */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* if ( nBytes != -1 ) { */
|
|
|
|
/* XWStreamCtxt* inboundS; */
|
|
|
|
/* redraw = XP_FALSE; */
|
|
|
|
|
|
|
|
/* inboundS = stream_from_msgbuf( &globals->cGlobals, */
|
|
|
|
/* buf, nBytes ); */
|
|
|
|
/* if ( !!inboundS ) { */
|
|
|
|
/* if ( comms_checkIncomingStream( */
|
|
|
|
/* globals->cGlobals.game.comms, */
|
|
|
|
/* inboundS, addrp ) ) { */
|
|
|
|
/* redraw = server_receiveMessage( */
|
|
|
|
/* globals->cGlobals.game.server, inboundS ); */
|
|
|
|
/* } */
|
|
|
|
/* stream_destroy( inboundS ); */
|
|
|
|
/* } */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2014-12-10 16:47:36 +01:00
|
|
|
/* /\* if there's something to draw resulting from the */
|
|
|
|
/* message, we need to give the main loop time to reflect */
|
|
|
|
/* that on the screen before giving the server another */
|
|
|
|
/* shot. So just call the idle proc. *\/ */
|
|
|
|
/* if ( redraw ) { */
|
|
|
|
/* curses_util_requestTime(globals->cGlobals.params->util); */
|
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
/* #else */
|
|
|
|
/* XP_ASSERT(0); /\* no socket activity in standalone game! *\/ */
|
|
|
|
/* #endif /\* #ifndef XWFEATURE_STANDALONE_ONLY *\/ */
|
|
|
|
/* } */
|
|
|
|
/* ++fdIndex; */
|
|
|
|
/* } */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* for ( ii = 0; ii < 5; ++ii ) { */
|
|
|
|
/* redraw = server_do( globals->cGlobals.game.server, NULL ) || redraw; */
|
|
|
|
/* } */
|
|
|
|
/* if ( redraw ) { */
|
|
|
|
/* /\* messages change a lot *\/ */
|
|
|
|
/* board_invalAll( globals->cGlobals.game.board ); */
|
|
|
|
/* board_draw( globals->cGlobals.game.board ); */
|
|
|
|
/* } */
|
|
|
|
/* saveGame( globals->cGlobals ); */
|
|
|
|
/* } */
|
|
|
|
/* return result; */
|
|
|
|
/* } /\* blocking_gotEvent *\/ */
|
2011-08-30 05:24:15 +02:00
|
|
|
#endif
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void */
|
|
|
|
/* remapKey( int* kp ) */
|
|
|
|
/* { */
|
|
|
|
/* /\* There's what the manual says I should get, and what I actually do from */
|
|
|
|
/* * a funky M$ keyboard.... */
|
|
|
|
/* *\/ */
|
|
|
|
/* int key = *kp; */
|
|
|
|
/* switch( key ) { */
|
|
|
|
/* case KEY_B2: /\* "center of keypad" *\/ */
|
|
|
|
/* key = '\r'; */
|
|
|
|
/* break; */
|
|
|
|
/* case KEY_DOWN: */
|
|
|
|
/* case 526: */
|
|
|
|
/* key = 'K'; */
|
|
|
|
/* break; */
|
|
|
|
/* case KEY_UP: */
|
|
|
|
/* case 523: */
|
|
|
|
/* key = 'J'; */
|
|
|
|
/* break; */
|
|
|
|
/* case KEY_LEFT: */
|
|
|
|
/* case 524: */
|
|
|
|
/* key = 'H'; */
|
|
|
|
/* break; */
|
|
|
|
/* case KEY_RIGHT: */
|
|
|
|
/* case 525: */
|
|
|
|
/* key = 'L'; */
|
|
|
|
/* break; */
|
|
|
|
/* default: */
|
|
|
|
/* if ( key > 0x7F ) { */
|
|
|
|
/* XP_LOGF( "%s(%d): no mapping", __func__, key ); */
|
|
|
|
/* } */
|
|
|
|
/* break; */
|
|
|
|
/* } */
|
|
|
|
/* *kp = key; */
|
|
|
|
/* } /\* remapKey *\/ */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
typedef struct _MenuEntry {
|
|
|
|
MenuList* menuItem;
|
|
|
|
void* closure;
|
|
|
|
} MenuEntry;
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* void */
|
|
|
|
/* drawMenuLargeOrSmall( CursesAppGlobals* globals, const MenuList* menuList, */
|
|
|
|
/* void* closure ) */
|
|
|
|
/* { */
|
|
|
|
/* #ifdef CURSES_SMALL_SCREEN */
|
|
|
|
/* const MenuList* lists[] = { g_rootMenuListShow, NULL }; */
|
|
|
|
/* #else */
|
|
|
|
/* const MenuList* lists[] = { g_sharedMenuList, menuList, NULL }; */
|
|
|
|
/* #endif */
|
|
|
|
/* wclear( globals->menuWin ); */
|
|
|
|
/* drawMenuFromList( globals->menuWin, lists, 0, 0 ); */
|
|
|
|
/* wrefresh( globals->menuWin ); */
|
|
|
|
/* } */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
static void
|
|
|
|
initClientSocket( CursesAppGlobals* globals, char* serverName )
|
|
|
|
{
|
|
|
|
struct hostent* hostinfo;
|
|
|
|
hostinfo = gethostbyname( serverName );
|
|
|
|
if ( !hostinfo ) {
|
2009-12-14 05:06:26 +01:00
|
|
|
userError( globals, "unable to get host info for %s\n", serverName );
|
2003-11-01 06:35:29 +01:00
|
|
|
} else {
|
2009-12-14 05:06:26 +01:00
|
|
|
char* hostName = inet_ntoa( *(struct in_addr*)hostinfo->h_addr );
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "gethostbyname returned %s", hostName );
|
2009-12-14 05:06:26 +01:00
|
|
|
globals->csInfo.client.serverAddr = inet_addr(hostName);
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "inet_addr returned %lu", globals->csInfo.client.serverAddr );
|
2003-11-01 06:35:29 +01:00
|
|
|
}
|
|
|
|
} /* initClientSocket */
|
|
|
|
#endif
|
|
|
|
|
Squashed commit of the following:
commit 6ed0462040d6fd45bf43c431df5db4702630da4e
Author: Eric House <eehouse@eehouse.org>
Date: Thu Jan 30 15:55:29 2020 -0800
script meant to be run in UserLAnd on android
commit 07b603f4abde00f1cb4face7f27d996fed1b0258
Author: Eric House <eehouse@eehouse.org>
Date: Thu Jan 30 15:01:00 2020 -0800
fix gtk invite scenario
required --name param, apparently.
commit 13201c4cedbf6564516ae850956b2f3155def0b1
Merge: a301491fb 752e3ff3e
Author: Eric House <xwords@eehouse.org>
Date: Thu Jan 30 12:38:09 2020 -0800
Merge branch 'android_branch' into duplicate_mode
commit a301491fb5d7b2e09f4b932b16c0a82d1429cb64
Merge: 5401a4bbe d6cf1d2f9
Author: Eric House <xwords@eehouse.org>
Date: Sat Jan 11 20:45:26 2020 -0800
Merge branch 'android_branch' into duplicate_mode
commit 5401a4bbe54cdad6adbfa8f9ba8a1c0112ff4dbe
Merge: a92275173 9406297c0
Author: Eric House <xwords@eehouse.org>
Date: Fri Jan 10 09:54:30 2020 -0800
Merge branch 'android_branch' into duplicate_mode
commit a922751730be87ae1ea7f6b2ee4263e8b14faabf
Author: Eric House <xwords@eehouse.org>
Date: Sun Dec 29 16:39:51 2019 -0800
move game list item pending counter below "dup"
commit 53ca75a56ba9ecde917a5c8c91deaf0afdb04ea0
Merge: 658e4ef92 15239d4a6
Author: Eric House <xwords@eehouse.org>
Date: Sun Dec 29 16:34:07 2019 -0800
Merge branch 'android_branch' into duplicate_mode
commit 658e4ef92277d0a1b5c7840883edfab55251d99f
Author: Eric House <xwords@eehouse.org>
Date: Tue Dec 10 20:33:24 2019 -0800
move BT UUID into build.gradle
And add a new UUID for the duplicate build so it doesn't try to talk to
the xw4d variant when both are installed.
commit a3141c86204bcc134a6fea1e8e6d1cedc743ee13
Author: Eric House <xwords@eehouse.org>
Date: Thu Nov 21 18:52:11 2019 -0800
modify icon for easier identification
commit db23f45ac075e8bc50c56b7fb9808a7e270f5625
Author: Eric House <xwords@eehouse.org>
Date: Thu Nov 21 18:38:18 2019 -0800
change name of key
I want to force the apps already out there to generate a correct
key. This has the lowest impact.
commit 91bc3f6ac406b2fda3426bb363c8e59c3973b75f
Author: Eric House <xwords@eehouse.org>
Date: Thu Nov 21 18:25:08 2019 -0800
use the right generated file
Duh. Used the wrong app/project so FCM couldn't work for the new Dup app
variant. Now it does.
commit d4ef6f12681bae4437e907e47fbdf1b35bf10d98
Author: Eric House <xwords@eehouse.org>
Date: Mon Nov 18 09:26:46 2019 -0800
add comms_getPending(), and refactor to implement
commit 60870e43373a8b73f3541529031791e1457aaa15
Author: Eric House <eehouse@eehouse.org>
Date: Wed Nov 13 12:30:07 2019 -0800
first cut at python version of dawg2dict
Perl version doesn't work and I don't remember enough of the language to
fix it.
commit b9547d1ec49f1d9d95b3b76b2bcc6ef0d088c531
Author: Eric House <eehouse@eehouse.org>
Date: Wed Nov 13 12:30:57 2019 -0800
fix comment
commit 442d219aeab0acfd3713e065f3c46cf0b5d40012
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 12 09:08:08 2019 -0800
check for undefined variable
commit 247415e18d0b764d3cdb52e9eedeac4b183428c5
Merge: 94c2a7e15 bd3b3e75e
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 19 20:12:18 2019 -0800
Merge branch 'duplicate_mode' of ssh://maidu2/home/eehouse/src/git/repos/xwords into duplicate_mode
commit 94c2a7e151eeb81bb29589db120a08ffdb5e78fb
Merge: 514e33900 a161abc1b
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 5 21:13:23 2019 -0800
Merge remote-tracking branch 'tmp-eeh/duplicate_mode' into duplicate_mode
commit a161abc1b2c1c0e8ce76ac71e9feed9d567a3a73
Author: Eric House <xwords@eehouse.org>
Date: Tue Nov 5 15:56:26 2019 -0800
make a new CrossDup variant
It's too much trouble having versions of CrossDbg that aren't compatible.
commit 514e33900fad2695dac89371995ea197a3c9fa4b
Merge: 2d5ec2dfc c69ec5250
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 5 08:43:52 2019 -0800
Merge branch 'android_branch' into duplicate_mode
commit 2d5ec2dfcdf2788baee2fadd69c8cbb7ac3cafd8
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 12:34:48 2019 +0000
log some hashing stuff (to share while debugging)
commit 564165ed2aef2cd2e893a1552dfb94ca61734f0d
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 11:23:40 2019 +0000
remove unnecessary logging
commit 0111db1951e40ff039cd276d1a77dc31d380ce32
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 11:22:27 2019 +0000
fix log_hex format alignment
commit c7e92680c2624c2d45bade42fddb3334348ce8fc
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 10:23:17 2019 +0000
toward making non-dupe stack hashes match
Changing the format meant that old builds and new couldn't play non-dupe
games together, which clearly sucks. There's still a problem, but this
is part of the fix.
commit fb185eca355840423b561e3237a6529ade409850
Merge: a6df962b1 37ac29e65
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 09:43:57 2019 +0000
Merge branch 'android_branch' into duplicate_mode
commit a6df962b1046ff191453a617afbeee272ce3dc66
Author: Eric House <eehouse@eehouse.org>
Date: Thu Oct 24 21:28:35 2019 +0200
cleanup (not dup-specific)
commit f8e31d20ae5399db98589540fff432dc053ec633
Author: Eric House <eehouse@eehouse.org>
Date: Tue Oct 22 13:38:37 2019 +0200
use https now to fix broken updating
commit 0add4e050235e9aed5e4f841497c02b80113dbdd
Author: Eric House <eehouse@eehouse.org>
Date: Tue Sep 10 16:39:19 2019 +0300
let cells be taller than wide too (take 2)
commit 897d4453702a4c820fb99e60ca0be1bca44d0f42
Author: Eric House <eehouse@eehouse.org>
Date: Tue Sep 10 16:30:14 2019 +0300
cleanup (not dup-specific)
commit 2973ffb908fc8a966082870dae348cdc74e646c7
Author: Eric House <eehouse@eehouse.org>
Date: Thu Aug 29 23:08:36 2019 +0300
assert that valid message is handled
I suspect that messages are being dropped (in server) after being
recorded (in comms), causing the game to stall forever. So add an
assertion that it's not happening. Haven't seen it yet in a few hundred
games, but it'll be nice to be more confident.
commit ae6aca71245c934ffe1cb8ba4dc12a0bcbfd1dda
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 18:35:12 2019 +0300
remove x86 from release builds
I either remove it or add the 64-bit abi. Since it's only there to run
in the emulator let's just leave it in for DEBUG builds. If I need to
run a release build in the emulator I can add it back.
commit 4d96f05f2ffea6ca3e9b7dd1776c81fbc0a1350b
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 18:14:01 2019 +0300
arm means two ABIs now
commit f00e8c1258ed62fcf74c7f4db856fb8366d3f348
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 18:13:40 2019 +0300
fix release build warnings
commit 86a7de8c493eb57012531e4953bfde8de38bbb97
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 08:23:52 2019 +0300
up API version to 28 (required soon)
commit 3382823b254cd7f2861362a895a7db483e253781
Author: Eric House <xwords@eehouse.org>
Date: Sun Jul 21 12:08:33 2019 -0700
wip: add clear 'X' to [un]pause msg editor
commit f0c0663b85bdcb6f36f50464a06ab5fb6041e738
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:11:17 2019 -0700
wip: stop using IMPORTANCE_HIGH: too obnoxious
commit 280838b680d10f0e5d280257e21c2eab66dbcec9
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:10:53 2019 -0700
wip: move misplaced assert
commit de004c956f2804264320adf4e197ed7274092f44
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 12:06:10 2019 -0700
wip: store the damned playerNum already
And remove mistaken minus-sign (typo?)
commit 17434fcb0c35f5e9489a6b01fd40e4908d4547e6
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 11:47:27 2019 -0700
wip: use rowid for notification id where possible
commit 5b20ba2f8c4d17118a709cdec556ea38b3f4199d
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:53:50 2019 -0700
wip: be smarter about looking for timer changes
Add a dutil callback for when timer value changes. In it, pass the new
value to DupeModeTimer. In that, don't bother servicing until the saved
value matches the stored/expected value (because there's otherwise yet
another save coming.)
commit e98d4154224e2013389962d22476bc571d721aa5
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:48:59 2019 -0700
wip: add unique notification id generator
I'm tired of trying to keep rowid-based notifications from trampling
each other. Now they can be unique per-channel.
commit fd94a0f0d23b4658c93bfb7793e658387bcbbcce
Author: Eric House <xwords@eehouse.org>
Date: Thu Jul 11 23:55:54 2019 -0700
wip: auto-pause when nobody moves
If moves all come in 0 and the timer's running, assume nobody's actually
playing and pause the game. While at it added [un]pause to game history
and made history entries include malloc()'d message, requiring a
free(). Lots of changes, with at least one glitch that games sometimes
hang after the autopause; and gameslist shows it as nobody's turn though
when opened the game knows it's a player's turn.
commit dfb6d2c2574fa63d416c7c800e7dbe30b0925143
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:40:11 2019 -0700
wip: cleanup/refactor
commit d4a37e5a03e874a4d1e43e72183eb73a8c0f70f5
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:23:58 2019 -0700
wip: run dupemodetimer more than once
Failure to reset a variable meant I never processed more than one timer
firing. Oops.
commit a19979ae7f71da4ba8d478c9a5a5ec4bc70b4c96
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 20:03:57 2019 -0700
wip: zero timer value when move's been made
Used to actually set the timer value to 0 when move was made, and
DupeModeTimer expected that. So zero the stored value before returning
it IFF move's been made already.
commit 7c52ce2a6a08db3b4e2a1bc32f71b073227f23ce
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 19:48:29 2019 -0700
wip: add pause button to notification
Make it easier to discover pausibility by adding pause button to
always-on notification. Implemented by opening the game and then within
it the Pause confirm alert, which required passing a boolean Extra
through from the launch intent to the one passed into BoardDelegate.
commit 9f82c2f2a3d710f6ad52b1b4f570625e2c19e277
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 14:31:43 2019 -0700
wip: fix to redraw timer when only turnDone changes
commit dee10cf35521018805621e3e2b4b58f2c2dee686
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 13:36:06 2019 -0700
wip: fix compile
commit b1e55307ccd8a849afddc27f9214eea738eb25d7
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 11:43:13 2019 -0700
wip: show timer when paused, and dim when turn done
commit 289080dcfa19e36ea0aa6bd204b61f81872f2b38
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:01:09 2019 -0700
wip: save separate excuses for pause and unpause
commit 0d427df8f45cc97e385886058b0b456a4e4ca495
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:00:20 2019 -0700
wip: invoke pause stuff via tap on timer
commit 6ef72472426c61573249e17a4842247114ecd432
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 30 20:39:17 2019 -0700
wip: pass name with pause info for better notification
commit 429baf6edb41a6821103a499b88406de9eb13673
Author: Eric House <xwords@eehouse.org>
Date: Sat Jun 29 11:50:40 2019 -0700
wip: improve pause/unpause confirm dialog
commit 9a302b137d56966513393abb4ca3169274ad72e3
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:45:17 2019 -0700
wip: pass just the message. Let client package it.
commit 6c9025e347a1fb97b90778db6563cd22a5aaa2b8
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:41:24 2019 -0700
wip: trigger notifications etc on pause change
commit dabe79c58c1a6ba1c098688dd2b6b764c543e98b
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:18:13 2019 -0700
wip: missing files
commit 352584858fa106b2094e9a393a9b3959a90511b9
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:15:58 2019 -0700
wip: pass explanatory message with [un]pause
commit a99976713b5f35ee61fc9629fb2df9ac11af9098
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 15:28:55 2019 -0700
set dbname in build.gradle
commit c0b3be342ad9d89b43ba00d77ae91ad09f8ff211
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 10:00:25 2019 -0700
fix crash on initial install
uninitialized variable
commit 3656f1d938c61ebf9ac780905f1a084cb4b024f1
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 13:35:30 2019 -0700
wip: fix too-frequent dupe-game checking
Do it all on a a background thread, and never process a game that was
added for processing while being processed. Fixes re-opening because we
just changed it, but may miss changes that matter.
commit a977b8fa51a8e8f9a469bc6fbf305364a29ef8ac
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 11:10:14 2019 -0700
wip: progress on timers
Mostly fixing DupeModeTimer to do less on main thread.
commit cb4cdc1c8221dfc94e9c9ef889d5d1b099b44049
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 07:14:13 2019 -0700
use macro for callbacks (as elsewhere)
commit 997de250c8d8e0a2de0b949258b06b8998bc1086
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 22:34:34 2019 -0700
wip: transmit [un]pause to other devices
commit 970fc8c9dbf3883211c1934f3f999149532609a8
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 17:15:55 2019 -0700
wip: more timer tweaks
commit b67b836028216345ef8d6d157bdaf9f59f698df4
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 15:01:04 2019 -0700
wip: fix assignment to wrong variable
commit 48cafcec1471e064413ade48ed79b51f1e7fb922
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 14:41:50 2019 -0700
wip: wire up [un]pause menus in Android board
commit 0476f1b21f3bd30e3ae970dc85a72a7eac67d5d9
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 11:09:19 2019 -0700
wip: pause/unpause without communication
commit 71815b2f17f0ca354eb6dd4dd12f65d309723db1
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:56:09 2019 -0700
wip: start adding [un]pause support
commit bc4f04c724f51668ace3db17703aa1446fad7405
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:07:24 2019 -0700
wip: fix to work when timer not set
commit 2b271abbb487aa8c5fa7f792d898c72f5d69e270
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:53:29 2019 -0700
wip: show tiles face-up in history for dup-mode
No point in hiding them when everybody has the same.
commit 945b8527847af20ca955fb313b7bf49887e4e012
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:47:19 2019 -0700
wip: don't draw paused (0:00) timer in duplicate mode
Required passing in a new boolean
commit 6229fb88302d6da8d432a743955f3dc54d871bda
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 19:16:40 2019 -0700
wip: adding timers
interpret the existing timer value as per-move, counting down to 0. When the timer fires, commit and send moves for all local players.
On Android, show notifications for games where a timer's running and nothing's been committed yet. Very rough, and somehow broke the
python test script for duplicate games.
commit 7892c42c69d2985b39c9fd50053fad3d5f03ba5a
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 16:40:14 2019 -0700
fix crash closing app when timers enabled
commit 1fbf78931b57ff4d92381a3b7f7e39770cb96ae0
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:23:33 2019 -0700
assert thread is same for map and unmap
It'll be a while before I'm comfortable moving this to main branch
commit 046b2e598ae8368eed6e68b5fbaeba69d0416b96
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:15:40 2019 -0700
add refcount on thread->env mapping
Just as a safeguard to ensure I'm not removing something I'll want
later. There appears to be no attempt at this point to use a stacked
protocol -- attempts to add what's already there are just dropped -- so
actual refcounting isn't working now. But if I double-remove I want to know.
commit 5c44e3cd2df87be904db6a7689c59be4fcf2696b
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:32:36 2019 -0700
fix breakage from backport and rebase
commit 4476bf10f222af90547e935d7eabd69fff0be427
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:13:17 2019 -0700
add timer to gtk's new-game dialog
commit fb50963e4314f85e8013717e4435671cb66b91df
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 20:29:26 2019 -0700
tweak text
commit 4d7fc28b0e0cc4c0e2c877401eb170a4764059f5
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:56:27 2019 -0700
make all config spinners use same styles
One had a label. How all do, and styles make them the same.
commit 5f064b31be8d8dfff0ada1d34acf2792ac6c721d
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:23:35 2019 -0700
make label-plus-timer-setting single-line
commit 38a271578dda87a025acd28c065a9748d88e7246
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 16:32:57 2019 -0700
wip: specify smaller size to avoid wrap on some phones
No idea if this will be enough. Or if just saying "one-line" would work
better.
commit 8e71bfbc011747b7738fd12e437fd73da7a7b01c
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 15:08:51 2019 -0700
wip: fix false dup-mode tag in games list
The layouts are reused, so it needs to be hidden for the non-dupe case
in case it represented a dup-mode game before and the tag was revealed.
commit 2186d72e04df901b53a6d578c24a945b01245f52
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 14:50:15 2019 -0700
fix listing of Hex language (not dup-specific)
commit a9afebea7493438681e3ebcc366f38542ecf4691
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 11:48:07 2019 -0700
wip: fix div-by-zero when all games are duplicate
commit 1925ff93cd1019f4daa6c9b86222dbf9f763d876
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 10:30:45 2019 -0700
wip: store scores in as many bits as largest requires
breaks storage format!
commit 8fb2678e8e937990ad63569b39c5c12a54a9089b
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 20:26:50 2019 -0700
wip: reduce scores correctly in dup-mode after undo
commit d1d72ce840eef5a1f9c0e3118660a9498e790848
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 18:26:15 2019 -0700
wip: fix tiles not being sorted after undo
I'm doing this in the model where there's no setting to prevent
sorting. Figure undo's a violent enough change nobody will care.
commit a8a36e8dfa1f61805932cabf607cf6f01b18a2d3
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:49:00 2019 -0700
wip: inval tray when copying from DUP player's
Fix failure to correctly draw current tray contents after replacement
based on winning dup. move.
commit 8b2f877f01cf954392841ee3e1eb8b75ce05b646
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:13:17 2019 -0700
wip: mark gameslist items with "dup" if in dup mode
commit 11f680fcce14a0303f50d685dde741b2d57241be
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 10:55:40 2019 -0700
wip: correct move count display in dup-mode case
commit 84bced651a5765ce5eacef90d653e1807a5e5a1b
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 11 15:29:30 2019 -0700
wip: fix crashes using word-lookup
Assertions about dup mode and pending plays being legal words were wrong
given how commitTurn() was used building a temp model inside
model_listWordsThrough().
commit 66b39ca29616dd5f7ae948185b6d16f2d207e45b
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 14:43:28 2019 -0700
print average scores at end of run
Should really be done separately by number of players, as non-dup games
with more players will have lower scores as each has fewer turns.
commit 3f722d974eaa77883f169974bca18e14b89dd829
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 10:30:26 2019 -0700
wip: notifiy turn change listeners in DUP case
Fixes occasional failure to update Exipration display in game list items
when a move's made.
commit 8fd13b8fc5040db0c5b631e5f97a31db08d7d053
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 22:16:23 2019 -0700
wip: don't cache variable locally
For some reason it's not set on K's phone. This is safer: what's always
worked, and it's late....
commit 6b67c4a59ca42a28d263f22ef334fe0d40fbab80
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 19:07:11 2019 -0700
wip: move status strings into resources
commit 6779c31f21e26abcbf0364322db1021ad3d82985
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 18:43:56 2019 -0700
wip: add status alerts for dup state transitions
So users know what's up, add not-again alerts when server gets moves but
can't yet act and when client sends moves.
commit 88770a9dbbe80d2d6364cd8402f4cc2e2f2ec367
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 13:03:54 2019 -0700
wip: create local copy of inDuplicateMode var
commit d157f114b1e1fb91da015bb6238c70c61b58b154
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:38:00 2019 -0700
wip: fix misplaced assert
commit 2f7230472f846ca29c791c9799a070415271e940
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:08:39 2019 -0700
wip: fix non-dup-mode scores and enable undo
commit 23a11e65e218762408315bbba1ef3d0b0f6808f1
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 11:16:05 2019 -0700
wip: list all players in a tie
commit 250bc52a044b89f8c39f2bf9a29cd0ce58b2d1a5
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:58:40 2019 -0700
wip: better last-move explanations
on android and linux. Required passing an array through the JNI which in
turn encouraged some refactoring.
commit 9cddab3be0164028a30997b5528bfc3334488dae
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:22:21 2019 -0700
wip: use only one ASSIGN in duplicate mode
They're otherwise all the same, and the other types all have
playerNum == DUP_PLAYER, so let's be consistent.
commit df50f81db9eace30884613ef4d9ec1c10904f1d9
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:47:59 2019 -0700
wip: call assertSorted() before scoring
the place that was the original problem
commit ccb026b82ebe600a697f36f67ccab250ac49b32c
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:43:31 2019 -0700
wip: fix so MoveInfo tiles always in order
Display of last-played move didn't work for duplicate case because
scoring assumes sorted tiles. So always sort, and assert sorted when
writing to and reading from stream.
commit a0967512f60354afd15ef6877f48bcc891a1d6d2
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:58:44 2019 -0700
wip: script progress shows dup- vs non-dup-mode
commit 947594afb0b1c681743fbe274d58ded302f1414a
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:18:19 2019 -0700
wip: allow mix of dup- and non-dup games in test script
commit a433cb230008a6cea8236c56a3d04c97a7702a80
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:35 2019 -0700
wip: work around misunderstood NPE (not dup-only)
commit a54a015983890338772de5043bb242aa8ebeb202
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:14 2019 -0700
wip: cleanup and add debug/logging util
commit 28c13b678f36c4c4678b1467e68daf3297db0464
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:58:14 2019 -0700
wip: don't exit engine when checking tray in dup mode
Android tends to abort the search because it has UI events
unprocessed. I'm hoping it's generally so quick that this is ok. If not,
I'll need to be more clever, e.g. adding an option to end the search
after finding only one move rather than the best move.
commit c807cb91d25a789fd3ce0e739ad864b6e84631e6
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:47:04 2019 -0700
wip: fix broken compile
commit 960dacdd5d7882f0b9cca9b5ad3e884bb04b9873
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:18:24 2019 -0700
wip: fix pool having too many tiles when engine busy
Bad loop structure meant I exited only after replacing in pool tiles I
was actually keeping.
commit 8ff5a5b27d319b55730688dc6e4bfd9a7eef59db
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:31:34 2019 -0700
wip: don't include number of players figuring pass count
otherwise we wait too long for duplicate mode game to end
commit 19677f2bb6a2eabb80d99d55087621f483cd3e07
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:30:41 2019 -0700
wip: log tile sets in and out
commit 9a0993ec30cb109c2171f141341f3e926ff801f9
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:29:32 2019 -0700
wip: no longer generate trades randomly
commit 2fc37b1f94c966669119e9f7b31ce8fa2d2971e0
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:19:06 2019 -0700
wip: figure bits-per-tile correctly
commit 295579d06a512d0a0012e725f42994e4b78436fa
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 08:52:49 2019 -0700
wip: flag dup-mode games and nuke all on demand
Add a bit to a summaries table field so dup-mode games can be
identified. Add disabled code to nuke them all without attempting to
open, something that still needs doing on occasion.
commit ddb73d9ccf66fd516ff10394cddb8f99956d99d5
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 17:39:21 2019 -0700
wip: get rid of new move types
It's enough to know whether we're in duplicate mode at runtime, as
confirmed by the assertions from the last commit.
commit 70918077c13eebc1651a607da326eaba97fc6813
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 12:10:35 2019 -0700
wip: assert new move types are redundant
Looks like I don't need them: I can know whether I'm in duplicate mode
or not and interpret them appropriately. This commit is to check; next
will remove the types.
commit de677d7276be4a78e1819920403a93fe8ca36a13
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:23:38 2019 -0700
wip: don't dup-trade when no tiles left in pool
and don't count dup-trade as a pass when deciding whether to end game.
commit 6914822fcb1256afb84933c0937eeecd0d906aa6
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:00:38 2019 -0700
wip: trade when nobody can move
Add a new move type, duplicate-trade. Generate and transmit one of those
when none of the submitted moves scores any points. And for testing,
randomly do it in DEBUG builds occasionally (should likely be a param
passed by the test script instead.) Still generates a very few
assertions run from the script, but worth snapshotting still.
commit 683fb31f2288b3767d1b8495c9ed71030556b018
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 2 10:09:26 2019 -0700
add prefs settings to unhide dup mode and for new-game default
For now, it should be hard to stumble onto it, so add a debug-only
setting so that all options are hidden by default. And so if you are
using it it's easier to use, add a new-game default setting (itself
hidden at first via the above.) Eventually I suspect it'll be easier to
find for French-localized devices.
commit e7816d7587b582311a79e253c55e916f32c84c4d
Author: Eric House <xwords@eehouse.org>
Date: Wed May 29 10:03:13 2019 -0700
cleanup
commit 78518d2af7c7787d46025ddee85401bdc75d7be7
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:54:17 2019 -0700
fix obscure NPE (not duplicate-specific)
commit d4f9bb2be51bd57fe87e1d5157e9e6eb408df528
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:44:57 2019 -0700
wip: fix NPE setting title too early
commit d02a2bf9b27544b8102025f599754d03797addb7
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 20:12:14 2019 -0700
wip: fix crashes and stalls script found
I was using a non-local player's model as scratch then failing to fully
update it before loading the winning tray in.
commit 4e611150248cb4b1d20281e73e68b0f44a6fca1e
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:38:12 2019 -0700
wip: add strings where test script can find them for dup games
commit 0685d64f9c7e17735bb651722b99f645aefe8ce8
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:36:44 2019 -0700
wip: fix assert when no tiles in move
commit e02436fd7135b7c9fb799f1f8a1c91e0d7abb5ea
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:55:03 2019 -0700
wip: mark duplicate games a bit
Add "(dup.)" to game title and new string to the commit confirm alert.
commit ef32d09205d126338046f45aec34d44853523a9f
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:51:39 2019 -0700
wip: fix tray-check bugs
Needed to run the engine against the tray of the winning move, even if
it wasn't local. Engines haven't existed for non-local players before so
some assertions weren't happy.
commit f0a03d41602037150c9f9872a7b6a5e1cd44e038
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:11:13 2019 -0700
fix to compile on Android
commit c442c92ab18e021743636e09956230fc78eb45fc
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 06:53:55 2019 -0700
fix breakage from too-eager refactoring
commit eff9e3aee484d8c2159b6c59d5fd4a734dc5a77f
Author: Eric House <xwords@eehouse.org>
Date: Sun May 26 19:51:21 2019 -0700
wip: refetch new tiles if current tray doesn't allow any moves
commit 47be80c68382dc1ac7c6a648f82e597bd0dde0df
Author: Eric House <xwords@eehouse.org>
Date: Sat May 25 13:34:24 2019 -0700
wip: add logging trying to catch stall
commit ccdb3a9d21d0d0a7de2fd3588dcb64754f747ad0
Author: Eric House <xwords@eehouse.org>
Date: Fri May 24 06:54:04 2019 -0700
wip: include dupMode in BT and SMS invitations
Add it to the json and url read/write code so other invitation types
also work.
commit 959895981505b9a5e58d9212e76bfb7c6f491f34
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:34:33 2019 -0700
add option to have all robots at full smartness
as a test of duplicate, makes all scores the same
commit bd520de6f83d7dd718cd5a50fe16d5414ce63654
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:55 2019 -0700
wip: fix method-name parens assert printf
commit d8196e9fc252d488b2d42527a734ace9926517cd
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:37 2019 -0700
wip: remove some logging
commit 4fa394f342b000d7ee44b42a513ea97f9f2d414e
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 19:43:52 2019 -0700
wip: add ability to run test app in duplicate mode
Doesn't come close to passing :-(
commit cb920e34ee9e3ab3000c89370d722a6a48abfdf5
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 16:47:20 2019 -0700
wip: report scores when move over (sorted by score)
Still need to made the strings localizable.
commit c3e72140a1966f53b165ff43d8b9e59951e65c94
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 13:57:45 2019 -0700
wip: fix problems opening old-version move stacks
Since the stack's not rewritten each time it's saved (moves stay in the
stream) the versioning scheme can't work. Instead use an extra bit to
store whether the stack uses the new format requiring an extra bit for
moveType.
commit b635c176820916b344657e9146fb28b998adb9f5
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:48:31 2019 -0700
wip: fix end-of-game message and initial turn assignment
commit 8bccd4e482fd48307ed22f5d9bc36966667f0084
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:10:48 2019 -0700
wip: UI doesn't need to always show the same turn
Figure what "turn" it is based on what candidate moves have been
reported locally. Fixes Android not showing games as needing attention
on all devices.
commit 909ce7ed7ab13317cbc51288ed71e97a4571414c
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 21:37:22 2019 -0700
wip cleanup
commit 6c5f4847a463a4d2022384677402d83ee1f87d1a
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 20:26:08 2019 -0700
wip: split method
commit 4d489591eb6fc6233d413cc906f84fe3e099b701
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 19:49:33 2019 -0700
wip: update scoreboard and end game correctly
commit 4c3aaa741bb903c8c1c74c4156ea626c4a0d3986
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:15:56 2019 -0700
wip: don't allow trade in dup mode
commit ea7b3495080fafe91722d2ce51299bf49e3119de
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:09:30 2019 -0700
wip: get building/limping along on Android
parity with GTK, basically.
commit 72d493588d518868955296fd59033fd6dc763268
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:57:45 2019 -0700
wip: break point tie based on word length
commit 08101b4e468efdd2b4b17f85a1492526993be978
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:12:28 2019 -0700
wip: fix networked games
commit d83094bfe750560b868d1915d4375a65120817da
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 16:28:46 2019 -0700
wip: fix problems updating model
Simplest test case now works: two-player one-device game in duplicate
mode can make a bunch of turns. Save/restore of game works. All on gtk;
Android likely doesn't build.
commit 8f7a00f1eecba537061fc8e22f3eb44591152cfa
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:38:37 2019 -0700
wip: tweak commit of dup move
commit b3212792311e69b2253832aedb052b6cc3c86eb9
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:23:08 2019 -0700
wip: correctly update board with dup move
and fix crash when move stack created with wrong version
commit 449f6f6ff4402ddc9581822ecbde9bb51120db85
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 09:10:31 2019 -0700
wip: update scores correctly when loading stack
commit 0c83965fe8fba7c7aea7407ce6dfb37bc0add39f
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 08:40:29 2019 -0700
wip: add dupe-mode move to move stack
Add new move entry type including a move and new tiles plus the scores
for all players. Reflect move and tiles when loading from file. Next:
figure out what to do with the scores.
commit 78edef74a2c19e4d513fea9da0c6ede4cc146b87
Author: Eric House <xwords@eehouse.org>
Date: Fri May 17 10:20:18 2019 -0700
wip: identify highest-scoring word
commit ac7c0b0fb543576e2121dbbeaf17bb3a13cb19c6
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 21:34:04 2019 -0700
wip: transmit client dupe-mode moves to server
and fix failure to get dupe flag into server on client side
commit de85dfaa2f484a1a02cd6997a7e732daa28de16b
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:54:41 2019 -0700
wip: invitation works to assign tiles
Include in nli sent across that we're in DUPLICATE mode. When sending
and receiving assigned tiles in that mode, send only one set and remove
from pool only once. But: games don't always connect, which might or not
be due to these changes. Next: handle commit by sending the move but not
a new tray.
commit dcb9e8f14d14749f81c63e08eed8418719555fb8
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:46:25 2019 -0700
wip: remove excessive logging
commit 67c62d84f1dfe2bc11463316697a0c62d449e429
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 08:15:20 2019 -0700
wip: accumulate local turns
Track whether players have committed turns yet. Once all have
notice (but do nothing yet).
commit d8dcb43dbc396c0f8fdb9a890b958f168137c2ad
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 22:24:04 2019 -0700
wip scoreboard shows it can be multiple players' turns
modify how scoreboard is drawn. next: let players commit until all are
done
commit 97ecc7bd81bac2a0832dfa01df3d7130547a1829
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 20:05:25 2019 -0700
wip: add duplicate checkbox and assign same tiles to all
next: make it everybody's turn until it's nobody's. This is all in
standalone mode for now.
commit bd3b3e75ef6a0bbf4de20cbdc1aaabb9adae2a9c
Author: Eric House <xwords@eehouse.org>
Date: Sun Jul 21 12:08:33 2019 -0700
wip: add clear 'X' to [un]pause msg editor
commit a0999d6af44d126fb450b220b49a743a3c7e439c
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:11:17 2019 -0700
wip: stop using IMPORTANCE_HIGH: too obnoxious
commit 3a7fd5758ffdaabf4b867f423db2d5558d1f10c0
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:10:53 2019 -0700
wip: move misplaced assert
commit d769855259daf340446e8c69b8091eec1cbc5d73
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 12:06:10 2019 -0700
wip: store the damned playerNum already
And remove mistaken minus-sign (typo?)
commit 9622a575863393668ac91a6233e5962ca413c8f8
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 11:47:27 2019 -0700
wip: use rowid for notification id where possible
commit 699b76db2683f7ee9c96adb6d00e9ad623275fba
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:53:50 2019 -0700
wip: be smarter about looking for timer changes
Add a dutil callback for when timer value changes. In it, pass the new
value to DupeModeTimer. In that, don't bother servicing until the saved
value matches the stored/expected value (because there's otherwise yet
another save coming.)
commit 25d3bc0a78557957c1cc4f1c727e581491bc969c
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:48:59 2019 -0700
wip: add unique notification id generator
I'm tired of trying to keep rowid-based notifications from trampling
each other. Now they can be unique per-channel.
commit 5b2f692adaddf1cfe58f073fa4ea4e39f31b7785
Author: Eric House <xwords@eehouse.org>
Date: Thu Jul 11 23:55:54 2019 -0700
wip: auto-pause when nobody moves
If moves all come in 0 and the timer's running, assume nobody's actually
playing and pause the game. While at it added [un]pause to game history
and made history entries include malloc()'d message, requiring a
free(). Lots of changes, with at least one glitch that games sometimes
hang after the autopause; and gameslist shows it as nobody's turn though
when opened the game knows it's a player's turn.
commit 1db4b1a3221f077cb797cc8e1c9a0468a9bc7f1f
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:40:11 2019 -0700
wip: cleanup/refactor
commit 873dbf3e7c46dbe9bf0cd7163788f9c0f35b32ea
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:23:58 2019 -0700
wip: run dupemodetimer more than once
Failure to reset a variable meant I never processed more than one timer
firing. Oops.
commit 0f13c4b95caa23ef19eae9454d034d5a881a7e20
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 20:03:57 2019 -0700
wip: zero timer value when move's been made
Used to actually set the timer value to 0 when move was made, and
DupeModeTimer expected that. So zero the stored value before returning
it IFF move's been made already.
commit 83761f9228828fa0ff51bd7595059912e76414bc
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 19:48:29 2019 -0700
wip: add pause button to notification
Make it easier to discover pausibility by adding pause button to
always-on notification. Implemented by opening the game and then within
it the Pause confirm alert, which required passing a boolean Extra
through from the launch intent to the one passed into BoardDelegate.
commit 6e543978b1ab132b8f95ae756301555f6267b037
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 14:31:43 2019 -0700
wip: fix to redraw timer when only turnDone changes
commit b3c79de07e9eeb2bbaed04ff9a46b91fb927fe3f
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 13:36:06 2019 -0700
wip: fix compile
commit d293864cff6d20197703ccadaa9f75b91e634004
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 11:43:13 2019 -0700
wip: show timer when paused, and dim when turn done
commit 9c25d5a79e39fad12054be0be3f3d33a569270a9
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:01:09 2019 -0700
wip: save separate excuses for pause and unpause
commit 9dfc00f4ff462a949ac453680ce160d436da430e
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:00:20 2019 -0700
wip: invoke pause stuff via tap on timer
commit e80d443cf9583ab388a5b077dbb37d0ce024e2c1
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 30 20:39:17 2019 -0700
wip: pass name with pause info for better notification
commit 511b319643482ef459b793cc37c6fefd585c18c1
Author: Eric House <xwords@eehouse.org>
Date: Sat Jun 29 11:50:40 2019 -0700
wip: improve pause/unpause confirm dialog
commit e63fc004c830f96ad87d29d26de55f9429a098e1
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:45:17 2019 -0700
wip: pass just the message. Let client package it.
commit dc79c7698a3b810bb94c4c6b732aa1e470953887
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:41:24 2019 -0700
wip: trigger notifications etc on pause change
commit 6654053dd9640b1c79830cfd2ccff6ee117d8bd6
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:18:13 2019 -0700
wip: missing files
commit 9579766643a0b939b0ebccd6b94fc1cace3f1a1a
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:15:58 2019 -0700
wip: pass explanatory message with [un]pause
commit 1b91ad47910e4f4e0e2bba06d72097e4e83013a5
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 15:28:55 2019 -0700
set dbname in build.gradle
commit c6c8ace0404f4a39214f294d3a85634d0db2080c
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 10:00:25 2019 -0700
fix crash on initial install
uninitialized variable
commit b0bcec10a896532d3439b4045e3406c1f361477b
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 13:35:30 2019 -0700
wip: fix too-frequent dupe-game checking
Do it all on a a background thread, and never process a game that was
added for processing while being processed. Fixes re-opening because we
just changed it, but may miss changes that matter.
commit 5f327d2eeabd8761691439c77db74f45514a0bf9
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 11:10:14 2019 -0700
wip: progress on timers
Mostly fixing DupeModeTimer to do less on main thread.
commit 847773f19b803626e56e4ee44a5f77ba225a487b
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 07:14:13 2019 -0700
use macro for callbacks (as elsewhere)
commit ff6a7430db4bb01e77b1f32efde801872995d709
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 22:34:34 2019 -0700
wip: transmit [un]pause to other devices
commit e8138431307763ffee8c8cba49cc00f6c36b3fa8
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 17:15:55 2019 -0700
wip: more timer tweaks
commit 7431f5b4ddb16ff3b646409f8a0c62c43d864810
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 15:01:04 2019 -0700
wip: fix assignment to wrong variable
commit fc703b6072d2dd7066e5bc9f6708b5b5d9aa11f9
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 14:41:50 2019 -0700
wip: wire up [un]pause menus in Android board
commit 0e53fbfcbe5bf8e4a1253e45a12b9b5a5fe1e5ad
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 11:09:19 2019 -0700
wip: pause/unpause without communication
commit 571200bebedb7df5f7193996a0db46ba6b05d1b6
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:56:09 2019 -0700
wip: start adding [un]pause support
commit dbe25a2a09beae6241cd59b322f29e532094a7ae
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:07:24 2019 -0700
wip: fix to work when timer not set
commit 6a58736eae4948c4245f7154e9e54a53ab2a39e9
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:53:29 2019 -0700
wip: show tiles face-up in history for dup-mode
No point in hiding them when everybody has the same.
commit 0b80a9ddfdcefdade0cf882cd4cd5b21ee4a5825
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:47:19 2019 -0700
wip: don't draw paused (0:00) timer in duplicate mode
Required passing in a new boolean
commit 1e94137e670bef7ecda614d3b513c6c065245704
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 19:16:40 2019 -0700
wip: adding timers
interpret the existing timer value as per-move, counting down to 0. When the timer fires, commit and send moves for all local players.
On Android, show notifications for games where a timer's running and nothing's been committed yet. Very rough, and somehow broke the
python test script for duplicate games.
commit 61b81b820afe4e7c30234d0c6de428fcc41e2a70
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 16:40:14 2019 -0700
fix crash closing app when timers enabled
commit d456444e33bdcf5b151e250a8afd536f52f0d362
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:23:33 2019 -0700
assert thread is same for map and unmap
It'll be a while before I'm comfortable moving this to main branch
commit c35de13cbaeb001d743bbfa00f6a95c16eb3a6fc
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:15:40 2019 -0700
add refcount on thread->env mapping
Just as a safeguard to ensure I'm not removing something I'll want
later. There appears to be no attempt at this point to use a stacked
protocol -- attempts to add what's already there are just dropped -- so
actual refcounting isn't working now. But if I double-remove I want to know.
commit a43b811c3343c1b393c707197a59dc3c7c52d7ac
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:32:36 2019 -0700
fix breakage from backport and rebase
commit 5dd2cf2a6209a6902ad7697b8831dfb998af42a8
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:13:17 2019 -0700
add timer to gtk's new-game dialog
commit 6fbb0522d65d11752da8170511e78775fc5c16ea
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 20:29:26 2019 -0700
tweak text
commit 9a4bf15f39e50eca71b489a771294b06787eba88
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:56:27 2019 -0700
make all config spinners use same styles
One had a label. How all do, and styles make them the same.
commit c9bf3b9d66cf4bf57fd8ab2a8311165a22ccfc5d
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:23:35 2019 -0700
make label-plus-timer-setting single-line
commit ab47ad09612da9b5cad6e450ffedb3c51357431a
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 16:32:57 2019 -0700
wip: specify smaller size to avoid wrap on some phones
No idea if this will be enough. Or if just saying "one-line" would work
better.
commit 18f60f13c11c5c87bb1cb89a34430bce4372f937
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 15:08:51 2019 -0700
wip: fix false dup-mode tag in games list
The layouts are reused, so it needs to be hidden for the non-dupe case
in case it represented a dup-mode game before and the tag was revealed.
commit 4c77db51f3ab618375d1b4b709d4ce5492ce7e5f
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 14:50:15 2019 -0700
fix listing of Hex language (not dup-specific)
commit df2006279f5203b28fae46f2cae5a99f83e80652
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 11:48:07 2019 -0700
wip: fix div-by-zero when all games are duplicate
commit a13d2c630b0b5a78048663b77051e29855ad012d
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 10:30:45 2019 -0700
wip: store scores in as many bits as largest requires
breaks storage format!
commit e1acb19d7de8b9f65f5727cd7b415dc6a05e5a1e
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 20:26:50 2019 -0700
wip: reduce scores correctly in dup-mode after undo
commit c8783625b72b2469013db4ffbe33ce6f2bc129c0
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 18:26:15 2019 -0700
wip: fix tiles not being sorted after undo
I'm doing this in the model where there's no setting to prevent
sorting. Figure undo's a violent enough change nobody will care.
commit 2a5f76e86a357194c46d7f41bf64fd8d9c238b62
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:49:00 2019 -0700
wip: inval tray when copying from DUP player's
Fix failure to correctly draw current tray contents after replacement
based on winning dup. move.
commit d93ae745a011b22dd1970039577537a0b0162103
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:13:17 2019 -0700
wip: mark gameslist items with "dup" if in dup mode
commit 5ab01db8227f16641f18b2dbe09decc5f1a10476
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 10:55:40 2019 -0700
wip: correct move count display in dup-mode case
commit bcff165e45eb0d347303b581a882118a0c1efbf8
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 11 15:29:30 2019 -0700
wip: fix crashes using word-lookup
Assertions about dup mode and pending plays being legal words were wrong
given how commitTurn() was used building a temp model inside
model_listWordsThrough().
commit a3eb0723987b6abf36f5bfa9b1536ee13fd12ccc
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 14:43:28 2019 -0700
print average scores at end of run
Should really be done separately by number of players, as non-dup games
with more players will have lower scores as each has fewer turns.
commit f764362e435d644ee1014e22aba7075452c54558
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 10:30:26 2019 -0700
wip: notifiy turn change listeners in DUP case
Fixes occasional failure to update Exipration display in game list items
when a move's made.
commit 4cb91d72259d7b3190205cc93974ad1052c8d883
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 22:16:23 2019 -0700
wip: don't cache variable locally
For some reason it's not set on K's phone. This is safer: what's always
worked, and it's late....
commit d78fee9a43cf0f6019f6a9494edc4a0573f6317d
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 19:07:11 2019 -0700
wip: move status strings into resources
commit f943a8ca280da3dce0b843a14fbed307814347e0
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 18:43:56 2019 -0700
wip: add status alerts for dup state transitions
So users know what's up, add not-again alerts when server gets moves but
can't yet act and when client sends moves.
commit 61bc587d656b47b194306ae9c6f10dc6a50878c7
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 13:03:54 2019 -0700
wip: create local copy of inDuplicateMode var
commit 5b37bb2cd45ca281f410487d63a328eb80b518d9
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:38:00 2019 -0700
wip: fix misplaced assert
commit dddcd5c073f4ee55d2367728381ef400faa6bc0e
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:08:39 2019 -0700
wip: fix non-dup-mode scores and enable undo
commit 09848e3a85635238df9ebc7b0f2c480c4f2db02a
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 11:16:05 2019 -0700
wip: list all players in a tie
commit 9d87087924fec2d0262ecc1ee2d3bb7d82d3c4c2
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:58:40 2019 -0700
wip: better last-move explanations
on android and linux. Required passing an array through the JNI which in
turn encouraged some refactoring.
commit 57b8c65de433cd694d978726257dda07d5918cef
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:22:21 2019 -0700
wip: use only one ASSIGN in duplicate mode
They're otherwise all the same, and the other types all have
playerNum == DUP_PLAYER, so let's be consistent.
commit 0d50b662a1290a5e58ee6229e1f9ad41de1eb5f3
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:47:59 2019 -0700
wip: call assertSorted() before scoring
the place that was the original problem
commit 78fc93e19658eb015ebb546e6bc3190a470bc2e5
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:43:31 2019 -0700
wip: fix so MoveInfo tiles always in order
Display of last-played move didn't work for duplicate case because
scoring assumes sorted tiles. So always sort, and assert sorted when
writing to and reading from stream.
commit 882c7ff9d60a5d5c79c6c35b54d9d84d19912d4e
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:58:44 2019 -0700
wip: script progress shows dup- vs non-dup-mode
commit 7b4bf585d4bdc3d77d858289f9c043552a41d027
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:18:19 2019 -0700
wip: allow mix of dup- and non-dup games in test script
commit 874b2bafc2b466f2bd2086a239942a350b93f1dd
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:35 2019 -0700
wip: work around misunderstood NPE (not dup-only)
commit 185a6d374fc49a955bbea90e086fd1570d023627
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:14 2019 -0700
wip: cleanup and add debug/logging util
commit a2a8dfcbd30d53bdac170e057605a683f3f30323
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:58:14 2019 -0700
wip: don't exit engine when checking tray in dup mode
Android tends to abort the search because it has UI events
unprocessed. I'm hoping it's generally so quick that this is ok. If not,
I'll need to be more clever, e.g. adding an option to end the search
after finding only one move rather than the best move.
commit 44c7528995327c9653dc69f60986f18442e232de
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:47:04 2019 -0700
wip: fix broken compile
commit 1bbc1607914993565c86d8b86da78b490e08d3f4
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:18:24 2019 -0700
wip: fix pool having too many tiles when engine busy
Bad loop structure meant I exited only after replacing in pool tiles I
was actually keeping.
commit 021f5afc8d4a871d42aa619be02b80fab7e2415c
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:31:34 2019 -0700
wip: don't include number of players figuring pass count
otherwise we wait too long for duplicate mode game to end
commit 1294b3bb0a4272e0bfb87f81ef5f9fe957d78b2e
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:30:41 2019 -0700
wip: log tile sets in and out
commit a01c50405e1edcfba4bb2fc89f4df0801226f5d5
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:29:32 2019 -0700
wip: no longer generate trades randomly
commit aeae0164c3c7e940430d72c000e2a66baf5f1dd5
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:19:06 2019 -0700
wip: figure bits-per-tile correctly
commit cb3bb8d55b9cae577941ab8707a91566f42a14f9
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 09:12:52 2019 -0700
log service stalls that don't trigger notification
I'm seeing RelayService never get scheduled, and need to see something
in the logs.
commit a8e0b43d004b2556ab4b22ab52be0ad7e3ddb45d
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 08:52:49 2019 -0700
wip: flag dup-mode games and nuke all on demand
Add a bit to a summaries table field so dup-mode games can be
identified. Add disabled code to nuke them all without attempting to
open, something that still needs doing on occasion.
commit 4e4bcd5d4590d0b429405a6a0a5de10f1a29689d
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 17:39:21 2019 -0700
wip: get rid of new move types
It's enough to know whether we're in duplicate mode at runtime, as
confirmed by the assertions from the last commit.
commit 7343ba3de1941a2b9d8fcd196506c9f62acbfe91
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 12:10:35 2019 -0700
wip: assert new move types are redundant
Looks like I don't need them: I can know whether I'm in duplicate mode
or not and interpret them appropriately. This commit is to check; next
will remove the types.
commit 07ae965094c720ebb71b2dd6c5e9a6facf854888
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:23:38 2019 -0700
wip: don't dup-trade when no tiles left in pool
and don't count dup-trade as a pass when deciding whether to end game.
commit b8cbfd0149f9c8e9854ae15dddc8328832f7d8a0
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:00:38 2019 -0700
wip: trade when nobody can move
Add a new move type, duplicate-trade. Generate and transmit one of those
when none of the submitted moves scores any points. And for testing,
randomly do it in DEBUG builds occasionally (should likely be a param
passed by the test script instead.) Still generates a very few
assertions run from the script, but worth snapshotting still.
commit 41f0258619a1f3ab72abd3d908d0b6cf2f999978
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 2 10:09:26 2019 -0700
add prefs settings to unhide dup mode and for new-game default
For now, it should be hard to stumble onto it, so add a debug-only
setting so that all options are hidden by default. And so if you are
using it it's easier to use, add a new-game default setting (itself
hidden at first via the above.) Eventually I suspect it'll be easier to
find for French-localized devices.
commit e152b407005e837eec4fe1f6ad552f55c157d877
Author: Eric House <xwords@eehouse.org>
Date: Wed May 29 10:03:13 2019 -0700
cleanup
commit 4439d8c3ea786b64dde554a25c62379bbea8347d
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:54:17 2019 -0700
fix obscure NPE (not duplicate-specific)
commit 4c5b1fc25d74f0ab40072f0d1987234e78b05569
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:44:57 2019 -0700
wip: fix NPE setting title too early
commit cc06a3df70157e3fd4c5b7f12d3adc8cfb87aa1c
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 20:12:14 2019 -0700
wip: fix crashes and stalls script found
I was using a non-local player's model as scratch then failing to fully
update it before loading the winning tray in.
commit 7010cd60af70965ac106072ca2eed91536c746d5
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:38:12 2019 -0700
wip: add strings where test script can find them for dup games
commit 1349d300b74168e2cae3c564fcbcec6fb28264c3
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:36:44 2019 -0700
wip: fix assert when no tiles in move
commit 8a789ef9c32d4d90ef7f054dc8d863902edc34eb
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:55:03 2019 -0700
wip: mark duplicate games a bit
Add "(dup.)" to game title and new string to the commit confirm alert.
commit 4ac09cf8daf8752106d1edf9a90e0f12fe3bc80a
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:51:39 2019 -0700
wip: fix tray-check bugs
Needed to run the engine against the tray of the winning move, even if
it wasn't local. Engines haven't existed for non-local players before so
some assertions weren't happy.
commit 99abae4d19383afe25a9fbe57960ec0f8530f49e
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:11:13 2019 -0700
fix to compile on Android
commit 22a58978dd1a6d851a5f92557928d5418d42a57a
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 06:53:55 2019 -0700
fix breakage from too-eager refactoring
commit d2f1a8d7c2c90e94bc00b170d69faa6f9b3e69e1
Author: Eric House <xwords@eehouse.org>
Date: Sun May 26 19:51:21 2019 -0700
wip: refetch new tiles if current tray doesn't allow any moves
commit c4c916c9f96231d9a2fd085df1aef8b54237ab4f
Author: Eric House <xwords@eehouse.org>
Date: Sat May 25 13:34:24 2019 -0700
wip: add logging trying to catch stall
commit 8355236bdc5b34e5a58594dfec982cf0cd3daa8a
Author: Eric House <xwords@eehouse.org>
Date: Fri May 24 06:54:04 2019 -0700
wip: include dupMode in BT and SMS invitations
Add it to the json and url read/write code so other invitation types
also work.
commit b8fb1d4c89285e0516aa55f830954dac16dbe7cc
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:34:33 2019 -0700
add option to have all robots at full smartness
as a test of duplicate, makes all scores the same
commit e653ad39284c5ba071e74a521a91d5bb21fbe320
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:55 2019 -0700
wip: fix method-name parens assert printf
commit fca3c06ff3007c3095128b27040d87e82eddf79b
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:37 2019 -0700
wip: remove some logging
commit 1a89b105d34ba0af2048b7693a3fdbeda7783070
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 19:43:52 2019 -0700
wip: add ability to run test app in duplicate mode
Doesn't come close to passing :-(
commit 308baf2a8b2cbdc1212cff17811ee6f750c67099
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 16:47:20 2019 -0700
wip: report scores when move over (sorted by score)
Still need to made the strings localizable.
commit 2db4bdceaba990f34dd32afb16f9d4bd04fd8cdc
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 13:57:45 2019 -0700
wip: fix problems opening old-version move stacks
Since the stack's not rewritten each time it's saved (moves stay in the
stream) the versioning scheme can't work. Instead use an extra bit to
store whether the stack uses the new format requiring an extra bit for
moveType.
commit 1df8e1754e35b784be2070c8416c6f5038fa65a7
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:48:31 2019 -0700
wip: fix end-of-game message and initial turn assignment
commit 4548435b36e9f9165b66832b93707a0b7e00f876
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:10:48 2019 -0700
wip: UI doesn't need to always show the same turn
Figure what "turn" it is based on what candidate moves have been
reported locally. Fixes Android not showing games as needing attention
on all devices.
commit 4a93f4b4528eabcef41bdfd67517bba4d1479407
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 21:37:22 2019 -0700
wip cleanup
commit f8184783bc9a8914310c39c54084e5fe492694a7
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 20:26:08 2019 -0700
wip: split method
commit 0d7d68737843017ecbc08dba87d881dabf7098ff
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 19:49:33 2019 -0700
wip: update scoreboard and end game correctly
commit d5d95424314b2e18c95f0a43eaa1759b3a7c6b5a
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:15:56 2019 -0700
wip: don't allow trade in dup mode
commit 8b102c0a8e5c0b39cc5b29aea16a5985a0e402c6
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:09:30 2019 -0700
wip: get building/limping along on Android
parity with GTK, basically.
commit 16cfc6b0bb1bb01ee801ccec2116eac94e16fdab
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:57:45 2019 -0700
wip: break point tie based on word length
commit 66dce87d98dce21d7616cc79c32ee88e8fbbb537
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:12:28 2019 -0700
wip: fix networked games
commit 33ba891082a9d59a90115357194841f8fa0532f8
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 16:28:46 2019 -0700
wip: fix problems updating model
Simplest test case now works: two-player one-device game in duplicate
mode can make a bunch of turns. Save/restore of game works. All on gtk;
Android likely doesn't build.
commit 33080c1014e40af0858a1d89168ffd52d1efd400
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:38:37 2019 -0700
wip: tweak commit of dup move
commit 65f06a216441624f811d1abb2e31955fb979b5c5
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:23:08 2019 -0700
wip: correctly update board with dup move
and fix crash when move stack created with wrong version
commit 4be132686b64cf6c49e541ad7df76bb7b753b3ce
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 09:10:31 2019 -0700
wip: update scores correctly when loading stack
commit 107f7b2a6708c1129f8fd67dc2deecb9e19a0606
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 08:40:29 2019 -0700
wip: add dupe-mode move to move stack
Add new move entry type including a move and new tiles plus the scores
for all players. Reflect move and tiles when loading from file. Next:
figure out what to do with the scores.
commit 6c05fe87d3ddae3e74edf0621df40dd083c9bebb
Author: Eric House <xwords@eehouse.org>
Date: Fri May 17 10:20:18 2019 -0700
wip: identify highest-scoring word
commit 4e498f754d637a15c63ec8498bad35c58f348a45
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 21:34:04 2019 -0700
wip: transmit client dupe-mode moves to server
and fix failure to get dupe flag into server on client side
commit 225b0f579d0c9aae85f439739d686b8afda7b6e3
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:54:41 2019 -0700
wip: invitation works to assign tiles
Include in nli sent across that we're in DUPLICATE mode. When sending
and receiving assigned tiles in that mode, send only one set and remove
from pool only once. But: games don't always connect, which might or not
be due to these changes. Next: handle commit by sending the move but not
a new tray.
commit 7e7b5d65e2fd4ccaf6657d88c9c9e1c59adc8c4f
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:46:25 2019 -0700
wip: remove excessive logging
commit 8afc11dc54c5aa145066729594fb741cf9e51c2c
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 08:15:20 2019 -0700
wip: accumulate local turns
Track whether players have committed turns yet. Once all have
notice (but do nothing yet).
commit d7697fba6f7bffc37d2ee09d9b397c1bb04cdf4b
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 22:24:04 2019 -0700
wip scoreboard shows it can be multiple players' turns
modify how scoreboard is drawn. next: let players commit until all are
done
commit eaa551d1d587fba90bb6cf960b4321949d173ef5
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 20:05:25 2019 -0700
wip: add duplicate checkbox and assign same tiles to all
next: make it everybody's turn until it's nobody's. This is all in
standalone mode for now.
2020-01-31 01:00:56 +01:00
|
|
|
/* <<<<<<< HEAD */
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_informNeedPassword( XW_UtilCtxt* XP_UNUSED(uc), */
|
|
|
|
/* XP_U16 XP_UNUSED_DBG(playerNum), */
|
|
|
|
/* const XP_UCHAR* XP_UNUSED_DBG(name) ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_WARNF( "curses_util_informNeedPassword(num=%d, name=%s", playerNum, name ); */
|
|
|
|
/* } /\* curses_util_askPassword *\/ */
|
|
|
|
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_yOffsetChange( XW_UtilCtxt* XP_UNUSED(uc), */
|
|
|
|
/* XP_U16 XP_UNUSED(maxOffset), */
|
|
|
|
/* XP_U16 XP_UNUSED(oldOffset), XP_U16 XP_UNUSED(newOffset) ) */
|
|
|
|
/* { */
|
|
|
|
/* /\* if ( oldOffset != newOffset ) { *\/ */
|
|
|
|
/* /\* XP_WARNF( "curses_util_yOffsetChange(%d,%d,%d) not implemented", *\/ */
|
|
|
|
/* /\* maxOffset, oldOffset, newOffset ); *\/ */
|
|
|
|
/* /\* } *\/ */
|
|
|
|
/* } /\* curses_util_yOffsetChange *\/ */
|
|
|
|
|
|
|
|
/* #ifdef XWFEATURE_TURNCHANGENOTIFY */
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_turnChanged( XW_UtilCtxt* XP_UNUSED(uc), XP_S16 XP_UNUSED_DBG(newTurn) ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_LOGF( "%s(turn=%d)", __func__, newTurn ); */
|
|
|
|
/* } */
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_notifyDupStatus( XW_UtilCtxt* XP_UNUSED(uc), */
|
|
|
|
/* XP_Bool amHost, */
|
|
|
|
/* const XP_UCHAR* msg ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_LOGF( "%s(amHost=%d, msg=%s)", __func__, amHost, msg ); */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_notifyIllegalWords( XW_UtilCtxt* XP_UNUSED(uc), */
|
|
|
|
/* BadWordInfo* XP_UNUSED(bwi), */
|
|
|
|
/* XP_U16 XP_UNUSED(player), */
|
|
|
|
/* XP_Bool XP_UNUSED(turnLost) ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_WARNF( "curses_util_notifyIllegalWords not implemented" ); */
|
|
|
|
/* } /\* curses_util_notifyIllegalWord *\/ */
|
|
|
|
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_remSelected( XW_UtilCtxt* uc ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure; */
|
|
|
|
/* XWStreamCtxt* stream; */
|
|
|
|
/* XP_UCHAR* text; */
|
|
|
|
|
|
|
|
/* stream = mem_stream_make_raw( MPPARM(globals->cGlobals.util->mpool) */
|
|
|
|
/* globals->cGlobals.params->vtMgr ); */
|
|
|
|
/* board_formatRemainingTiles( globals->cGlobals.game.board, stream ); */
|
|
|
|
|
|
|
|
/* text = strFromStream( stream ); */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
Squashed commit of the following:
commit 6ed0462040d6fd45bf43c431df5db4702630da4e
Author: Eric House <eehouse@eehouse.org>
Date: Thu Jan 30 15:55:29 2020 -0800
script meant to be run in UserLAnd on android
commit 07b603f4abde00f1cb4face7f27d996fed1b0258
Author: Eric House <eehouse@eehouse.org>
Date: Thu Jan 30 15:01:00 2020 -0800
fix gtk invite scenario
required --name param, apparently.
commit 13201c4cedbf6564516ae850956b2f3155def0b1
Merge: a301491fb 752e3ff3e
Author: Eric House <xwords@eehouse.org>
Date: Thu Jan 30 12:38:09 2020 -0800
Merge branch 'android_branch' into duplicate_mode
commit a301491fb5d7b2e09f4b932b16c0a82d1429cb64
Merge: 5401a4bbe d6cf1d2f9
Author: Eric House <xwords@eehouse.org>
Date: Sat Jan 11 20:45:26 2020 -0800
Merge branch 'android_branch' into duplicate_mode
commit 5401a4bbe54cdad6adbfa8f9ba8a1c0112ff4dbe
Merge: a92275173 9406297c0
Author: Eric House <xwords@eehouse.org>
Date: Fri Jan 10 09:54:30 2020 -0800
Merge branch 'android_branch' into duplicate_mode
commit a922751730be87ae1ea7f6b2ee4263e8b14faabf
Author: Eric House <xwords@eehouse.org>
Date: Sun Dec 29 16:39:51 2019 -0800
move game list item pending counter below "dup"
commit 53ca75a56ba9ecde917a5c8c91deaf0afdb04ea0
Merge: 658e4ef92 15239d4a6
Author: Eric House <xwords@eehouse.org>
Date: Sun Dec 29 16:34:07 2019 -0800
Merge branch 'android_branch' into duplicate_mode
commit 658e4ef92277d0a1b5c7840883edfab55251d99f
Author: Eric House <xwords@eehouse.org>
Date: Tue Dec 10 20:33:24 2019 -0800
move BT UUID into build.gradle
And add a new UUID for the duplicate build so it doesn't try to talk to
the xw4d variant when both are installed.
commit a3141c86204bcc134a6fea1e8e6d1cedc743ee13
Author: Eric House <xwords@eehouse.org>
Date: Thu Nov 21 18:52:11 2019 -0800
modify icon for easier identification
commit db23f45ac075e8bc50c56b7fb9808a7e270f5625
Author: Eric House <xwords@eehouse.org>
Date: Thu Nov 21 18:38:18 2019 -0800
change name of key
I want to force the apps already out there to generate a correct
key. This has the lowest impact.
commit 91bc3f6ac406b2fda3426bb363c8e59c3973b75f
Author: Eric House <xwords@eehouse.org>
Date: Thu Nov 21 18:25:08 2019 -0800
use the right generated file
Duh. Used the wrong app/project so FCM couldn't work for the new Dup app
variant. Now it does.
commit d4ef6f12681bae4437e907e47fbdf1b35bf10d98
Author: Eric House <xwords@eehouse.org>
Date: Mon Nov 18 09:26:46 2019 -0800
add comms_getPending(), and refactor to implement
commit 60870e43373a8b73f3541529031791e1457aaa15
Author: Eric House <eehouse@eehouse.org>
Date: Wed Nov 13 12:30:07 2019 -0800
first cut at python version of dawg2dict
Perl version doesn't work and I don't remember enough of the language to
fix it.
commit b9547d1ec49f1d9d95b3b76b2bcc6ef0d088c531
Author: Eric House <eehouse@eehouse.org>
Date: Wed Nov 13 12:30:57 2019 -0800
fix comment
commit 442d219aeab0acfd3713e065f3c46cf0b5d40012
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 12 09:08:08 2019 -0800
check for undefined variable
commit 247415e18d0b764d3cdb52e9eedeac4b183428c5
Merge: 94c2a7e15 bd3b3e75e
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 19 20:12:18 2019 -0800
Merge branch 'duplicate_mode' of ssh://maidu2/home/eehouse/src/git/repos/xwords into duplicate_mode
commit 94c2a7e151eeb81bb29589db120a08ffdb5e78fb
Merge: 514e33900 a161abc1b
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 5 21:13:23 2019 -0800
Merge remote-tracking branch 'tmp-eeh/duplicate_mode' into duplicate_mode
commit a161abc1b2c1c0e8ce76ac71e9feed9d567a3a73
Author: Eric House <xwords@eehouse.org>
Date: Tue Nov 5 15:56:26 2019 -0800
make a new CrossDup variant
It's too much trouble having versions of CrossDbg that aren't compatible.
commit 514e33900fad2695dac89371995ea197a3c9fa4b
Merge: 2d5ec2dfc c69ec5250
Author: Eric House <eehouse@eehouse.org>
Date: Tue Nov 5 08:43:52 2019 -0800
Merge branch 'android_branch' into duplicate_mode
commit 2d5ec2dfcdf2788baee2fadd69c8cbb7ac3cafd8
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 12:34:48 2019 +0000
log some hashing stuff (to share while debugging)
commit 564165ed2aef2cd2e893a1552dfb94ca61734f0d
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 11:23:40 2019 +0000
remove unnecessary logging
commit 0111db1951e40ff039cd276d1a77dc31d380ce32
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 11:22:27 2019 +0000
fix log_hex format alignment
commit c7e92680c2624c2d45bade42fddb3334348ce8fc
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 10:23:17 2019 +0000
toward making non-dupe stack hashes match
Changing the format meant that old builds and new couldn't play non-dupe
games together, which clearly sucks. There's still a problem, but this
is part of the fix.
commit fb185eca355840423b561e3237a6529ade409850
Merge: a6df962b1 37ac29e65
Author: Eric House <eehouse@eehouse.org>
Date: Sun Nov 3 09:43:57 2019 +0000
Merge branch 'android_branch' into duplicate_mode
commit a6df962b1046ff191453a617afbeee272ce3dc66
Author: Eric House <eehouse@eehouse.org>
Date: Thu Oct 24 21:28:35 2019 +0200
cleanup (not dup-specific)
commit f8e31d20ae5399db98589540fff432dc053ec633
Author: Eric House <eehouse@eehouse.org>
Date: Tue Oct 22 13:38:37 2019 +0200
use https now to fix broken updating
commit 0add4e050235e9aed5e4f841497c02b80113dbdd
Author: Eric House <eehouse@eehouse.org>
Date: Tue Sep 10 16:39:19 2019 +0300
let cells be taller than wide too (take 2)
commit 897d4453702a4c820fb99e60ca0be1bca44d0f42
Author: Eric House <eehouse@eehouse.org>
Date: Tue Sep 10 16:30:14 2019 +0300
cleanup (not dup-specific)
commit 2973ffb908fc8a966082870dae348cdc74e646c7
Author: Eric House <eehouse@eehouse.org>
Date: Thu Aug 29 23:08:36 2019 +0300
assert that valid message is handled
I suspect that messages are being dropped (in server) after being
recorded (in comms), causing the game to stall forever. So add an
assertion that it's not happening. Haven't seen it yet in a few hundred
games, but it'll be nice to be more confident.
commit ae6aca71245c934ffe1cb8ba4dc12a0bcbfd1dda
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 18:35:12 2019 +0300
remove x86 from release builds
I either remove it or add the 64-bit abi. Since it's only there to run
in the emulator let's just leave it in for DEBUG builds. If I need to
run a release build in the emulator I can add it back.
commit 4d96f05f2ffea6ca3e9b7dd1776c81fbc0a1350b
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 18:14:01 2019 +0300
arm means two ABIs now
commit f00e8c1258ed62fcf74c7f4db856fb8366d3f348
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 18:13:40 2019 +0300
fix release build warnings
commit 86a7de8c493eb57012531e4953bfde8de38bbb97
Author: Eric House <eehouse@eehouse.org>
Date: Mon Aug 26 08:23:52 2019 +0300
up API version to 28 (required soon)
commit 3382823b254cd7f2861362a895a7db483e253781
Author: Eric House <xwords@eehouse.org>
Date: Sun Jul 21 12:08:33 2019 -0700
wip: add clear 'X' to [un]pause msg editor
commit f0c0663b85bdcb6f36f50464a06ab5fb6041e738
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:11:17 2019 -0700
wip: stop using IMPORTANCE_HIGH: too obnoxious
commit 280838b680d10f0e5d280257e21c2eab66dbcec9
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:10:53 2019 -0700
wip: move misplaced assert
commit de004c956f2804264320adf4e197ed7274092f44
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 12:06:10 2019 -0700
wip: store the damned playerNum already
And remove mistaken minus-sign (typo?)
commit 17434fcb0c35f5e9489a6b01fd40e4908d4547e6
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 11:47:27 2019 -0700
wip: use rowid for notification id where possible
commit 5b20ba2f8c4d17118a709cdec556ea38b3f4199d
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:53:50 2019 -0700
wip: be smarter about looking for timer changes
Add a dutil callback for when timer value changes. In it, pass the new
value to DupeModeTimer. In that, don't bother servicing until the saved
value matches the stored/expected value (because there's otherwise yet
another save coming.)
commit e98d4154224e2013389962d22476bc571d721aa5
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:48:59 2019 -0700
wip: add unique notification id generator
I'm tired of trying to keep rowid-based notifications from trampling
each other. Now they can be unique per-channel.
commit fd94a0f0d23b4658c93bfb7793e658387bcbbcce
Author: Eric House <xwords@eehouse.org>
Date: Thu Jul 11 23:55:54 2019 -0700
wip: auto-pause when nobody moves
If moves all come in 0 and the timer's running, assume nobody's actually
playing and pause the game. While at it added [un]pause to game history
and made history entries include malloc()'d message, requiring a
free(). Lots of changes, with at least one glitch that games sometimes
hang after the autopause; and gameslist shows it as nobody's turn though
when opened the game knows it's a player's turn.
commit dfb6d2c2574fa63d416c7c800e7dbe30b0925143
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:40:11 2019 -0700
wip: cleanup/refactor
commit d4a37e5a03e874a4d1e43e72183eb73a8c0f70f5
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:23:58 2019 -0700
wip: run dupemodetimer more than once
Failure to reset a variable meant I never processed more than one timer
firing. Oops.
commit a19979ae7f71da4ba8d478c9a5a5ec4bc70b4c96
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 20:03:57 2019 -0700
wip: zero timer value when move's been made
Used to actually set the timer value to 0 when move was made, and
DupeModeTimer expected that. So zero the stored value before returning
it IFF move's been made already.
commit 7c52ce2a6a08db3b4e2a1bc32f71b073227f23ce
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 19:48:29 2019 -0700
wip: add pause button to notification
Make it easier to discover pausibility by adding pause button to
always-on notification. Implemented by opening the game and then within
it the Pause confirm alert, which required passing a boolean Extra
through from the launch intent to the one passed into BoardDelegate.
commit 9f82c2f2a3d710f6ad52b1b4f570625e2c19e277
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 14:31:43 2019 -0700
wip: fix to redraw timer when only turnDone changes
commit dee10cf35521018805621e3e2b4b58f2c2dee686
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 13:36:06 2019 -0700
wip: fix compile
commit b1e55307ccd8a849afddc27f9214eea738eb25d7
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 11:43:13 2019 -0700
wip: show timer when paused, and dim when turn done
commit 289080dcfa19e36ea0aa6bd204b61f81872f2b38
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:01:09 2019 -0700
wip: save separate excuses for pause and unpause
commit 0d427df8f45cc97e385886058b0b456a4e4ca495
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:00:20 2019 -0700
wip: invoke pause stuff via tap on timer
commit 6ef72472426c61573249e17a4842247114ecd432
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 30 20:39:17 2019 -0700
wip: pass name with pause info for better notification
commit 429baf6edb41a6821103a499b88406de9eb13673
Author: Eric House <xwords@eehouse.org>
Date: Sat Jun 29 11:50:40 2019 -0700
wip: improve pause/unpause confirm dialog
commit 9a302b137d56966513393abb4ca3169274ad72e3
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:45:17 2019 -0700
wip: pass just the message. Let client package it.
commit 6c9025e347a1fb97b90778db6563cd22a5aaa2b8
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:41:24 2019 -0700
wip: trigger notifications etc on pause change
commit dabe79c58c1a6ba1c098688dd2b6b764c543e98b
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:18:13 2019 -0700
wip: missing files
commit 352584858fa106b2094e9a393a9b3959a90511b9
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:15:58 2019 -0700
wip: pass explanatory message with [un]pause
commit a99976713b5f35ee61fc9629fb2df9ac11af9098
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 15:28:55 2019 -0700
set dbname in build.gradle
commit c0b3be342ad9d89b43ba00d77ae91ad09f8ff211
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 10:00:25 2019 -0700
fix crash on initial install
uninitialized variable
commit 3656f1d938c61ebf9ac780905f1a084cb4b024f1
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 13:35:30 2019 -0700
wip: fix too-frequent dupe-game checking
Do it all on a a background thread, and never process a game that was
added for processing while being processed. Fixes re-opening because we
just changed it, but may miss changes that matter.
commit a977b8fa51a8e8f9a469bc6fbf305364a29ef8ac
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 11:10:14 2019 -0700
wip: progress on timers
Mostly fixing DupeModeTimer to do less on main thread.
commit cb4cdc1c8221dfc94e9c9ef889d5d1b099b44049
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 07:14:13 2019 -0700
use macro for callbacks (as elsewhere)
commit 997de250c8d8e0a2de0b949258b06b8998bc1086
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 22:34:34 2019 -0700
wip: transmit [un]pause to other devices
commit 970fc8c9dbf3883211c1934f3f999149532609a8
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 17:15:55 2019 -0700
wip: more timer tweaks
commit b67b836028216345ef8d6d157bdaf9f59f698df4
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 15:01:04 2019 -0700
wip: fix assignment to wrong variable
commit 48cafcec1471e064413ade48ed79b51f1e7fb922
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 14:41:50 2019 -0700
wip: wire up [un]pause menus in Android board
commit 0476f1b21f3bd30e3ae970dc85a72a7eac67d5d9
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 11:09:19 2019 -0700
wip: pause/unpause without communication
commit 71815b2f17f0ca354eb6dd4dd12f65d309723db1
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:56:09 2019 -0700
wip: start adding [un]pause support
commit bc4f04c724f51668ace3db17703aa1446fad7405
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:07:24 2019 -0700
wip: fix to work when timer not set
commit 2b271abbb487aa8c5fa7f792d898c72f5d69e270
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:53:29 2019 -0700
wip: show tiles face-up in history for dup-mode
No point in hiding them when everybody has the same.
commit 945b8527847af20ca955fb313b7bf49887e4e012
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:47:19 2019 -0700
wip: don't draw paused (0:00) timer in duplicate mode
Required passing in a new boolean
commit 6229fb88302d6da8d432a743955f3dc54d871bda
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 19:16:40 2019 -0700
wip: adding timers
interpret the existing timer value as per-move, counting down to 0. When the timer fires, commit and send moves for all local players.
On Android, show notifications for games where a timer's running and nothing's been committed yet. Very rough, and somehow broke the
python test script for duplicate games.
commit 7892c42c69d2985b39c9fd50053fad3d5f03ba5a
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 16:40:14 2019 -0700
fix crash closing app when timers enabled
commit 1fbf78931b57ff4d92381a3b7f7e39770cb96ae0
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:23:33 2019 -0700
assert thread is same for map and unmap
It'll be a while before I'm comfortable moving this to main branch
commit 046b2e598ae8368eed6e68b5fbaeba69d0416b96
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:15:40 2019 -0700
add refcount on thread->env mapping
Just as a safeguard to ensure I'm not removing something I'll want
later. There appears to be no attempt at this point to use a stacked
protocol -- attempts to add what's already there are just dropped -- so
actual refcounting isn't working now. But if I double-remove I want to know.
commit 5c44e3cd2df87be904db6a7689c59be4fcf2696b
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:32:36 2019 -0700
fix breakage from backport and rebase
commit 4476bf10f222af90547e935d7eabd69fff0be427
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:13:17 2019 -0700
add timer to gtk's new-game dialog
commit fb50963e4314f85e8013717e4435671cb66b91df
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 20:29:26 2019 -0700
tweak text
commit 4d7fc28b0e0cc4c0e2c877401eb170a4764059f5
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:56:27 2019 -0700
make all config spinners use same styles
One had a label. How all do, and styles make them the same.
commit 5f064b31be8d8dfff0ada1d34acf2792ac6c721d
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:23:35 2019 -0700
make label-plus-timer-setting single-line
commit 38a271578dda87a025acd28c065a9748d88e7246
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 16:32:57 2019 -0700
wip: specify smaller size to avoid wrap on some phones
No idea if this will be enough. Or if just saying "one-line" would work
better.
commit 8e71bfbc011747b7738fd12e437fd73da7a7b01c
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 15:08:51 2019 -0700
wip: fix false dup-mode tag in games list
The layouts are reused, so it needs to be hidden for the non-dupe case
in case it represented a dup-mode game before and the tag was revealed.
commit 2186d72e04df901b53a6d578c24a945b01245f52
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 14:50:15 2019 -0700
fix listing of Hex language (not dup-specific)
commit a9afebea7493438681e3ebcc366f38542ecf4691
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 11:48:07 2019 -0700
wip: fix div-by-zero when all games are duplicate
commit 1925ff93cd1019f4daa6c9b86222dbf9f763d876
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 10:30:45 2019 -0700
wip: store scores in as many bits as largest requires
breaks storage format!
commit 8fb2678e8e937990ad63569b39c5c12a54a9089b
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 20:26:50 2019 -0700
wip: reduce scores correctly in dup-mode after undo
commit d1d72ce840eef5a1f9c0e3118660a9498e790848
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 18:26:15 2019 -0700
wip: fix tiles not being sorted after undo
I'm doing this in the model where there's no setting to prevent
sorting. Figure undo's a violent enough change nobody will care.
commit a8a36e8dfa1f61805932cabf607cf6f01b18a2d3
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:49:00 2019 -0700
wip: inval tray when copying from DUP player's
Fix failure to correctly draw current tray contents after replacement
based on winning dup. move.
commit 8b2f877f01cf954392841ee3e1eb8b75ce05b646
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:13:17 2019 -0700
wip: mark gameslist items with "dup" if in dup mode
commit 11f680fcce14a0303f50d685dde741b2d57241be
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 10:55:40 2019 -0700
wip: correct move count display in dup-mode case
commit 84bced651a5765ce5eacef90d653e1807a5e5a1b
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 11 15:29:30 2019 -0700
wip: fix crashes using word-lookup
Assertions about dup mode and pending plays being legal words were wrong
given how commitTurn() was used building a temp model inside
model_listWordsThrough().
commit 66b39ca29616dd5f7ae948185b6d16f2d207e45b
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 14:43:28 2019 -0700
print average scores at end of run
Should really be done separately by number of players, as non-dup games
with more players will have lower scores as each has fewer turns.
commit 3f722d974eaa77883f169974bca18e14b89dd829
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 10:30:26 2019 -0700
wip: notifiy turn change listeners in DUP case
Fixes occasional failure to update Exipration display in game list items
when a move's made.
commit 8fd13b8fc5040db0c5b631e5f97a31db08d7d053
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 22:16:23 2019 -0700
wip: don't cache variable locally
For some reason it's not set on K's phone. This is safer: what's always
worked, and it's late....
commit 6b67c4a59ca42a28d263f22ef334fe0d40fbab80
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 19:07:11 2019 -0700
wip: move status strings into resources
commit 6779c31f21e26abcbf0364322db1021ad3d82985
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 18:43:56 2019 -0700
wip: add status alerts for dup state transitions
So users know what's up, add not-again alerts when server gets moves but
can't yet act and when client sends moves.
commit 88770a9dbbe80d2d6364cd8402f4cc2e2f2ec367
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 13:03:54 2019 -0700
wip: create local copy of inDuplicateMode var
commit d157f114b1e1fb91da015bb6238c70c61b58b154
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:38:00 2019 -0700
wip: fix misplaced assert
commit 2f7230472f846ca29c791c9799a070415271e940
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:08:39 2019 -0700
wip: fix non-dup-mode scores and enable undo
commit 23a11e65e218762408315bbba1ef3d0b0f6808f1
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 11:16:05 2019 -0700
wip: list all players in a tie
commit 250bc52a044b89f8c39f2bf9a29cd0ce58b2d1a5
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:58:40 2019 -0700
wip: better last-move explanations
on android and linux. Required passing an array through the JNI which in
turn encouraged some refactoring.
commit 9cddab3be0164028a30997b5528bfc3334488dae
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:22:21 2019 -0700
wip: use only one ASSIGN in duplicate mode
They're otherwise all the same, and the other types all have
playerNum == DUP_PLAYER, so let's be consistent.
commit df50f81db9eace30884613ef4d9ec1c10904f1d9
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:47:59 2019 -0700
wip: call assertSorted() before scoring
the place that was the original problem
commit ccb026b82ebe600a697f36f67ccab250ac49b32c
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:43:31 2019 -0700
wip: fix so MoveInfo tiles always in order
Display of last-played move didn't work for duplicate case because
scoring assumes sorted tiles. So always sort, and assert sorted when
writing to and reading from stream.
commit a0967512f60354afd15ef6877f48bcc891a1d6d2
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:58:44 2019 -0700
wip: script progress shows dup- vs non-dup-mode
commit 947594afb0b1c681743fbe274d58ded302f1414a
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:18:19 2019 -0700
wip: allow mix of dup- and non-dup games in test script
commit a433cb230008a6cea8236c56a3d04c97a7702a80
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:35 2019 -0700
wip: work around misunderstood NPE (not dup-only)
commit a54a015983890338772de5043bb242aa8ebeb202
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:14 2019 -0700
wip: cleanup and add debug/logging util
commit 28c13b678f36c4c4678b1467e68daf3297db0464
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:58:14 2019 -0700
wip: don't exit engine when checking tray in dup mode
Android tends to abort the search because it has UI events
unprocessed. I'm hoping it's generally so quick that this is ok. If not,
I'll need to be more clever, e.g. adding an option to end the search
after finding only one move rather than the best move.
commit c807cb91d25a789fd3ce0e739ad864b6e84631e6
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:47:04 2019 -0700
wip: fix broken compile
commit 960dacdd5d7882f0b9cca9b5ad3e884bb04b9873
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:18:24 2019 -0700
wip: fix pool having too many tiles when engine busy
Bad loop structure meant I exited only after replacing in pool tiles I
was actually keeping.
commit 8ff5a5b27d319b55730688dc6e4bfd9a7eef59db
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:31:34 2019 -0700
wip: don't include number of players figuring pass count
otherwise we wait too long for duplicate mode game to end
commit 19677f2bb6a2eabb80d99d55087621f483cd3e07
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:30:41 2019 -0700
wip: log tile sets in and out
commit 9a0993ec30cb109c2171f141341f3e926ff801f9
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:29:32 2019 -0700
wip: no longer generate trades randomly
commit 2fc37b1f94c966669119e9f7b31ce8fa2d2971e0
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:19:06 2019 -0700
wip: figure bits-per-tile correctly
commit 295579d06a512d0a0012e725f42994e4b78436fa
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 08:52:49 2019 -0700
wip: flag dup-mode games and nuke all on demand
Add a bit to a summaries table field so dup-mode games can be
identified. Add disabled code to nuke them all without attempting to
open, something that still needs doing on occasion.
commit ddb73d9ccf66fd516ff10394cddb8f99956d99d5
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 17:39:21 2019 -0700
wip: get rid of new move types
It's enough to know whether we're in duplicate mode at runtime, as
confirmed by the assertions from the last commit.
commit 70918077c13eebc1651a607da326eaba97fc6813
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 12:10:35 2019 -0700
wip: assert new move types are redundant
Looks like I don't need them: I can know whether I'm in duplicate mode
or not and interpret them appropriately. This commit is to check; next
will remove the types.
commit de677d7276be4a78e1819920403a93fe8ca36a13
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:23:38 2019 -0700
wip: don't dup-trade when no tiles left in pool
and don't count dup-trade as a pass when deciding whether to end game.
commit 6914822fcb1256afb84933c0937eeecd0d906aa6
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:00:38 2019 -0700
wip: trade when nobody can move
Add a new move type, duplicate-trade. Generate and transmit one of those
when none of the submitted moves scores any points. And for testing,
randomly do it in DEBUG builds occasionally (should likely be a param
passed by the test script instead.) Still generates a very few
assertions run from the script, but worth snapshotting still.
commit 683fb31f2288b3767d1b8495c9ed71030556b018
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 2 10:09:26 2019 -0700
add prefs settings to unhide dup mode and for new-game default
For now, it should be hard to stumble onto it, so add a debug-only
setting so that all options are hidden by default. And so if you are
using it it's easier to use, add a new-game default setting (itself
hidden at first via the above.) Eventually I suspect it'll be easier to
find for French-localized devices.
commit e7816d7587b582311a79e253c55e916f32c84c4d
Author: Eric House <xwords@eehouse.org>
Date: Wed May 29 10:03:13 2019 -0700
cleanup
commit 78518d2af7c7787d46025ddee85401bdc75d7be7
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:54:17 2019 -0700
fix obscure NPE (not duplicate-specific)
commit d4f9bb2be51bd57fe87e1d5157e9e6eb408df528
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:44:57 2019 -0700
wip: fix NPE setting title too early
commit d02a2bf9b27544b8102025f599754d03797addb7
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 20:12:14 2019 -0700
wip: fix crashes and stalls script found
I was using a non-local player's model as scratch then failing to fully
update it before loading the winning tray in.
commit 4e611150248cb4b1d20281e73e68b0f44a6fca1e
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:38:12 2019 -0700
wip: add strings where test script can find them for dup games
commit 0685d64f9c7e17735bb651722b99f645aefe8ce8
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:36:44 2019 -0700
wip: fix assert when no tiles in move
commit e02436fd7135b7c9fb799f1f8a1c91e0d7abb5ea
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:55:03 2019 -0700
wip: mark duplicate games a bit
Add "(dup.)" to game title and new string to the commit confirm alert.
commit ef32d09205d126338046f45aec34d44853523a9f
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:51:39 2019 -0700
wip: fix tray-check bugs
Needed to run the engine against the tray of the winning move, even if
it wasn't local. Engines haven't existed for non-local players before so
some assertions weren't happy.
commit f0a03d41602037150c9f9872a7b6a5e1cd44e038
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:11:13 2019 -0700
fix to compile on Android
commit c442c92ab18e021743636e09956230fc78eb45fc
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 06:53:55 2019 -0700
fix breakage from too-eager refactoring
commit eff9e3aee484d8c2159b6c59d5fd4a734dc5a77f
Author: Eric House <xwords@eehouse.org>
Date: Sun May 26 19:51:21 2019 -0700
wip: refetch new tiles if current tray doesn't allow any moves
commit 47be80c68382dc1ac7c6a648f82e597bd0dde0df
Author: Eric House <xwords@eehouse.org>
Date: Sat May 25 13:34:24 2019 -0700
wip: add logging trying to catch stall
commit ccdb3a9d21d0d0a7de2fd3588dcb64754f747ad0
Author: Eric House <xwords@eehouse.org>
Date: Fri May 24 06:54:04 2019 -0700
wip: include dupMode in BT and SMS invitations
Add it to the json and url read/write code so other invitation types
also work.
commit 959895981505b9a5e58d9212e76bfb7c6f491f34
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:34:33 2019 -0700
add option to have all robots at full smartness
as a test of duplicate, makes all scores the same
commit bd520de6f83d7dd718cd5a50fe16d5414ce63654
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:55 2019 -0700
wip: fix method-name parens assert printf
commit d8196e9fc252d488b2d42527a734ace9926517cd
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:37 2019 -0700
wip: remove some logging
commit 4fa394f342b000d7ee44b42a513ea97f9f2d414e
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 19:43:52 2019 -0700
wip: add ability to run test app in duplicate mode
Doesn't come close to passing :-(
commit cb920e34ee9e3ab3000c89370d722a6a48abfdf5
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 16:47:20 2019 -0700
wip: report scores when move over (sorted by score)
Still need to made the strings localizable.
commit c3e72140a1966f53b165ff43d8b9e59951e65c94
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 13:57:45 2019 -0700
wip: fix problems opening old-version move stacks
Since the stack's not rewritten each time it's saved (moves stay in the
stream) the versioning scheme can't work. Instead use an extra bit to
store whether the stack uses the new format requiring an extra bit for
moveType.
commit b635c176820916b344657e9146fb28b998adb9f5
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:48:31 2019 -0700
wip: fix end-of-game message and initial turn assignment
commit 8bccd4e482fd48307ed22f5d9bc36966667f0084
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:10:48 2019 -0700
wip: UI doesn't need to always show the same turn
Figure what "turn" it is based on what candidate moves have been
reported locally. Fixes Android not showing games as needing attention
on all devices.
commit 909ce7ed7ab13317cbc51288ed71e97a4571414c
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 21:37:22 2019 -0700
wip cleanup
commit 6c5f4847a463a4d2022384677402d83ee1f87d1a
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 20:26:08 2019 -0700
wip: split method
commit 4d489591eb6fc6233d413cc906f84fe3e099b701
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 19:49:33 2019 -0700
wip: update scoreboard and end game correctly
commit 4c3aaa741bb903c8c1c74c4156ea626c4a0d3986
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:15:56 2019 -0700
wip: don't allow trade in dup mode
commit ea7b3495080fafe91722d2ce51299bf49e3119de
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:09:30 2019 -0700
wip: get building/limping along on Android
parity with GTK, basically.
commit 72d493588d518868955296fd59033fd6dc763268
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:57:45 2019 -0700
wip: break point tie based on word length
commit 08101b4e468efdd2b4b17f85a1492526993be978
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:12:28 2019 -0700
wip: fix networked games
commit d83094bfe750560b868d1915d4375a65120817da
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 16:28:46 2019 -0700
wip: fix problems updating model
Simplest test case now works: two-player one-device game in duplicate
mode can make a bunch of turns. Save/restore of game works. All on gtk;
Android likely doesn't build.
commit 8f7a00f1eecba537061fc8e22f3eb44591152cfa
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:38:37 2019 -0700
wip: tweak commit of dup move
commit b3212792311e69b2253832aedb052b6cc3c86eb9
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:23:08 2019 -0700
wip: correctly update board with dup move
and fix crash when move stack created with wrong version
commit 449f6f6ff4402ddc9581822ecbde9bb51120db85
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 09:10:31 2019 -0700
wip: update scores correctly when loading stack
commit 0c83965fe8fba7c7aea7407ce6dfb37bc0add39f
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 08:40:29 2019 -0700
wip: add dupe-mode move to move stack
Add new move entry type including a move and new tiles plus the scores
for all players. Reflect move and tiles when loading from file. Next:
figure out what to do with the scores.
commit 78edef74a2c19e4d513fea9da0c6ede4cc146b87
Author: Eric House <xwords@eehouse.org>
Date: Fri May 17 10:20:18 2019 -0700
wip: identify highest-scoring word
commit ac7c0b0fb543576e2121dbbeaf17bb3a13cb19c6
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 21:34:04 2019 -0700
wip: transmit client dupe-mode moves to server
and fix failure to get dupe flag into server on client side
commit de85dfaa2f484a1a02cd6997a7e732daa28de16b
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:54:41 2019 -0700
wip: invitation works to assign tiles
Include in nli sent across that we're in DUPLICATE mode. When sending
and receiving assigned tiles in that mode, send only one set and remove
from pool only once. But: games don't always connect, which might or not
be due to these changes. Next: handle commit by sending the move but not
a new tray.
commit dcb9e8f14d14749f81c63e08eed8418719555fb8
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:46:25 2019 -0700
wip: remove excessive logging
commit 67c62d84f1dfe2bc11463316697a0c62d449e429
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 08:15:20 2019 -0700
wip: accumulate local turns
Track whether players have committed turns yet. Once all have
notice (but do nothing yet).
commit d8dcb43dbc396c0f8fdb9a890b958f168137c2ad
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 22:24:04 2019 -0700
wip scoreboard shows it can be multiple players' turns
modify how scoreboard is drawn. next: let players commit until all are
done
commit 97ecc7bd81bac2a0832dfa01df3d7130547a1829
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 20:05:25 2019 -0700
wip: add duplicate checkbox and assign same tiles to all
next: make it everybody's turn until it's nobody's. This is all in
standalone mode for now.
commit bd3b3e75ef6a0bbf4de20cbdc1aaabb9adae2a9c
Author: Eric House <xwords@eehouse.org>
Date: Sun Jul 21 12:08:33 2019 -0700
wip: add clear 'X' to [un]pause msg editor
commit a0999d6af44d126fb450b220b49a743a3c7e439c
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:11:17 2019 -0700
wip: stop using IMPORTANCE_HIGH: too obnoxious
commit 3a7fd5758ffdaabf4b867f423db2d5558d1f10c0
Author: Eric House <xwords@eehouse.org>
Date: Sat Jul 13 10:10:53 2019 -0700
wip: move misplaced assert
commit d769855259daf340446e8c69b8091eec1cbc5d73
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 12:06:10 2019 -0700
wip: store the damned playerNum already
And remove mistaken minus-sign (typo?)
commit 9622a575863393668ac91a6233e5962ca413c8f8
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 11:47:27 2019 -0700
wip: use rowid for notification id where possible
commit 699b76db2683f7ee9c96adb6d00e9ad623275fba
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:53:50 2019 -0700
wip: be smarter about looking for timer changes
Add a dutil callback for when timer value changes. In it, pass the new
value to DupeModeTimer. In that, don't bother servicing until the saved
value matches the stored/expected value (because there's otherwise yet
another save coming.)
commit 25d3bc0a78557957c1cc4f1c727e581491bc969c
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 12 10:48:59 2019 -0700
wip: add unique notification id generator
I'm tired of trying to keep rowid-based notifications from trampling
each other. Now they can be unique per-channel.
commit 5b2f692adaddf1cfe58f073fa4ea4e39f31b7785
Author: Eric House <xwords@eehouse.org>
Date: Thu Jul 11 23:55:54 2019 -0700
wip: auto-pause when nobody moves
If moves all come in 0 and the timer's running, assume nobody's actually
playing and pause the game. While at it added [un]pause to game history
and made history entries include malloc()'d message, requiring a
free(). Lots of changes, with at least one glitch that games sometimes
hang after the autopause; and gameslist shows it as nobody's turn though
when opened the game knows it's a player's turn.
commit 1db4b1a3221f077cb797cc8e1c9a0468a9bc7f1f
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:40:11 2019 -0700
wip: cleanup/refactor
commit 873dbf3e7c46dbe9bf0cd7163788f9c0f35b32ea
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 8 20:23:58 2019 -0700
wip: run dupemodetimer more than once
Failure to reset a variable meant I never processed more than one timer
firing. Oops.
commit 0f13c4b95caa23ef19eae9454d034d5a881a7e20
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 20:03:57 2019 -0700
wip: zero timer value when move's been made
Used to actually set the timer value to 0 when move was made, and
DupeModeTimer expected that. So zero the stored value before returning
it IFF move's been made already.
commit 83761f9228828fa0ff51bd7595059912e76414bc
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 19:48:29 2019 -0700
wip: add pause button to notification
Make it easier to discover pausibility by adding pause button to
always-on notification. Implemented by opening the game and then within
it the Pause confirm alert, which required passing a boolean Extra
through from the launch intent to the one passed into BoardDelegate.
commit 6e543978b1ab132b8f95ae756301555f6267b037
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 14:31:43 2019 -0700
wip: fix to redraw timer when only turnDone changes
commit b3c79de07e9eeb2bbaed04ff9a46b91fb927fe3f
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 13:36:06 2019 -0700
wip: fix compile
commit d293864cff6d20197703ccadaa9f75b91e634004
Author: Eric House <xwords@eehouse.org>
Date: Fri Jul 5 11:43:13 2019 -0700
wip: show timer when paused, and dim when turn done
commit 9c25d5a79e39fad12054be0be3f3d33a569270a9
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:01:09 2019 -0700
wip: save separate excuses for pause and unpause
commit 9dfc00f4ff462a949ac453680ce160d436da430e
Author: Eric House <xwords@eehouse.org>
Date: Mon Jul 1 21:00:20 2019 -0700
wip: invoke pause stuff via tap on timer
commit e80d443cf9583ab388a5b077dbb37d0ce024e2c1
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 30 20:39:17 2019 -0700
wip: pass name with pause info for better notification
commit 511b319643482ef459b793cc37c6fefd585c18c1
Author: Eric House <xwords@eehouse.org>
Date: Sat Jun 29 11:50:40 2019 -0700
wip: improve pause/unpause confirm dialog
commit e63fc004c830f96ad87d29d26de55f9429a098e1
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:45:17 2019 -0700
wip: pass just the message. Let client package it.
commit dc79c7698a3b810bb94c4c6b732aa1e470953887
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:41:24 2019 -0700
wip: trigger notifications etc on pause change
commit 6654053dd9640b1c79830cfd2ccff6ee117d8bd6
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:18:13 2019 -0700
wip: missing files
commit 9579766643a0b939b0ebccd6b94fc1cace3f1a1a
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 21:15:58 2019 -0700
wip: pass explanatory message with [un]pause
commit 1b91ad47910e4f4e0e2bba06d72097e4e83013a5
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 15:28:55 2019 -0700
set dbname in build.gradle
commit c6c8ace0404f4a39214f294d3a85634d0db2080c
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 28 10:00:25 2019 -0700
fix crash on initial install
uninitialized variable
commit b0bcec10a896532d3439b4045e3406c1f361477b
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 13:35:30 2019 -0700
wip: fix too-frequent dupe-game checking
Do it all on a a background thread, and never process a game that was
added for processing while being processed. Fixes re-opening because we
just changed it, but may miss changes that matter.
commit 5f327d2eeabd8761691439c77db74f45514a0bf9
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 11:10:14 2019 -0700
wip: progress on timers
Mostly fixing DupeModeTimer to do less on main thread.
commit 847773f19b803626e56e4ee44a5f77ba225a487b
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 27 07:14:13 2019 -0700
use macro for callbacks (as elsewhere)
commit ff6a7430db4bb01e77b1f32efde801872995d709
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 22:34:34 2019 -0700
wip: transmit [un]pause to other devices
commit e8138431307763ffee8c8cba49cc00f6c36b3fa8
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 17:15:55 2019 -0700
wip: more timer tweaks
commit 7431f5b4ddb16ff3b646409f8a0c62c43d864810
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 15:01:04 2019 -0700
wip: fix assignment to wrong variable
commit fc703b6072d2dd7066e5bc9f6708b5b5d9aa11f9
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 14:41:50 2019 -0700
wip: wire up [un]pause menus in Android board
commit 0e53fbfcbe5bf8e4a1253e45a12b9b5a5fe1e5ad
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 11:09:19 2019 -0700
wip: pause/unpause without communication
commit 571200bebedb7df5f7193996a0db46ba6b05d1b6
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:56:09 2019 -0700
wip: start adding [un]pause support
commit dbe25a2a09beae6241cd59b322f29e532094a7ae
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 10:07:24 2019 -0700
wip: fix to work when timer not set
commit 6a58736eae4948c4245f7154e9e54a53ab2a39e9
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:53:29 2019 -0700
wip: show tiles face-up in history for dup-mode
No point in hiding them when everybody has the same.
commit 0b80a9ddfdcefdade0cf882cd4cd5b21ee4a5825
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 26 09:47:19 2019 -0700
wip: don't draw paused (0:00) timer in duplicate mode
Required passing in a new boolean
commit 1e94137e670bef7ecda614d3b513c6c065245704
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 19:16:40 2019 -0700
wip: adding timers
interpret the existing timer value as per-move, counting down to 0. When the timer fires, commit and send moves for all local players.
On Android, show notifications for games where a timer's running and nothing's been committed yet. Very rough, and somehow broke the
python test script for duplicate games.
commit 61b81b820afe4e7c30234d0c6de428fcc41e2a70
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 25 16:40:14 2019 -0700
fix crash closing app when timers enabled
commit d456444e33bdcf5b151e250a8afd536f52f0d362
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:23:33 2019 -0700
assert thread is same for map and unmap
It'll be a while before I'm comfortable moving this to main branch
commit c35de13cbaeb001d743bbfa00f6a95c16eb3a6fc
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 12:15:40 2019 -0700
add refcount on thread->env mapping
Just as a safeguard to ensure I'm not removing something I'll want
later. There appears to be no attempt at this point to use a stacked
protocol -- attempts to add what's already there are just dropped -- so
actual refcounting isn't working now. But if I double-remove I want to know.
commit a43b811c3343c1b393c707197a59dc3c7c52d7ac
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:32:36 2019 -0700
fix breakage from backport and rebase
commit 5dd2cf2a6209a6902ad7697b8831dfb998af42a8
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 24 09:13:17 2019 -0700
add timer to gtk's new-game dialog
commit 6fbb0522d65d11752da8170511e78775fc5c16ea
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 20:29:26 2019 -0700
tweak text
commit 9a4bf15f39e50eca71b489a771294b06787eba88
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:56:27 2019 -0700
make all config spinners use same styles
One had a label. How all do, and styles make them the same.
commit c9bf3b9d66cf4bf57fd8ab2a8311165a22ccfc5d
Author: Eric House <eehouse@eehouse.org>
Date: Sat Jun 22 08:23:35 2019 -0700
make label-plus-timer-setting single-line
commit ab47ad09612da9b5cad6e450ffedb3c51357431a
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 16:32:57 2019 -0700
wip: specify smaller size to avoid wrap on some phones
No idea if this will be enough. Or if just saying "one-line" would work
better.
commit 18f60f13c11c5c87bb1cb89a34430bce4372f937
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 15:08:51 2019 -0700
wip: fix false dup-mode tag in games list
The layouts are reused, so it needs to be hidden for the non-dupe case
in case it represented a dup-mode game before and the tag was revealed.
commit 4c77db51f3ab618375d1b4b709d4ce5492ce7e5f
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 14:50:15 2019 -0700
fix listing of Hex language (not dup-specific)
commit df2006279f5203b28fae46f2cae5a99f83e80652
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 11:48:07 2019 -0700
wip: fix div-by-zero when all games are duplicate
commit a13d2c630b0b5a78048663b77051e29855ad012d
Author: Eric House <xwords@eehouse.org>
Date: Fri Jun 14 10:30:45 2019 -0700
wip: store scores in as many bits as largest requires
breaks storage format!
commit e1acb19d7de8b9f65f5727cd7b415dc6a05e5a1e
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 20:26:50 2019 -0700
wip: reduce scores correctly in dup-mode after undo
commit c8783625b72b2469013db4ffbe33ce6f2bc129c0
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 18:26:15 2019 -0700
wip: fix tiles not being sorted after undo
I'm doing this in the model where there's no setting to prevent
sorting. Figure undo's a violent enough change nobody will care.
commit 2a5f76e86a357194c46d7f41bf64fd8d9c238b62
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:49:00 2019 -0700
wip: inval tray when copying from DUP player's
Fix failure to correctly draw current tray contents after replacement
based on winning dup. move.
commit d93ae745a011b22dd1970039577537a0b0162103
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 17:13:17 2019 -0700
wip: mark gameslist items with "dup" if in dup mode
commit 5ab01db8227f16641f18b2dbe09decc5f1a10476
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 13 10:55:40 2019 -0700
wip: correct move count display in dup-mode case
commit bcff165e45eb0d347303b581a882118a0c1efbf8
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 11 15:29:30 2019 -0700
wip: fix crashes using word-lookup
Assertions about dup mode and pending plays being legal words were wrong
given how commitTurn() was used building a temp model inside
model_listWordsThrough().
commit a3eb0723987b6abf36f5bfa9b1536ee13fd12ccc
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 14:43:28 2019 -0700
print average scores at end of run
Should really be done separately by number of players, as non-dup games
with more players will have lower scores as each has fewer turns.
commit f764362e435d644ee1014e22aba7075452c54558
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 9 10:30:26 2019 -0700
wip: notifiy turn change listeners in DUP case
Fixes occasional failure to update Exipration display in game list items
when a move's made.
commit 4cb91d72259d7b3190205cc93974ad1052c8d883
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 22:16:23 2019 -0700
wip: don't cache variable locally
For some reason it's not set on K's phone. This is safer: what's always
worked, and it's late....
commit d78fee9a43cf0f6019f6a9494edc4a0573f6317d
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 19:07:11 2019 -0700
wip: move status strings into resources
commit f943a8ca280da3dce0b843a14fbed307814347e0
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 18:43:56 2019 -0700
wip: add status alerts for dup state transitions
So users know what's up, add not-again alerts when server gets moves but
can't yet act and when client sends moves.
commit 61bc587d656b47b194306ae9c6f10dc6a50878c7
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 13:03:54 2019 -0700
wip: create local copy of inDuplicateMode var
commit 5b37bb2cd45ca281f410487d63a328eb80b518d9
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:38:00 2019 -0700
wip: fix misplaced assert
commit dddcd5c073f4ee55d2367728381ef400faa6bc0e
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 12:08:39 2019 -0700
wip: fix non-dup-mode scores and enable undo
commit 09848e3a85635238df9ebc7b0f2c480c4f2db02a
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 11:16:05 2019 -0700
wip: list all players in a tie
commit 9d87087924fec2d0262ecc1ee2d3bb7d82d3c4c2
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:58:40 2019 -0700
wip: better last-move explanations
on android and linux. Required passing an array through the JNI which in
turn encouraged some refactoring.
commit 57b8c65de433cd694d978726257dda07d5918cef
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 10:22:21 2019 -0700
wip: use only one ASSIGN in duplicate mode
They're otherwise all the same, and the other types all have
playerNum == DUP_PLAYER, so let's be consistent.
commit 0d50b662a1290a5e58ee6229e1f9ad41de1eb5f3
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:47:59 2019 -0700
wip: call assertSorted() before scoring
the place that was the original problem
commit 78fc93e19658eb015ebb546e6bc3190a470bc2e5
Author: Eric House <xwords@eehouse.org>
Date: Thu Jun 6 08:43:31 2019 -0700
wip: fix so MoveInfo tiles always in order
Display of last-played move didn't work for duplicate case because
scoring assumes sorted tiles. So always sort, and assert sorted when
writing to and reading from stream.
commit 882c7ff9d60a5d5c79c6c35b54d9d84d19912d4e
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:58:44 2019 -0700
wip: script progress shows dup- vs non-dup-mode
commit 7b4bf585d4bdc3d77d858289f9c043552a41d027
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:18:19 2019 -0700
wip: allow mix of dup- and non-dup games in test script
commit 874b2bafc2b466f2bd2086a239942a350b93f1dd
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:35 2019 -0700
wip: work around misunderstood NPE (not dup-only)
commit 185a6d374fc49a955bbea90e086fd1570d023627
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 08:03:14 2019 -0700
wip: cleanup and add debug/logging util
commit a2a8dfcbd30d53bdac170e057605a683f3f30323
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:58:14 2019 -0700
wip: don't exit engine when checking tray in dup mode
Android tends to abort the search because it has UI events
unprocessed. I'm hoping it's generally so quick that this is ok. If not,
I'll need to be more clever, e.g. adding an option to end the search
after finding only one move rather than the best move.
commit 44c7528995327c9653dc69f60986f18442e232de
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:47:04 2019 -0700
wip: fix broken compile
commit 1bbc1607914993565c86d8b86da78b490e08d3f4
Author: Eric House <xwords@eehouse.org>
Date: Wed Jun 5 07:18:24 2019 -0700
wip: fix pool having too many tiles when engine busy
Bad loop structure meant I exited only after replacing in pool tiles I
was actually keeping.
commit 021f5afc8d4a871d42aa619be02b80fab7e2415c
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:31:34 2019 -0700
wip: don't include number of players figuring pass count
otherwise we wait too long for duplicate mode game to end
commit 1294b3bb0a4272e0bfb87f81ef5f9fe957d78b2e
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:30:41 2019 -0700
wip: log tile sets in and out
commit a01c50405e1edcfba4bb2fc89f4df0801226f5d5
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:29:32 2019 -0700
wip: no longer generate trades randomly
commit aeae0164c3c7e940430d72c000e2a66baf5f1dd5
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 19:19:06 2019 -0700
wip: figure bits-per-tile correctly
commit cb3bb8d55b9cae577941ab8707a91566f42a14f9
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 09:12:52 2019 -0700
log service stalls that don't trigger notification
I'm seeing RelayService never get scheduled, and need to see something
in the logs.
commit a8e0b43d004b2556ab4b22ab52be0ad7e3ddb45d
Author: Eric House <xwords@eehouse.org>
Date: Tue Jun 4 08:52:49 2019 -0700
wip: flag dup-mode games and nuke all on demand
Add a bit to a summaries table field so dup-mode games can be
identified. Add disabled code to nuke them all without attempting to
open, something that still needs doing on occasion.
commit 4e4bcd5d4590d0b429405a6a0a5de10f1a29689d
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 17:39:21 2019 -0700
wip: get rid of new move types
It's enough to know whether we're in duplicate mode at runtime, as
confirmed by the assertions from the last commit.
commit 7343ba3de1941a2b9d8fcd196506c9f62acbfe91
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 12:10:35 2019 -0700
wip: assert new move types are redundant
Looks like I don't need them: I can know whether I'm in duplicate mode
or not and interpret them appropriately. This commit is to check; next
will remove the types.
commit 07ae965094c720ebb71b2dd6c5e9a6facf854888
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:23:38 2019 -0700
wip: don't dup-trade when no tiles left in pool
and don't count dup-trade as a pass when deciding whether to end game.
commit b8cbfd0149f9c8e9854ae15dddc8328832f7d8a0
Author: Eric House <xwords@eehouse.org>
Date: Mon Jun 3 11:00:38 2019 -0700
wip: trade when nobody can move
Add a new move type, duplicate-trade. Generate and transmit one of those
when none of the submitted moves scores any points. And for testing,
randomly do it in DEBUG builds occasionally (should likely be a param
passed by the test script instead.) Still generates a very few
assertions run from the script, but worth snapshotting still.
commit 41f0258619a1f3ab72abd3d908d0b6cf2f999978
Author: Eric House <xwords@eehouse.org>
Date: Sun Jun 2 10:09:26 2019 -0700
add prefs settings to unhide dup mode and for new-game default
For now, it should be hard to stumble onto it, so add a debug-only
setting so that all options are hidden by default. And so if you are
using it it's easier to use, add a new-game default setting (itself
hidden at first via the above.) Eventually I suspect it'll be easier to
find for French-localized devices.
commit e152b407005e837eec4fe1f6ad552f55c157d877
Author: Eric House <xwords@eehouse.org>
Date: Wed May 29 10:03:13 2019 -0700
cleanup
commit 4439d8c3ea786b64dde554a25c62379bbea8347d
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:54:17 2019 -0700
fix obscure NPE (not duplicate-specific)
commit 4c5b1fc25d74f0ab40072f0d1987234e78b05569
Author: Eric House <xwords@eehouse.org>
Date: Tue May 28 06:44:57 2019 -0700
wip: fix NPE setting title too early
commit cc06a3df70157e3fd4c5b7f12d3adc8cfb87aa1c
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 20:12:14 2019 -0700
wip: fix crashes and stalls script found
I was using a non-local player's model as scratch then failing to fully
update it before loading the winning tray in.
commit 7010cd60af70965ac106072ca2eed91536c746d5
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:38:12 2019 -0700
wip: add strings where test script can find them for dup games
commit 1349d300b74168e2cae3c564fcbcec6fb28264c3
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 14:36:44 2019 -0700
wip: fix assert when no tiles in move
commit 8a789ef9c32d4d90ef7f054dc8d863902edc34eb
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:55:03 2019 -0700
wip: mark duplicate games a bit
Add "(dup.)" to game title and new string to the commit confirm alert.
commit 4ac09cf8daf8752106d1edf9a90e0f12fe3bc80a
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:51:39 2019 -0700
wip: fix tray-check bugs
Needed to run the engine against the tray of the winning move, even if
it wasn't local. Engines haven't existed for non-local players before so
some assertions weren't happy.
commit 99abae4d19383afe25a9fbe57960ec0f8530f49e
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 08:11:13 2019 -0700
fix to compile on Android
commit 22a58978dd1a6d851a5f92557928d5418d42a57a
Author: Eric House <xwords@eehouse.org>
Date: Mon May 27 06:53:55 2019 -0700
fix breakage from too-eager refactoring
commit d2f1a8d7c2c90e94bc00b170d69faa6f9b3e69e1
Author: Eric House <xwords@eehouse.org>
Date: Sun May 26 19:51:21 2019 -0700
wip: refetch new tiles if current tray doesn't allow any moves
commit c4c916c9f96231d9a2fd085df1aef8b54237ab4f
Author: Eric House <xwords@eehouse.org>
Date: Sat May 25 13:34:24 2019 -0700
wip: add logging trying to catch stall
commit 8355236bdc5b34e5a58594dfec982cf0cd3daa8a
Author: Eric House <xwords@eehouse.org>
Date: Fri May 24 06:54:04 2019 -0700
wip: include dupMode in BT and SMS invitations
Add it to the json and url read/write code so other invitation types
also work.
commit b8fb1d4c89285e0516aa55f830954dac16dbe7cc
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:34:33 2019 -0700
add option to have all robots at full smartness
as a test of duplicate, makes all scores the same
commit e653ad39284c5ba071e74a521a91d5bb21fbe320
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:55 2019 -0700
wip: fix method-name parens assert printf
commit fca3c06ff3007c3095128b27040d87e82eddf79b
Author: Eric House <xwords@eehouse.org>
Date: Thu May 23 20:33:37 2019 -0700
wip: remove some logging
commit 1a89b105d34ba0af2048b7693a3fdbeda7783070
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 19:43:52 2019 -0700
wip: add ability to run test app in duplicate mode
Doesn't come close to passing :-(
commit 308baf2a8b2cbdc1212cff17811ee6f750c67099
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 16:47:20 2019 -0700
wip: report scores when move over (sorted by score)
Still need to made the strings localizable.
commit 2db4bdceaba990f34dd32afb16f9d4bd04fd8cdc
Author: Eric House <xwords@eehouse.org>
Date: Wed May 22 13:57:45 2019 -0700
wip: fix problems opening old-version move stacks
Since the stack's not rewritten each time it's saved (moves stay in the
stream) the versioning scheme can't work. Instead use an extra bit to
store whether the stack uses the new format requiring an extra bit for
moveType.
commit 1df8e1754e35b784be2070c8416c6f5038fa65a7
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:48:31 2019 -0700
wip: fix end-of-game message and initial turn assignment
commit 4548435b36e9f9165b66832b93707a0b7e00f876
Author: Eric House <xwords@eehouse.org>
Date: Tue May 21 18:10:48 2019 -0700
wip: UI doesn't need to always show the same turn
Figure what "turn" it is based on what candidate moves have been
reported locally. Fixes Android not showing games as needing attention
on all devices.
commit 4a93f4b4528eabcef41bdfd67517bba4d1479407
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 21:37:22 2019 -0700
wip cleanup
commit f8184783bc9a8914310c39c54084e5fe492694a7
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 20:26:08 2019 -0700
wip: split method
commit 0d7d68737843017ecbc08dba87d881dabf7098ff
Author: Eric House <xwords@eehouse.org>
Date: Mon May 20 19:49:33 2019 -0700
wip: update scoreboard and end game correctly
commit d5d95424314b2e18c95f0a43eaa1759b3a7c6b5a
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:15:56 2019 -0700
wip: don't allow trade in dup mode
commit 8b102c0a8e5c0b39cc5b29aea16a5985a0e402c6
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 21:09:30 2019 -0700
wip: get building/limping along on Android
parity with GTK, basically.
commit 16cfc6b0bb1bb01ee801ccec2116eac94e16fdab
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:57:45 2019 -0700
wip: break point tie based on word length
commit 66dce87d98dce21d7616cc79c32ee88e8fbbb537
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 17:12:28 2019 -0700
wip: fix networked games
commit 33ba891082a9d59a90115357194841f8fa0532f8
Author: Eric House <xwords@eehouse.org>
Date: Sun May 19 16:28:46 2019 -0700
wip: fix problems updating model
Simplest test case now works: two-player one-device game in duplicate
mode can make a bunch of turns. Save/restore of game works. All on gtk;
Android likely doesn't build.
commit 33080c1014e40af0858a1d89168ffd52d1efd400
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:38:37 2019 -0700
wip: tweak commit of dup move
commit 65f06a216441624f811d1abb2e31955fb979b5c5
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 10:23:08 2019 -0700
wip: correctly update board with dup move
and fix crash when move stack created with wrong version
commit 4be132686b64cf6c49e541ad7df76bb7b753b3ce
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 09:10:31 2019 -0700
wip: update scores correctly when loading stack
commit 107f7b2a6708c1129f8fd67dc2deecb9e19a0606
Author: Eric House <xwords@eehouse.org>
Date: Sat May 18 08:40:29 2019 -0700
wip: add dupe-mode move to move stack
Add new move entry type including a move and new tiles plus the scores
for all players. Reflect move and tiles when loading from file. Next:
figure out what to do with the scores.
commit 6c05fe87d3ddae3e74edf0621df40dd083c9bebb
Author: Eric House <xwords@eehouse.org>
Date: Fri May 17 10:20:18 2019 -0700
wip: identify highest-scoring word
commit 4e498f754d637a15c63ec8498bad35c58f348a45
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 21:34:04 2019 -0700
wip: transmit client dupe-mode moves to server
and fix failure to get dupe flag into server on client side
commit 225b0f579d0c9aae85f439739d686b8afda7b6e3
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:54:41 2019 -0700
wip: invitation works to assign tiles
Include in nli sent across that we're in DUPLICATE mode. When sending
and receiving assigned tiles in that mode, send only one set and remove
from pool only once. But: games don't always connect, which might or not
be due to these changes. Next: handle commit by sending the move but not
a new tray.
commit 7e7b5d65e2fd4ccaf6657d88c9c9e1c59adc8c4f
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 19:46:25 2019 -0700
wip: remove excessive logging
commit 8afc11dc54c5aa145066729594fb741cf9e51c2c
Author: Eric House <xwords@eehouse.org>
Date: Thu May 16 08:15:20 2019 -0700
wip: accumulate local turns
Track whether players have committed turns yet. Once all have
notice (but do nothing yet).
commit d7697fba6f7bffc37d2ee09d9b397c1bb04cdf4b
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 22:24:04 2019 -0700
wip scoreboard shows it can be multiple players' turns
modify how scoreboard is drawn. next: let players commit until all are
done
commit eaa551d1d587fba90bb6cf960b4321949d173ef5
Author: Eric House <xwords@eehouse.org>
Date: Wed May 15 20:05:25 2019 -0700
wip: add duplicate checkbox and assign same tiles to all
next: make it everybody's turn until it's nobody's. This is all in
standalone mode for now.
2020-01-31 01:00:56 +01:00
|
|
|
/* const char* buttons[] = { "Ok" }; */
|
|
|
|
/* (void)cursesask( globals, text, VSIZE(buttons), buttons ); */
|
|
|
|
|
|
|
|
/* free( text ); */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* #ifndef XWFEATURE_STANDALONE_ONLY */
|
|
|
|
/* static XWStreamCtxt* */
|
|
|
|
/* curses_util_makeStreamFromAddr(XW_UtilCtxt* uc, XP_PlayerAddr channelNo ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure; */
|
|
|
|
/* LaunchParams* params = globals->cGlobals.params; */
|
|
|
|
|
|
|
|
/* XWStreamCtxt* stream = mem_stream_make( MPPARM(uc->mpool) params->vtMgr, */
|
|
|
|
/* &globals->cGlobals, channelNo, */
|
|
|
|
/* sendOnClose ); */
|
|
|
|
/* return stream; */
|
|
|
|
/* } /\* curses_util_makeStreamFromAddr *\/ */
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
/* #ifdef XWFEATURE_CHAT */
|
|
|
|
/* static void */
|
|
|
|
/* curses_util_showChat( XW_UtilCtxt* uc, */
|
|
|
|
/* const XP_UCHAR* const XP_UNUSED_DBG(msg), */
|
|
|
|
/* XP_S16 XP_UNUSED_DBG(from), XP_U32 XP_UNUSED(timestamp) ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesAppGlobals* globals = (CursesAppGlobals*)uc->closure; */
|
|
|
|
/* globals->nChatsSent = 0; */
|
|
|
|
/* # ifdef DEBUG */
|
|
|
|
/* const XP_UCHAR* name = "<unknown>"; */
|
|
|
|
/* if ( 0 <= from ) { */
|
|
|
|
/* CommonGlobals* cGlobals = &globals->cGlobals; */
|
|
|
|
/* name = cGlobals->gi->players[from].name; */
|
|
|
|
/* } */
|
|
|
|
/* XP_LOGF( "%s: got \"%s\" from %s", __func__, msg, name ); */
|
|
|
|
/* # endif */
|
|
|
|
/* } */
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
/* static void */
|
|
|
|
/* setupCursesUtilCallbacks( CursesAppGlobals* globals, XW_UtilCtxt* util ) */
|
|
|
|
/* { */
|
|
|
|
/* util->vtable->m_util_userError = curses_util_userError; */
|
|
|
|
|
|
|
|
/* util->vtable->m_util_informNeedPassword = curses_util_informNeedPassword; */
|
|
|
|
/* util->vtable->m_util_yOffsetChange = curses_util_yOffsetChange; */
|
|
|
|
/* #ifdef XWFEATURE_TURNCHANGENOTIFY */
|
|
|
|
/* util->vtable->m_util_turnChanged = curses_util_turnChanged; */
|
|
|
|
/* #endif */
|
|
|
|
/* util->vtable->m_util_notifyDupStatus = curses_util_notifyDupStatus; */
|
|
|
|
/* util->vtable->m_util_notifyIllegalWords = curses_util_notifyIllegalWords; */
|
|
|
|
/* util->vtable->m_util_remSelected = curses_util_remSelected; */
|
|
|
|
/* #ifndef XWFEATURE_STANDALONE_ONLY */
|
|
|
|
/* util->vtable->m_util_makeStreamFromAddr = curses_util_makeStreamFromAddr; */
|
|
|
|
/* #endif */
|
|
|
|
/* #ifdef XWFEATURE_CHAT */
|
|
|
|
/* util->vtable->m_util_showChat = curses_util_showChat; */
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
/* util->vtable->m_util_notifyMove = curses_util_notifyMove; */
|
|
|
|
/* util->vtable->m_util_notifyTrade = curses_util_notifyTrade; */
|
|
|
|
/* util->vtable->m_util_notifyPickTileBlank = curses_util_notifyPickTileBlank; */
|
|
|
|
/* util->vtable->m_util_informNeedPickTiles = curses_util_informNeedPickTiles; */
|
|
|
|
/* util->vtable->m_util_trayHiddenChange = curses_util_trayHiddenChange; */
|
|
|
|
/* util->vtable->m_util_informMove = curses_util_informMove; */
|
|
|
|
/* util->vtable->m_util_informUndo = curses_util_informUndo; */
|
|
|
|
/* util->vtable->m_util_notifyGameOver = curses_util_notifyGameOver; */
|
|
|
|
/* util->vtable->m_util_informNetDict = curses_util_informNetDict; */
|
|
|
|
/* util->vtable->m_util_setIsServer = curses_util_setIsServer; */
|
|
|
|
|
|
|
|
/* #ifdef XWFEATURE_HILITECELL */
|
|
|
|
/* util->vtable->m_util_hiliteCell = curses_util_hiliteCell; */
|
|
|
|
/* #endif */
|
|
|
|
/* util->vtable->m_util_engineProgressCallback = */
|
|
|
|
/* curses_util_engineProgressCallback; */
|
|
|
|
|
|
|
|
/* util->vtable->m_util_setTimer = curses_util_setTimer; */
|
|
|
|
/* util->vtable->m_util_clearTimer = curses_util_clearTimer; */
|
|
|
|
/* util->vtable->m_util_requestTime = curses_util_requestTime; */
|
|
|
|
|
|
|
|
/* util->closure = globals; */
|
|
|
|
/* } /\* setupCursesUtilCallbacks *\/ */
|
|
|
|
|
|
|
|
/* static CursesMenuHandler */
|
|
|
|
/* getHandlerForKey( const MenuList* list, char ch ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesMenuHandler handler = NULL; */
|
|
|
|
/* while ( list->handler != NULL ) { */
|
|
|
|
/* if ( list->key == ch ) { */
|
|
|
|
/* handler = list->handler; */
|
|
|
|
/* break; */
|
|
|
|
/* } */
|
|
|
|
/* ++list; */
|
|
|
|
/* } */
|
|
|
|
/* return handler; */
|
|
|
|
/* } */
|
|
|
|
|
|
|
|
/* static XP_Bool */
|
|
|
|
/* handleKeyEvent( CursesAppGlobals* globals, const MenuList* list, char ch ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesMenuHandler handler = getHandlerForKey( list, ch ); */
|
|
|
|
/* XP_Bool result = XP_FALSE; */
|
|
|
|
/* if ( !!handler ) { */
|
|
|
|
/* result = (*handler)(globals); */
|
|
|
|
/* } */
|
|
|
|
/* return result; */
|
|
|
|
/* } /\* handleKeyEvent *\/ */
|
|
|
|
|
|
|
|
/* static XP_Bool */
|
|
|
|
/* passKeyToBoard( CursesAppGlobals* globals, char ch ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_Bool handled = ch >= 'a' && ch <= 'z'; */
|
|
|
|
/* if ( handled ) { */
|
|
|
|
/* ch += 'A' - 'a'; */
|
|
|
|
/* globals->doDraw = board_handleKey( globals->cGlobals.game.board, */
|
|
|
|
/* ch, NULL ); */
|
|
|
|
/* } */
|
|
|
|
/* return handled; */
|
|
|
|
/* } /\* passKeyToBoard *\/ */
|
|
|
|
|
|
|
|
/* static void */
|
|
|
|
/* positionSizeStuff( CursesAppGlobals* globals, int width, int height ) */
|
|
|
|
/* { */
|
|
|
|
/* CommonGlobals* cGlobals = &globals->cGlobals; */
|
|
|
|
/* BoardCtxt* board = cGlobals->game.board; */
|
|
|
|
/* #ifdef COMMON_LAYOUT */
|
|
|
|
|
|
|
|
/* BoardDims dims; */
|
|
|
|
/* board_figureLayout( board, cGlobals->gi, */
|
|
|
|
/* 0, 0, width, height, 100, */
|
|
|
|
/* 150, 200, /\* percents *\/ */
|
|
|
|
/* width*75/100, 2, 1, */
|
|
|
|
/* XP_FALSE, &dims ); */
|
|
|
|
/* board_applyLayout( board, &dims ); */
|
|
|
|
/* ======= */
|
|
|
|
/* >>>>>>> android_branch */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static const MenuList* */
|
|
|
|
/* getHandlerForKey( const MenuList* list, char ch ) */
|
|
|
|
/* { */
|
|
|
|
/* MenuList* handler = NULL; */
|
|
|
|
/* while ( list->handler != NULL ) { */
|
|
|
|
/* if ( list->key == ch ) { */
|
|
|
|
/* handler = list->handler; */
|
|
|
|
/* break; */
|
|
|
|
/* } */
|
|
|
|
/* ++list; */
|
|
|
|
/* } */
|
|
|
|
/* return handler; */
|
|
|
|
/* } */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static XP_Bool */
|
|
|
|
/* handleKeyEvent( CursesAppGlobals* globals, const MenuList* list, char ch ) */
|
|
|
|
/* { */
|
|
|
|
/* const MenuList* entry = getHandlerForKey( list, ch ); */
|
|
|
|
/* XP_Bool result = XP_FALSE; */
|
|
|
|
/* if ( !!handler ) { */
|
|
|
|
/* result = (*entry->handler)(entry->closure); */
|
|
|
|
/* } */
|
|
|
|
/* return result; */
|
|
|
|
/* } /\* handleKeyEvent *\/ */
|
2008-02-02 17:56:20 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static XP_Bool */
|
|
|
|
/* passKeyToBoard( CursesAppGlobals* XP_UNUSED(globals), char XP_UNUSED(ch) ) */
|
|
|
|
/* { */
|
|
|
|
/* XP_ASSERT(0); */
|
|
|
|
/* /\* XP_Bool handled = ch >= 'a' && ch <= 'z'; *\/ */
|
|
|
|
/* /\* if ( handled ) { *\/ */
|
|
|
|
/* /\* ch += 'A' - 'a'; *\/ */
|
|
|
|
/* /\* globals->doDraw = board_handleKey( globals->cGlobals.game.board, *\/ */
|
|
|
|
/* /\* ch, NULL ); *\/ */
|
|
|
|
/* /\* } *\/ */
|
|
|
|
/* /\* return handled; *\/ */
|
|
|
|
/* } /\* passKeyToBoard *\/ */
|
2011-09-30 15:32:21 +02:00
|
|
|
|
2017-11-11 06:34:02 +01:00
|
|
|
#ifdef RELAY_VIA_HTTP
|
|
|
|
static void
|
|
|
|
onJoined( void* closure, const XP_UCHAR* connname, XWHostID hid )
|
|
|
|
{
|
|
|
|
LOG_FUNC();
|
|
|
|
CursesAppGlobals* globals = (CursesAppGlobals*)closure;
|
|
|
|
CommsCtxt* comms = globals->cGlobals.game.comms;
|
|
|
|
comms_gameJoined( comms, connname, hid );
|
|
|
|
}
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void */
|
|
|
|
/* relay_requestJoin_curses( void* closure, const XP_UCHAR* devID, const XP_UCHAR* room, */
|
|
|
|
/* XP_U16 nPlayersHere, XP_U16 nPlayersTotal, */
|
|
|
|
/* XP_U16 seed, XP_U16 lang ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesAppGlobals* globals = (CursesAppGlobals*)closure; */
|
|
|
|
/* relaycon_join( globals->cGlobals.params, devID, room, nPlayersHere, nPlayersTotal, */
|
|
|
|
/* seed, lang, onJoined, globals ); */
|
|
|
|
/* } */
|
2013-01-18 16:49:00 +01:00
|
|
|
#endif
|
|
|
|
|
2020-05-20 22:58:53 +02:00
|
|
|
void
|
2022-09-23 02:06:26 +02:00
|
|
|
inviteReceivedCurses( void* closure, const NetLaunchInfo* invite )
|
2020-01-31 22:29:36 +01:00
|
|
|
{
|
2020-05-20 22:58:53 +02:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
2020-01-31 22:29:36 +01:00
|
|
|
sqlite3_int64 rowids[1];
|
|
|
|
int nRowIDs = VSIZE(rowids);
|
2020-09-25 05:56:46 +02:00
|
|
|
gdb_getRowsForGameID( aGlobals->cag.params->pDb, invite->gameID, rowids, &nRowIDs );
|
2020-02-03 04:12:35 +01:00
|
|
|
bool doIt = 0 == nRowIDs;
|
2020-02-14 06:43:46 +01:00
|
|
|
if ( ! doIt && !!aGlobals->mainWin ) {
|
2023-11-17 18:00:43 +01:00
|
|
|
XP_LOGFF( "duplicate invite; not creating game" );
|
|
|
|
/* const gchar* question = "Duplicate invitation received. Accept anyway?"; */
|
|
|
|
/* const char* buttons[] = { "Yes", "No" }; */
|
|
|
|
/* doIt = 0 == cursesask( aGlobals->mainWin, question, VSIZE(buttons), buttons ); */
|
2020-02-03 04:12:35 +01:00
|
|
|
}
|
|
|
|
if ( doIt ) {
|
2020-01-31 22:29:36 +01:00
|
|
|
cb_dims dims;
|
|
|
|
figureDims( aGlobals, &dims );
|
2022-09-23 02:06:26 +02:00
|
|
|
cb_newFor( aGlobals->cbState, invite, &dims );
|
2020-02-17 07:34:33 +01:00
|
|
|
} else {
|
2022-12-31 01:14:22 +01:00
|
|
|
XP_LOGFF( "Not accepting duplicate invitation (nRowIDs(gameID=%X) was %d",
|
2020-02-24 21:10:49 +01:00
|
|
|
invite->gameID, nRowIDs );
|
2020-01-31 22:29:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-04-28 16:37:33 +02:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2020-02-17 07:34:33 +01:00
|
|
|
static void
|
2020-05-20 22:58:53 +02:00
|
|
|
relayInviteReceivedCurses( void* closure, const NetLaunchInfo* invite )
|
2020-02-17 07:34:33 +01:00
|
|
|
{
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
2022-09-23 02:06:26 +02:00
|
|
|
inviteReceivedCurses( aGlobals, invite );
|
2020-02-17 07:34:33 +01:00
|
|
|
}
|
|
|
|
|
2013-01-24 16:49:49 +01:00
|
|
|
static void
|
2020-01-24 18:05:16 +01:00
|
|
|
cursesGotBuf( void* closure, const CommsAddrRec* addr,
|
2014-11-05 16:41:20 +01:00
|
|
|
const XP_U8* buf, XP_U16 len )
|
2013-01-24 16:49:49 +01:00
|
|
|
{
|
2017-10-25 04:18:19 +02:00
|
|
|
LOG_FUNC();
|
2020-01-24 18:05:16 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
2013-07-12 05:39:10 +02:00
|
|
|
XP_U32 clientToken;
|
|
|
|
XP_ASSERT( sizeof(clientToken) < len );
|
|
|
|
XP_MEMCPY( &clientToken, &buf[0], sizeof(clientToken) );
|
|
|
|
buf += sizeof(clientToken);
|
|
|
|
len -= sizeof(clientToken);
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
sqlite3_int64 rowid;
|
|
|
|
XP_U16 gotSeed;
|
|
|
|
rowidFromToken( XP_NTOHL( clientToken ), &rowid, &gotSeed );
|
|
|
|
|
|
|
|
/* Figure out if the device is live, or we need to open the game */
|
2020-04-11 20:44:09 +02:00
|
|
|
cb_feedRow( aGlobals->cbState, rowid, gotSeed, buf, len, addr );
|
2020-01-24 18:05:16 +01:00
|
|
|
|
|
|
|
/* if ( seed == comms_getChannelSeed( cGlobals->game.comms ) ) { */
|
|
|
|
/* gameGotBuf( cGlobals, XP_TRUE, buf, len, addr ); */
|
|
|
|
/* } else { */
|
|
|
|
/* XP_LOGF( "%s(): dropping packet; meant for a different device", */
|
|
|
|
/* __func__ ); */
|
|
|
|
/* } */
|
|
|
|
/* LOG_RETURN_VOID(); */
|
2017-10-25 04:18:19 +02:00
|
|
|
}
|
2022-04-28 16:37:33 +02:00
|
|
|
#endif
|
2017-10-25 04:18:19 +02:00
|
|
|
|
2020-01-29 19:59:57 +01:00
|
|
|
static void
|
2022-09-23 02:06:26 +02:00
|
|
|
smsInviteReceivedCurses( void* closure, const NetLaunchInfo* nli )
|
2020-01-29 19:59:57 +01:00
|
|
|
{
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
2022-09-23 02:06:26 +02:00
|
|
|
inviteReceivedCurses( aGlobals, nli );
|
2020-01-29 19:59:57 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
smsMsgReceivedCurses( void* closure, const CommsAddrRec* from, XP_U32 gameID,
|
|
|
|
const XP_U8* buf, XP_U16 len )
|
|
|
|
{
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
|
|
|
cb_feedGame( aGlobals->cbState, gameID, buf, len, from );
|
|
|
|
}
|
|
|
|
|
2020-05-20 22:58:53 +02:00
|
|
|
void
|
|
|
|
mqttMsgReceivedCurses( void* closure, const CommsAddrRec* from,
|
|
|
|
XP_U32 gameID, const XP_U8* buf, XP_U16 len )
|
|
|
|
{
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
|
|
|
cb_feedGame( aGlobals->cbState, gameID, buf, len, from );
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
gameGoneCurses( void* XP_UNUSED(closure), const CommsAddrRec* XP_UNUSED(from),
|
|
|
|
XP_U32 XP_UNUSED_DBG(gameID) )
|
|
|
|
{
|
|
|
|
XP_LOGFF( "(gameID=%d)", gameID );
|
|
|
|
}
|
|
|
|
|
2022-04-28 16:37:33 +02:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2017-10-25 04:18:19 +02:00
|
|
|
static void
|
2020-01-24 18:05:16 +01:00
|
|
|
cursesGotForRow( void* XP_UNUSED(closure), const CommsAddrRec* XP_UNUSED(from),
|
|
|
|
sqlite3_int64 XP_UNUSED(rowid), const XP_U8* XP_UNUSED(buf),
|
|
|
|
XP_U16 XP_UNUSED(len) )
|
2017-10-25 04:18:19 +02:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
// CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
2017-10-25 04:18:19 +02:00
|
|
|
LOG_FUNC();
|
2020-01-24 18:05:16 +01:00
|
|
|
/* gameGotBuf( &globals->cGlobals, XP_TRUE, buf, len, from ); */
|
|
|
|
XP_ASSERT( 0 );
|
2017-10-25 04:18:19 +02:00
|
|
|
LOG_RETURN_VOID();
|
2013-01-24 16:49:49 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static gint
|
|
|
|
curses_requestMsgs( gpointer data )
|
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)data;
|
2013-01-24 16:49:49 +01:00
|
|
|
XP_UCHAR devIDBuf[64] = {0};
|
2020-09-25 05:56:46 +02:00
|
|
|
gdb_fetch_safe( aGlobals->cag.params->pDb, KEY_RDEVID, NULL, devIDBuf,
|
|
|
|
sizeof(devIDBuf) );
|
2013-01-24 16:49:49 +01:00
|
|
|
if ( '\0' != devIDBuf[0] ) {
|
2020-01-24 18:05:16 +01:00
|
|
|
relaycon_requestMsgs( aGlobals->cag.params, devIDBuf );
|
2013-01-24 16:49:49 +01:00
|
|
|
} else {
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "not requesting messages as don't have relay id" );
|
2013-01-24 16:49:49 +01:00
|
|
|
}
|
|
|
|
return 0; /* don't run again */
|
|
|
|
}
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
static void
|
2013-01-25 04:20:35 +01:00
|
|
|
cursesNoticeRcvd( void* closure )
|
2013-01-24 16:49:49 +01:00
|
|
|
{
|
|
|
|
LOG_FUNC();
|
|
|
|
CursesAppGlobals* globals = (CursesAppGlobals*)closure;
|
2020-01-24 18:05:16 +01:00
|
|
|
#ifdef DEBUG
|
|
|
|
guint res =
|
|
|
|
#endif
|
|
|
|
ADD_ONETIME_IDLE( curses_requestMsgs, globals );
|
|
|
|
XP_ASSERT( res > 0 );
|
2013-01-24 16:49:49 +01:00
|
|
|
}
|
|
|
|
|
2013-08-02 17:01:16 +02:00
|
|
|
static gboolean
|
|
|
|
keepalive_timer( gpointer data )
|
|
|
|
{
|
|
|
|
LOG_FUNC();
|
|
|
|
curses_requestMsgs( data );
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2013-01-24 16:49:49 +01:00
|
|
|
static void
|
2020-01-24 18:05:16 +01:00
|
|
|
cursesDevIDReceived( void* closure, const XP_UCHAR* devID,
|
2013-09-15 06:06:14 +02:00
|
|
|
XP_U16 maxInterval )
|
2013-01-24 16:49:49 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)closure;
|
|
|
|
sqlite3* pDb = aGlobals->cag.params->pDb;
|
2013-01-24 16:49:49 +01:00
|
|
|
if ( !!devID ) {
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "(devID='%s')", devID );
|
2013-09-15 06:06:14 +02:00
|
|
|
|
|
|
|
/* If we already have one, make sure it's the same! Else store. */
|
|
|
|
gchar buf[64];
|
2020-09-25 05:56:46 +02:00
|
|
|
XP_Bool have = gdb_fetch_safe( pDb, KEY_RDEVID, NULL, buf, sizeof(buf) )
|
2017-10-07 19:47:44 +02:00
|
|
|
&& 0 == strcmp( buf, devID );
|
2013-09-15 06:06:14 +02:00
|
|
|
if ( !have ) {
|
2020-09-25 05:56:46 +02:00
|
|
|
gdb_store( pDb, KEY_RDEVID, devID );
|
2020-02-14 06:43:46 +01:00
|
|
|
XP_LOGFF( "storing new devid: %s", devID );
|
|
|
|
cgl_draw( aGlobals->gameList );
|
2013-09-15 06:06:14 +02:00
|
|
|
}
|
2020-01-24 18:05:16 +01:00
|
|
|
(void)g_timeout_add_seconds( maxInterval, keepalive_timer, aGlobals );
|
2013-01-24 16:49:49 +01:00
|
|
|
} else {
|
2020-04-07 01:34:02 +02:00
|
|
|
XP_LOGFF( "bad relayid" );
|
2020-09-25 05:56:46 +02:00
|
|
|
gdb_remove( pDb, KEY_RDEVID );
|
2013-01-29 16:42:10 +01:00
|
|
|
|
|
|
|
DevIDType typ;
|
2020-01-24 18:05:16 +01:00
|
|
|
const XP_UCHAR* devID = linux_getDevID( aGlobals->cag.params, &typ );
|
|
|
|
relaycon_reg( aGlobals->cag.params, NULL, typ, devID );
|
2013-01-24 16:49:49 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
cursesErrorMsgRcvd( void* closure, const XP_UCHAR* msg )
|
|
|
|
{
|
|
|
|
CursesAppGlobals* globals = (CursesAppGlobals*)closure;
|
|
|
|
if ( !!globals->lastErr && 0 == strcmp( globals->lastErr, msg ) ) {
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_LOGFF( "skipping error message from relay" );
|
2013-01-24 16:49:49 +01:00
|
|
|
} else {
|
|
|
|
g_free( globals->lastErr );
|
|
|
|
globals->lastErr = g_strdup( msg );
|
2014-01-05 22:04:59 +01:00
|
|
|
const char* buttons[] = { "Ok" };
|
2020-01-24 18:05:16 +01:00
|
|
|
(void)cursesask( globals->mainWin, msg, VSIZE(buttons), buttons );
|
2013-01-24 16:49:49 +01:00
|
|
|
}
|
|
|
|
}
|
2022-04-28 16:37:33 +02:00
|
|
|
#endif
|
2013-01-24 16:49:49 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static gboolean */
|
|
|
|
/* chatsTimerFired( gpointer data ) */
|
|
|
|
/* { */
|
|
|
|
/* CursesAppGlobals* globals = (CursesAppGlobals*)data; */
|
|
|
|
/* XWGame* game = &globals->cGlobals.game; */
|
|
|
|
/* GameStateInfo gsi; */
|
|
|
|
|
|
|
|
/* game_getState( game, &gsi ); */
|
|
|
|
|
|
|
|
/* if ( gsi.canChat && 3 > globals->nChatsSent ) { */
|
|
|
|
/* XP_UCHAR msg[128]; */
|
|
|
|
/* struct tm* timp; */
|
|
|
|
/* struct timeval tv; */
|
|
|
|
/* struct timezone tz; */
|
|
|
|
|
|
|
|
/* gettimeofday( &tv, &tz ); */
|
|
|
|
/* timp = localtime( &tv.tv_sec ); */
|
|
|
|
|
|
|
|
/* snprintf( msg, sizeof(msg), "%x: Saying hi via chat at %.2d:%.2d:%.2d", */
|
|
|
|
/* comms_getChannelSeed( game->comms ), */
|
|
|
|
/* timp->tm_hour, timp->tm_min, timp->tm_sec ); */
|
|
|
|
/* XP_LOGF( "%s: sending \"%s\"", __func__, msg ); */
|
|
|
|
/* board_sendChat( game->board, msg ); */
|
|
|
|
/* ++globals->nChatsSent; */
|
|
|
|
/* } */
|
2013-06-25 03:37:49 +02:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* return TRUE; */
|
|
|
|
/* } */
|
2013-06-25 03:37:49 +02:00
|
|
|
|
2014-11-05 16:41:20 +01:00
|
|
|
/* static XP_U16 */
|
|
|
|
/* feedBufferCurses( CommonGlobals* cGlobals, sqlite3_int64 rowid, */
|
|
|
|
/* const XP_U8* buf, XP_U16 len, const CommsAddrRec* from ) */
|
|
|
|
/* { */
|
|
|
|
/* gameGotBuf( cGlobals, XP_TRUE, buf, len, from ); */
|
|
|
|
|
|
|
|
/* /\* GtkGameGlobals* globals = findOpenGame( apg, rowid ); *\/ */
|
|
|
|
|
|
|
|
/* /\* if ( !!globals ) { *\/ */
|
|
|
|
/* /\* gameGotBuf( &globals->cGlobals, XP_TRUE, buf, len, from ); *\/ */
|
|
|
|
/* /\* seed = comms_getChannelSeed( globals->cGlobals.game.comms ); *\/ */
|
|
|
|
/* /\* } else { *\/ */
|
|
|
|
/* /\* GtkGameGlobals tmpGlobals; *\/ */
|
|
|
|
/* /\* if ( loadGameNoDraw( &tmpGlobals, apg->params, rowid ) ) { *\/ */
|
|
|
|
/* /\* gameGotBuf( &tmpGlobals.cGlobals, XP_FALSE, buf, len, from ); *\/ */
|
|
|
|
/* /\* seed = comms_getChannelSeed( tmpGlobals.cGlobals.game.comms ); *\/ */
|
|
|
|
/* /\* saveGame( &tmpGlobals.cGlobals ); *\/ */
|
|
|
|
/* /\* } *\/ */
|
|
|
|
/* /\* freeGlobals( &tmpGlobals ); *\/ */
|
|
|
|
/* /\* } *\/ */
|
|
|
|
/* /\* return seed; *\/ */
|
|
|
|
/* } */
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* static void */
|
|
|
|
/* smsMsgReceivedCurses( void* closure, const CommsAddrRec* from, */
|
|
|
|
/* XP_U32 XP_UNUSED(gameID), */
|
|
|
|
/* const XP_U8* buf, XP_U16 len ) */
|
|
|
|
/* { */
|
|
|
|
/* LOG_FUNC(); */
|
|
|
|
/* CommonGlobals* cGlobals = (CommonGlobals*)closure; */
|
|
|
|
/* gameGotBuf( cGlobals, XP_TRUE, buf, len, from ); */
|
|
|
|
/* LOG_RETURN_VOID(); */
|
|
|
|
/* /\* LaunchParams* params = cGlobals->params; *\/ */
|
|
|
|
|
|
|
|
/* /\* sqlite3_int64 rowids[4]; *\/ */
|
|
|
|
/* /\* int nRowIDs = VSIZE(rowids); *\/ */
|
|
|
|
/* /\* getRowsForGameID( params->pDb, gameID, rowids, &nRowIDs ); *\/ */
|
|
|
|
/* /\* for ( int ii = 0; ii < nRowIDs; ++ii ) { *\/ */
|
|
|
|
/* /\* gameGotBuf( cGlobals, XP_TRUE, buf, len, from ); *\/ */
|
|
|
|
/* /\* // feedBufferCurses( cGlobals, rowids[ii], buf, len, from ); *\/ */
|
|
|
|
/* /\* } *\/ */
|
|
|
|
/* } */
|
2014-11-05 16:41:20 +01:00
|
|
|
|
2019-12-10 23:42:54 +01:00
|
|
|
static void
|
2020-01-24 18:05:16 +01:00
|
|
|
onGameSaved( CursesAppGlobals* aGlobals, sqlite3_int64 rowid, bool isNew )
|
2019-12-10 23:42:54 +01:00
|
|
|
{
|
2020-01-24 18:05:16 +01:00
|
|
|
cgl_refreshOne( aGlobals->gameList, rowid, isNew );
|
2019-12-10 23:42:54 +01:00
|
|
|
}
|
|
|
|
|
2023-11-30 02:11:51 +01:00
|
|
|
static XP_U32
|
|
|
|
castGid( cJSON* obj )
|
|
|
|
{
|
|
|
|
XP_U32 gameID;
|
|
|
|
sscanf( obj->valuestring, "%X", &gameID );
|
|
|
|
return gameID;
|
|
|
|
}
|
|
|
|
|
|
|
|
static XP_U32
|
2023-11-30 20:03:27 +01:00
|
|
|
gidFromObject( const cJSON* obj )
|
2023-11-30 02:11:51 +01:00
|
|
|
{
|
|
|
|
cJSON* tmp = cJSON_GetObjectItem( obj, "gid" );
|
|
|
|
XP_ASSERT( !!tmp );
|
|
|
|
return castGid( tmp );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-11-30 20:03:27 +01:00
|
|
|
makeObjIfNot( cJSON** objp )
|
2023-11-30 02:11:51 +01:00
|
|
|
{
|
2023-11-30 20:03:27 +01:00
|
|
|
if ( NULL == *objp ) {
|
|
|
|
*objp = cJSON_CreateObject();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2023-12-06 18:11:09 +01:00
|
|
|
addStringToObject( cJSON** objp, const char* key, const char* value )
|
2023-11-30 20:03:27 +01:00
|
|
|
{
|
|
|
|
makeObjIfNot( objp );
|
2023-12-06 18:11:09 +01:00
|
|
|
cJSON_AddStringToObject( *objp, key, value );
|
|
|
|
}
|
2023-11-30 20:03:27 +01:00
|
|
|
|
2023-12-06 18:11:09 +01:00
|
|
|
static void
|
|
|
|
addGIDToObject( cJSON** objp, XP_U32 gid, const char* key )
|
|
|
|
{
|
2023-11-30 02:11:51 +01:00
|
|
|
char buf[16];
|
|
|
|
sprintf( buf, "%08X", gid );
|
2023-12-06 18:11:09 +01:00
|
|
|
addStringToObject( objp, key, buf );
|
2023-11-30 02:11:51 +01:00
|
|
|
}
|
|
|
|
|
2023-11-30 20:03:27 +01:00
|
|
|
static void
|
|
|
|
addObjectToObject( cJSON** objp, const char* key, cJSON* value )
|
|
|
|
{
|
|
|
|
makeObjIfNot( objp );
|
|
|
|
cJSON_AddItemToObject( *objp, key, value );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
addSuccessToObject( cJSON** objp, XP_Bool success )
|
|
|
|
{
|
|
|
|
makeObjIfNot( objp );
|
|
|
|
cJSON_AddBoolToObject( *objp, "success", success );
|
|
|
|
}
|
|
|
|
|
|
|
|
static XP_U32
|
2023-11-18 04:39:45 +01:00
|
|
|
makeGameFromArgs( CursesAppGlobals* aGlobals, cJSON* args )
|
|
|
|
{
|
|
|
|
LaunchParams* params = aGlobals->cag.params;
|
|
|
|
CurGameInfo gi = {0};
|
|
|
|
gi_copy( MPPARM(params->mpool) &gi, ¶ms->pgi );
|
|
|
|
gi.boardSize = 15;
|
|
|
|
gi.traySize = 7;
|
|
|
|
|
2023-11-30 02:11:51 +01:00
|
|
|
cJSON* tmp = cJSON_GetObjectItem( args, "nPlayers" );
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_ASSERT( !!tmp );
|
|
|
|
gi.nPlayers = tmp->valueint;
|
|
|
|
|
2023-11-29 20:33:12 +01:00
|
|
|
tmp = cJSON_GetObjectItem( args, "boardSize" );
|
|
|
|
if ( !!tmp ) {
|
|
|
|
gi.boardSize = tmp->valueint;
|
|
|
|
}
|
|
|
|
tmp = cJSON_GetObjectItem( args, "traySize" );
|
|
|
|
if ( !!tmp ) {
|
|
|
|
gi.traySize = tmp->valueint;
|
|
|
|
}
|
|
|
|
|
2024-02-03 06:03:42 +01:00
|
|
|
tmp = cJSON_GetObjectItem( args, "isSolo" );
|
|
|
|
XP_ASSERT( !!tmp );
|
|
|
|
XP_Bool isSolo = cJSON_IsTrue( tmp );
|
|
|
|
|
2023-11-18 04:39:45 +01:00
|
|
|
tmp = cJSON_GetObjectItem( args, "hostPosn" );
|
|
|
|
XP_ASSERT( !!tmp );
|
|
|
|
int hostPosn = tmp->valueint;
|
|
|
|
replaceStringIfDifferent( params->mpool, &gi.players[hostPosn].name,
|
|
|
|
params->localName );
|
|
|
|
for ( int ii = 0; ii < gi.nPlayers; ++ii ) {
|
2024-02-03 06:03:42 +01:00
|
|
|
LocalPlayer* lp = &gi.players[ii];
|
|
|
|
lp->isLocal = isSolo || ii == hostPosn;
|
|
|
|
if ( isSolo ) {
|
|
|
|
lp->robotIQ = ii == hostPosn ? 0 : 1;
|
|
|
|
}
|
2023-11-18 04:39:45 +01:00
|
|
|
}
|
|
|
|
|
2024-02-03 06:03:42 +01:00
|
|
|
gi.serverRole = isSolo ? SERVER_STANDALONE : SERVER_ISHOST;
|
|
|
|
|
2023-11-18 04:39:45 +01:00
|
|
|
tmp = cJSON_GetObjectItem( args, "dict" );
|
|
|
|
XP_ASSERT( tmp );
|
|
|
|
replaceStringIfDifferent( params->mpool, &gi.dictName, tmp->valuestring );
|
|
|
|
|
|
|
|
cb_dims dims;
|
|
|
|
figureDims( aGlobals, &dims );
|
2023-11-30 20:03:27 +01:00
|
|
|
|
|
|
|
XP_U32 newGameID;
|
|
|
|
bool success = cb_new( aGlobals->cbState, &dims, &gi, &newGameID );
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_ASSERT( success );
|
|
|
|
|
|
|
|
gi_disposePlayerInfo( MPPARM(params->mpool) &gi );
|
2023-11-30 20:03:27 +01:00
|
|
|
return newGameID;
|
2023-11-18 04:39:45 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static XP_Bool
|
|
|
|
inviteFromArgs( CursesAppGlobals* aGlobals, cJSON* args )
|
|
|
|
{
|
2023-11-30 02:11:51 +01:00
|
|
|
XP_U32 gameID = gidFromObject( args );
|
2023-11-18 04:39:45 +01:00
|
|
|
|
2024-01-05 05:28:49 +01:00
|
|
|
cJSON* remotes = cJSON_GetObjectItem( args, "remotes" );
|
|
|
|
int nRemotes = cJSON_GetArraySize(remotes);
|
|
|
|
CommsAddrRec destAddrs[nRemotes];
|
|
|
|
XP_MEMSET( destAddrs, 0, sizeof(destAddrs) );
|
|
|
|
XP_U16 channels[nRemotes];
|
|
|
|
XP_MEMSET( channels, 0, sizeof(channels) );
|
|
|
|
|
|
|
|
for ( int ii = 0; ii < nRemotes; ++ii ) {
|
|
|
|
cJSON* item = cJSON_GetArrayItem( remotes, ii );
|
|
|
|
cJSON* tmp = cJSON_GetObjectItem( item, "channel" );
|
|
|
|
XP_ASSERT( !!tmp );
|
|
|
|
channels[ii] = tmp->valueint;
|
|
|
|
XP_LOGFF( "read channel: %X", channels[ii] );
|
|
|
|
|
|
|
|
cJSON* addr = cJSON_GetObjectItem( item, "addr" );
|
|
|
|
XP_ASSERT( !!addr );
|
|
|
|
tmp = cJSON_GetObjectItem( addr, "mqtt" );
|
|
|
|
if ( !!tmp ) {
|
|
|
|
XP_LOGFF( "parsing mqtt: %s", tmp->valuestring );
|
|
|
|
addr_addType( &destAddrs[ii], COMMS_CONN_MQTT );
|
|
|
|
XP_Bool success = strToMQTTCDevID( tmp->valuestring, &destAddrs[ii].u.mqtt.devID );
|
|
|
|
XP_ASSERT( success );
|
|
|
|
}
|
|
|
|
tmp = cJSON_GetObjectItem( addr, "sms" );
|
|
|
|
if ( !!tmp ) {
|
|
|
|
XP_LOGFF( "parsing sms: %s", tmp->valuestring );
|
|
|
|
addr_addType( &destAddrs[ii], COMMS_CONN_SMS );
|
|
|
|
XP_STRCAT( destAddrs[ii].u.sms.phone, tmp->valuestring );
|
|
|
|
destAddrs[ii].u.sms.port = 1;
|
|
|
|
}
|
2023-11-18 04:39:45 +01:00
|
|
|
}
|
|
|
|
|
2024-01-05 05:28:49 +01:00
|
|
|
cb_addInvites( aGlobals->cbState, gameID, nRemotes, channels, destAddrs );
|
|
|
|
|
2023-11-18 04:39:45 +01:00
|
|
|
LOG_RETURN_VOID();
|
|
|
|
return XP_TRUE;
|
|
|
|
}
|
|
|
|
|
2023-11-30 02:11:51 +01:00
|
|
|
static XP_Bool
|
|
|
|
moveifFromArgs( CursesAppGlobals* aGlobals, cJSON* args )
|
|
|
|
{
|
|
|
|
XP_U32 gameID = gidFromObject( args );
|
|
|
|
return cb_makeMoveIf( aGlobals->cbState, gameID );
|
|
|
|
}
|
|
|
|
|
2024-01-23 06:19:13 +01:00
|
|
|
static XP_Bool
|
|
|
|
chatFromArgs( CursesAppGlobals* aGlobals, cJSON* args )
|
|
|
|
{
|
|
|
|
XP_U32 gameID = gidFromObject( args );
|
|
|
|
cJSON* tmp = cJSON_GetObjectItem( args, "msg" );
|
|
|
|
const char* msg = tmp->valuestring;
|
|
|
|
return cb_sendChat( aGlobals->cbState, gameID, msg );
|
|
|
|
}
|
|
|
|
|
2023-11-30 02:11:51 +01:00
|
|
|
/* Return 'gid' of new game */
|
|
|
|
static XP_U32
|
|
|
|
rematchFromArgs( CursesAppGlobals* aGlobals, cJSON* args )
|
|
|
|
{
|
|
|
|
XP_U32 result = 0;
|
|
|
|
|
|
|
|
XP_U32 gameID = gidFromObject( args );
|
|
|
|
|
2023-12-19 02:08:51 +01:00
|
|
|
cJSON* tmp = cJSON_GetObjectItem( args, "rematchOrder" );
|
|
|
|
RematchOrder ro = roFromStr( tmp->valuestring );
|
|
|
|
|
2023-11-30 02:11:51 +01:00
|
|
|
XP_U32 newGameID = 0;
|
2023-12-19 02:08:51 +01:00
|
|
|
if ( cb_makeRematch( aGlobals->cbState, gameID, ro, &newGameID ) ) {
|
2023-11-30 02:11:51 +01:00
|
|
|
result = newGameID;
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2023-12-06 18:11:09 +01:00
|
|
|
static XP_Bool
|
|
|
|
getGamesStateForArgs( CursesAppGlobals* aGlobals, cJSON* args,
|
|
|
|
cJSON** states, cJSON** orders )
|
2023-11-18 04:39:45 +01:00
|
|
|
{
|
2023-12-06 18:11:09 +01:00
|
|
|
LOG_FUNC();
|
2023-11-18 04:39:45 +01:00
|
|
|
LaunchParams* params = aGlobals->cag.params;
|
2023-12-06 18:11:09 +01:00
|
|
|
|
|
|
|
*states = cJSON_CreateArray();
|
|
|
|
|
|
|
|
cJSON* gids = cJSON_GetObjectItem( args, "gids" );
|
|
|
|
XP_Bool success = !!gids;
|
|
|
|
for ( int ii = 0 ; success && ii < cJSON_GetArraySize(gids) ; ++ii ) {
|
2023-11-30 02:11:51 +01:00
|
|
|
XP_U32 gameID = castGid( cJSON_GetArrayItem( gids, ii ) );
|
2023-11-18 04:39:45 +01:00
|
|
|
|
|
|
|
GameInfo gib;
|
|
|
|
if ( gdb_getGameInfoForGID( params->pDb, gameID, &gib ) ) {
|
2023-11-30 20:03:27 +01:00
|
|
|
cJSON* item = NULL;
|
|
|
|
addGIDToObject( &item, gameID, "gid" );
|
2023-11-18 04:39:45 +01:00
|
|
|
cJSON_AddBoolToObject( item, "gameOver", gib.gameOver );
|
|
|
|
cJSON_AddNumberToObject( item, "nPending", gib.nPending );
|
|
|
|
cJSON_AddNumberToObject( item, "nMoves", gib.nMoves );
|
|
|
|
cJSON_AddNumberToObject( item, "nTiles", gib.nTiles );
|
|
|
|
|
2023-12-06 18:11:09 +01:00
|
|
|
cJSON_AddItemToArray( *states, item );
|
2023-11-18 04:39:45 +01:00
|
|
|
}
|
|
|
|
}
|
2023-12-06 18:11:09 +01:00
|
|
|
|
|
|
|
XP_LOGFF( "done with states" ); /* got here */
|
|
|
|
|
|
|
|
if ( success && !!orders ) {
|
|
|
|
cJSON* gids = cJSON_GetObjectItem( args, "orders" );
|
|
|
|
if ( !gids ) {
|
|
|
|
*orders = NULL;
|
|
|
|
} else {
|
|
|
|
*orders = cJSON_CreateArray();
|
|
|
|
for ( int ii = 0 ; ii < cJSON_GetArraySize(gids) ; ++ii ) {
|
|
|
|
XP_U32 gameID = castGid( cJSON_GetArrayItem( gids, ii ) );
|
|
|
|
|
|
|
|
const CommonGlobals* cg = cb_getForGameID( aGlobals->cbState, gameID );
|
|
|
|
if ( !cg ) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
const XWGame* game = &cg->game;
|
|
|
|
if ( server_getGameIsConnected( game->server ) ) {
|
|
|
|
const CurGameInfo* gi = cg->gi;
|
|
|
|
LOGGI( gi, __func__ );
|
|
|
|
cJSON* order = NULL;
|
|
|
|
addGIDToObject( &order, gameID, "gid" );
|
|
|
|
cJSON* players = cJSON_CreateArray();
|
|
|
|
for ( int jj = 0; jj < gi->nPlayers; ++jj ) {
|
|
|
|
XP_LOGFF( "looking at player %d", jj );
|
|
|
|
const LocalPlayer* lp = &gi->players[jj];
|
|
|
|
XP_LOGFF( "adding player %d: %s", jj, lp->name );
|
|
|
|
cJSON* cName = cJSON_CreateString( lp->name );
|
|
|
|
cJSON_AddItemToArray( players, cName);
|
|
|
|
}
|
|
|
|
cJSON_AddItemToObject( order, "players", players );
|
|
|
|
cJSON_AddItemToArray( *orders, order );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
LOG_RETURNF( "%s", boolToStr(success) );
|
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Return for each gid and array of player names, in play order, and including
|
|
|
|
for each whether it's the host and if a robot. For now let's try by opening
|
|
|
|
each game (yeah! yuck!) to read the info directly. Later add to a the db
|
|
|
|
accessed by gamesdb.c
|
|
|
|
*/
|
|
|
|
static cJSON*
|
|
|
|
getPlayersForArgs( CursesAppGlobals* aGlobals, cJSON* args )
|
|
|
|
{
|
|
|
|
cJSON* result = cJSON_CreateArray();
|
|
|
|
cJSON* gids = cJSON_GetObjectItem( args, "gids" );
|
|
|
|
for ( int ii = 0 ; ii < cJSON_GetArraySize(gids) ; ++ii ) {
|
|
|
|
XP_U32 gameID = castGid( cJSON_GetArrayItem( gids, ii ) );
|
|
|
|
|
|
|
|
const CommonGlobals* cg = cb_getForGameID( aGlobals->cbState, gameID );
|
|
|
|
const CurGameInfo* gi = cg->gi;
|
|
|
|
LOGGI( gi, __func__ );
|
|
|
|
const XWGame* game = &cg->game;
|
|
|
|
|
|
|
|
cJSON* players = cJSON_CreateArray();
|
|
|
|
for ( int jj = 0; jj < gi->nPlayers; ++jj ) {
|
|
|
|
cJSON* playerObj = NULL;
|
|
|
|
const LocalPlayer* lp = &gi->players[jj];
|
|
|
|
XP_LOGFF( "adding player %d: %s", jj, lp->name );
|
|
|
|
addStringToObject( &playerObj, "name", lp->name );
|
|
|
|
XP_Bool isLocal = lp->isLocal;
|
|
|
|
cJSON_AddBoolToObject( playerObj, "isLocal", isLocal );
|
|
|
|
|
|
|
|
/* Roles: I don't think a guest in a 3- or 4-device game knows
|
|
|
|
which of the other players is host. Host is who it sends its
|
|
|
|
moves to, but is there an order there? */
|
|
|
|
XP_Bool isHost = game_getIsHost( game );
|
|
|
|
isHost = isHost && isLocal;
|
|
|
|
cJSON_AddBoolToObject( playerObj, "isHost", isHost );
|
|
|
|
|
|
|
|
cJSON_AddItemToArray( players, playerObj );
|
|
|
|
}
|
|
|
|
cJSON_AddItemToArray( result, players );
|
|
|
|
}
|
2023-11-18 04:39:45 +01:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
on_incoming_signal( GSocketService* XP_UNUSED(service),
|
|
|
|
GSocketConnection* connection,
|
|
|
|
GObject* XP_UNUSED(source_object), gpointer user_data )
|
|
|
|
{
|
|
|
|
XP_LOGFF( "called" );
|
|
|
|
CursesAppGlobals* aGlobals = (CursesAppGlobals*)user_data;
|
|
|
|
LaunchParams* params = aGlobals->cag.params;
|
2024-01-05 05:28:49 +01:00
|
|
|
XP_U32 startTime = dutil_getCurSeconds( params->dutil, NULL_XWE );
|
2023-11-18 04:39:45 +01:00
|
|
|
|
|
|
|
GInputStream* istream = g_io_stream_get_input_stream( G_IO_STREAM(connection) );
|
|
|
|
|
|
|
|
short len;
|
|
|
|
gssize nread = g_input_stream_read( istream, &len, sizeof(len), NULL, NULL );
|
|
|
|
XP_ASSERT( nread == sizeof(len) );
|
|
|
|
len = ntohs(len);
|
|
|
|
|
|
|
|
gchar buf[len+1];
|
|
|
|
nread = g_input_stream_read( istream, buf, len, NULL, NULL );
|
|
|
|
if ( 0 <= nread ) {
|
|
|
|
XP_ASSERT( nread == len );
|
|
|
|
buf[nread] = '\0';
|
2023-12-06 18:11:09 +01:00
|
|
|
XP_LOGFF( "Message: \"%s\"\n", buf );
|
2023-11-18 04:39:45 +01:00
|
|
|
|
|
|
|
cJSON* reply = cJSON_CreateArray();
|
|
|
|
|
|
|
|
cJSON* cmds = cJSON_Parse( buf );
|
|
|
|
XP_LOGFF( "got msg with array of len %d", cJSON_GetArraySize(cmds) );
|
|
|
|
for ( int ii = 0 ; ii < cJSON_GetArraySize(cmds) ; ++ii ) {
|
|
|
|
cJSON* item = cJSON_GetArrayItem( cmds, ii );
|
|
|
|
cJSON* cmd = cJSON_GetObjectItem( item, "cmd" );
|
|
|
|
cJSON* key = cJSON_GetObjectItem( item, "key" );
|
|
|
|
cJSON* args = cJSON_GetObjectItem( item, "args" );
|
|
|
|
const char* cmdStr = cmd->valuestring;
|
|
|
|
|
|
|
|
cJSON* response = NULL;
|
2023-11-30 20:03:27 +01:00
|
|
|
XP_Bool success = XP_TRUE;
|
2023-11-18 04:39:45 +01:00
|
|
|
|
|
|
|
if ( 0 == strcmp( cmdStr, "quit" ) ) {
|
2023-12-06 18:11:09 +01:00
|
|
|
cJSON* gids;
|
|
|
|
if ( getGamesStateForArgs( aGlobals, args, &gids, NULL ) ) {
|
|
|
|
addObjectToObject( &response, "states", gids );
|
|
|
|
}
|
2023-11-18 04:39:45 +01:00
|
|
|
handleQuit( aGlobals, 0 );
|
|
|
|
} else if ( 0 == strcmp( cmdStr, "getMQTTDevID" ) ) {
|
|
|
|
MQTTDevID devID;
|
|
|
|
dvc_getMQTTDevID( params->dutil, NULL_XWE, &devID );
|
|
|
|
char buf[64];
|
|
|
|
formatMQTTDevID( &devID, buf, sizeof(buf) );
|
2023-11-30 20:03:27 +01:00
|
|
|
cJSON* devid = cJSON_CreateString( buf );
|
|
|
|
addObjectToObject( &response, "mqtt", devid );
|
2023-11-18 04:39:45 +01:00
|
|
|
} else if ( 0 == strcmp( cmdStr, "makeGame" ) ) {
|
2023-11-30 20:03:27 +01:00
|
|
|
XP_U32 newGameID = makeGameFromArgs( aGlobals, args );
|
|
|
|
success = 0 != newGameID;
|
|
|
|
if ( success ) {
|
|
|
|
addGIDToObject( &response, newGameID, "newGid" );
|
|
|
|
}
|
2023-11-18 04:39:45 +01:00
|
|
|
} else if ( 0 == strcmp( cmdStr, "invite" ) ) {
|
2023-11-30 20:03:27 +01:00
|
|
|
success = inviteFromArgs( aGlobals, args );
|
2023-11-30 02:11:51 +01:00
|
|
|
} else if ( 0 == strcmp( cmdStr, "moveIf" ) ) {
|
2023-11-30 20:03:27 +01:00
|
|
|
success = moveifFromArgs( aGlobals, args );
|
2023-11-30 02:11:51 +01:00
|
|
|
} else if ( 0 == strcmp( cmdStr, "rematch" ) ) {
|
|
|
|
XP_U32 newGameID = rematchFromArgs( aGlobals, args );
|
2023-11-30 20:03:27 +01:00
|
|
|
success = 0 != newGameID;
|
|
|
|
if ( success ) {
|
|
|
|
addGIDToObject( &response, newGameID, "newGid" );
|
2023-11-30 02:11:51 +01:00
|
|
|
}
|
2023-12-02 23:29:25 +01:00
|
|
|
} else if ( 0 == strcmp( cmdStr, "getStates" ) ) {
|
2023-12-06 18:11:09 +01:00
|
|
|
cJSON* gids;
|
|
|
|
cJSON* orders;
|
|
|
|
success = getGamesStateForArgs( aGlobals, args, &gids, &orders );
|
|
|
|
if ( success ) {
|
|
|
|
addObjectToObject( &response, "states", gids );
|
|
|
|
addObjectToObject( &response, "orders", orders );
|
|
|
|
}
|
|
|
|
} else if ( 0 == strcmp( cmdStr, "getPlayers" ) ) {
|
|
|
|
cJSON* players = getPlayersForArgs( aGlobals, args );
|
|
|
|
addObjectToObject( &response, "players", players );
|
2024-01-23 06:19:13 +01:00
|
|
|
} else if ( 0 == strcmp( cmdStr, "sendChat" ) ) {
|
|
|
|
success = chatFromArgs( aGlobals, args );
|
2023-11-18 04:39:45 +01:00
|
|
|
} else {
|
2023-11-30 20:03:27 +01:00
|
|
|
success = XP_FALSE;
|
2023-11-18 04:39:45 +01:00
|
|
|
XP_ASSERT(0);
|
|
|
|
}
|
|
|
|
|
2023-11-30 20:03:27 +01:00
|
|
|
addSuccessToObject( &response, success );
|
2023-11-18 04:39:45 +01:00
|
|
|
|
2023-11-30 20:03:27 +01:00
|
|
|
cJSON* tmp = cJSON_CreateObject();
|
|
|
|
cJSON_AddStringToObject( tmp, "cmd", cmdStr );
|
|
|
|
cJSON_AddNumberToObject( tmp, "key", key->valueint );
|
|
|
|
cJSON_AddItemToObject( tmp, "response", response );
|
|
|
|
|
|
|
|
/*(void)*/cJSON_AddItemToArray( reply, tmp );
|
2023-11-18 04:39:45 +01:00
|
|
|
}
|
|
|
|
cJSON_Delete( cmds ); /* this apparently takes care of all children */
|
|
|
|
|
|
|
|
char* replyStr = cJSON_PrintUnformatted( reply );
|
|
|
|
short replyStrLen = strlen(replyStr);
|
|
|
|
XP_LOGFF( "len(%s): %d", replyStr, replyStrLen );
|
|
|
|
short replyStrNBOLen = htons(replyStrLen);
|
|
|
|
|
|
|
|
GOutputStream* ostream = g_io_stream_get_output_stream( G_IO_STREAM(connection) );
|
|
|
|
gsize nwritten;
|
|
|
|
gboolean wroteall = g_output_stream_write_all( ostream, &replyStrNBOLen, sizeof(replyStrNBOLen),
|
|
|
|
&nwritten, NULL, NULL );
|
|
|
|
XP_ASSERT( wroteall && nwritten == sizeof(replyStrNBOLen) );
|
|
|
|
wroteall = g_output_stream_write_all( ostream, replyStr, replyStrLen, &nwritten, NULL, NULL );
|
|
|
|
XP_ASSERT( wroteall && nwritten == replyStrLen );
|
|
|
|
GError* error = NULL;
|
|
|
|
g_output_stream_close( ostream, NULL, &error );
|
|
|
|
if ( !!error ) {
|
|
|
|
XP_LOGFF( "g_output_stream_close()=>%s", error->message );
|
|
|
|
g_error_free( error );
|
|
|
|
}
|
|
|
|
cJSON_Delete( reply );
|
|
|
|
free( replyStr );
|
|
|
|
}
|
|
|
|
|
2024-01-05 05:28:49 +01:00
|
|
|
XP_U32 consumed = dutil_getCurSeconds( params->dutil, NULL_XWE ) - startTime;
|
|
|
|
if ( 0 < consumed ) {
|
|
|
|
XP_LOGFF( "took %d seconds", consumed );
|
|
|
|
}
|
2023-11-18 04:39:45 +01:00
|
|
|
LOG_RETURN_VOID();
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GSocketService*
|
|
|
|
addCmdListener( CursesAppGlobals* aGlobals )
|
|
|
|
{
|
|
|
|
LOG_FUNC();
|
|
|
|
LaunchParams* params = aGlobals->cag.params;
|
|
|
|
const XP_UCHAR* cmdsSocket = params->cmdsSocket;
|
|
|
|
GSocketService* service = NULL;
|
|
|
|
if ( !!cmdsSocket ) {
|
|
|
|
service = g_socket_service_new();
|
|
|
|
|
|
|
|
struct sockaddr_un addr = {0};
|
|
|
|
addr.sun_family = AF_UNIX;
|
|
|
|
strncpy( addr.sun_path, cmdsSocket, sizeof(addr.sun_path) - 1);
|
|
|
|
GSocketAddress* gsaddr
|
|
|
|
= g_socket_address_new_from_native (&addr, sizeof(addr) );
|
|
|
|
GError* error = NULL;
|
|
|
|
if ( g_socket_listener_add_address( (GSocketListener*)service, gsaddr, G_SOCKET_TYPE_STREAM,
|
|
|
|
G_SOCKET_PROTOCOL_DEFAULT, NULL, NULL, &error ) ) {
|
|
|
|
} else {
|
|
|
|
XP_LOGFF( "g_socket_listener_add_address() failed: %s", error->message );
|
|
|
|
}
|
|
|
|
g_object_unref( gsaddr );
|
|
|
|
|
|
|
|
g_signal_connect( service, "incoming", G_CALLBACK(on_incoming_signal), aGlobals );
|
|
|
|
}
|
|
|
|
LOG_RETURNF( "%p", service );
|
|
|
|
return service;
|
|
|
|
}
|
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
void
|
2020-01-24 18:05:16 +01:00
|
|
|
cursesmain( XP_Bool XP_UNUSED(isServer), LaunchParams* params )
|
2003-11-01 06:35:29 +01:00
|
|
|
{
|
2008-02-02 17:56:20 +01:00
|
|
|
memset( &g_globals, 0, sizeof(g_globals) );
|
2020-01-24 18:05:16 +01:00
|
|
|
g_globals.cag.params = params;
|
2020-05-20 22:58:53 +02:00
|
|
|
params->appGlobals = &g_globals;
|
2020-01-24 18:05:16 +01:00
|
|
|
|
2023-08-14 17:10:29 +02:00
|
|
|
params->cmdProcs.quit = invokeQuit;
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
initCurses( &g_globals );
|
|
|
|
if ( !params->closeStdin ) {
|
|
|
|
g_globals.menuState = cmenu_init( g_globals.mainWin );
|
|
|
|
cmenu_push( g_globals.menuState, &g_globals, g_sharedMenuList, NULL );
|
|
|
|
}
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2011-08-30 05:24:15 +02:00
|
|
|
g_globals.loop = g_main_loop_new( NULL, FALSE );
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
g_globals.cbState = cb_init( &g_globals, params, g_globals.menuState,
|
|
|
|
onGameSaved );
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-31 22:29:36 +01:00
|
|
|
g_globals.gameList = cgl_init( params, g_globals.winWidth, params->cursesListWinHt );
|
2020-01-24 18:05:16 +01:00
|
|
|
cgl_refresh( g_globals.gameList );
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2023-11-18 04:39:45 +01:00
|
|
|
GSocketService* cmdService = addCmdListener( &g_globals );
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
// g_globals.amServer = isServer;
|
|
|
|
/* g_globals.cGlobals.params = params; */
|
|
|
|
/* #ifdef XWFEATURE_RELAY */
|
|
|
|
/* g_globals.cGlobals.relaySocket = -1; */
|
|
|
|
/* #endif */
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* g_globals.cGlobals.socketAdded = curses_socket_added; */
|
|
|
|
/* g_globals.cGlobals.socketAddedClosure = &g_globals; */
|
|
|
|
/* g_globals.cGlobals.onSave = curses_onGameSaved; */
|
|
|
|
/* g_globals.cGlobals.onSaveClosure = &g_globals; */
|
|
|
|
|
|
|
|
/* g_globals.cGlobals.addAcceptor = curses_socket_acceptor; */
|
|
|
|
|
|
|
|
/* g_globals.cGlobals.cp.showBoardArrow = XP_TRUE; */
|
|
|
|
/* g_globals.cGlobals.cp.showRobotScores = params->showRobotScores; */
|
|
|
|
/* g_globals.cGlobals.cp.hideTileValues = params->hideValues; */
|
|
|
|
/* g_globals.cGlobals.cp.skipCommitConfirm = params->skipCommitConfirm; */
|
|
|
|
/* g_globals.cGlobals.cp.sortNewTiles = params->sortNewTiles; */
|
|
|
|
/* g_globals.cGlobals.cp.showColors = params->showColors; */
|
|
|
|
/* g_globals.cGlobals.cp.allowPeek = params->allowPeek; */
|
|
|
|
/* #ifdef XWFEATURE_SLOW_ROBOT */
|
|
|
|
/* g_globals.cGlobals.cp.robotThinkMin = params->robotThinkMin; */
|
|
|
|
/* g_globals.cGlobals.cp.robotThinkMax = params->robotThinkMax; */
|
|
|
|
/* g_globals.cGlobals.cp.robotTradePct = params->robotTradePct; */
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
/* g_globals.cGlobals.gi = ¶ms->pgi; */
|
|
|
|
/* setupUtil( &g_globals.cGlobals ); */
|
|
|
|
/* setupCursesUtilCallbacks( &g_globals, g_globals.cGlobals.util ); */
|
|
|
|
|
|
|
|
// initFromParams( &g_globals.cGlobals, params );
|
2013-01-08 05:40:46 +01:00
|
|
|
|
2006-10-10 03:34:37 +02:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2020-01-24 18:05:16 +01:00
|
|
|
/* if ( addr_hasType( ¶ms->addr, COMMS_CONN_RELAY ) ) { */
|
|
|
|
/* g_globals.cGlobals.defaultServerName */
|
|
|
|
/* = params->connInfo.relay.relayName; */
|
|
|
|
/* } */
|
2006-10-10 03:34:37 +02:00
|
|
|
#endif
|
2011-08-30 05:24:15 +02:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
/* if ( !params->closeStdin ) { */
|
|
|
|
/* cursesListenOnSocket( &g_globals, 0, handle_stdin ); */
|
|
|
|
/* } */
|
|
|
|
/* setOneSecondTimer( &g_globals.cGlobals ); */
|
2013-01-22 03:57:48 +01:00
|
|
|
|
2013-05-28 01:18:11 +02:00
|
|
|
# ifdef DEBUG
|
|
|
|
int piperesult =
|
|
|
|
# endif
|
|
|
|
pipe( g_globals.quitpipe );
|
2013-05-25 06:19:20 +02:00
|
|
|
XP_ASSERT( piperesult == 0 );
|
2020-01-24 18:05:16 +01:00
|
|
|
ADD_SOCKET( &g_globals, g_globals.quitpipe[0], handle_quitwrite );
|
2009-07-29 06:29:29 +02:00
|
|
|
|
2020-01-31 21:29:45 +01:00
|
|
|
pipe( g_globals.winchpipe );
|
|
|
|
ADD_SOCKET( &g_globals, g_globals.winchpipe[0], handle_winchwrite );
|
|
|
|
|
2009-08-30 17:23:05 +02:00
|
|
|
struct sigaction act = { .sa_handler = SIGINTTERM_handler };
|
2009-07-29 06:29:29 +02:00
|
|
|
sigaction( SIGINT, &act, NULL );
|
2009-08-30 17:23:05 +02:00
|
|
|
sigaction( SIGTERM, &act, NULL );
|
2009-07-29 06:29:29 +02:00
|
|
|
struct sigaction act2 = { .sa_handler = SIGWINCH_handler };
|
|
|
|
sigaction( SIGWINCH, &act2, NULL );
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2022-04-28 16:37:33 +02:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2020-01-24 18:05:16 +01:00
|
|
|
if ( params->useUdp ) {
|
|
|
|
RelayConnProcs procs = {
|
2020-01-31 22:29:36 +01:00
|
|
|
.inviteReceived = relayInviteReceivedCurses,
|
2020-01-24 18:05:16 +01:00
|
|
|
.msgReceived = cursesGotBuf,
|
|
|
|
.msgForRow = cursesGotForRow,
|
|
|
|
.msgNoticeReceived = cursesNoticeRcvd,
|
|
|
|
.devIDReceived = cursesDevIDReceived,
|
|
|
|
.msgErrorMsg = cursesErrorMsgRcvd,
|
|
|
|
};
|
|
|
|
|
|
|
|
relaycon_init( params, &procs, &g_globals,
|
|
|
|
params->connInfo.relay.relayName,
|
|
|
|
params->connInfo.relay.defaultSendPort );
|
|
|
|
|
|
|
|
XP_Bool idIsNew = linux_setupDevidParams( params );
|
|
|
|
linux_doInitialReg( params, idIsNew );
|
2011-01-25 07:20:47 +01:00
|
|
|
}
|
2022-04-28 16:37:33 +02:00
|
|
|
#endif
|
2020-05-20 22:58:53 +02:00
|
|
|
mqttc_init( params );
|
|
|
|
|
2020-01-29 19:59:57 +01:00
|
|
|
#ifdef XWFEATURE_SMS
|
|
|
|
gchar* myPhone = NULL;
|
|
|
|
XP_U16 myPort = 0;
|
|
|
|
if ( parseSMSParams( params, &myPhone, &myPort ) ) {
|
|
|
|
SMSProcs smsProcs = {
|
|
|
|
.inviteReceived = smsInviteReceivedCurses,
|
|
|
|
.msgReceived = smsMsgReceivedCurses,
|
|
|
|
};
|
|
|
|
linux_sms_init( params, myPhone, myPort, &smsProcs, &g_globals );
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
if ( 0 == cgl_getNGames( g_globals.gameList ) ) {
|
2020-02-13 06:40:42 +01:00
|
|
|
if ( params->forceNewGame ) {
|
|
|
|
handleNewGame( &g_globals, 0 );
|
|
|
|
}
|
2020-02-08 08:11:20 +01:00
|
|
|
} else {
|
2023-11-18 04:39:45 +01:00
|
|
|
/* Always open a game (at random). Without that it won't attempt to
|
|
|
|
connect and stalls are likely in the test script case at least. If
|
|
|
|
that's annoying when running manually add a launch flag */
|
|
|
|
cgl_setSel( g_globals.gameList, -1 );
|
2020-02-08 08:11:20 +01:00
|
|
|
handleOpenGame( &g_globals, 0 );
|
2013-01-20 07:53:25 +01:00
|
|
|
}
|
2010-09-20 13:55:35 +02:00
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
g_main_loop_run( g_globals.loop );
|
|
|
|
|
2023-11-18 04:39:45 +01:00
|
|
|
g_object_unref( cmdService );
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
cb_closeAll( g_globals.cbState );
|
2003-11-01 06:35:29 +01:00
|
|
|
|
2009-01-13 14:33:56 +01:00
|
|
|
#ifdef XWFEATURE_BLUETOOTH
|
2020-01-24 18:05:16 +01:00
|
|
|
// linux_bt_close( &g_globals.cGlobals );
|
2009-01-13 14:33:56 +01:00
|
|
|
#endif
|
|
|
|
#ifdef XWFEATURE_SMS
|
2013-12-13 06:08:25 +01:00
|
|
|
// linux_sms_close( &g_globals.cGlobals );
|
2009-01-13 14:33:56 +01:00
|
|
|
#endif
|
|
|
|
#ifdef XWFEATURE_IP_DIRECT
|
2020-01-24 18:05:16 +01:00
|
|
|
// linux_udp_close( &g_globals.cGlobals );
|
2009-01-13 14:33:56 +01:00
|
|
|
#endif
|
|
|
|
|
2020-01-24 18:05:16 +01:00
|
|
|
cgl_destroy( g_globals.gameList );
|
|
|
|
|
2003-11-01 06:35:29 +01:00
|
|
|
endwin();
|
2013-01-08 05:40:46 +01:00
|
|
|
|
2020-05-20 22:58:53 +02:00
|
|
|
dvc_store( params->dutil, NULL_XWE );
|
2020-01-08 19:19:01 +01:00
|
|
|
|
2022-09-08 18:57:11 +02:00
|
|
|
#ifdef XWFEATURE_RELAY
|
2020-01-24 18:05:16 +01:00
|
|
|
if ( params->useUdp ) {
|
|
|
|
relaycon_cleanup( params );
|
2013-01-24 17:08:53 +01:00
|
|
|
}
|
2022-09-08 18:57:11 +02:00
|
|
|
#endif
|
2013-01-24 17:08:53 +01:00
|
|
|
|
2014-11-05 16:41:20 +01:00
|
|
|
linux_sms_cleanup( params );
|
2020-05-20 22:58:53 +02:00
|
|
|
mqttc_cleanup( params );
|
2003-11-01 06:35:29 +01:00
|
|
|
} /* cursesmain */
|
|
|
|
#endif /* PLATFORM_NCURSES */
|