diff --git a/xwords4/common/game.c b/xwords4/common/game.c index e4e004867..4f56b6b1c 100644 --- a/xwords4/common/game.c +++ b/xwords4/common/game.c @@ -444,6 +444,21 @@ gi_copy( MPFORMAL CurGameInfo* destGI, const CurGameInfo* srcGI ) } } /* gi_copy */ +void +gi_setNPlayers( CurGameInfo* gi, XP_U16 nTotal, XP_U16 nHere ) +{ + assert( nTotal < MAX_NUM_PLAYERS ); + assert( nHere < nTotal ); + + gi->nPlayers = nTotal; + + XP_U16 ii; + for ( ii = 0; ii < nTotal; ++ii ) { + gi->players[ii].isLocal = ii < nHere; + XP_ASSERT( !LP_IS_ROBOT(&gi->players[ii]) ); + } +} + XP_U16 gi_countLocalPlayers( const CurGameInfo* gi, XP_Bool humanOnly ) { diff --git a/xwords4/common/game.h b/xwords4/common/game.h index 882a60e2f..7b2c44d2c 100644 --- a/xwords4/common/game.h +++ b/xwords4/common/game.h @@ -83,6 +83,7 @@ void game_getState( const XWGame* game, GameStateInfo* gsi ); void gi_initPlayerInfo( MPFORMAL CurGameInfo* gi, const XP_UCHAR* nameTemplate ); +void gi_setNPlayers( CurGameInfo* gi, XP_U16 nTotal, XP_U16 nHere ); void gi_disposePlayerInfo( MPFORMAL CurGameInfo* gi ); void gi_writeToStream( XWStreamCtxt* stream, const CurGameInfo* gi ); void gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi );