/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2007, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
#include <config.h>
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "treaty.h"
-#include "nat.h"
-#include "ship.h"
-#include "land.h"
-#include "sect.h"
-#include "retreat.h"
-#include "news.h"
-#include "nsc.h"
-#include "file.h"
-#include "queue.h"
-#include <ctype.h>
-#include "optlist.h"
-#include "damage.h"
#include "commands.h"
+#include "damage.h"
+#include "empobj.h"
+#include "optlist.h"
+#include "retreat.h"
enum targ_type {
targ_land, targ_ship, targ_sub, targ_unit, targ_bogus
int victim; /* who I was shooting at */
};
-union item_u {
- struct shpstr ship;
- struct sctstr sect;
- struct lndstr land;
-};
-
static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
static int defend(struct emp_qelem *al,
struct emp_qelem *dl,
char *p;
int nfiring = 0;
int ndefending = 0;
- union item_u item;
+ union empobj_storage item;
struct emp_qelem fired, defended;
double odds;
char buf[1024];
continue;
}
if (fship.shp_effic < 60) {
- pr("Ship #%d is crippled (%d%%)\n", fshipno,
- fship.shp_effic);
+ pr("Ship #%d is crippled (%d%%)\n",
+ fshipno, fship.shp_effic);
continue;
}
range = effrange(fship.shp_frnge, fship.shp_tech);
shots = gun;
guneff = seagun(fship.shp_effic, shots);
dam = (int)guneff;
- shell -= ldround(((double)shots) / 2.0, 1);
+ shell -= ldround(shots / 2.0, 1);
fship.shp_item[I_SHELL] = shell;
if (opt_NOMOBCOST == 0)
fship.shp_mobil = MAX(fship.shp_mobil - 15, -100);
dam = (int)landunitgun(fland.lnd_effic, fland.lnd_dam, gun,
fland.lnd_ammo, shell);
if (target == targ_ship) {
- if (chance(((double)fland.lnd_acc) / 100.0))
- dam = ldround(((double)dam / 2.0), 1);
+ if (chance(fland.lnd_acc / 100.0))
+ dam = ldround(dam / 2.0, 1);
}
use_supply(&fland);
resupply_commod(&fland, I_SHELL); /* Get more shells */
prb *= prb;
if (chance(prb)) {
pr("Wind deflects shell%s.\n", splur(shots));
-/* dam = (int)((double)dam / 2.0);*/
+/* dam = (int)(dam / 2.0);*/
dam *= (90 - (random() % 11)) / 100.0;
if (dam < 0)
dam = 0;
pr("\nDefenders fire back!\n");
first = 0;
}
- dam = (odds * (double)fp->defdam);
+ dam = odds * fp->defdam;
if (fp->type == targ_ship) {
vict = fp->victim;