First round of Sergeev merges.
authorEric S. Raymond <esr@thyrsus.com>
Wed, 19 Jan 2005 23:17:44 +0000 (23:17 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Wed, 19 Jan 2005 23:17:44 +0000 (23:17 +0000)
battle.c
events.c
io.c
makefile
moving.c
reports.c
setup.c
sst.c
sst.h

index dd102aa8e250464188ddcaf3ad3ae46eb3e642c7..97cea709fca529f5d140f6601c8f7fb3fb0699a4 100644 (file)
--- a/battle.c
+++ b/battle.c
@@ -1,3 +1,8 @@
+#ifdef SERGEEV\r
+#include <conio.h>\r
+#include <unistd.h>\r
+#include "sstlinux.h"\r
+#endif /* SERGEEV */\r
 #include "sst.h"\r
 \r
 void doshield(int i) {\r
@@ -171,8 +176,12 @@ void ram(int ibumpd, int ienm, int ix, int iy) {
        return;\r
 }\r
 \r
-void torpedo(double course, double r, int inx, int iny, double *hit) {\r
-       int l, iquad, ix, iy,  jx, jy, shoved=0, ll;\r
+void torpedo(double course, double r, int inx, int iny, double *hit, int wait) {\r
+        int l, iquad=0, ix=0, iy=0, jx=0, jy=0, shoved=0, ll;\r
+#ifdef SERGEEV\r
+       int crx,cry;\r
+       \r
+#endif /* SERGEEV */\r
        double ac=course + 0.25*r;\r
        double angle = (15.0-ac)*0.5235988;\r
        double bullseye = (15.0 - course)*0.5235988;\r
@@ -183,7 +192,12 @@ void torpedo(double course, double r, int inx, int iny, double *hit) {
        if (fabs(deltay) > bigger) bigger = fabs(deltay);\r
        deltax /= bigger;\r
        deltay /= bigger;\r
-\r
+#ifdef SERGEEV\r
+        crx=wherex();\r
+        cry=wherey();\r
+        if (game.damage[DSRSENS]==0 || condit==IHDOCKED) setwnd(1);\r
+       else setwnd(4);\r
+#endif /* SERGEEV */\r
        /* Loop to move a single torpedo */\r
        for (l=1; l <= 15; l++) {\r
                x += deltax;\r
@@ -192,12 +206,49 @@ void torpedo(double course, double r, int inx, int iny, double *hit) {
                y += deltay;\r
                iy = y + 0.5;\r
                if (iy < 1 || iy > 10) break;\r
+#ifndef SERGEEV\r
                if (l==4 || l==9) skip(1);\r
                proutn("%d - %d   ", (int)x, (int)y);\r
                iquad=game.quad[ix][iy];\r
+#else\r
+                iquad=game.quad[ix][iy];\r
+                if (game.damage[DSRSENS]==0 || condit==IHDOCKED){\r
+                   drawmaps(2);\r
+                   delay((wait!=1)*400);\r
+                   wait=1;\r
+                   gotoxy(iy*2+3,ix+2);\r
+                   if ((game.quad[ix][iy]==IHDOT)||(game.quad[ix][iy]==IHBLANK)){\r
+                      game.quad[ix][iy]='+';\r
+                      drawmaps(2);\r
+                      game.quad[ix][iy]=iquad;\r
+                      sound(l*10);\r
+                      delay(100);\r
+                      nosound();\r
+                   }\r
+                   else {\r
+                        game.quad[ix][iy]|=128;\r
+                        drawmaps(2);\r
+                        game.quad[ix][iy]=iquad;\r
+                        _setcursortype(_NOCURSOR);\r
+                        sound(500);\r
+                        delay(1000);\r
+                        nosound();\r
+                        lowvideo();\r
+                        _setcursortype(_NORMALCURSOR);\r
+                   }\r
+                }\r
+                else {\r
+                 proutn("%d - %d   ", (int)x, (int)y);\r
+               }\r
+#endif /* SERGEEV */\r
                if (iquad==IHDOT) continue;\r
                /* hit something */\r
+#ifndef SERGEEV\r
                skip(1);\r
+#else\r
+               setwnd(4);\r
+               gotoxy(crx,cry);\r
+#endif\r
                switch(iquad) {\r
                        case IHE: /* Hit our ship */\r
                        case IHF:\r
@@ -209,7 +260,9 @@ void torpedo(double course, double r, int inx, int iny, double *hit) {
                                           1000.0*sqrt(square(ix-inx)+square(iy-iny))*\r
                                           fabs(sin(bullseye-angle));\r
                                *hit = fabs(*hit);\r
+#ifndef SERGEEV\r
                                newcnd(); /* undock */\r
+#endif /* SERGEEV */\r
                                /* We may be displaced. */\r
                                if (landed==1 || condit==IHDOCKED) return; /* Cheat if on a planet */\r
                                ang = angle + 2.5*(Rand()-0.5);\r
@@ -361,10 +414,15 @@ void torpedo(double course, double r, int inx, int iny, double *hit) {
                                         fabs(sin(bullseye-angle));\r
                                h1 = fabs(h1);\r
                                if (h1 >= 600) {\r
+#ifndef SERGEEV\r
                                        prout(" destroyed.");\r
+#endif /* SERGEEV */\r
                                        game.quad[ix][iy] = IHDOT;\r
                                        ithere = 0;\r
                                        ithx = ithy = 0;\r
+#ifdef SERGEEV\r
+                                        deadkl(ix, iy, iquad, ix, iy);\r
+#endif /* SERGEEV */\r
                                        return;\r
                                }\r
                                skip(1);\r
@@ -392,6 +450,12 @@ void torpedo(double course, double r, int inx, int iny, double *hit) {
                }\r
                break;\r
        }\r
+#ifdef SERGEEV\r
+        if(curwnd!=4) {\r
+           setwnd(4);\r
+           gotoxy(crx,cry);\r
+       }\r
+#endif /* SERGEEV */\r
        if (shoved) {\r
                game.quad[jx][jy]=iquad;\r
                game.quad[ix][iy]=IHDOT;\r
@@ -401,14 +465,16 @@ void torpedo(double course, double r, int inx, int iny, double *hit) {
                sortkl();\r
                return;\r
        }\r
+#ifndef SERGEEV\r
        skip(1);\r
+#endif /* SERGEEV */\r
        prout("Torpedo missed.");\r
        return;\r
 }\r
 \r
 static void fry(double hit) {\r
        double ncrit, extradm;\r
-       int ktr=1, l, ll, j, cdam[NDEVICES+1], crptr;\r
+       int ktr=1, l, ll, j, cdam[NDEVICES+1];\r
 \r
        /* a critical hit occured */\r
        if (hit < (275.0-25.0*skill)*(1.0+0.5*Rand())) return;\r
@@ -502,7 +568,7 @@ void attack(int k) {
                        prout("  ");\r
                        r = (Rand()+Rand())*0.5 -0.5;\r
                        r += 0.002*game.kpower[l]*r;\r
-                       torpedo(course, r, jx, jy, &hit);\r
+                       torpedo(course, r, jx, jy, &hit, 0);\r
                        if (game.state.remkl==0) finish(FWON); /* Klingons did themselves in! */\r
                        if (game.state.galaxy[quadx][quady] == 1000 ||\r
                                alldone) return; /* Supernova or finished */\r
@@ -518,6 +584,7 @@ void attack(int k) {
                        if (absorb > shield) absorb = shield;\r
                        shield -= absorb;\r
                        hit -= hitsh;\r
+                        if (condit==IHDOCKED) dock(0);\r
                        if (propor > 0.1 && hit < 0.005*energy) continue;\r
                }\r
                /* It's a hit -- print out hit size */\r
@@ -541,6 +608,7 @@ void attack(int k) {
                fry(hit);\r
                prout("Hit %g energy %g", hit, energy);\r
                energy -= hit;\r
+                if (condit==IHDOCKED) dock(0);\r
        }\r
        if (energy <= 0) {\r
                /* Returning home upon your shield, not with it... */\r
@@ -585,7 +653,10 @@ void deadkl(int ix, int iy, int type, int ixx, int iyy) {
        /* Added ixx and iyy allow enemy to "move" before dying */\r
 \r
        int i,j;\r
-       \r
+\r
+#ifdef SERGEEV \r
+        skip(1);\r
+#endif /* SERGEEV */\r
        crmena(1, type, 2, ixx, iyy);\r
        /* Decide what kind of enemy it is and update approriately */\r
        if (type == IHR) {\r
@@ -801,7 +872,8 @@ void photon(void) {
                                break;\r
                        }\r
                }\r
-               if (shldup != 0 || condit == IHDOCKED) r *= 1.0 + 0.0001*shield;\r
+               if (shldup || condit == IHDOCKED) r *= 1.0 + 0.0001*shield;\r
+#ifndef SERGEEV\r
                if (n != 1) {\r
                        skip(1);\r
                        proutn("Track for torpedo number %d-  ", i);\r
@@ -810,7 +882,8 @@ void photon(void) {
                        skip(1);\r
                        proutn("Torpedo track- ");\r
                }\r
-               torpedo(course[i], r, sectx, secty, &dummy);\r
+#endif /* SERGEEV */\r
+               torpedo(course[i], r, sectx, secty, &dummy, i);\r
                if (alldone || game.state.galaxy[quadx][quady]==1000) return;\r
        }\r
        if (game.state.remkl==0) finish(FWON);\r
@@ -871,8 +944,8 @@ static int checkshctrl(double rpow) {
        \r
 \r
 void phasers(void) {\r
-       double hits[21], rpow, extra, powrem, over, temp;\r
-       int kz = 0, k=1, i; /* Cheating inhibitor */\r
+       double hits[21], rpow=0, extra, powrem, over, temp;\r
+       int kz = 0, k=1, i, irec=0; /* Cheating inhibitor */\r
        int ifast=0, no=0, ipoop=1, msgflag = 1;\r
        enum {NOTSET, MANUAL, FORCEMAN, AUTOMATIC} automode = NOTSET;\r
        int key=0;\r
@@ -905,7 +978,6 @@ void phasers(void) {
                ifast = 1;\r
                \r
        }\r
-       ididit = 1;\r
        /* Original code so convoluted, I re-did it all */\r
        while (automode==NOTSET) {\r
                key=scan();\r
@@ -938,7 +1010,6 @@ void phasers(void) {
                        }\r
                        else {\r
                                huh();\r
-                               ididit = 0;\r
                                return;\r
                        }\r
                }\r
@@ -972,25 +1043,31 @@ void phasers(void) {
                                key = scan();\r
                        }\r
                        if (key != IHREAL && nenhere != 0) {\r
-                               prout("Phasers locked on target. Energy available: %.2f", ifast?energy-200.0:energy);\r
+                                prout("Phasers locked on target. Energy available: %.2f",\r
+                                   ifast?energy-200.0:energy,1,2);\r
                        }\r
+                        irec=0;\r
                        do {\r
-                               while (key != IHREAL) {\r
+                                        chew();\r
+                                        if (!kz) for (i = 1; i <= nenhere; i++)\r
+                                                     irec+=fabs(game.kpower[i])/(PHASEFAC*pow(0.90,game.kdist[i]))*\r
+                                                     (1.01+0.05*Rand()) + 1.0;\r
+                                        kz=1;\r
+                                        proutn("(%d) units required. ", irec);\r
                                        chew();\r
-                                       proutn("Units to fire=");\r
+                                       proutn("Units to fire= ");\r
                                        key = scan();\r
-                               }\r
-                               rpow = aaitem;\r
-                               if (rpow >= (ifast?energy-200:energy)) {\r
-                                   proutn("Energy available= %.2f",\r
-                                       ifast?energy-200:energy);\r
+                                        if (key!=IHREAL) return;\r
+                                       rpow = aaitem;\r
+                                       if (rpow > (ifast?energy-200:energy)) {\r
+                                           proutn("Energy available= %.2f",\r
+                                           ifast?energy-200:energy);\r
                                        skip(1);\r
                                        key = IHEOL;\r
                                }\r
-                       } while (rpow >= (ifast?energy-200:energy));\r
+                       } while (rpow > (ifast?energy-200:energy));\r
                        if (rpow<=0) {\r
                                /* chicken out */\r
-                               ididit = 0;\r
                                chew();\r
                                return;\r
                        }\r
@@ -1020,6 +1097,7 @@ void phasers(void) {
                                }\r
                                if (powrem > 0.0) extra += powrem;\r
                                hittem(hits);\r
+                                ididit=1;\r
                        }\r
                        if (extra > 0 && alldone == 0) {\r
                                if (ithere) {\r
@@ -1071,12 +1149,14 @@ void phasers(void) {
                                }\r
                                if (key == IHEOL) {\r
                                        chew();\r
-                                       if (ipoop && k > kz) {\r
-                                               int irec=(fabs(game.kpower[k])/(PHASEFAC*pow(0.9,game.kdist[k])))*\r
+                                        if (ipoop && k > kz)\r
+                                                irec=(fabs(game.kpower[k])/(PHASEFAC*pow(0.9,game.kdist[k])))*\r
                                                                 (1.01+0.05*Rand()) + 1.0;\r
-                                               kz = k;\r
-                                               proutn("(%d)", irec);\r
-                                       }\r
+                                       kz = k;\r
+                                       proutn("(");\r
+                                        if (game.damage[DCOMPTR]==0) proutn("%d", irec);\r
+                                        else proutn("??");\r
+                                       proutn(")  ");\r
                                        proutn("units to fire at ");\r
                                        crmena(0, ienm, 2, ii, jj);\r
                                        proutn("-  ");\r
@@ -1089,7 +1169,6 @@ void phasers(void) {
                                        }\r
                                if (key == IHALPHA) {\r
                                        huh();\r
-                                       ididit = 0;\r
                                        return;\r
                                }\r
                                if (key == IHEOL) {\r
@@ -1107,20 +1186,16 @@ void phasers(void) {
                                rpow += aaitem;\r
                                /* If total requested is too much, inform and start over */\r
                                \r
-                               if (rpow >= (ifast?energy-200:energy)) {\r
+                               if (rpow > (ifast?energy-200:energy)) {\r
                                        prout("Available energy exceeded -- try again.");\r
                                        chew();\r
-                                       key = IHEOL;\r
-                                       k = 1;\r
-                                       msgflag = 1;\r
-                                       continue;\r
+                                        return;\r
                                }\r
                                key = scan(); /* scan for next value */\r
                                k++;\r
                        }\r
                        if (rpow == 0.0) {\r
                                /* zero energy -- abort */\r
-                               ididit = 0;\r
                                chew();\r
                                return;\r
                        }\r
@@ -1135,6 +1210,7 @@ void phasers(void) {
                        }\r
                        hittem(hits);\r
                        ididit=1;\r
+               case NOTSET:;   /* avoid gcc warning */\r
        }\r
        /* Say shield raised or malfunction, if necessary */\r
        if (alldone) return;\r
@@ -1158,6 +1234,9 @@ void phasers(void) {
 \r
 void hittem(double *hits) {\r
        double kp, kpow, wham, hit, dustfac, kpini;\r
+#ifdef SERGEEV\r
+       int cx, cy;\r
+#endif /* SERGEEV */\r
        int nenhr2=nenhere, k=1, kk=1, ii, jj, ienm;\r
 \r
        skip(1);\r
@@ -1174,6 +1253,27 @@ void hittem(double *hits) {
                ii = game.kx[kk];\r
                jj = game.ky[kk];\r
                if (hit > 0.005) {\r
+#ifdef SERGEEV\r
+                        if (game.damage[DSRSENS]==0){\r
+                           crx=wherex();\r
+                           cry=wherey();\r
+                           setwnd(1);\r
+                           drawmaps(2);\r
+                           gotoxy(jj*2+3,ii+2);\r
+                           highvideo();\r
+                           proutn("%c", game.quad[ii][jj]);\r
+                           gotoxy(wherex()-1,wherey());\r
+                           sound(500);\r
+                           delay(1000);\r
+                           nosound();\r
+                           lowvideo();\r
+                           proutn("%c", game.quad[ii][jj]);\r
+                           setwnd(4);\r
+                           gotoxy(crx,cry);\r
+                           _setcursortype(_NORMALCURSOR);\r
+                           delay(500);\r
+                        }\r
+#endif /* SERGEEV */\r
                        proutn("%d unit hit on ", (int)hit);\r
                }\r
                else\r
index 194901df53c3f9d2e69e1b0d9edca42ab070d6ed..10c030ae0bb25abe52ed964040b82b26f4a90e35 100644 (file)
--- a/events.c
+++ b/events.c
@@ -585,7 +585,7 @@ void nova(int ix, int iy) {
        \r
        \r
 void snova(int insx, int insy) {\r
-       int comdead, nqx, nqy, nsx, nsy, num, kldead, iscdead;\r
+        int comdead, nqx=0, nqy=0, nsx, nsy, num, kldead, iscdead;\r
        int nrmdead, npdead;\r
        int insipient=0;\r
 \r
diff --git a/io.c b/io.c
index 81f1c8a18b70fdb3953cb5d7530f43de77d1b1f6..8b766e9876be9a51ed8e633d4a4d8b360574c2f0 100644 (file)
--- a/io.c
+++ b/io.c
@@ -1,19 +1,37 @@
+#ifdef SERGEEV
+#define _GNU_SOURCE
+#endif /* SERGEEV */
 #include <stdio.h>
+#ifdef SERGEEV
+#include <unistd.h>
+#endif /* SERGEEV */
 #include <termios.h>
 #include <curses.h>
 #include <signal.h>
 #include <ctype.h>
 #include <stdarg.h>
+#ifdef SERGEEV
+#include <conio.h>
+#endif /* SERGEEV */
 #ifdef MSDOS
 #include <dos.h>
 #endif
 #include <time.h>
 
+#ifdef SERGEEV
+#include "sstlinux.h"
+#endif /* SERGEEV */
 #include "sst.h"
 
+#ifndef SERGEEV
 static int linecount;  /* for paging */
+#endif /* SERGEEV */
 static int screenheight = 24, screenwidth = 80;
+#ifndef SERGEEV
 static int curses = FALSE;
+#else /* SERGEEV */
+static int curses = TRUE;
+#endif /* SERGEEV */
 
 static void outro(int sig) {
 /* wrap up, either normally or due to signal */
@@ -41,7 +59,11 @@ void iostart(int usecurses) {
        if(signal(SIGQUIT,SIG_IGN) != SIG_IGN)
            (void)signal(SIGQUIT,fastexit);
 
+#ifndef SERGEEV
        if (curses = usecurses) {
+#else /* SERGEEV */
+       if ((curses = usecurses)) {
+#endif /* SERGEEV */
                (void)initscr();
 #ifdef KEY_MIN
                keypad(stdscr, TRUE);
@@ -83,7 +105,13 @@ void clearscreen(void) {
 }
 
 void pause_game(int i) {
+#ifndef SERGEEV
     char buf[BUFSIZ], *prompt;
+#else /* SERGEEV */
+       char *prompt;
+        drawmaps(0);
+        setwnd(5);
+#endif /* SERGEEV */
        if (i==1) {
                if (skill > 2)
                        prompt = "[ANOUNCEMENT ARRIVING...]";
@@ -97,6 +125,7 @@ void pause_game(int i) {
                        prompt = "[PRESS ENTER TO CONTINUE]";
 
        }
+#ifndef SERGEEV
        if (curses) {
            waddch(stdscr, '\n');
                waddstr(stdscr, prompt);
@@ -112,10 +141,18 @@ void pause_game(int i) {
                }
                linecount = 0;
        }
+#else /* SERGEEV */
+       proutn(prompt);
+       getche();
+        clrscr();
+        setwnd(4);
+        clrscr();
+#endif /* SERGEEV */
 }
 
 
 void skip(int i) {
+#ifndef SERGEEV
     while (i-- > 0) {
        if (curses) {
            int y, x;
@@ -131,42 +168,99 @@ void skip(int i) {
            else
                putchar('\n');
        }
+#else /* SERGEEV */
+        while (i-- > 0) proutn("\n\r");
+}
+
+static void vproutn(char *fmt, va_list ap) {
+    char *strbuf, *p, *s;
+    vasprintf(&strbuf, fmt, ap);
+    p=s=strbuf;
+    if ((curwnd==4)&&(wherey()==wnds[curwnd].wndbottom-wnds[curwnd].wndtop)){
+       if (strchr(strbuf,'\n')){
+          p=strchr(strbuf,'\n');
+          p[0]=0;
+          cprintf("%s",strbuf);
+          p++;
+          pause_game(0);
+       }
+#endif /* SERGEEV */
     }
+#ifdef SERGEEV
+    if ((curwnd==4)&&(wherey()>wnds[curwnd].wndbottom-wnds[curwnd].wndtop+1))
+       cprintf("\r");
+//        setwnd(curwnd);
+    if (strchr(s,'\n') || strchr(s,'\r')) clreol();
+    cprintf("%s",p);
+    free(strbuf);
+#endif /* SERGEEV */
 }
 
 void proutn(char *fmt, ...) {
     va_list ap;
     va_start(ap, fmt);
+#ifndef SERGEEV
     if (curses) {
        vw_printw(stdscr, fmt, ap);
         wrefresh(stdscr);
     } else
        vprintf(fmt, ap);
+#else /* SERGEEV */
+    vproutn(fmt, ap);
+#endif /* SERGEEV */
     va_end(ap);
 }
 
 void prout(char *fmt, ...) {
     va_list ap;
     va_start(ap, fmt);
+#ifndef SERGEEV
     if (curses) {
        vw_printw(stdscr, fmt, ap);
        wrefresh(stdscr);
     } else
        vprintf(fmt, ap);
+#else /* SERGEEV */
+    vproutn(fmt, ap);
+#endif /* SERGEEV */
     va_end(ap);
     skip(1);
 }
 
 void proutc(char *line) {
     line[strlen(line)-1] = '\0';
+#ifndef SERGEEV
     if (curses)
        waddstr(stdscr, line);
     else
        fputs(line, stdout);
+#else /* SERGEEV */
+    cputs(line);
+#endif /* SERGEEV */
     skip(1);
 }
 
+#ifdef SERGEEV
+static void prchr(char *s){
+     char str[2];
+     strncpy(str,s,1);
+     str[1]=0;
+     proutn(str);
+}
+
+static void vprouts(char *fmt, va_list ap) {
+    char *s;
+    vasprintf(&s, fmt, ap);
+    while (*s) {
+        prchr(s++);
+        delay(30);
+    }
+    free(s);
+}
+
+#endif /* SERGEEV */
 void prouts(char *fmt, ...) {
+#ifndef SERGEEV
        clock_t endTime;
        char *s, buf[BUFSIZ];
        /* print slowly! */
@@ -187,12 +281,28 @@ void prouts(char *fmt, ...) {
                    fflush(stdout);
                }
        }
+#else /* SERGEEV */
+    va_list ap;
+    va_start(ap, fmt);
+    vprouts(fmt, ap);
+    va_end(ap);
+#endif /* SERGEEV */
 }
 
+#ifndef SERGEEV
 void getline(char *line, int max) {
+#else /* SERGEEV */
+void cgetline(char *line, int max) {
+#endif /* SERGEEV */
     if (curses) {
+#ifndef SERGEEV
        wgetnstr(stdscr, line, max);
        wrefresh(stdscr);
+#else /* SERGEEV */
+       line[0]=max-1;
+       cgets(line);
+       memmove(line,&line[2],max-3);
+#endif /* SERGEEV */
     } else {
        fgets(line, max, stdin);
         line[strlen(line)-1] = '\0';
index c9c42b183eeb64acbd106b0a6eb8934854b5dfbb..1d41c146bf3ae08db8fce5240c06ce9b061f7e30 100644 (file)
--- a/makefile
+++ b/makefile
@@ -2,12 +2,16 @@
 
 VERS=$(shell sed <sst.spec -n -e '/Version: \(.*\)/s//\1/p')
 
+#ifndef SERGEEV
 CFLAGS=     -O -g -DSSTDOC='"/usr/share/doc/sst/sst.doc"'
+#else /* SERGEEV */
+CFLAGS= -O1 -g -Wall -DSSTDOC='"/usr/share/doc/sst/sst.doc"'
+#endif /* SERGEEV */
 
 .c.o:
        $(CC) $(CFLAGS) -c $<
 
-CFILES= sst.c finish.c reports.c setup.c moving.c battle.c events.c ai.c planets.c io.c
+CFILES= sst.c finish.c reports.c setup.c moving.c battle.c events.c ai.c planets.c io.c sstlinux.c conio.c
 OFILES= $(CFILES:.c=.o)
 HFILES=sst.h
 DOCS = README sst-doc.xml sst.xml sst-layer.xsl TODO
index ec7bc91b4ca0676f45d481991a654879b84679cd..8aa48f07a87d9769871672836120b7e0d1af4c05 100644 (file)
--- a/moving.c
+++ b/moving.c
@@ -887,7 +887,7 @@ void probe(void) {
 void help(void) {\r
        /* There's more than one way to move in this game! */\r
        double ddist, xdist, probf;\r
-       int line, l, ix, iy;\r
+       int line = 0, l, ix, iy;\r
 \r
        chew();\r
        /* Test for conditions which prevent calling for help */\r
index 794b18117afe27d06951e3f3899aac37cd0fb2f7..07a5196946a84c34e24e77d9419631bb9a036d29 100644 (file)
--- a/reports.c
+++ b/reports.c
@@ -217,8 +217,8 @@ void chart(int nn) {
 void srscan(int l) {\r
        static char requests[][3] =\r
                {"","da","co","po","ls","wa","en","to","sh","kl","ti"};\r
-       char *cp;\r
-       int leftside=TRUE, rightside=TRUE, i, j, jj, k=0, nn=FALSE;\r
+       char *cp = NULL;\r
+       int leftside=TRUE, rightside=TRUE, i, j, k=0, nn=FALSE;\r
        int goodScan=TRUE;\r
        switch (l) {\r
                case 1: // SRSCAN\r
@@ -339,7 +339,7 @@ void srscan(int l) {
                        \r
                        \r
 void eta(void) {\r
-       int key, ix1, ix2, iy1, iy2, prompt=FALSE;\r
+       int ix1, ix2, iy1, iy2, prompt=FALSE;\r
        int wfl;\r
        double ttime, twarp, tpower;\r
        if (game.damage[DCOMPTR] != 0.0) {\r
diff --git a/setup.c b/setup.c
index 1d7dd0153679b77abc4e5d21520c216fb44bb48e..8bd5bd190b28143df437eb70ded1a2c29580aa75 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -10,7 +10,6 @@ void prelim(void) {
 }\r
 \r
 void freeze(int boss) {\r
-       char *x, *y;\r
        FILE *fp;\r
        int key;\r
        if (boss) {\r
diff --git a/sst.c b/sst.c
index b456772c5a9a058e5e71a61c1d5f7feaf7313c32..b60b57e5621dab63dc1ff7a0fe888ec49f4e2d3c 100644 (file)
--- a/sst.c
+++ b/sst.c
@@ -201,7 +201,6 @@ static void helpme(void) {
 \r
 static void makemoves(void) {\r
        int i, hitme;\r
-       char ch;\r
        while (TRUE) { /* command loop */\r
                hitme = FALSE;\r
                justin = 0;\r
@@ -385,9 +384,6 @@ static void makemoves(void) {
 \r
 int main(int argc, char **argv) {\r
     int i, option, usecurses = TRUE;\r
-       int hitme;\r
-       char ch;\r
-\r
        while ((option = getopt(argc, argv, "t")) != -1) {\r
            switch (option) {\r
            case 't':\r
@@ -430,6 +426,7 @@ int main(int argc, char **argv) {
        skip(1);\r
        ioend();\r
        puts("May the Great Bird of the Galaxy roost upon your home planet.");\r
+       exit(0);\r
 }\r
 \r
 \r
diff --git a/sst.h b/sst.h
index 63ea4cfa1ef9e957e87d66b440fb24c00093b589..49cd2179c0818d4798a5285f6b5d6312ae71699a 100644 (file)
--- a/sst.h
+++ b/sst.h
@@ -408,7 +408,7 @@ void crmena(int, int, int, int, int);
 void deadkl(int, int, int, int, int);\r
 void timwrp(void);\r
 void movcom(void);\r
-void torpedo(double, double, int, int, double *);\r
+void torpedo(double, double, int, int, double *, int);\r
 void huh(void);\r
 void pause_game(int);\r
 void nova(int, int);\r