Parallel cleanups in the C and scratch Python code.
[super-star-trek.git] / src / ai.c
index 733c62f83351b9540bb72a5b6f00e164ff264cbf..80465ba11e33fb9574d0f24a8a2c1fde5ace37ba 100644 (file)
--- a/src/ai.c
+++ b/src/ai.c
@@ -10,8 +10,8 @@ static bool tryexit(coord look, int ienm, int loccom, bool irun)
     iq.y = game.quadrant.y+(look.y+(QUADSIZE-1))/QUADSIZE - 1;
     if (!VALID_QUADRANT(iq.x,iq.y) ||
        game.state.galaxy[iq.x][iq.y].supernova ||
-       game.state.galaxy[iq.x][iq.y].klingons > 8)
-       return false; /* no can do -- neg energy, supernovae, or >8 Klingons */
+       game.state.galaxy[iq.x][iq.y].klingons > MAXKLQUAD-1)
+       return false; /* no can do -- neg energy, supernovae, or >MAXKLQUAD-1 Klingons */
     if (ienm == IHR) return false; /* Romulans cannot escape! */
     if (!irun) {
        /* avoid intruding on another commander's territory */
@@ -155,7 +155,7 @@ static void movebaddy(coord com, int loccom, feature ienm)
                motion -= game.skill*(2.0-square(Rand()));
        }
        if (idebug)
-           proutn("=== MOTION = %1.2f, FORCES = %1.2f, ", motion, forces);
+           proutn("=== MOTION = %d, FORCES = %1.2f, ", motion, forces);
        /* don't move if no motion */
        if (motion==0) return;
        /* Limit motion according to skill */
@@ -231,7 +231,7 @@ static void movebaddy(coord com, int loccom, feature ienm)
        
     }
     if (idebug)
-       prout("");
+       skip(1);
     /* Put commander in place within same quadrant */
     game.quad[com.x][com.y] = IHDOT;
     game.quad[next.x][next.y] = ienm;
@@ -296,7 +296,7 @@ static bool movescom(coord iq, bool flag, bool *ipage)
 
     if (same(iq, game.quadrant) || !VALID_QUADRANT(iq.x, iq.y) ||
        game.state.galaxy[iq.x][iq.y].supernova ||
-       game.state.galaxy[iq.x][iq.y].klingons > 8
+       game.state.galaxy[iq.x][iq.y].klingons > MAXKLQUAD-1
        return 1;
     if (flag) {
        /* Avoid quadrants with bases if we want to avoid Enterprise */
@@ -331,7 +331,7 @@ static bool movescom(coord iq, bool flag, bool *ipage)
     /* check for a helpful planet */
     for (i = 0; i < game.inplan; i++) {
        if (same(game.state.plnets[i].w, game.state.kscmdr) &&
-           game.state.plnets[i].crystals == 1) {
+           game.state.plnets[i].crystals == present) {
            /* destroy the planet */
            DESTROY(&game.state.plnets[i]);
            game.state.galaxy[game.state.kscmdr.x][game.state.kscmdr.y].planet = NOPLANET;
@@ -413,7 +413,7 @@ void scom(bool *ipage)
            ibq = game.state.baseq[i];
            if (same(ibq, game.quadrant) || same(ibq, game.battle) ||
                game.state.galaxy[ibq.x][ibq.y].supernova ||
-               game.state.galaxy[ibq.x][ibq.y].klingons > 8
+               game.state.galaxy[ibq.x][ibq.y].klingons > MAXKLQUAD-1
                continue;
            /* if there is a commander, an no other base is appropriate,
               we will take the one with the commander */