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:
Markus Armbruster 2016-09-18 12:32:17 +02:00
parent c7195ed92e
commit d8e19174ae
4 changed files with 6 additions and 6 deletions

View file

@ -437,6 +437,7 @@ take_casualties(struct sctstr *sp, int mc)
* them amongst the land units in the sector * them amongst the land units in the sector
* Do security troops first, then others. * Do security troops first, then others.
* Try not to kill any unit. * 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); snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
while (NULL != (lp = nxtitemp(&ni))) { 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 = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
cantake = MIN(lp->lnd_item[I_MILIT], cantake); cantake = MIN(lp->lnd_item[I_MILIT], cantake);
deq = MIN(cantake, each); deq = MIN(cantake, MIN(each, mc - taken));
if (deq <= 0) if (deq <= 0)
continue; 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 = ((lp->lnd_effic - 40) / 100.0) * lp->lnd_item[I_MILIT];
cantake = MIN(lp->lnd_item[I_MILIT], cantake); cantake = MIN(lp->lnd_item[I_MILIT], cantake);
deq = MIN(cantake, each); deq = MIN(cantake, MIN(each, mc - taken));
if (deq <= 0) if (deq <= 0)
continue; continue;

View file

@ -182,7 +182,6 @@ land 0:31,-16:-1
| BUG: "Sector -12,-8 has been retaken!" instead of takeover | BUG: "Sector -12,-8 has been retaken!" instead of takeover
| -10,-8 che win, don't take over | -10,-8 che win, don't take over
| -8,-8 che lose | -8,-8 che lose
| BUG: che kill 2m more than they should
| -6,-8 che lose | -6,-8 che lose
| BUG: inf#29 shouldn't die | BUG: inf#29 shouldn't die
| plague stage 4 (dying) -16:-1,-6 ship#10 land#10 | plague stage 4 (dying) -16:-1,-6 ship#10 land#10

View file

@ -381,7 +381,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
25 0 -12 -8 20 0 -30 0 170 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 9 0 0 0 0 0 healthy 0 -1 0 25 0 -12 -8 20 0 -30 0 170 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 9 0 0 0 0 0 healthy 0 -1 0
26 0 -12 -8 2 0 -30 0 50 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 10 0 0 0 0 0 healthy 0 -1 0 26 0 -12 -8 2 0 -30 0 50 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 10 0 0 0 0 0 healthy 0 -1 0
27 0 -12 -8 20 0 0 0 170 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 9 0 0 0 0 0 healthy 0 -1 0 27 0 -12 -8 20 0 0 0 170 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 9 0 0 0 0 0 healthy 0 -1 0
28 4 -8 -8 1 60 40 0 50 0 0 none 0 "" -1 0 42 () "" 0 12 0 0 0 0 0 0 9 0 0 0 0 0 healthy 0 -1 0 28 4 -8 -8 1 70 45 0 50 0 0 none 0 "" -1 0 42 () "" 0 14 0 0 0 0 0 0 9 0 0 0 0 0 healthy 0 -1 0
29 0 -6 -8 2 0 0 0 50 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 8 0 0 0 0 0 healthy 0 -1 0 29 0 -6 -8 2 0 0 0 50 0 0 none 0 "" -1 0 42 () "" 0 0 0 0 0 0 0 0 8 0 0 0 0 0 healthy 0 -1 0
30 2 -16 0 2 88 60 0 50 0 0 none 0 "" -1 0 42 () "" 0 100 0 0 0 0 0 0 7 0 0 0 0 0 healthy 0 -1 0 30 2 -16 0 2 88 60 0 50 0 0 none 0 "" -1 0 42 () "" 0 100 0 0 0 0 0 0 7 0 0 0 0 0 healthy 0 -1 0
31 2 -16 0 2 10 60 0 50 0 0 none 0 "" -1 0 42 () "" 0 100 0 0 0 0 0 0 7 0 0 0 0 0 healthy 0 -1 0 31 2 -16 0 2 10 60 0 50 0 0 none 0 "" -1 0 42 () "" 0 100 0 0 0 0 0 0 7 0 0 0 0 0 healthy 0 -1 0

View file

@ -1374,7 +1374,7 @@
Play#0 output Play#0 1 Guerrilla warfare in -10,-8 Play#0 output Play#0 1 Guerrilla warfare in -10,-8
Play#0 output Play#0 1 body count: troops: 10, rebels: 5 Play#0 output Play#0 1 body count: troops: 10, rebels: 5
Play#0 output Play#0 1 Guerrilla warfare in -8,-8 Play#0 output Play#0 1 Guerrilla warfare in -8,-8
Play#0 output Play#0 1 body count: troops: 9, rebels: 22 Play#0 output Play#0 1 body count: troops: 7, rebels: 22
Play#0 output Play#0 1 inf infantry #29 dies fighting guerrillas in -6,-8 Play#0 output Play#0 1 inf infantry #29 dies fighting guerrillas in -6,-8
Play#0 output Play#0 1 Guerrilla warfare in -6,-8 Play#0 output Play#0 1 Guerrilla warfare in -6,-8
Play#0 output Play#0 1 body count: troops: 50, rebels: 52 Play#0 output Play#0 1 body count: troops: 50, rebels: 52
@ -1682,7 +1682,7 @@
Play#0 output Play#0 1 4 19 inf infantry -10,-6 100% 100 0 60 7 50 42% 0 0 Play#0 output Play#0 1 4 19 inf infantry -10,-6 100% 100 0 60 7 50 42% 0 0
Play#0 output Play#0 1 5 20 inf infantry -16,-8 20% 0 0 60 10 50 42% 0 0 Play#0 output Play#0 1 5 20 inf infantry -16,-8 20% 0 0 60 10 50 42% 0 0
Play#0 output Play#0 1 5 23 inf infantry -14,-8 20% 0 0 60 10 50 42% 0 0 Play#0 output Play#0 1 5 23 inf infantry -14,-8 20% 0 0 60 10 50 42% 0 0
Play#0 output Play#0 1 4 28 linf light infa -8,-8 60% 12 0 40 9 50 42% 0 0 Play#0 output Play#0 1 4 28 linf light infa -8,-8 70% 14 0 45 9 50 42% 0 0
Play#0 output Play#0 1 13 units Play#0 output Play#0 1 13 units
Play#0 output Play#0 6 0 640 Play#0 output Play#0 6 0 640
Play#0 input read 5 Play#0 input read 5