Provide default player names in game info dialog rather than when

creating the very first game to fix bug where creating a game with n+m
players from a saved game with n yields m blank default names.
This commit is contained in:
ehouse 2008-12-12 13:42:52 +00:00
parent 59cd2a83d1
commit 9e7bfe0ff7
2 changed files with 8 additions and 4 deletions

View file

@ -462,14 +462,18 @@ ceSetColProc( void* closure, XP_U16 player, NewGameColumn col,
GameInfoState* giState = (GameInfoState*)closure;
XP_U16 resID = resIDForCol( player, col );
const XP_UCHAR* cp;
XP_UCHAR buf[16];
switch( col ) {
case NG_COL_PASSWD:
case NG_COL_NAME:
if ( NULL == value.ng_cp ) {
cp = "";
} else {
if ( NULL != value.ng_cp ) {
cp = value.ng_cp;
} else if ( col == NG_COL_NAME ) {
cp = buf;
snprintf( cp, sizeof(buf), "Player %d", player + 1 );
} else {
cp = "";
}
ceSetDlgItemText( giState->dlgHdr.hDlg, resID, cp );
break;

View file

@ -1349,7 +1349,7 @@ InitInstance(HINSTANCE hInstance, int nCmdShow
ceInitUtilFuncs( globals );
gi_initPlayerInfo( MPPARM(mpool) &globals->gameInfo, "Player %d" );
gi_initPlayerInfo( MPPARM(mpool) &globals->gameInfo, NULL );
/* choose one. If none found it's an error. */
#ifndef STUBBED_DICT