diff --git a/data/language/en-GB.txt b/data/language/en-GB.txt index cb5321ff36..dd0a94c1fb 100644 --- a/data/language/en-GB.txt +++ b/data/language/en-GB.txt @@ -4362,6 +4362,7 @@ STR_6050 :Error reading bitmap STR_6051 :The width and height need to match STR_6052 :The heightmap is too big, and will be cut off STR_6053 :The heightmap cannot be normalized +STR_6054 :Only 24-bit bitmaps are supported ############# # Scenarios # diff --git a/src/openrct2/localisation/string_ids.h b/src/openrct2/localisation/string_ids.h index 146b9d88b2..17be5b2e6b 100644 --- a/src/openrct2/localisation/string_ids.h +++ b/src/openrct2/localisation/string_ids.h @@ -3712,6 +3712,7 @@ enum { STR_ERROR_WIDTH_AND_HEIGHT_DO_NOT_MATCH = 6051, STR_ERROR_HEIHGT_MAP_TOO_BIG = 6052, STR_ERROR_CANNOT_NORMALIZE = 6053, + STR_ERROR_24_BIT_BITMAP = 6054, // Have to include resource strings (from scenarios and objects) for the time being now that language is partially working STR_COUNT = 32768 diff --git a/src/openrct2/world/mapgen.c b/src/openrct2/world/mapgen.c index a1f44eefa3..833326768c 100644 --- a/src/openrct2/world/mapgen.c +++ b/src/openrct2/world/mapgen.c @@ -816,6 +816,13 @@ bool mapgen_load_heightmap(const utf8 *path) numChannels = bitmap->format->BytesPerPixel; pitch = bitmap->pitch; + if (numChannels < 3 || bitmap->format->BitsPerPixel < 24) + { + window_error_open(STR_HEIGHT_MAP_ERROR, STR_ERROR_24_BIT_BITMAP); + SDL_FreeSurface(bitmap); + return false; + } + // Copy pixels over, then discard the surface SDL_LockSurface(bitmap); pixels = malloc(height * bitmap->pitch);