Skip to content
Permalink
Browse files

Fix trying to load a map in 'load level' menu that doesn't actually e…

…xist on disc anymore doing nothing. Now it logs a 'file not found' error in chat.
  • Loading branch information
UnknownShadow200 committed Dec 29, 2019
1 parent 5300b8f commit 143292324081238cd2558ec1fd1a70600332f4a1
Showing with 7 additions and 9 deletions.
  1. +7 −9 src/Menus.c
@@ -1470,14 +1470,14 @@ void SaveLevelScreen_Show(void) {
static void TexturePackScreen_EntryClick(void* screen, void* widget) {
String path; char pathBuffer[FILENAME_SIZE];
struct ListScreen* s = (struct ListScreen*)screen;
String filename;
String relPath;

filename = ListScreen_UNSAFE_GetCur(s, widget);
relPath = ListScreen_UNSAFE_GetCur(s, widget);
String_InitArray(path, pathBuffer);
String_Format1(&path, "texpacks/%s", &filename);
String_Format1(&path, "texpacks/%s", &relPath);
if (!File_Exists(&path)) return;

Game_SetDefaultTexturePack(&filename);
Game_SetDefaultTexturePack(&relPath);
World_TextureUrl.length = 0;
TexturePack_ExtractCurrent(true);
}
@@ -1638,13 +1638,11 @@ void HotkeyListScreen_Show(void) {
static void LoadLevelScreen_EntryClick(void* screen, void* widget) {
String path; char pathBuffer[FILENAME_SIZE];
struct ListScreen* s = (struct ListScreen*)screen;
String filename;
String relPath;

filename = ListScreen_UNSAFE_GetCur(s, widget);
relPath = ListScreen_UNSAFE_GetCur(s, widget);
String_InitArray(path, pathBuffer);
String_Format1(&path, "maps/%s", &filename);

if (!File_Exists(&path)) return;
String_Format1(&path, "maps/%s", &relPath);
Map_LoadFrom(&path);
}

0 comments on commit 1432923

Please sign in to comment.
You can’t perform that action at this time.