Fix che revolt to damage only land units that actually fight
guerrilla() lets only the sector owner's land units fight. But take_casualties() spread the casualties among all land units in the sector. Thus, defending land units could survive a defeat if foreign land units were present. The sector takeover then had che capture them, or their crews blow them up. The foreign land units were damaged silently.
This commit is contained in:
parent
162158fd4a
commit
10f5000aa1
1 changed files with 10 additions and 0 deletions
|
@ -439,6 +439,8 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
*/
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (NULL != (lp = nxtitemp(&ni))) {
|
||||
if (lp->lnd_own != sp->sct_own)
|
||||
continue;
|
||||
nunits++;
|
||||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
||||
nunits++;
|
||||
|
@ -452,6 +454,8 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
/* kill some security troops */
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (NULL != (lp = nxtitemp(&ni))) {
|
||||
if (lp->lnd_own != sp->sct_own)
|
||||
continue;
|
||||
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
|
||||
continue;
|
||||
|
||||
|
@ -477,6 +481,8 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
/* kill some normal troops */
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (NULL != (lp = nxtitemp(&ni))) {
|
||||
if (lp->lnd_own != sp->sct_own)
|
||||
continue;
|
||||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
||||
continue;
|
||||
|
||||
|
@ -503,6 +509,8 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
/* kill some normal troops */
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (NULL != (lp = nxtitemp(&ni))) {
|
||||
if (lp->lnd_own != sp->sct_own)
|
||||
continue;
|
||||
if (lchr[(int)lp->lnd_type].l_flags & L_SECURITY)
|
||||
continue;
|
||||
|
||||
|
@ -521,6 +529,8 @@ take_casualties(struct sctstr *sp, int mc)
|
|||
/* kill some security troops */
|
||||
snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
|
||||
while (NULL != (lp = nxtitemp(&ni))) {
|
||||
if (lp->lnd_own != sp->sct_own)
|
||||
continue;
|
||||
if (!(lchr[(int)lp->lnd_type].l_flags & L_SECURITY))
|
||||
continue;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue