git rid of compiler warns
authorKevin Layer <layer@ucbvax.Berkeley.EDU>
Sat, 28 May 1983 05:58:12 +0000 (21:58 -0800)
committerKevin Layer <layer@ucbvax.Berkeley.EDU>
Sat, 28 May 1983 05:58:12 +0000 (21:58 -0800)
SCCS-vsn: games/trek/dumpgame.c 4.2
SCCS-vsn: games/trek/phaser.c 4.2
SCCS-vsn: games/trek/setup.c 4.2
SCCS-vsn: games/trek/shield.c 4.2

usr/src/games/trek/dumpgame.c
usr/src/games/trek/phaser.c
usr/src/games/trek/setup.c
usr/src/games/trek/shield.c

index 98d3e96..d7e6f01 100644 (file)
@@ -1,11 +1,11 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)dumpgame.c 4.1     (Berkeley)      %G%";
+static char sccsid[] = "@(#)dumpgame.c 4.2     (Berkeley)      %G%";
 #endif not lint
 
 # include      "trek.h"
 
 /***  THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/
 #endif not lint
 
 # include      "trek.h"
 
 /***  THIS CONSTANT MUST CHANGE AS THE DATA SPACES CHANGE ***/
-# define       VERSION         1
+# define       VERSION         2
 
 struct dump
 {
 
 struct dump
 {
@@ -13,17 +13,18 @@ struct dump
        int     count;
 };
 
        int     count;
 };
 
-struct dump    Dump_template[]
+
+struct dump    Dump_template[] =
 {
 {
-       &Ship,          sizeof Ship,
-       &Now,           sizeof Now,
-       &Param,         sizeof Param,
-       &Etc,           sizeof Etc,
-       &Game,          sizeof Game,
-       &Sect,          sizeof Sect,
-       &Quad,          sizeof Quad,
-       &Move,          sizeof Move,
-       &Event,         sizeof Event,
+       (char *)&Ship,          sizeof (Ship),
+       (char *)&Now,           sizeof (Now),
+       (char *)&Param,         sizeof (Param),
+       (char *)&Etc,           sizeof (Etc),
+       (char *)&Game,          sizeof (Game),
+       (char *)Sect,           sizeof (Sect),
+       (char *)Quad,           sizeof (Quad),
+       (char *)&Move,          sizeof (Move),
+       (char *)Event,          sizeof (Event),
        0
 };
 
        0
 };
 
@@ -113,9 +114,9 @@ int fd1;
 
        for (d = Dump_template; d->area; d++)
        {
 
        for (d = Dump_template; d->area; d++)
        {
-               if (read(fd, &junk, sizeof junk) != sizeof junk)
+               if (read(fd, &junk, sizeof junk) != (sizeof junk))
                        return (1);
                        return (1);
-               if (junk != d->area)
+               if ((char *)junk != d->area)
                        return (1);
                i = d->count;
                if (read(fd, d->area, i) != i)
                        return (1);
                i = d->count;
                if (read(fd, d->area, i) != i)
index 19df6d5..f7fbd18 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)phaser.c   4.1     (Berkeley)      %G%";
+static char sccsid[] = "@(#)phaser.c   4.2     (Berkeley)      %G%";
 #endif not lint
 
 # include      "trek.h"
 #endif not lint
 
 # include      "trek.h"
@@ -38,9 +38,9 @@ static char sccsid[] = "@(#)phaser.c  4.1     (Berkeley)      %G%";
 **     Uses trace flag 30
 */
 
 **     Uses trace flag 30
 */
 
-struct cvntab  Matab[]
+struct cvntab  Matab[] =
 {
 {
-       "m",            "anual",                1,              0,
+       "m",            "anual",                (int (*)())1,           0,
        "a",            "utomatic",             0,              0,
        0
 };
        "a",            "utomatic",             0,              0,
        0
 };
@@ -48,8 +48,8 @@ struct cvntab Matab[]
 struct banks
 {
        int     units;
 struct banks
 {
        int     units;
-       float   angle;
-       float   spread;
+       double  angle;
+       double  spread;
 };
 
 
 };
 
 
@@ -105,7 +105,7 @@ phaser()
        if (!manual)
        {
                ptr = getcodpar("Manual or automatic", Matab);
        if (!manual)
        {
                ptr = getcodpar("Manual or automatic", Matab);
-               manual = ptr->value;
+               manual = (int) ptr->value;
        }
        if (!manual && damaged(COMPUTER))
        {
        }
        if (!manual && damaged(COMPUTER))
        {
@@ -135,7 +135,7 @@ phaser()
                                        return;
                                if (hit == 0)
                                        break;
                                        return;
                                if (hit == 0)
                                        break;
-                               extra =+ hit;
+                               extra += hit;
                                if (extra > Ship.energy)
                                {
                                        printf("available energy exceeded.  ");
                                if (extra > Ship.energy)
                                {
                                        printf("available energy exceeded.  ");
@@ -152,7 +152,7 @@ phaser()
                                if (b->spread < 0 || b->spread > 1)
                                        return;
                        }
                                if (b->spread < 0 || b->spread > 1)
                                        return;
                        }
-                       Ship.energy =- extra;
+                       Ship.energy -= extra;
                }
                extra = 0;
        }
                }
                extra = 0;
        }
