One more small merge.
[super-star-trek.git] / setup.c
diff --git a/setup.c b/setup.c
index 1d7dd0153679b77abc4e5d21520c216fb44bb48e..932faa8a037c3fef105260ff2a4b033a726f73f3 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -1,16 +1,31 @@
 #include <time.h>\r
+#ifdef SERGEEV\r
+#include <sys/stat.h>\r
+#include <conio.h>\r
+#endif /* SERGEEV */\r
 #include "sst.h"\r
 \r
+#ifdef SERGEEV\r
+#ifdef __linux__\r
+static long filelength(int fd) {\r
+struct stat buf;\r
+    fstat(fd, &buf);\r
+    return buf.st_size;\r
+}\r
+#endif\r
+#endif /* SERGEEV */\r
+\r
 void prelim(void) {\r
        skip(2);\r
        prout("-SUPER- STAR TREK");\r
        skip(1);\r
+#ifndef SERGEEV\r
        prout("Latest update-21 Sept 78");\r
        skip(1);\r
+#endif /* SERGEEV */\r
 }\r
 \r
 void freeze(int boss) {\r
-       char *x, *y;\r
        FILE *fp;\r
        int key;\r
        if (boss) {\r
@@ -374,6 +389,9 @@ void setup(int needprompt) {
        skip(2);\r
        prout("Good Luck!");\r
        if (game.state.nscrem) prout("  YOU'LL NEED IT.");\r
+#ifdef SERGEEV\r
+        getche();\r
+#endif /* SERGEEV */\r
        newqad(0);\r
         if (nenhere-iqhere-ithere) shldup=1.0;\r
        if (neutz) attack(0);   // bad luck to start in a Romulan Neutral Zone\r
@@ -446,9 +464,10 @@ int choose(int needprompt) {
                else {\r
                        chew();\r
                        if (length==0) proutn("Would you like a Short, Medium, or Long game? ");\r
-                       else if (skill == 0) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player?");\r
+                       else if (skill == 0) proutn("Are you a Novice, Fair, Good, Expert, or Emeritus player? ");\r
                }\r
        }\r
+#ifndef SERGEEV\r
        while (TRUE) {\r
                scan();\r
                strcpy(game.passwd, citem);\r
@@ -456,6 +475,10 @@ int choose(int needprompt) {
                if (*game.passwd != 0) break;\r
                proutn("Please type in a secret password-");\r
        }\r
+#else\r
+        for(i=0;i<3;i++) game.passwd[i]=(char)(97+(int)(Rand()*25));\r
+        game.passwd[3]=0;\r
+#endif /* SERGEEV */\r
 #ifdef DEBUG\r
        if (strcmp(game.passwd, "debug")==0) idebug = 1;\r
 #endif\r
@@ -493,6 +516,7 @@ void newcnd(void) {
        if (energy < 1000.0) condit = IHYELLOW;\r
        if (game.state.galaxy[quadx][quady] > 99 || game.state.newstuf[quadx][quady] > 9)\r
                condit = IHRED;\r
+        if (!alive) condit=IHDEAD;\r
 }\r
 \r
 \r