board: Fix mobility cost when defender's efficiency < 100%

The cost is meant to be proportional to efficiency / 100, but the code
truncates the fraction to zero.  Broken in Empire 2.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-02-03 07:44:23 +01:00
parent 39884aff59
commit 48d8533443
3 changed files with 3 additions and 3 deletions

View file

@ -856,7 +856,7 @@ calc_mobcost(int combat_mode, struct combat *off, struct combat *def,
case EF_SHIP: case EF_SHIP:
/* the 2 in the formula below is a fudge factor */ /* the 2 in the formula below is a fudge factor */
getship(def->shp_uid, &ship); getship(def->shp_uid, &ship);
off->mobcost += (def->eff / 100) * (shp_speed(&ship) / 2); off->mobcost += shp_speed(&ship) / 2 * def->eff / 100;
} }
} }
} }

View file

@ -30,7 +30,7 @@ uid owner xloc yloc type effic mobil off tech opx opy mission radius fleet civil
2 1 -3 1 10 93 118 0 45 0 0 none 0 "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured torpedoed sonared helpless bombed depth-charged boarded) "bgyujnbgy" 2 1 -3 1 10 93 118 0 45 0 0 none 0 "" 0 9 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (injured torpedoed sonared helpless bombed depth-charged boarded) "bgyujnbgy"
3 1 -3 1 10 100 127 0 45 0 0 none 0 "a" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () "" 3 1 -3 1 10 100 127 0 45 0 0 none 0 "a" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""
4 1 -5 1 10 100 127 0 45 0 0 none 0 "a" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group helpless) "b" 4 1 -5 1 10 100 127 0 45 0 0 none 0 "a" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group helpless) "b"
5 1 -5 1 17 96 63 0 70 0 0 none 0 "" 0 6 31 1 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () "" 5 1 -5 1 17 96 61 0 70 0 0 none 0 "" 0 6 31 1 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""
6 1 -1 3 18 100 97 0 165 0 0 none 0 "" 0 10 21 1 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () "" 6 1 -1 3 18 100 97 0 165 0 0 none 0 "" 0 10 21 1 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""
7 1 -5 1 10 100 127 0 45 0 0 none 0 "a" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group helpless) "b" 7 1 -5 1 10 100 127 0 45 0 0 none 0 "a" 0 10 0 0 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 (group helpless) "b"
9 2 -4 -2 17 60 127 0 70 0 0 none 0 "" 0 60 38 1 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () "" 9 2 -4 -2 17 60 127 0 70 0 0 none 0 "" 0 60 38 1 0 0 0 0 0 0 0 0 0 0 healthy 0 0 "" -3 1 1 () ""

View file

@ -1548,7 +1548,7 @@
Play#0 output Play#0 1 1 2 lc light cruis -3,1 93% 0 9 0 0 0 0 0 0 118 45 Play#0 output Play#0 1 1 2 lc light cruis -3,1 93% 0 9 0 0 0 0 0 0 118 45
Play#0 output Play#0 1 1 3 lc light cruis -3,1 a 100% 0 10 0 0 0 0 0 0 127 45 Play#0 output Play#0 1 1 3 lc light cruis -3,1 a 100% 0 10 0 0 0 0 0 0 127 45
Play#0 output Play#0 1 1 4 lc light cruis -5,1 a 100% 0 10 0 0 0 0 0 0 127 45 Play#0 output Play#0 1 1 4 lc light cruis -5,1 a 100% 0 10 0 0 0 0 0 0 127 45
Play#0 output Play#0 1 1 5 dd destroyer -5,1 96% 0 6 0 0 0 0 0 0 63 70 Play#0 output Play#0 1 1 5 dd destroyer -5,1 96% 0 6 0 0 0 0 0 0 61 70
Play#0 output Play#0 1 1 6 sb submarine -1,3 100% 0 10 0 0 0 0 0 0 97 165 Play#0 output Play#0 1 1 6 sb submarine -1,3 100% 0 10 0 0 0 0 0 0 97 165
Play#0 output Play#0 1 1 7 lc light cruis -5,1 a 100% 0 10 0 0 0 0 0 0 127 45 Play#0 output Play#0 1 1 7 lc light cruis -5,1 a 100% 0 10 0 0 0 0 0 0 127 45
Play#0 output Play#0 1 2 9 dd destroyer -4,-2 60% 0 60 0 0 0 0 0 0 127 70 Play#0 output Play#0 1 2 9 dd destroyer -4,-2 60% 0 60 0 0 0 0 0 0 127 70