@@ -175,7 +175,7 @@ phaser()
                                continue;
                        }
                        flag = 0;
                                continue;
                        }
                        flag = 0;
-                       Ship.energy =- hit;
+                       Ship.energy -= hit;
                        extra = hit;
                        n = Etc.nkling;
                        if (n > NBANKS)
                        extra = hit;
                        n = Etc.nkling;
                        if (n > NBANKS)
@@ -187,9 +187,9 @@ phaser()
                                b = &bank[i];
                                distfactor = k->dist;
                                anglefactor = ALPHA * BETA * OMEGA / (distfactor * distfactor + EPSILON);
                                b = &bank[i];
                                distfactor = k->dist;
                                anglefactor = ALPHA * BETA * OMEGA / (distfactor * distfactor + EPSILON);
-                               anglefactor =* GAMMA;
+                               anglefactor *= GAMMA;
                                distfactor = k->power;
                                distfactor = k->power;
-                               distfactor =/ anglefactor;
+                               distfactor /= anglefactor;
                                hitreqd[i] = distfactor + 0.5;
                                dx = Ship.sectx - k->x;
                                dy = k->y - Ship.secty;
                                hitreqd[i] = distfactor + 0.5;
                                dx = Ship.sectx - k->x;
                                dy = k->y - Ship.secty;
@@ -204,12 +204,12 @@ phaser()
                                                distfactor, anglefactor);
                                }
 #                              endif
                                                distfactor, anglefactor);
                                }
 #                              endif
-                               extra =- b->units;
+                               extra -= b->units;
                                hit = b->units - hitreqd[i];
                                if (hit > 0)
                                {
                                hit = b->units - hitreqd[i];
                                if (hit > 0)
                                {
-                                       extra =+ hit;
-                                       b->units =- hit;
+                                       extra += hit;
+                                       b->units -= hit;
                                }
                        }
 
                                }
                        }
 
@@ -224,12 +224,12 @@ phaser()
                                                continue;
                                        if (hit >= extra)
                                        {
                                                continue;
                                        if (hit >= extra)
                                        {
-                                               b->units =+ extra;
+                                               b->units += extra;
                                                extra = 0;
                                                break;
                                        }
                                        b->units = hitreqd[i];
                                                extra = 0;
                                                break;
                                        }
                                        b->units = hitreqd[i];
-                                       extra =- hit;
+                                       extra -= hit;
                                }
                                if (extra > 0)
                                        printf("%d units overkill\n", extra);
                                }
                                if (extra > 0)
                                        printf("%d units overkill\n", extra);
@@ -298,11 +298,11 @@ phaser()
                        ** tion applies.
                        */
                        distfactor = BETA + franf();
                        ** tion applies.
                        */
                        distfactor = BETA + franf();
-                       distfactor =* ALPHA + b->spread;
-                       distfactor =* OMEGA;
+                       distfactor *= ALPHA + b->spread;
+                       distfactor *= OMEGA;
                        anglefactor = k->dist;
                        anglefactor = k->dist;
-                       distfactor =/ anglefactor * anglefactor + EPSILON;
-                       distfactor =* b->units;
+                       distfactor /= anglefactor * anglefactor + EPSILON;
+                       distfactor *= b->units;
                        dx = Ship.sectx - k->x;
                        dy = k->y - Ship.secty;
                        anglefactor = atan2(dy, dx) - b->angle;
                        dx = Ship.sectx - k->x;
                        dy = k->y - Ship.secty;
                        anglefactor = atan2(dy, dx) - b->angle;
@@ -313,12 +313,12 @@ phaser()
                                continue;
                        }
                        hit = anglefactor * distfactor + 0.5;
                                continue;
                        }
                        hit = anglefactor * distfactor + 0.5;
-                       k->power =- hit;
+                       k->power -= hit;
                        printf("%d unit hit on Klingon", hit);
                        if (!damaged(SRSCAN))
                                printf(" at %d,%d", k->x, k->y);
                        printf("\n");
                        printf("%d unit hit on Klingon", hit);
                        if (!damaged(SRSCAN))
                                printf(" at %d,%d", k->x, k->y);
                        printf("\n");
