restore_menu (trunk only)

Move the code to use a nethack menu for restoring a saved game.  It
was inline in tty_askname() but is now a separate routine, restore_menu()
in restore.c.  There was no port-specific code and only a small amount of
tty-specific code; it should be useable by anyone (but Qt doesn't have to
switch over if it doesn't want to).

     The original behaved strangely if there were exactly 26 saved chars;
the "start new game" menu entry ended up using "{" as selection character.
There wasn't any comparable problem at 52; it was limiting the menu to 51
games.  Now it will allow 52 (with "start a new game" bumped into "#" if
there are that many), and adds an explicit quit entry (unless there are
52 or more games so that # is already used by new-game, then quit remains
implicit rather than resort to some other none-of-the-above character).
This commit is contained in:
nethack.rankin
2006-12-12 04:52:39 +00:00
parent 176a59bb0a
commit 0db19f1c96
4 changed files with 113 additions and 61 deletions

View File

@@ -679,7 +679,6 @@ E char *FDECL(fname_encode, (const char *, CHAR_P, char *, char *, int));
E char *FDECL(fname_decode, (CHAR_P, char *, char *, int));
E const char *FDECL(fqname, (const char *, int, int));
E FILE *FDECL(fopen_datafile, (const char *,const char *,int));
E void FDECL(store_version, (int));
#ifdef MFLOPPY
E void NDECL(set_lock_and_bones);
#endif
@@ -1859,6 +1858,9 @@ E int FDECL(dorecover, (int));
E void FDECL(trickery, (char *));
E void FDECL(getlev, (int,int,XCHAR_P,BOOLEAN_P));
E void FDECL(get_plname_from_file, (int, char *));
#ifdef SELECTSAVED
E int FDECL(restore_menu, (winid));
#endif
E void NDECL(minit);
E boolean FDECL(lookup_id_mapping, (unsigned, unsigned *));
E void FDECL(mread, (int,genericptr_t,unsigned int));
@@ -2331,12 +2333,11 @@ E boolean FDECL(comp_times, (long));
#endif
E boolean FDECL(check_version, (struct version_info *,
const char *,BOOLEAN_P));
E boolean FDECL(uptodate, (int,const char *));
E void FDECL(store_version, (int));
E unsigned long FDECL(get_feature_notice_ver, (char *));
E unsigned long NDECL(get_current_feature_ver);
#ifdef RUNTIME_PORT_ID
E void FDECL(append_port_id, (char *));
#endif
E boolean FDECL(uptodate, (int,const char *));
E const char *FDECL(copyright_banner_line, (int));
/* ### video.c ### */