Warn when unable to open a saved game (generally when an older version

of the app tries to open game saved by newer version.)
This commit is contained in:
ehouse 2008-12-11 13:48:59 +00:00
parent 6c9c013f1a
commit d0222385fb
3 changed files with 20 additions and 9 deletions

View file

@ -1115,8 +1115,8 @@ ceLoadSavedGame( CEAppGlobals* globals )
snprintf( buf, VSIZE(buf), "Unable to open dictionary: %s",
dictName );
buf[VSIZE(buf)-1] = '\0';
ceMessageBoxChar( globals, NULL, buf, L"Oops!",
MB_OK | MB_ICONHAND );
ceOops( globals, NULL, buf );
}
XP_FREE( globals->mpool, dictName );
#endif
@ -1138,8 +1138,11 @@ ceLoadSavedGame( CEAppGlobals* globals )
CE_RESET_PROC globals );
if ( success ) {
ceSetTitleFromName( globals );
} else if ( !!dict ) {
dict_destroy( dict );
} else {
if ( !!dict ) {
dict_destroy( dict );
}
ceOops( globals, NULL, "Saved game cannot be opened." );
}
}
@ -2970,7 +2973,7 @@ ce_util_userError( XW_UtilCtxt* uc, UtilErrID id )
break;
}
ceMessageBoxChar( globals, NULL, message, L"Oops!", MB_OK | MB_ICONHAND );
ceOops( globals, NULL, message );
} /* ce_util_userError */
static XP_Bool

View file

@ -872,8 +872,8 @@ ceGetPath( CEAppGlobals* globals, CePathType typ,
} /* ceGetPath */
int
ceMessageBoxChar( CEAppGlobals* globals, HWND parent, XP_UCHAR* str,
wchar_t* title, XP_U16 buttons )
ceMessageBoxChar( CEAppGlobals* globals, HWND parent, const XP_UCHAR* str,
const wchar_t* title, XP_U16 buttons )
{
/* Get the length required, then alloc and go. This is technically
correct, but everywhere else I assume a 2:1 ratio for wchar_t:char. */
@ -889,3 +889,10 @@ ceMessageBoxChar( CEAppGlobals* globals, HWND parent, XP_UCHAR* str,
}
return MessageBox( parent, widebuf, title, buttons );
} /* ceMessageBoxChar */
int
ceOops( CEAppGlobals* globals, HWND parent, const XP_UCHAR* str )
{
return ceMessageBoxChar( globals, parent, str, L"Oops!",
MB_OK | MB_ICONHAND );
}

View file

@ -47,8 +47,9 @@ void ceCheckMenus( const CEAppGlobals* globals );
void ceGetItemRect( HWND hDlg, XP_U16 resID, RECT* rect );
void ceMoveItem( HWND hDlg, XP_U16 resID, XP_S16 byX, XP_S16 byY );
int ceMessageBoxChar( CEAppGlobals* globals, HWND parent, XP_UCHAR* str,
wchar_t* title, XP_U16 buttons );
int ceMessageBoxChar( CEAppGlobals* globals, HWND parent, const XP_UCHAR* str,
const wchar_t* title, XP_U16 buttons );
int ceOops( CEAppGlobals* globals, HWND parent, const XP_UCHAR* str );
typedef enum {
PREFS_FILE_PATH_L