-                       b->units =- hit;
+                       b->units -= hit;
                        if (k->power <= 0)
                        {
                                killk(k->x, k->y);
                        if (k->power <= 0)
                        {
                                killk(k->x, k->y);
@@ -330,7 +330,7 @@ phaser()
 
        /* compute overkill */
        for (i = 0; i < NBANKS; i++)
 
        /* compute overkill */
        for (i = 0; i < NBANKS; i++)
-               extra =+ bank[i].units;
+               extra += bank[i].units;
        if (extra > 0)
                printf("\n%d units expended on empty space\n", extra);
 }
        if (extra > 0)
                printf("\n%d units expended on empty space\n", extra);
 }
index 4f67bd9..617535d 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)setup.c    4.1     (Berkeley)      %G%";
+static char sccsid[] = "@(#)setup.c    4.2     (Berkeley)      %G%";
 #endif not lint
 
 # include      "trek.h"
 #endif not lint
 
 # include      "trek.h"
@@ -16,23 +16,23 @@ static char sccsid[] = "@(#)setup.c 4.1     (Berkeley)      %G%";
 **     Game restart and tournament games are handled here.
 */
 
 **     Game restart and tournament games are handled here.
 */
 
-struct cvntab  Lentab[]
+struct cvntab  Lentab[] =
 {
 {
-       "s",            "hort",                 1,              0,
-       "m",            "edium",                2,              0,
-       "l",            "ong",                  4,              0,
+       "s",            "hort",                 (int (*)())1,           0,
+       "m",            "edium",                (int (*)())2,           0,
+       "l",            "ong",                  (int (*)())4,           0,
        "restart",      "",                     0,              0,
        0
 };
 
        "restart",      "",                     0,              0,
        0
 };
 
-struct cvntab  Skitab[]
+struct cvntab  Skitab[] =
 {
 {
-       "n",            "ovice",                1,              0,
-       "f",            "air",                  2,              0,
-       "g",            "ood",                  3,              0,
-       "e",            "xpert",                4,              0,
-       "c",            "ommodore",             5,              0,
-       "i",            "mpossible",            6,              0,
+       "n",            "ovice",                (int (*)())1,           0,
+       "f",            "air",                  (int (*)())2,           0,
+       "g",            "ood",                  (int (*)())3,           0,
+       "e",            "xpert",                (int (*)())4,           0,
+       "c",            "ommodore",             (int (*)())5,           0,
+       "i",            "mpossible",            (int (*)())6,           0,
        0
 };
 
        0
 };
 
@@ -40,7 +40,7 @@ setup()
 {
        struct cvntab           *r;
        register int            i, j;
 {
        struct cvntab           *r;
        register int            i, j;
-       float                   f;
+       double                  f;
        int                     d;
        int                     fd;
        int                     klump;
        int                     d;
        int                     fd;
        int                     klump;
@@ -51,7 +51,7 @@ setup()
        while (1)
        {
                r = getcodpar("What length game", Lentab);
        while (1)
        {
                r = getcodpar("What length game", Lentab);
-               Game.length = r->value;
+               Game.length = (int) r->value;
                if (Game.length == 0)
                {
                        if (restartgame())
                if (Game.length == 0)
                {
                        if (restartgame())
@@ -61,7 +61,7 @@ setup()
                break;
        }
        r = getcodpar("What skill game", Skitab);
                break;
        }
        r = getcodpar("What skill game", Skitab);
-       Game.skill = r->value;
+       Game.skill = (int) r->value;
        Game.tourn = 0;
        getstrpar("Enter a password", Game.passwd, 14, 0);
        if (sequal(Game.passwd, "tournament"))
        Game.tourn = 0;
        getstrpar("Enter a password", Game.passwd, 14, 0);
        if (sequal(Game.passwd, "tournament"))
@@ -70,7 +70,7 @@ setup()
                Game.tourn = 1;
                d = 0;
                for (i = 0; Game.passwd[i]; i++)
                Game.tourn = 1;
                d = 0;
                for (i = 0; Game.passwd[i]; i++)
-                       d =+ Game.passwd[i] << i;
+                       d += Game.passwd[i] << i;
                srand(d);
        }
        Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
                srand(d);
        }
        Param.bases = Now.bases = ranf(6 - Game.skill) + 2;
@@ -124,7 +124,7 @@ setup()
        Param.damprob[XPORTER] = 80;    /* transporter           8.0% */
        /* check to see that I didn't blow it */
        for (i = j = 0; i < NDEV; i++)
        Param.damprob[XPORTER] = 80;    /* transporter           8.0% */
        /* check to see that I didn't blow it */
        for (i = j = 0; i < NDEV; i++)
-               j =+ Param.damprob[i];
+               j += Param.damprob[i];
        if (j != 1000)
                syserr("Device probabilities sum to %d", j);
        Param.dockfac = 0.5;
        if (j != 1000)
                syserr("Device probabilities sum to %d", j);
        Param.dockfac = 0.5;
@@ -137,7 +137,7 @@ setup()
        i = Game.skill;
        Param.klingpwr = 100 + 150 * i;
        if (i >= 6)
        i = Game.skill;
        Param.klingpwr = 100 + 150 * i;
        if (i >= 6)
-               Param.klingpwr =+ 150;
+               Param.klingpwr += 150;
        Param.phasfac = 0.8;
        Param.hitfac = 0.5;
        Param.klingcrew = 200;
        Param.phasfac = 0.8;
        Param.hitfac = 0.5;
        Param.klingcrew = 200;
@@ -197,7 +197,7 @@ setup()
                        q->scanned = -1;
                        q->stars = ranf(9) + 1;
                        q->holes = ranf(3) - q->stars / 5;
                        q->scanned = -1;
                        q->stars = ranf(9) + 1;
                        q->holes = ranf(3) - q->stars / 5;
-                       q->systemname = 0;
+                       q->qsystemname = 0;
                }
 
        /* select inhabited starsystems */
                }
 
        /* select inhabited starsystems */
