More applications of same().
authorEric S. Raymond <esr@thyrsus.com>
Thu, 21 Sep 2006 10:47:26 +0000 (10:47 +0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 21 Sep 2006 10:47:26 +0000 (10:47 +0000)
src/ai.c
src/setup.c

index b4b35b9ed93f8be79999b3d72b0d786d7232972b..733c62f83351b9540bb72a5b6f00e164ff264cbf 100644 (file)
--- a/src/ai.c
+++ b/src/ai.c
@@ -301,7 +301,8 @@ static bool movescom(coord iq, bool flag, bool *ipage)
     if (flag) {
        /* Avoid quadrants with bases if we want to avoid Enterprise */
        for_starbases(i)
     if (flag) {
        /* Avoid quadrants with bases if we want to avoid Enterprise */
        for_starbases(i)
-           if (game.state.baseq[i].x==iq.x && game.state.baseq[i].y==iq.y) return 1;
+           if (same(game.state.baseq[i], iq)) 
+               return true;
     }
     if (game.justin && !game.iscate) return true;
     /* do the move */
     }
     if (game.justin && !game.iscate) return true;
     /* do the move */
@@ -329,7 +330,7 @@ static bool movescom(coord iq, bool flag, bool *ipage)
     }
     /* check for a helpful planet */
     for (i = 0; i < game.inplan; i++) {
     }
     /* check for a helpful planet */
     for (i = 0; i < game.inplan; i++) {
-       if (game.state.plnets[i].w.x==game.state.kscmdr.x && game.state.plnets[i].w.y==game.state.kscmdr.y &&
+       if (same(game.state.plnets[i].w, game.state.kscmdr) &&
            game.state.plnets[i].crystals == 1) {
            /* destroy the planet */
            DESTROY(&game.state.plnets[i]);
            game.state.plnets[i].crystals == 1) {
            /* destroy the planet */
            DESTROY(&game.state.plnets[i]);
index 8bbafbc31e539f43fd0b7927979a31af22f303e7..7e1b65257f96120f2971be5b66d7f5c486743548 100644 (file)
@@ -324,7 +324,8 @@ void setup(bool needprompt)
                   game.state.galaxy[w.x][w.y].klingons > 8);
            // check for duplicate
            for (j = 1; j < i; j++)
                   game.state.galaxy[w.x][w.y].klingons > 8);
            // check for duplicate
            for (j = 1; j < i; j++)
-               if (game.state.kcmdr[j].x==w.x && game.state.kcmdr[j].y==w.y) break;
+               if (same(game.state.kcmdr[j], w))
+                   break;
        } while (j < i);
        game.state.galaxy[w.x][w.y].klingons++;
        game.state.kcmdr[i] = w;
        } while (j < i);
        game.state.galaxy[w.x][w.y].klingons++;
        game.state.kcmdr[i] = w;