add gi_setNPlayers()

This commit is contained in:
Eric House 2013-12-17 21:54:02 -08:00
parent de41802f54
commit 2a47c91a91
2 changed files with 16 additions and 0 deletions

View file

@ -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 )
{

View file

@ -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 );