/*
* 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
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;
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;