Abstract away the operations involving a sentinel value for coordinates.
[super-star-trek.git] / src / planets.c
index a34b1f694b06b0c68a4f2faf5de49fc2875524d7..ca8996fc360ceb843031638b84ffe855ef56b196 100644 (file)
@@ -55,7 +55,7 @@ void orbit(void)
        prout(_("Both warp and impulse engines damaged."));
        return;
     }
        prout(_("Both warp and impulse engines damaged."));
        return;
     }
-    if (game.plnet.x == 0 || abs(game.sector.x-game.plnet.x) > 1 || abs(game.sector.y-game.plnet.y) > 1) {
+    if (!is_valid(game.plnet) || abs(game.sector.x-game.plnet.x) > 1 || abs(game.sector.y-game.plnet.y) > 1) {
        crmshp();
        prout(_(" not adjacent to planet."));
        skip(1);
        crmshp();
        prout(_(" not adjacent to planet."));
        skip(1);