Checkpoint with several changes, committed so Stas can play with debug code.
[super-star-trek.git] / src / battle.c
index c0dac65b0c2f3b2cce110b5053f470fbe9e48021..343c05a3d1cfe3644712f8205c8923546c8de082 100644 (file)
@@ -318,7 +318,7 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
            crmena(1, iquad, 2, w);
            prout(_(" destroyed."));
            game.state.nplankl++;
-           game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NULL;
+           game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
            DESTROY(&game.state.plnets[game.iplnet]);
            game.iplnet = 0;
            game.plnet.x = game.plnet.y = 0;
@@ -328,6 +328,22 @@ void torpedo(double course, double r, int inx, int iny, double *hit, int i, int
                finish(FDPLANET);
            }
            return;
+       case IHW: /* Hit an inhabited world -- very bad! */
+           crmena(1, iquad, 2, w);
+           prout(_(" destroyed."));
+           game.state.nworldkl++;
+           game.state.galaxy[game.quadrant.x][game.quadrant.y].planet = NOPLANET;
+           DESTROY(&game.state.plnets[game.iplnet]);
+           game.iplnet = 0;
+           game.plnet.x = game.plnet.y = 0;
+           game.quad[w.x][w.y] = IHDOT;
+           if (game.landed==1) {
+               /* captain perishes on planet */
+               finish(FDPLANET);
+           }
+           prout("You have just destroyed an inhabited planet.");
+           prout("Celebratory rallies are being held on the Klingon homeworld.");
+           return;
        case IHSTAR: /* Hit a star */
            if (Rand() > 0.10) {
                nova(w.x, w.y);