/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2008, 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 "sect.h"
-#include "nat.h"
-#include "news.h"
-#include "file.h"
-#include "path.h"
-#include "xy.h"
#include "land.h"
+#include "lost.h"
+#include "news.h"
#include "nsc.h"
+#include "path.h"
#include "plane.h"
#include "update.h"
-#include "common.h"
-#include "gen.h"
-#include "lost.h"
-#include "subs.h"
static void take_casualties(struct sctstr *, int);
mil += lp->lnd_item[I_MILIT];
- /* Security troops can now kill up to 1/2 their complement each
+ if (sp->sct_che_target != sp->sct_own)
+ continue;
+
+ /* Security troops can now kill up to 1/5 their complement each
update, before doing anything else. */
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY) {
int che_kill, r;
for (n = 1; n <= 6; n++) {
nsp = getsectp(sp->sct_x + diroff[n][0],
sp->sct_y + diroff[n][1]);
- if (dchr[nsp->sct_type].d_mcst == 0)
+ if (dchr[nsp->sct_type].d_mob0 < 0)
continue;
if (nsp->sct_own != target)
continue;
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
continue;
- cantake = ((lp->lnd_effic - 40) / 100.0)
- * lp->lnd_item[I_MILIT] * 2.0;
+ cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
if (cantake >= each) {
- deq = (each / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
- mc -= each;
+ deq = ((double)each / lp->lnd_item[I_MILIT]) * 100.0;
+ mc -= 2 * each;
} else if (cantake > 0) {
- deq = (cantake / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
- mc -= (deq / 100.0) * lp->lnd_item[I_MILIT] * 2.0;
+ deq = ((double)cantake / lp->lnd_item[I_MILIT]) * 100.0;
+ mc -= 2 * cantake;
} else
deq = 0;
lp->lnd_effic -= deq;
lp->lnd_mobil -= deq / 2;
- deq = lchr[(int)lp->lnd_type].l_mil * (deq / 100.0);
+ deq = lchr[(int)lp->lnd_type].l_item[I_MILIT] * (deq / 100.0);
lnd_submil(lp, deq);
if (mc <= 0)
return;
cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
if (cantake >= each) {
- deq = ((double)each / (lp->lnd_item[I_MILIT] * 2.0)) * 100.0;
+ deq = ((double)each / lp->lnd_item[I_MILIT]) * 100.0;
mc -= each;
} else if (cantake > 0) {
deq = ((double)cantake / lp->lnd_item[I_MILIT]) * 100.0;
- mc -= (deq / 100.0) * lp->lnd_item[I_MILIT];
+ mc -= cantake;
} else
deq = 0;
lp->lnd_effic -= deq;
lp->lnd_mobil -= deq / 2;
- deq = lchr[(int)lp->lnd_type].l_mil * (deq / 100.0);
+ deq = lchr[(int)lp->lnd_type].l_item[I_MILIT] * (deq / 100.0);
lnd_submil(lp, deq);
if (mc <= 0)
return;