@@ -208,8 +208,8 @@ setup()
                        i = ranf(NQUADS);
                        j = ranf(NQUADS);
                        q = &Quad[i][j];
                        i = ranf(NQUADS);
                        j = ranf(NQUADS);
                        q = &Quad[i][j];
-               } while (q->systemname);
-               q->systemname = d;
+               } while (q->qsystemname);
+               q->qsystemname = d;
        }
 
        /* position starbases */
        }
 
        /* position starbases */
@@ -249,8 +249,8 @@ setup()
                        q = &Quad[ix][iy];
                        if (q->klings + klump > MAXKLQUAD)
                                continue;
                        q = &Quad[ix][iy];
                        if (q->klings + klump > MAXKLQUAD)
                                continue;
-                       q->klings =+ klump;
-                       i =- klump;
+                       q->klings += klump;
+                       i -= klump;
                        break;
                }
        }
                        break;
                }
        }
index 5e477e5..7bea211 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)shield.c   4.1     (Berkeley)      %G%";
+static char sccsid[] = "@(#)shield.c   4.2     (Berkeley)      %G%";
 #endif not lint
 
 # include      "trek.h"
 #endif not lint
 
 # include      "trek.h"
@@ -22,9 +22,9 @@ static char sccsid[] = "@(#)shield.c  4.1     (Berkeley)      %G%";
 **     so you get partial hits.
 */
 
 **     so you get partial hits.
 */
 
-struct cvntab Udtab[]
+struct cvntab Udtab[] =
 {
 {
-       "u",            "p",                    1,              0,
+       "u",            "p",                    (int (*)())1,           0,
        "d",            "own",                  0,              0,
        0
 };
        "d",            "own",                  0,              0,
        0
 };
@@ -76,14 +76,14 @@ int f;
        if (f <= 0 && !testnl())
        {
                r = getcodpar("Up or down", Udtab);
        if (f <= 0 && !testnl())
        {
                r = getcodpar("Up or down", Udtab);
-               i = r->value;
+               i = (int) r->value;
        }
        else
        {
                if (*stat)
        }
        else
        {
                if (*stat)
-                       printf(-1, s, "%s %s up.  Do you want %s down", device, dev2, dev3);
+                       sprintf(s, "%s %s up.  Do you want %s down", device, dev2, dev3);
                else
                else
-                       printf(-1, s, "%s %s down.  Do you want %s up", device, dev2, dev3);
+                       sprintf(s, "%s %s down.  Do you want %s up", device, dev2, dev3);
                if (!getynpar(s))
                        return;
                i = !*stat;
                if (!getynpar(s))
                        return;
                i = !*stat;
@@ -99,7 +99,7 @@ int   f;
        }
        if (i)
                if (f >= 0)
        }
        if (i)
                if (f >= 0)
-                       Ship.energy =- Param.shupengy;
+                       Ship.energy -= Param.shupengy;
                else
                        Ship.cloakgood = 0;
        Move.free = 0;
                else
                        Ship.cloakgood = 0;
        Move.free = 0;