Change the condition field from an uint with #defines to an enum.
[super-star-trek.git] / src / setup.c
index 80ab2e4bca4db1d3ec9e0b3248ec16a15c4f2da1..5912f1d30fd809b38cf5d826ba6b148815927956 100644 (file)
@@ -121,7 +121,7 @@ void abandn(void)
     struct quadrant *q;
 
     chew();
-    if (game.condit==IHDOCKED) {
+    if (game.condition==docked) {
        if (game.ship!=IHE) {
            prout("You cannot abandon Ye Faerie Queene.");
            return;
@@ -177,7 +177,7 @@ void abandn(void)
 
        /* If at least one base left, give 'em the Faerie Queene */
        skip(1);
-       game.icrystl = 0; /* crystals are lost */
+       game.icrystl = false; /* crystals are lost */
        game.nprobes = 0; /* No probes */
        prout("You are captured by Klingons and released to");
        prout("the Federation in a prisoner-of-war exchange.");
@@ -209,11 +209,11 @@ void abandn(void)
     prout("Starfleet puts you in command of another ship,");
     prout("the Faerie Queene, which is antiquated but,");
     prout("still useable.");
-    if (game.icrystl!=0) prout("The dilithium crystals have been moved.");
+    if (game.icrystl) prout("The dilithium crystals have been moved.");
     game.imine = false;
     game.iscraft=0; /* Galileo disappears */
     /* Resupply ship */
-    game.condit=IHDOCKED;
+    game.condition=docked;
     for (l = 0; l < NDEVICES; l++) 
        game.damage[l] = 0.0;
     game.damage[DSHUTTL] = -1;
@@ -256,8 +256,8 @@ void setup(bool needprompt)
     game.battle.x = game.battle.y = 0;
     game.state.date = game.indate = 100.0*(int)(31.0*Rand()+20.0);
     game.nkinks = game.nhelp = game.casual = game.abandoned = 0;
-    game.resting = game.imine = game.icraft = false;
-    game.isatb = game.iscate = game.icrystl = game.state.nplankl = 0;
+    game.resting = game.imine = game.icrystl = game.icraft = false;
+    game.isatb = game.iscate = game.state.nplankl = 0;
     game.state.starkl = game.state.basekl = 0;
     game.iscraft = 1;
     game.landed = -1;
@@ -579,11 +579,11 @@ coord dropin(int iquad)
 void newcnd(void)
 /* update our alert status */
 {
-    game.condit = IHGREEN;
-    if (game.energy < 1000.0) game.condit = IHYELLOW;
+    game.condition = green;
+    if (game.energy < 1000.0) game.condition = yellow;
     if (game.state.galaxy[game.quadrant.x][game.quadrant.y].klingons || game.state.galaxy[game.quadrant.x][game.quadrant.y].romulans)
-       game.condit = IHRED;
-    if (!game.alive) game.condit=IHDEAD;
+       game.condition = red;
+    if (!game.alive) game.condition=dead;
 }
 
 coord newkling(int i)
@@ -607,7 +607,7 @@ void newqad(bool shutup)
     game.justin = true;
     game.base.x = game.base.y = 0;
     game.klhere = 0;
-    game.comhere = 0;
+    game.comhere = false;
     game.plnet.x = game.plnet.y = 0;
     game.ishere = false;
     game.irhere = 0;
@@ -620,7 +620,7 @@ void newqad(bool shutup)
     game.ithere = false;
     iqhere = false;
     iqengry = false;
-    game.iseenit = 0;
+    game.iseenit = false;
     if (game.iscate) {
        // Attempt to escape Super-commander, so tbeam back!
        game.iscate = 0;
@@ -654,7 +654,7 @@ void newqad(bool shutup)
        if (i <= game.state.remcom) {
            game.quad[w.x][w.y] = IHC;
            game.kpower[game.klhere] = 950.0+400.0*Rand()+50.0*game.skill;
-           game.comhere = 1;
+           game.comhere = true;
        }
 
        // If we need a super-commander, promote a Klingon
@@ -684,7 +684,7 @@ void newqad(bool shutup)
        else
            game.plnet = dropin(IHW);
     }
-    // Check for game.condition
+    // Check for condition
     newcnd();
     // And finally the stars
     for (i = 1; i <= q->stars; i++) 
@@ -692,7 +692,7 @@ void newqad(bool shutup)
 
     // Check for RNZ
     if (game.irhere > 0 && game.klhere == 0 && (q->planet == NOPLANET || game.state.plnets[q->planet].inhabited == UNINHABITED)) {
-       game.neutz = 1;
+       game.neutz = true;
        if (!damaged(DRADIO)) {
            skip(1);
            prout("LT. Uhura- \"Captain, an urgent message.");
@@ -735,8 +735,7 @@ void newqad(bool shutup)
            game.quad[game.tholian.x][game.tholian.y] = IHT;
            game.ithere = true;
            game.nenhere++;
-           game.ks[game.nenhere].x = game.tholian.x;
-           game.ks[game.nenhere].y = game.tholian.y;
+           game.ks[game.nenhere] = game.tholian;
            game.kdist[game.nenhere] = game.kavgd[game.nenhere] =
                distance(game.sector, game.tholian);
            game.kpower[game.nenhere] = Rand()*400.0 +100.0 +25.0*game.skill;