Show better error message when not enough memory to load a level

This commit is contained in:
UnknownShadow200 2024-04-06 14:05:57 +11:00
parent 4ee1775ccb
commit 01c872f333
2 changed files with 8 additions and 6 deletions

View File

@ -652,8 +652,8 @@ static void OnInit(void) {
// Tile the texture to fill the entire screen
int tilesX = (320 + ctx.width - 1) / ctx.width;
int tilesY = (240 + ctx.height - 1) / ctx.height;
touchBgTex.Width *= tilesX; touchBgTex.Height *= tilesY;
touchBgTex.uv.U2 *= tilesX; touchBgTex.uv.V2 *= tilesY;
touchBgTex.width *= tilesX; touchBgTex.height *= tilesY;
touchBgTex.uv.u2 *= tilesX; touchBgTex.uv.v2 *= tilesY;
#endif
Event_Register_(&ChatEvents.FontChanged, NULL, OnFontChanged);
@ -691,4 +691,4 @@ struct IGameComponent Gui_Component = {
OnReset, /* Reset */
NULL, /* OnNewMap */
NULL, /* OnNewMapLoaded */
};
};

View File

@ -612,11 +612,13 @@ static void Classic_LevelFinalise(cc_uint8* data) {
length = Stream_GetU16_BE(data + 4);
volume = width * height * length;
if (!map1.blocks) {
if (map1.allocFailed) {
Chat_AddRaw("&cFailed to load map, try joining a different map");
Chat_AddRaw(" &cNot enough free memory to load the map");
} else if (!map1.blocks) {
Chat_AddRaw("&cFailed to load map, try joining a different map");
Chat_AddRaw(" &cAttempted to load map without a Blocks array");
}
if (map_volume != volume) {
} else if (map_volume != volume) {
Chat_AddRaw("&cFailed to load map, try joining a different map");
Chat_Add2( " &cBlocks array size (%i) does not match volume of map (%i)", &map_volume, &volume);
FreeMapStates();