From 712381232727c00211828c4def939d092643ddc3 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 17 Sep 2018 15:46:47 -0400 Subject: [PATCH] try to coax an error code for display on tile_file failure If the underlying error is that Windows LoadImage() just wasn't happy with the format of the image file, you'll just get a 0x0 result, which won't help much. If, however, it shows a 0x2 result that means it couldn't find the file to load it. --- win/win32/mswproc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/win/win32/mswproc.c b/win/win32/mswproc.c index ce9b14d5f..3512f2627 100644 --- a/win/win32/mswproc.c +++ b/win/win32/mswproc.c @@ -2118,6 +2118,7 @@ initMapTiles(void) HBITMAP hBmp; BITMAP bm; TCHAR wbuf[MAX_PATH]; + DWORD errcode; int tl_num; SIZE map_size; extern int total_tiles_used; @@ -2131,8 +2132,13 @@ initMapTiles(void) NH_A2W(iflags.wc_tile_file, wbuf, MAX_PATH), IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE); if (hBmp == NULL) { - raw_print( - "Cannot load tiles from the file. Reverting back to default."); + char errmsg[BUFSZ]; + + errcode = GetLastError(); + Sprintf(errmsg, "%s (0x%x).", + "Cannot load tiles from the file. Reverting back to default", + errcode); + raw_print(errmsg); return FALSE; }