fix segfault with #therecmdmenu
The change to add a menu choice for naming an adjacent monster via \#therecmdmenu was unintentionally requiring that the monster have monst->mextra. So it worked on pets (regardless of whether they were already named) because they have mextra for 'edog' extension, but not on the majority of monsters. And when it failed the program would crash with a 'segmentation fault' error. Fix the check for whether a target monster already had a name when deciding to use "name <mon>" or "rename <mon>" in the menu entry.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.916 $ $NHDT-Date: 1652689792 2022/05/16 08:29:52 $
|
||||
HDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.917 $ $NHDT-Date: 1652719274 2022/05/16 16:41:14 $
|
||||
|
||||
General Fixes and Modified Features
|
||||
-----------------------------------
|
||||
@@ -1215,6 +1215,8 @@ recent changes in removing a dead monster from the map didn't update screen
|
||||
to show objects it dropped; they were present, just not displayed
|
||||
further changes resulted in dead monsters' corpses be placed at <0,0>;
|
||||
reverse the part(s) that cleared stale monst->mx,my
|
||||
adding name/rename choice to #therecmdmenu caused it to crash when picking an
|
||||
adjacent unnamed, untame monster
|
||||
|
||||
curses: 'msg_window' option wasn't functional for curses unless the binary
|
||||
also included tty support
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* NetHack 3.7 cmd.c $NHDT-Date: 1652637694 2022/05/15 18:01:34 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.563 $ */
|
||||
/* NetHack 3.7 cmd.c $NHDT-Date: 1652719274 2022/05/16 16:41:14 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.564 $ */
|
||||
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
|
||||
/*-Copyright (c) Robert Patrick Rankin, 2013. */
|
||||
/* NetHack may be freely redistributed. See license for details. */
|
||||
@@ -4764,7 +4764,7 @@ there_cmd_menu_next2u(
|
||||
}
|
||||
if (mtmp) {
|
||||
Sprintf(buf, "%s %s",
|
||||
!MGIVENNAME(mtmp) ? "Name" : "Rename",
|
||||
!has_mgivenname(mtmp) ? "Name" : "Rename",
|
||||
mon_nam(mtmp));
|
||||
mcmd_addmenu(win, MCMD_NAME, buf), ++K;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user