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:
+8
-2
@@ -2118,6 +2118,7 @@ initMapTiles(void)
|
|||||||
HBITMAP hBmp;
|
HBITMAP hBmp;
|
||||||
BITMAP bm;
|
BITMAP bm;
|
||||||
TCHAR wbuf[MAX_PATH];
|
TCHAR wbuf[MAX_PATH];
|
||||||
|
DWORD errcode;
|
||||||
int tl_num;
|
int tl_num;
|
||||||
SIZE map_size;
|
SIZE map_size;
|
||||||
extern int total_tiles_used;
|
extern int total_tiles_used;
|
||||||
@@ -2131,8 +2132,13 @@ initMapTiles(void)
|
|||||||
NH_A2W(iflags.wc_tile_file, wbuf, MAX_PATH),
|
NH_A2W(iflags.wc_tile_file, wbuf, MAX_PATH),
|
||||||
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
|
IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_DEFAULTSIZE);
|
||||||
if (hBmp == NULL) {
|
if (hBmp == NULL) {
|
||||||
raw_print(
|
char errmsg[BUFSZ];
|
||||||
"Cannot load tiles from the file. Reverting back to default.");
|
|
||||||
|
errcode = GetLastError();
|
||||||
|
Sprintf(errmsg, "%s (0x%x).",
|
||||||
|
"Cannot load tiles from the file. Reverting back to default",
|
||||||
|
errcode);
|
||||||
|
raw_print(errmsg);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user