Menus: Open the User Map menu to a folder named "usermaps" if one exists.

git-svn-id: https://svn.eduke32.com/eduke32@7999 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2019-08-14 09:02:12 +00:00 committed by Christoph Oelckers
parent 345497b271
commit 00992a7ba5
2 changed files with 13 additions and 3 deletions

View file

@ -1448,9 +1448,9 @@ static MenuTextForm_t M_CHEATENTRY = { NULL, "Enter Cheat Code:", MAXCHEATLEN, 0
static MenuTextForm_t M_CHEAT_WARP = { NULL, "Enter Warp #:", 3, 0 }; static MenuTextForm_t M_CHEAT_WARP = { NULL, "Enter Warp #:", 3, 0 };
static MenuTextForm_t M_CHEAT_SKILL = { NULL, "Enter Skill #:", 1, 0 }; static MenuTextForm_t M_CHEAT_SKILL = { NULL, "Enter Skill #:", 1, 0 };
#define MAKE_MENUFILESELECT(a, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 } #define MAKE_MENUFILESELECT(a, dir, b, c) { a, { &MMF_FileSelectLeft, &MMF_FileSelectRight }, { &MF_Minifont, &MF_Minifont }, dir, b, c, { NULL, NULL }, { 0, 0 }, { 3<<16, 3<<16 }, FNLIST_INITIALIZER, 0 }
static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "*.map", boardfilename ); static MenuFileSelect_t M_USERMAP = MAKE_MENUFILESELECT( "Select A User Map", "./usermaps/", "*.map", boardfilename );
// MUST be in ascending order of MenuID enum values due to binary search // MUST be in ascending order of MenuID enum values due to binary search
static Menu_t Menus[] = { static Menu_t Menus[] = {
@ -3952,7 +3952,16 @@ static void Menu_FileSelectInit(MenuFileSelect_t *object)
fnlist_clearnames(&object->fnlist); fnlist_clearnames(&object->fnlist);
if (object->destination[0] == 0) if (object->destination[0] == 0)
{
BDIR * usermaps = Bopendir(object->startdir);
if (usermaps)
{
Bclosedir(usermaps);
Bstrcpy(object->destination, object->startdir);
}
else
Bstrcpy(object->destination, "./"); Bstrcpy(object->destination, "./");
}
Bcorrectfilename(object->destination, 1); Bcorrectfilename(object->destination, 1);
fnlist_getnames(&object->fnlist, object->destination, object->pattern, 0, 0); fnlist_getnames(&object->fnlist, object->destination, object->pattern, 0, 0);

View file

@ -421,6 +421,7 @@ typedef struct MenuFileSelect_t
MenuFont_t *font[2]; MenuFont_t *font[2];
// traits // traits
const char * startdir;
const char *pattern; const char *pattern;
char *destination; char *destination;