OSDN Git Service

get_check_strict() を作った。modeの指定によってESCを受けつけないようにしたり、
authormogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 21 Jan 2002 13:19:57 +0000 (13:19 +0000)
committermogami <mogami@0568b783-4c39-0410-ac80-bf13821ea2a2>
Mon, 21 Jan 2002 13:19:57 +0000 (13:19 +0000)
'y'一文字ではなく"yes"と3文字入力しないといけないようにした。
死亡後、スコア登録を聞いてくるときに、ESCを受けつけないモードで使用。
ランダムテレポートの質問では"yes"を要求するモードで使用。
他にも使い道あると思うが、まだこの二箇所だけ。

src/dungeon.c
src/externs.h
src/scores.c
src/util.c

index 538c9f0..629d313 100644 (file)
@@ -3378,7 +3378,7 @@ if (!get_rnd_line("chainswd_j.txt", 0, noise))
                                                /* msg_print("Teleport aborted.") */ ;
                                        }
 #ifdef JP
-else if (get_check("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©"))
+else if (get_check_strict("¥Æ¥ì¥Ý¡¼¥È¤·¤Þ¤¹¤«¡©", 1))
 #else
                                        else if (get_check("Teleport? "))
 #endif
index 156be48..99e7dfd 100644 (file)
@@ -1154,6 +1154,7 @@ extern void clear_from(int row);
 extern bool askfor_aux(char *buf, int len);
 extern bool get_string(cptr prompt, char *buf, int len);
 extern bool get_check(cptr prompt);
+extern bool get_check_strict(cptr prompt, int mode);
 extern bool get_com(cptr prompt, char *command, bool z_escape);
 extern s16b get_quantity(cptr prompt, int max);
 extern void pause_line(int row);
index 60c741a..4177195 100644 (file)
@@ -427,7 +427,7 @@ bool send_world_score(bool do_send)
 #endif
                }
 #ifdef JP
-               else if(get_check("¥¹¥³¥¢¤ò¥¹¥³¥¢¡¦¥µ¡¼¥Ð¤ËÅÐÏ¿¤·¤Þ¤¹¤«? "))
+               else if(get_check_strict("¥¹¥³¥¢¤ò¥¹¥³¥¢¡¦¥µ¡¼¥Ð¤ËÅÐÏ¿¤·¤Þ¤¹¤«? ", 2))
 #else
                else if(get_check("Do you send score to the world score sever? "))
 #endif
index c8ec313..cf8bbd1 100644 (file)
@@ -3301,8 +3301,18 @@ bool get_string(cptr prompt, char *buf, int len)
  */
 bool get_check(cptr prompt)
 {
-       int i;
+       return get_check_strict(prompt, 0);
+}
 
+/*
+ * Verify something with the user strictly
+ *
+ * mode & 0x01 : force user to answer "YES" or "N"
+ * mode & 0x02 : don't allow ESCAPE key
+ */
+bool get_check_strict(cptr prompt, int mode)
+{
+       int i;
        char buf[80];
 
        if (auto_more)
@@ -3315,8 +3325,14 @@ bool get_check(cptr prompt)
        /* Paranoia XXX XXX XXX */
        msg_print(NULL);
 
+       if (!rogue_like_commands)
+               mode &= ~1;
+
        /* Hack -- Build a "useful" prompt */
-       (void)strnfmt(buf, 78, "%.70s[y/n] ", prompt);
+       if (mode & 1)
+               (void)strnfmt(buf, 75, "%.66s[yes/no] ", prompt);
+       else
+               (void)strnfmt(buf, 78, "%.70s[y/n] ", prompt);
 
        /* Prompt for it */
        prt(buf, 0, 0);
@@ -3325,9 +3341,39 @@ bool get_check(cptr prompt)
        while (TRUE)
        {
                i = inkey();
-/*             if (quick_messages) break; */
-               if (i == ESCAPE) break;
-               if (strchr("YyNn", i)) break;
+
+               if (i == 'y' || i == 'Y')
+               {
+                       if (!(mode & 1))
+                               break;
+                       else
+                       {
+#ifdef JP
+                               prt("y (YES¤ÈÆþÎϤ·¤Æ¤¯¤À¤µ¤¤)", 0, strlen(buf));
+#else
+                               prt("y (Please answer YES.)", 0, strlen(buf));
+#endif
+                               i = inkey();
+                               if (i == 'e' || i == 'E')
+                               {
+#ifdef JP
+                                       prt("e (YES¤ÈÆþÎϤ·¤Æ¤¯¤À¤µ¤¤)", 0, strlen(buf)+1);
+#else
+                                       prt("e (Please answer YES.)", 0, strlen(buf)+1);
+#endif
+                                       i = inkey();
+                                       if (i == 's' || i == 'S')
+                                       {
+                                               i = 'y';
+                                               break;
+                                       }
+                                       prt("", 0, strlen(buf)+1);
+                               }
+                               prt("", 0, strlen(buf));
+                       }
+               }
+               if (!(mode & 2) && (i == ESCAPE)) break;
+               if (strchr("Nn", i)) break;
                bell();
        }