m-prefix groundwork (trunk only)

Set up to be able to use the m command prefix to request menu mode
for commands other than just pickup.  As a side-effect, a hardcoded ','
referencing that command is eliminated.  Also, the command handling for
pickup was accepting the other prefix characters (F,g,G,M,numpad 5) as
synonyms for m; this reverts all but 'm' to movement modifiers only (it
may be reasonable to retain M and 5, but this doesn't).
This commit is contained in:
nethack.rankin
2007-02-03 03:41:22 +00:00
parent dda8161ece
commit 42444d0db5
2 changed files with 28 additions and 4 deletions
+1
View File
@@ -185,6 +185,7 @@ shooting range for crossbow isn't affected by strength; multi-shot volley is
right-handed boomerang throw travels counterclockwise right-handed boomerang throw travels counterclockwise
monsters can use ranged attacks over/around boulders, same as hero monsters can use ranged attacks over/around boulders, same as hero
can't drop part of a stack of N weapons welded to hero's hand can't drop part of a stack of N weapons welded to hero's hand
pickup still accepts m as command prefix, but now rejects F,g,G,M,numpad 5
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+27 -4
View File
@@ -148,6 +148,7 @@ STATIC_DCL void FDECL(mon_invent_chain, (winid, const char *, struct monst *, lo
STATIC_DCL void FDECL(mon_chain, (winid, const char *, struct monst *, long *, long *)); STATIC_DCL void FDECL(mon_chain, (winid, const char *, struct monst *, long *, long *));
STATIC_DCL void FDECL(contained, (winid, const char *, long *, long *)); STATIC_DCL void FDECL(contained, (winid, const char *, long *, long *));
STATIC_PTR int NDECL(wiz_show_stats); STATIC_PTR int NDECL(wiz_show_stats);
STATIC_DCL boolean FDECL(accept_menu_prefix, (int NDECL((*))));
# ifdef PORT_DEBUG # ifdef PORT_DEBUG
STATIC_DCL int NDECL(wiz_port_debug); STATIC_DCL int NDECL(wiz_port_debug);
# endif # endif
@@ -293,14 +294,20 @@ STATIC_PTR int
doextcmd(VOID_ARGS) /* here after # - now read a full-word command */ doextcmd(VOID_ARGS) /* here after # - now read a full-word command */
{ {
int idx, retval; int idx, retval;
int NDECL((*func));
/* keep repeating until we don't run help or quit */ /* keep repeating until we don't run help or quit */
do { do {
idx = get_ext_cmd(); idx = get_ext_cmd();
if (idx < 0) return 0; /* quit */ if (idx < 0) return 0; /* quit */
retval = (*extcmdlist[idx].ef_funct)(); func = extcmdlist[idx].ef_funct;
} while (extcmdlist[idx].ef_funct == doextlist); if (iflags.menu_requested && !accept_menu_prefix(func)) {
pline("'m' prefix has no effect for this command.");
iflags.menu_requested = FALSE;
}
retval = (*func)();
} while (func == doextlist);
return retval; return retval;
} }
@@ -2180,6 +2187,16 @@ boolean initial;
Cmd.move_SW = Cmd.dirchars[7]; Cmd.move_SW = Cmd.dirchars[7];
} }
STATIC_OVL boolean
accept_menu_prefix(cmd_func)
int NDECL((*cmd_func));
{
if (cmd_func == dopickup ||
cmd_func == doextcmd || cmd_func == doextlist)
return TRUE;
return FALSE;
}
void void
rhack(cmd) rhack(cmd)
register char *cmd; register char *cmd;
@@ -2310,10 +2327,16 @@ register char *cmd;
} }
/* some special prefix handling */ /* some special prefix handling */
/* overload 'm' prefix for ',' to mean "request a menu" */ /* overload 'm' prefix to mean "request a menu" */
if (prefix_seen && cmd[1] == ',') { if (prefix_seen && cmd[0] == 'm') {
/* (for func_tab cast, see below) */
const struct func_tab *ft = Cmd.commands[cmd[1] & 0xff];
int NDECL((*func)) = ft ? ((struct func_tab *)ft)->f_funct : 0;
if (func && accept_menu_prefix(func)) {
iflags.menu_requested = TRUE; iflags.menu_requested = TRUE;
++cmd; ++cmd;
}
} }
if (do_walk) { if (do_walk) {