diff --git a/common/game.c b/common/game.c index 1ca1f84cf..4ebe71e82 100644 --- a/common/game.c +++ b/common/game.c @@ -313,6 +313,19 @@ gi_copy( MPFORMAL CurGameInfo* destGI, CurGameInfo* srcGI ) } } /* gi_copy */ +XP_U16 +gi_countHumans( CurGameInfo* gi ) +{ + XP_U16 count = 0; + XP_U16 nPlayers = gi->nPlayers; + while ( nPlayers-- ) { + if ( !gi->players[nPlayers].isRobot ) { + ++count; + } + } + return count; +} /* gi_countHumans */ + void gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi ) { diff --git a/common/game.h b/common/game.h index b9173f327..9ba043932 100644 --- a/common/game.h +++ b/common/game.h @@ -91,6 +91,7 @@ void gi_disposePlayerInfo( MPFORMAL CurGameInfo* gi ); void gi_writeToStream( XWStreamCtxt* stream, CurGameInfo* gi ); void gi_readFromStream( MPFORMAL XWStreamCtxt* stream, CurGameInfo* gi ); void gi_copy( MPFORMAL CurGameInfo* destGI, CurGameInfo* srcGi ); +XP_U16 gi_countHumans( CurGameInfo* gi ); XP_Bool player_hasPasswd( LocalPlayer* player ); XP_Bool player_passwordMatches( LocalPlayer* player, XP_U8* buf, XP_U16 len );