-NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.343 $ $NHDT-Date: 1603777052 2020/10/27 05:37:32 $
+NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.344 $ $NHDT-Date: 1603836614 2020/10/27 22:10:14 $
General Fixes and Modified Features
-----------------------------------
Qt: fix the display side of saved game selection; character names for
available save files are shown in a column of push buttons instead
of each button overwriting all the ones before it
+Qt: don't clobber an existing save file after choosing "new game" in the
+ saved game selection widget
+Qt: don't get stuck in a loop after choosing "play" while the character name
+ field is empty in the character selection widget
Qt+OSX: fix control key
Qt+OSX: rename menu entry "nethack->Preferences..." for invoking nethack's
'O' command to "Game->Run-time options" and entry "Game->Qt settings"
characters from ^A through ^U, ^W through ^Z, and ^[, ^\, ^], ^^, ^_
work; no attempt to have ^@ generate NUL has been made).
-The save file selection widget writes all the file name selection
-buttons on top of each other, with the last one added being the only
-one visible. Clicking on it seems to be picking the first one instead.
-If you pick "new game" and use a different character name then
-eventually save, it clobbers the last one in the list (rather, warns
-the player that a save file exists and asks whether to overwrite it;
-answering yes and then loading the file shows the new character, not
-the original one even though the file is still named for that one).
-
Map column #0, which the core reserves for its own purposes and isn't
intended to be displayed, is displayed (as blank terrain).
void NetHackQtBind::qt_askname()
{
+ char default_plname[PL_NSIZ];
+
have_asked = true;
+ str_copy(default_plname, g.plname, PL_NSIZ);
- // We do it all here, and nothing in askname
+ // We do it all here (plus qt_plsel.cpp and qt_svsel.cpp),
+ // nothing in player_selection().
char** saved = get_saved_games();
- int ch = -1;
+ int ch = -1; // -1 => new game
if ( saved && *saved ) {
if ( splash ) splash->hide();
NetHackQtSavedGameSelector sgsel((const char**)saved);
ch = sgsel.choose();
if ( ch >= 0 )
str_copy(g.plname, saved[ch], SIZE(g.plname));
+ // caller needs new lock name even if plname[] hasn't changed
+ // because successful get_saved_games() clobbers g.SAVEF[]
+ ::iflags.renameinprogress = TRUE;
}
free_saved_games(saved);
switch (ch) {
case -1:
+ // New Game
if (splash)
splash->hide();
- if (NetHackQtPlayerSelector(keybuffer).Choose())
- return;
+ if (NetHackQtPlayerSelector(keybuffer).Choose()) {
+ // success; handle plname[] verification below prior to returning
+ break;
+ }
/*FALLTHRU*/
case -2:
+ // Quit
+ clearlocks();
+ qt_exit_nhwindows(0);
+ nh_terminate(0);
+ /*NOTREACHED*/
break;
default:
- return;
+ // picked a character from the saved games list
+ break;
}
- // Quit
- clearlocks();
- qt_exit_nhwindows(0);
- nh_terminate(0);
+ if (!*g.plname)
+ // in case Choose() returns with plname[] empty
+ Strcpy(g.plname, default_plname);
+ else if (strcmp(g.plname, default_plname) != 0)
+ // caller needs to set new lock file name
+ ::iflags.renameinprogress = TRUE;
+ return;
}
void NetHackQtBind::qt_get_nh_event()