tend: Don't tend land units to multiple target ships

Each land unit is tended to each target ship in turn, and ends up on
the last one that can take it..  The load-tend test demonstrates this
with command "tend land 173 s 150/165":

    spy  infiltrator #320 transferred from sbc  cargo submarine (#173) to cs   cargo ship (#150)
    spy  infiltrator #320 transferred from sbc  cargo submarine (#173) to ls   landing ship (#165)
    spy  infiltrator #321 is not on sbc  cargo submarine (#173)!
    spy  infiltrator #322 transferred from sbc  cargo submarine (#173) to cs   cargo ship (#150)
    spy  infiltrator #322 transferred from sbc  cargo submarine (#173) to ls   landing ship (#165)

Has been that way ever since Empire 2 added tending of land units.

Fix by breaking tend_land()'s loop over all target ships after a
successful transfer.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2017-09-11 07:37:49 +02:00
parent 68945c8ff8
commit 3064731af4
4 changed files with 7 additions and 8 deletions

View file

@ -30,7 +30,7 @@
* Dave Pare, 1986
* Thomas Ruschak, 1992
* Steve McClure, 2000
* Markus Armbruster, 2004-2012
* Markus Armbruster, 2004-2017
*/
#include <config.h>
@ -280,6 +280,7 @@ tend_land(struct shpstr *tenderp, char *units)
expose_ship(tenderp, &target);
putship(target.shp_uid, &target);
putship(tenderp->shp_uid, tenderp);
break;
}
}
return 0;

View file

@ -173,7 +173,6 @@ tend land 165 320/321/322 171
tend land 165/171 s 173
| spy can use light and non-light slot
tend land 173 s 150/165
| BUG: #173 transfers spy first to #150, then same spy to #165
|
|| to foreign ships
tend land 166 330 162

View file

@ -458,7 +458,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius army ship h
315 1 1 -1 1 100 60 0 40 1 -1 none 0 "" 165 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
316 1 1 -1 1 100 60 0 40 1 -1 none 0 "" 165 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
317 1 1 -1 1 100 60 0 40 1 -1 none 0 "" 165 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
320 1 1 -1 8 100 60 0 40 1 -1 none 0 "s" 165 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
320 1 1 -1 8 100 60 0 40 1 -1 none 0 "s" 150 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
321 1 1 -1 8 100 60 0 40 1 -1 none 0 "s" 171 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
322 1 1 -1 8 100 60 0 40 1 -1 none 0 "s" 172 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0
330 2 0 -2 1 100 60 0 40 0 0 none 0 "" 162 0 42 () "" 0 0 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 -1 0

View file

@ -2475,9 +2475,8 @@
Play#1 input tend land 173 s 150/165
Play#1 command tend
Play#1 output Play#1 1 spy infiltrator #320 transferred from sbc cargo submarine (#173) to cs cargo ship (#150)
Play#1 output Play#1 1 spy infiltrator #320 transferred from sbc cargo submarine (#173) to ls landing ship (#165)
Play#1 output Play#1 1 spy infiltrator #321 is not on sbc cargo submarine (#173)!
Play#1 output Play#1 1 spy infiltrator #322 transferred from sbc cargo submarine (#173) to cs cargo ship (#150)
Play#1 output Play#1 1 cs cargo ship (#150) doesn't have room for any more land units!
Play#1 output Play#1 1 spy infiltrator #322 transferred from sbc cargo submarine (#173) to ls landing ship (#165)
Play#1 output Play#1 6 0 381
Play#1 input tend land 166 330 162
@ -2903,7 +2902,7 @@
Play#0 output Play#0 1 1 112 cs cargo ship -2,0 100% 0 0 0 0 0 0 0 2 90 145
Play#0 output Play#0 1 1 113 sbc cargo subma -2,0 100% 0 0 0 0 0 0 0 1 90 150
Play#0 output Play#0 1 1 115 cs cargo ship -2,0 100% 0 0 0 0 0 0 0 2 90 150
Play#0 output Play#0 1 1 150 cs cargo ship 1,-1 t 100% 17 17 23 19 0 0 0 1 90 145
Play#0 output Play#0 1 1 150 cs cargo ship 1,-1 t 100% 17 17 23 19 0 0 0 2 90 145
Play#0 output Play#0 1 1 151 cs cargo ship 1,-1 t 100% 17 17 23 21 0 0 0 0 90 145
Play#0 output Play#0 1 1 152 cs cargo ship 1,-1 t 100% 22 22 18 20 0 0 0 0 90 145
Play#0 output Play#0 1 1 153 cs cargo ship 1,-1 t 100% 22 22 18 21 0 0 0 1 90 145
@ -2911,7 +2910,7 @@
Play#0 output Play#0 1 2 162 cs cargo ship 0,-2 u 100% 20 20 20 25 0 0 0 1 90 145
Play#0 output Play#0 1 3 163 cs cargo ship 0,-2 u 100% 20 20 20 25 0 0 0 1 90 145
Play#0 output Play#0 1 4 164 cs cargo ship 0,-2 u 100% 20 19 20 21 0 0 0 0 90 145
Play#0 output Play#0 1 1 165 ls landing shi 1,-1 100% 0 20 0 20 0 0 0 4 90 145
Play#0 output Play#0 1 1 165 ls landing shi 1,-1 100% 0 20 0 20 0 0 0 3 90 145
Play#0 output Play#0 1 1 166 cs cargo ship 0,-2 100% 20 22 20 8 0 0 0 2 90 145
Play#0 output Play#0 1 1 170 frg frigate 1,-1 100% 0 20 0 20 0 0 0 2 90 145
Play#0 output Play#0 1 1 171 sb submarine 1,-1 100% 0 20 0 20 0 0 0 1 90 145
@ -3328,7 +3327,7 @@
Play#0 output Play#0 1 1 315 linf light infa 1,-1 100% 0 0 60 0 40 42% 0 0 165S
Play#0 output Play#0 1 1 316 linf light infa 1,-1 100% 0 0 60 0 40 42% 0 0 165S
Play#0 output Play#0 1 1 317 linf light infa 1,-1 100% 0 0 60 0 40 42% 0 0 165S
Play#0 output Play#0 1 1 320 spy infiltrato 1,-1 s 100% 0 0 60 0 40 42% 0 0 165S
Play#0 output Play#0 1 1 320 spy infiltrato 1,-1 s 100% 0 0 60 0 40 42% 0 0 150S
Play#0 output Play#0 1 1 321 spy infiltrato 1,-1 s 100% 0 0 60 0 40 42% 0 0 171S
Play#0 output Play#0 1 1 322 spy infiltrato 1,-1 s 100% 0 0 60 0 40 42% 0 0 172S
Play#0 output Play#0 1 2 330 linf light infa 0,-2 100% 0 0 60 0 40 42% 0 0 162S