Knock SERGEEV out of setup.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 3 Feb 2005 20:19:59 +0000 (20:19 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 3 Feb 2005 20:19:59 +0000 (20:19 +0000)
io.c
setup.c
sst.h

diff --git a/io.c b/io.c
index 3bc3b9c2c88d225069e90723e3ba96093f871dd8..ec30ccffc676959c9c59bd9cfe7dacf4e58fdb17 100644 (file)
--- a/io.c
+++ b/io.c
@@ -100,6 +100,13 @@ void clearscreen(void) {
 #endif
 }
 
+void waitfor(void) {
+/* wait for user action -- OK to do nothing if on a TTY */
+#ifdef SERGEEV
+       getche();
+#endif /* SERGEEV */
+}
+
 void pause_game(int i) {
        char *prompt;
 #ifndef SERGEEV
@@ -304,6 +311,22 @@ void warble(void)
 #endif /* SERGEEV */
 }
 
+void setpassword(void) {
+#ifndef SERGEEV
+       while (TRUE) {
+               scan();
+               strcpy(game.passwd, citem);
+               chew();
+               if (*game.passwd != 0) break;
+               proutn("Please type in a secret password-");
+       }
+#else
+       int i;
+        for(i=0;i<3;i++) game.passwd[i]=(char)(97+(int)(Rand()*25));
+        game.passwd[3]=0;
+#endif /* SERGEEV */
+}
+
 void getline(char *line, int max) {
     if (curses) {
 #ifndef SERGEEV
diff --git a/setup.c b/setup.c
index 58f45f175b8d12593d592c00f8f0a3ead10edf4a..4df870978b1397a20951c92743f4500336b38591 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -385,9 +385,7 @@ void setup(int needprompt) {
        skip(2);
        prout("Good Luck!");
        if (game.state.nscrem) prout("  YOU'LL NEED IT.");
-#ifdef SERGEEV
-        getche();
-#endif /* SERGEEV */
+        waitfor();
        newqad(0);
         if (nenhere-iqhere-ithere) shldup=1.0;
        if (neutz) attack(0);   // bad luck to start in a Romulan Neutral Zone
@@ -420,19 +418,13 @@ int choose(int needprompt) {
                        srand((unsigned int)(int)aaitem);
                        break;
                }
-               if (isit("frozen") || isit("frozen")) {
+               if (isit("saved") || isit("frozen")) {
                         if (thaw()) continue;
                        chew();
-#ifndef SERGEEV
                        if (*game.passwd==0) continue;
-                       randomize();
-                       Rand(); Rand(); Rand(); Rand();
-#endif
                        if (!alldone) thawed = 1; // No plaque if not finished
                         report();
-#ifdef SERGEEV
-                        getche();
-#endif /* SERGEEV */
+                        waitfor();
                        return TRUE;
                }
                 if (isit("regular")) break;
@@ -463,18 +455,7 @@ int choose(int needprompt) {
                        else if (skill == 0) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player? ");
                }
        }
-#ifndef SERGEEV
-       while (TRUE) {
-               scan();
-               strcpy(game.passwd, citem);
-               chew();
-               if (*game.passwd != 0) break;
-               proutn("Please type in a secret password-");
-       }
-#else
-        for(i=0;i<3;i++) game.passwd[i]=(char)(97+(int)(Rand()*25));
-        game.passwd[3]=0;
-#endif /* SERGEEV */
+       setpassword();
 #ifdef DEBUG
        if (strcmp(game.passwd, "debug")==0) idebug = 1;
 #endif
diff --git a/sst.h b/sst.h
index 9c964fa18089d323092f9ef76801a78cc435caa2..7d0b9c37478b03c63fd3a2e9cf2ae47e81d3b5dc 100644 (file)
--- a/sst.h
+++ b/sst.h
@@ -439,6 +439,8 @@ void ioend(void);
 void setwnd(short);
 void warble(void);
 void getline(char *, int);
+void waitfor(void);
+void setpassword(void);
 void commandhook(char *, int);
 
 typedef struct {