xwords/xwords4/linux/cursesboard.h
Eric House 1181e908dc Add option to choose how rematch-game players will be ordered
When rematching, some users have a convention that e.g. lowest scoring
player in the "parent" game goes first. So allow that, providing the
choice on each rematch until a default has been chosen. Support
changing that default in a new prefs setting.

The place I chose to enforce the order was on the host as invitees are
registering and being assigned slots. But by then there's no longer
any connection to the game that was rematched, e.g. to use its
scores. So during the rematched game creation process I create and
store with the new game the necessary ordering information. For the
3-and-4 device case, it was also necessary to tweak the information
about other guests that the host sends guests (added during earlier
work on rematching.)
2024-01-04 09:50:24 -08:00

64 lines
2.5 KiB
C

/* -*- compile-command: "make MEMDEBUG=TRUE -j3"; -*- */
/*
* Copyright 2000 - 2020 by Eric House (xwords@eehouse.org). All rights
* reserved.
*
* 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.
*/
#ifndef _CURSESBOARD_H_
#define _CURSESBOARD_H_
#include "cursesmain.h"
#include "nli.h"
typedef struct CursesAppGlobals CursesAppGlobals;
typedef struct CursesBoardState CursesBoardState;
typedef void (*OnGameSaved)( CursesAppGlobals* aGlobals, sqlite3_int64 rowid, bool isNew );
typedef struct _cb_dims {
int width;
int top;
int height;
} cb_dims;
CursesBoardState* cb_init( CursesAppGlobals* aGlobals, LaunchParams* params,
CursesMenuState* menuState, OnGameSaved onGameSaved );
void cb_resized( CursesBoardState* cbState, const cb_dims* dims );
void cb_open( CursesBoardState* cbState, sqlite3_int64 rowid, const cb_dims* dims );
bool cb_new( CursesBoardState* cbState, const cb_dims* dims,
const CurGameInfo* gi /* optional: use from globals if unset */,
XP_U32* newGameIDP );
void cb_newFor( CursesBoardState* cbState, const NetLaunchInfo* nli,
const cb_dims* dims );
bool cb_feedRow( CursesBoardState* cbState, sqlite3_int64 rowid,
XP_U16 expectSeed, const XP_U8* buf, XP_U16 len,
const CommsAddrRec* from );
void cb_feedGame( CursesBoardState* cbState, XP_U32 gameID,
const XP_U8* buf, XP_U16 len, const CommsAddrRec* from );
void cb_addInvite( CursesBoardState* cbState, XP_U32 gameID, XP_U16 forceChannel,
const CommsAddrRec* destAddr );
XP_Bool cb_makeRematch( CursesBoardState* cbState, XP_U32 gameID,
RematchOrder ro, XP_U32* newGameID );
XP_Bool cb_makeMoveIf( CursesBoardState* cbState, XP_U32 gameID );
const CommonGlobals* cb_getForGameID( CursesBoardState* cbState, XP_U32 gameID );
void cb_closeAll( CursesBoardState* cbState );
#endif