Merge some more SERGEEV stuff.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 20 Jan 2005 07:23:49 +0000 (07:23 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 20 Jan 2005 07:23:49 +0000 (07:23 +0000)
planets.c
setup.c
sst.c
sst.h

index eed32104fea1cccc1cdbe509124fdc1e3a809730..a9ec295fc76ad3c5affe5975c09632b9a8a6e436 100644 (file)
--- a/planets.c
+++ b/planets.c
@@ -58,7 +58,6 @@ void preport(void) {
 void orbit(void) {\r
        skip(1);\r
        chew();\r
 void orbit(void) {\r
        skip(1);\r
        chew();\r
-       ididit=0;\r
        if (inorbit!=0) {\r
                prout("Already in standard orbit.");\r
                return;\r
        if (inorbit!=0) {\r
                prout("Already in standard orbit.");\r
                return;\r
@@ -114,7 +113,7 @@ void beam(void) {
                prout("Transporter damaged.");\r
                if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {\r
                        skip(1);\r
                prout("Transporter damaged.");\r
                if (game.damage[DSHUTTL]==0 && (game.state.plnets[iplnet].known==shuttle_down || iscraft == 1)) {\r
                        skip(1);\r
-                       prout("Spock-  \"May I suggest the shuttle craft, Sir?\" ");\r
+                       proutn("Spock-  \"May I suggest the shuttle craft, Sir?\" ");\r
                        if (ja() != 0) shuttle();\r
                }\r
                return;\r
                        if (ja() != 0) shuttle();\r
                }\r
                return;\r
diff --git a/setup.c b/setup.c
index 55db1d9cbfc2c24554e15c2bf20575f7a5079af6..9de1a9590dc0bd9c6685f361dd274bb2ad052a3a 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -1,12 +1,24 @@
 #include <time.h>\r
 #include "sst.h"\r
 \r
 #include <time.h>\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
 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
        prout("Latest update-21 Sept 78");\r
        skip(1);\r
+#endif /* SERGEEV */\r
 }\r
 \r
 void freeze(int boss) {\r
 }\r
 \r
 void freeze(int boss) {\r
diff --git a/sst.c b/sst.c
index 330d8de7a5256a7e01904014bad5b28ef2d763bf..3567c2551b8aa14c25d622fdcc77a5de6d3097b4 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -35,9 +35,9 @@ Here are Tom Almy's changes:
 \r
    1. Better base positioning at startup\r
 \r
 \r
    1. Better base positioning at startup\r
 \r
-   2. deathray improvement (but keeping original failure alternatives)\r
+   2. Deathray improvement (but keeping original failure alternatives)\r
 \r
 \r
-   3. Tholian Web\r
+   3. Tholian Web.\r
 \r
    4. Enemies can ram the Enterprise. Regular Klingons and Romulans can\r
       move in Expert and Emeritus games. This code could use improvement.\r
 \r
    4. Enemies can ram the Enterprise. Regular Klingons and Romulans can\r
       move in Expert and Emeritus games. This code could use improvement.\r
@@ -47,7 +47,7 @@ Here are Tom Almy's changes:
    6. Perhaps cloaking to be added later? BSD version\r
 \r
 Here are Stas Sergeev's changes (controlled by the proprocessor symbol\r
    6. Perhaps cloaking to be added later? BSD version\r
 \r
 Here are Stas Sergeev's changes (controlled by the proprocessor symbol\r
-SERGEEV, not yet merged):\r
+SERGEEV, not yet completely merged):\r
 \r
    1. The Space Thingy can be shoved, if you it ram, and can fire back if \r
       fired upon.\r
 \r
    1. The Space Thingy can be shoved, if you it ram, and can fire back if \r
       fired upon.\r
@@ -133,6 +133,21 @@ static void listCommands(int x) {
        if (x) prout("   HELP");\r
 }\r
 \r
        if (x) prout("   HELP");\r
 }\r
 \r
+#ifdef SERGEEV\r
+void setwnd(short wndnum){\r
+     int cury;\r
+     cury=wherey()+wnds[curwnd].wndtop-wnds[wndnum].wndtop;\r
+     if ((curwnd==0)&&(wndnum!=0)) clrscr();\r
+     window(wnds[wndnum].wndleft, wnds[wndnum].wndtop, wnds[wndnum].wndright, wnds[wndnum].wndbottom);\r
+     if ((curwnd==wndnum)&&(cury>wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1)){\r
+        gotoxy(wnds[wndnum].wndright-wnds[wndnum].wndleft+1,wnds[wndnum].wndbottom-wnds[wndnum].wndtop+1);\r
+       skip(1);\r
+     }\r
+     curwnd=wndnum;\r
+     gotoxy(1,cury);\r
+}\r
+#endif /* SERGEEV */\r
+\r
 static void helpme(void) {\r
        int i, j;\r
        char cmdbuf[32], *cp;\r
 static void helpme(void) {\r
        int i, j;\r
        char cmdbuf[32], *cp;\r
@@ -143,9 +158,15 @@ static void helpme(void) {
        key = scan();\r
        while (TRUE) {\r
                if (key == IHEOL) {\r
        key = scan();\r
        while (TRUE) {\r
                if (key == IHEOL) {\r
-                       proutn("Help on what command?");\r
+#ifdef SERGEEV\r
+                        setwnd(5);\r
+#endif /* SERGEEV */\r
+                        proutn("Help on what command? ");\r
                        key = scan();\r
                }\r
                        key = scan();\r
                }\r
+#ifdef SERGEEV\r
+                setwnd(4);\r
+#endif /* SERGEEV */\r
                if (key == IHEOL) return;\r
                for (i = 0; i < NUMCOMMANDS; i++) {\r
                        if (strcmp(commands[i], citem)==0) break;\r
                if (key == IHEOL) return;\r
                for (i = 0; i < NUMCOMMANDS; i++) {\r
                        if (strcmp(commands[i], citem)==0) break;\r
@@ -442,11 +463,17 @@ int main(int argc, char **argv) {
                                freeze(FALSE);\r
                        }\r
                }\r
                                freeze(FALSE);\r
                        }\r
                }\r
-               proutn("Do you want to play again?");\r
+               proutn("Do you want to play again? ");\r
                if (!ja()) break;\r
                if (!ja()) break;\r
+#ifdef SERGEEV\r
+               setwnd(0);\r
+               clrscr();\r
+#endif /* SERGEEV */\r
        }\r
        skip(1);\r
        }\r
        skip(1);\r
+#ifndef SERGEEV\r
        ioend();\r
        ioend();\r
+#endif /* SERGEEV */\r
        puts("May the Great Bird of the Galaxy roost upon your home planet.");\r
        exit(0);\r
 }\r
        puts("May the Great Bird of the Galaxy roost upon your home planet.");\r
        exit(0);\r
 }\r
@@ -588,7 +615,7 @@ int ja(void) {
                chew();\r
                if (*citem == 'y') return TRUE;\r
                if (*citem == 'n') return FALSE;\r
                chew();\r
                if (*citem == 'y') return TRUE;\r
                if (*citem == 'n') return FALSE;\r
-               proutn("Please answer with \"Y\" or \"N\":");\r
+               proutn("Please answer with \"Y\" or \"N\": ");\r
        }\r
 }\r
 \r
        }\r
 }\r
 \r
diff --git a/sst.h b/sst.h
index 0e198f4921e41042e7ea8e540a71ad60cec2ca4f..08977838d99c1e26a69e12af232b16760759a2b5 100644 (file)
--- a/sst.h
+++ b/sst.h
@@ -438,3 +438,10 @@ void iostart(int);
 void ioend(void);\r
 void getline(char *, int);\r
 void commandhook(char *, int);\r
 void ioend(void);\r
 void getline(char *, int);\r
 void commandhook(char *, int);\r
+\r
+#ifdef SERGEEV\r
+typedef struct {\r
+        int wndleft,wndtop,wndright,wndbottom;\r
+} wnd;\r
+extern wnd wnds[6];\r
+#endif /* SERGEEV */\r