update/revolt: Spread only actual casualties to land units
To spread C casualties among N land units, take_casualties() applies floor(C/N)+2 to each. Bonkers. Has been that way since land units were added in Chainsaw 3. Limit casualties spread to a land unit to their remaining amount. Should really spread proportionally to military instead of evenly; add a TODO comment for that. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
c7195ed92e
commit
d8e19174ae
4 changed files with 6 additions and 6 deletions
|
@ -437,6 +437,7 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
* them amongst the land units in the sector
|
||||
* Do security troops first, then others.
|
||||
* Try not to kill any unit.
|
||||
* TODO Spread proportionally to mil instead of evenly
|
||||
*/
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (NULL != (lp = nxtitemp(&ni))) {
|
||||
|
@ -465,7 +466,7 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
|
||||
cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
|
||||
cantake = MIN(lp->lnd_item[I_MILIT], cantake);
|
||||
deq = MIN(cantake, each);
|
||||
deq = MIN(cantake, MIN(each, mc - taken));
|
||||
if (deq <= 0)
|
||||
continue;
|
||||
|
||||
|
@ -490,7 +491,7 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
|
||||
cantake = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
|
||||
cantake = MIN(lp->lnd_item[I_MILIT], cantake);
|
||||
deq = MIN(cantake, each);
|
||||
deq = MIN(cantake, MIN(each, mc - taken));
|
||||
if (deq <= 0)
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue