Remove awful kludges dealing with command counts.
This commit is contained in:
+3
-1
@@ -701,7 +701,7 @@ struct instance_globals {
|
|||||||
coord clicklook_cc;
|
coord clicklook_cc;
|
||||||
winid en_win;
|
winid en_win;
|
||||||
boolean en_via_menu;
|
boolean en_via_menu;
|
||||||
int last_multi;
|
long last_command_count;
|
||||||
|
|
||||||
/* dbridge.c */
|
/* dbridge.c */
|
||||||
struct entity occupants[ENTITIES];
|
struct entity occupants[ENTITIES];
|
||||||
@@ -714,6 +714,8 @@ struct instance_globals {
|
|||||||
char chosen_windowtype[WINTYPELEN];
|
char chosen_windowtype[WINTYPELEN];
|
||||||
int bases[MAXOCLASSES + 1];
|
int bases[MAXOCLASSES + 1];
|
||||||
int multi;
|
int multi;
|
||||||
|
char command_line[COLNO];
|
||||||
|
long command_count;
|
||||||
const char *multi_reason;
|
const char *multi_reason;
|
||||||
int nroom;
|
int nroom;
|
||||||
int nsubroom;
|
int nsubroom;
|
||||||
|
|||||||
+2
-1
@@ -435,7 +435,8 @@ moveloop(boolean resuming)
|
|||||||
domove();
|
domove();
|
||||||
} else {
|
} else {
|
||||||
--g.multi;
|
--g.multi;
|
||||||
rhack(g.save_cm);
|
nhassert(g.command_count != 0);
|
||||||
|
rhack(g.command_line);
|
||||||
}
|
}
|
||||||
} else if (g.multi == 0) {
|
} else if (g.multi == 0) {
|
||||||
#ifdef MAIL
|
#ifdef MAIL
|
||||||
|
|||||||
@@ -4477,15 +4477,10 @@ get_count(char *allowchars, char inkey,
|
|||||||
static char *
|
static char *
|
||||||
parse(void)
|
parse(void)
|
||||||
{
|
{
|
||||||
#ifdef LINT /* static char in_line[COLNO]; */
|
|
||||||
char in_line[COLNO];
|
|
||||||
#else
|
|
||||||
static char in_line[COLNO];
|
|
||||||
#endif
|
|
||||||
register int foo;
|
register int foo;
|
||||||
|
|
||||||
iflags.in_parse = TRUE;
|
iflags.in_parse = TRUE;
|
||||||
g.multi = 0;
|
g.command_count = 0;
|
||||||
g.context.move = 1;
|
g.context.move = 1;
|
||||||
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
|
flush_screen(1); /* Flush screen buffer. Put the cursor on the hero. */
|
||||||
|
|
||||||
@@ -4493,10 +4488,8 @@ parse(void)
|
|||||||
alt_esc = iflags.altmeta; /* readchar() hack */
|
alt_esc = iflags.altmeta; /* readchar() hack */
|
||||||
#endif
|
#endif
|
||||||
if (!g.Cmd.num_pad || (foo = readchar()) == g.Cmd.spkeys[NHKF_COUNT]) {
|
if (!g.Cmd.num_pad || (foo = readchar()) == g.Cmd.spkeys[NHKF_COUNT]) {
|
||||||
long tmpmulti = g.multi;
|
foo = get_count((char *) 0, '\0', LARGEST_INT, &g.command_count, FALSE);
|
||||||
|
g.last_command_count = g.command_count;
|
||||||
foo = get_count((char *) 0, '\0', LARGEST_INT, &tmpmulti, FALSE);
|
|
||||||
g.last_multi = g.multi = tmpmulti;
|
|
||||||
}
|
}
|
||||||
#ifdef ALTMETA
|
#ifdef ALTMETA
|
||||||
alt_esc = FALSE; /* readchar() reset */
|
alt_esc = FALSE; /* readchar() reset */
|
||||||
@@ -4510,18 +4503,25 @@ parse(void)
|
|||||||
|
|
||||||
if (foo == g.Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */
|
if (foo == g.Cmd.spkeys[NHKF_ESC]) { /* esc cancels count (TH) */
|
||||||
clear_nhwindow(WIN_MESSAGE);
|
clear_nhwindow(WIN_MESSAGE);
|
||||||
g.multi = g.last_multi = 0;
|
g.command_count = 0;
|
||||||
} else if ((foo && foo == g.Cmd.spkeys[NHKF_DOAGAIN]) || g.in_doagain) {
|
g.last_command_count = 0;
|
||||||
g.multi = g.last_multi;
|
} else if (g.in_doagain) {
|
||||||
|
g.command_count = g.last_command_count;
|
||||||
|
} else if (foo && foo == g.Cmd.spkeys[NHKF_DOAGAIN]) {
|
||||||
|
// g.command_count will be set again when we
|
||||||
|
// re-enter with g.in_doagain set true
|
||||||
|
g.command_count = g.last_command_count;
|
||||||
} else {
|
} else {
|
||||||
g.last_multi = g.multi;
|
g.last_command_count = g.command_count;
|
||||||
savech(0); /* reset input queue */
|
savech(0); /* reset input queue */
|
||||||
savech((char) foo);
|
savech((char) foo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g.multi = g.command_count;
|
||||||
|
|
||||||
if (g.multi) {
|
if (g.multi) {
|
||||||
g.multi--;
|
g.multi--;
|
||||||
g.save_cm = in_line;
|
g.save_cm = g.command_line;
|
||||||
} else {
|
} else {
|
||||||
g.save_cm = (char *) 0;
|
g.save_cm = (char *) 0;
|
||||||
}
|
}
|
||||||
@@ -4546,18 +4546,18 @@ parse(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
in_line[0] = foo;
|
g.command_line[0] = foo;
|
||||||
in_line[1] = '\0';
|
g.command_line[1] = '\0';
|
||||||
if (prefix_cmd(foo)) {
|
if (prefix_cmd(foo)) {
|
||||||
foo = readchar();
|
foo = readchar();
|
||||||
savech((char) foo);
|
savech((char) foo);
|
||||||
in_line[1] = foo;
|
g.command_line[1] = foo;
|
||||||
in_line[2] = 0;
|
g.command_line[2] = 0;
|
||||||
}
|
}
|
||||||
clear_nhwindow(WIN_MESSAGE);
|
clear_nhwindow(WIN_MESSAGE);
|
||||||
|
|
||||||
iflags.in_parse = FALSE;
|
iflags.in_parse = FALSE;
|
||||||
return in_line;
|
return g.command_line;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HANGUPHANDLING
|
#ifdef HANGUPHANDLING
|
||||||
|
|||||||
+4
-2
@@ -243,7 +243,7 @@ const struct instance_globals g_init = {
|
|||||||
UNDEFINED_VALUES, /* clicklook_cc */
|
UNDEFINED_VALUES, /* clicklook_cc */
|
||||||
WIN_ERR, /* en_win */
|
WIN_ERR, /* en_win */
|
||||||
FALSE, /* en_via_menu */
|
FALSE, /* en_via_menu */
|
||||||
UNDEFINED_VALUE, /* last_multi */
|
UNDEFINED_VALUE, /* last_command_count */
|
||||||
|
|
||||||
/* dbridge.c */
|
/* dbridge.c */
|
||||||
UNDEFINED_VALUES, /* occupants */
|
UNDEFINED_VALUES, /* occupants */
|
||||||
@@ -256,7 +256,9 @@ const struct instance_globals g_init = {
|
|||||||
UNDEFINED_VALUES, /* chosen_windowtype */
|
UNDEFINED_VALUES, /* chosen_windowtype */
|
||||||
DUMMY, /* bases */
|
DUMMY, /* bases */
|
||||||
0, /* multi */
|
0, /* multi */
|
||||||
NULL, /* g.multi_reason */
|
UNDEFINED_VALUES, /* command_line */
|
||||||
|
0, /* command_count */
|
||||||
|
NULL, /* multi_reason */
|
||||||
0, /* nroom */
|
0, /* nroom */
|
||||||
0, /* nsubroom */
|
0, /* nsubroom */
|
||||||
0, /* occtime */
|
0, /* occtime */
|
||||||
|
|||||||
+1
-2
@@ -246,8 +246,7 @@ throw_obj(struct obj *obj, int shotlimit)
|
|||||||
static boolean
|
static boolean
|
||||||
ok_to_throw(int *shotlimit_p) /* (see dothrow()) */
|
ok_to_throw(int *shotlimit_p) /* (see dothrow()) */
|
||||||
{
|
{
|
||||||
/* kludge to work around parse()'s pre-decrement of `multi' */
|
*shotlimit_p = g.command_count;
|
||||||
*shotlimit_p = (g.multi || g.save_cm) ? g.multi + 1 : 0;
|
|
||||||
g.multi = 0; /* reset; it's been used up */
|
g.multi = 0; /* reset; it's been used up */
|
||||||
|
|
||||||
if (notake(g.youmonst.data)) {
|
if (notake(g.youmonst.data)) {
|
||||||
|
|||||||
+5
-3
@@ -2753,9 +2753,7 @@ dopickup(void)
|
|||||||
{
|
{
|
||||||
int count, tmpcount, ret;
|
int count, tmpcount, ret;
|
||||||
|
|
||||||
/* awful kludge to work around parse()'s pre-decrement */
|
count = g.command_count;
|
||||||
count = (g.multi || (g.save_cm && *g.save_cm == cmd_from_func(dopickup)))
|
|
||||||
? g.multi + 1 : 0;
|
|
||||||
g.multi = 0; /* always reset */
|
g.multi = 0; /* always reset */
|
||||||
|
|
||||||
if ((ret = pickup_checks()) >= 0) {
|
if ((ret = pickup_checks()) >= 0) {
|
||||||
@@ -3002,6 +3000,10 @@ end_running(boolean and_travel)
|
|||||||
all clear it too */
|
all clear it too */
|
||||||
if (and_travel)
|
if (and_travel)
|
||||||
g.context.travel = g.context.travel1 = g.context.mv = 0;
|
g.context.travel = g.context.travel1 = g.context.mv = 0;
|
||||||
|
|
||||||
|
// Cancel mutli
|
||||||
|
if (g.multi > 0)
|
||||||
|
g.multi = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user