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.
This commit is contained in:
nhmall
2018-09-17 15:46:47 -04:00
parent 89237fc96d
commit 7123812327

View File

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