Skip to content

Commit

Permalink
Fix trying to load a map in 'load level' menu that doesn't actually e…
Browse files Browse the repository at this point in the history
…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 1432923
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Menus.c
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 1432923

Please sign in to comment.