From 0799708880fbd11a6a9a8ed42f6cf726edd0fe7e Mon Sep 17 00:00:00 2001 From: nothere Date: Sat, 18 Oct 2003 10:47:11 +0000 Subject: [PATCH] =?utf8?q?askfor=5Faux()=E3=82=84get=5Fstring()=E3=81=AA?= =?utf8?q?=E3=81=A9=E3=81=AE=E3=82=88=E3=81=86=E3=81=AB=E6=96=87=E5=AD=97?= =?utf8?q?=E5=88=97=E5=85=A5=E5=8A=9B=E3=81=99=E3=82=8B=E5=A0=B4=E5=90=88?= =?utf8?q?=E3=81=AF=E3=83=86=E3=83=B3=E3=82=AD=E3=83=BC=E3=81=AF=20?= =?utf8?q?=E3=82=AB=E3=83=BC=E3=82=BD=E3=83=AB=E6=89=B1=E3=81=84=E3=81=A7?= =?utf8?q?=E3=81=AF=E3=81=AA=E3=81=8F=E6=95=B0=E5=80=A4=E5=85=A5=E5=8A=9B?= =?utf8?q?=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB=E5=A4=89?= =?utf8?q?=E6=9B=B4.=20inkey=5Fspecial()=E3=81=AE=E5=BC=95=E6=95=B0?= =?utf8?q?=E3=81=A7=20=E3=83=86=E3=83=B3=E3=82=AD=E3=83=BC=E3=81=AE?= =?utf8?q?=E6=89=B1=E3=81=84=E3=82=92=E5=A4=89=E3=81=88=E3=82=8B=E3=82=88?= =?utf8?q?=E3=81=86=E3=81=AB=E3=81=97=E3=81=9F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/autopick.c | 4 ++-- src/birth.c | 2 +- src/cmd4.c | 2 +- src/externs.h | 2 +- src/files.c | 2 +- src/util.c | 24 ++++++++++++++++++++++-- 6 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/autopick.c b/src/autopick.c index a865c275e..f65c59876 100644 --- a/src/autopick.c +++ b/src/autopick.c @@ -3136,7 +3136,7 @@ static byte get_string_for_search(object_type **o_handle, cptr *search_strp) Term_gotoxy(col + pos, 0); /* Get a special key code */ - skey = inkey_special(); + skey = inkey_special(FALSE); /* Analyze the key */ switch (skey) @@ -5656,7 +5656,7 @@ void do_cmd_edit_autopick(void) tb->old_hgt = tb->hgt; /* Get a command */ - key = inkey_special(); + key = inkey_special(TRUE); /* Special keys */ if (key & SKEY_MASK) diff --git a/src/birth.c b/src/birth.c index 4c840ac45..e43833b40 100644 --- a/src/birth.c +++ b/src/birth.c @@ -5396,7 +5396,7 @@ static void edit_history(void) Term_gotoxy(x + 10, y + 12); /* Get special key code */ - skey = inkey_special(); + skey = inkey_special(TRUE); /* Get a character code */ if (!(skey & SKEY_MASK)) c = (char)skey; diff --git a/src/cmd4.c b/src/cmd4.c index 1da1c3dce..5956e7c8b 100644 --- a/src/cmd4.c +++ b/src/cmd4.c @@ -1382,7 +1382,7 @@ void do_cmd_messages(int num_now) /* Get a command */ - skey = inkey_special(); + skey = inkey_special(TRUE); /* Exit on Escape */ if (skey == ESCAPE) break; diff --git a/src/externs.h b/src/externs.h index d7c49d3d7..ff492f4f4 100644 --- a/src/externs.h +++ b/src/externs.h @@ -1227,7 +1227,7 @@ extern void build_gamma_table(int gamma); extern size_t my_strcpy(char *buf, const char *src, size_t bufsize); extern size_t my_strcat(char *buf, const char *src, size_t bufsize); -extern int inkey_special(void); +extern int inkey_special(bool use_numkey_as_special); /* xtra1.c */ diff --git a/src/files.c b/src/files.c index f9124d132..e8ee38747 100644 --- a/src/files.c +++ b/src/files.c @@ -5315,7 +5315,7 @@ prt("[ } /* Get a special key code */ - skey = inkey_special(); + skey = inkey_special(TRUE); /* Show the help for the help */ if (skey == '?') diff --git a/src/util.c b/src/util.c index 63a5d82da..66188d499 100644 --- a/src/util.c +++ b/src/util.c @@ -3195,7 +3195,7 @@ bool askfor_aux(char *buf, int len) Term_gotoxy(x + pos, y); /* Get a special key code */ - skey = inkey_special(); + skey = inkey_special(FALSE); /* Analyze the key */ switch (skey) @@ -5224,7 +5224,7 @@ size_t my_strcat(char *buf, const char *src, size_t bufsize) * This function is a Mega-Hack and depend on pref-xxx.prf's. * Currently works on Linux(UNIX), Windows, and Macintosh only. */ -int inkey_special(void) +int inkey_special(bool use_numkey_as_special) { static const struct { cptr keyname; @@ -5255,6 +5255,13 @@ int inkey_special(void) {"KP_Page_Down]", SKEY_PGDOWN}, {"KP_Home]", SKEY_TOP}, {"KP_End]", SKEY_BOTTOM}, + {NULL, 0}, + }; + + static const struct { + cptr keyname; + int keycode; + } numkey_list[] = { {"KP_2]", SKEY_DOWN}, {"KP_4]", SKEY_LEFT}, {"KP_6]", SKEY_RIGHT}, @@ -5341,6 +5348,19 @@ int inkey_special(void) } } + if (!skey && use_numkey_as_special) + { + /* Get a numkey code */ + for (i = 0; numkey_list[i].keyname; i++) + { + if (streq(str, numkey_list[i].keyname)) + { + skey = numkey_list[i].keycode; + break; + } + } + } + /* No special key found? */ if (!skey) { -- 2.11.0