[Freeciv-Dev] Re: Cruise Missile (PR#562)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Tue, 19 Sep 2000, Christian Knoke <ChrisK@xxxxxxxx> wrote:
> Version: 1.11.4 built from source
> A missile can be sentried as 8th unit on a carrier and doesn't
> get lost. When moving the carrier next round, the missile will
> not be carried, stays on its spot sentried.
>
> Reproducable: Put cruise missile from the city Royal Leamington
> on the nearby carrier.
>
> The savegame is here:
> http://www.enter.de/~c.knoke/missile-sentry.sav.gz
Thanks, this is reproducably with current CVS too. Actually, its OK
that the Cruise Missile is not lost, since the capacity of a Carrier
is 8, not 7. The problem is that the missile is not carried when the
Carrier moves out.
Its looks to me to be a problem in assign_units_to_transporter(),
called from move_unit() (server/unitfunc.c), fixed by the attached
patch. (When Carrier checks to pick up extra air/missile units when
moving, it can decrement capacity multiple times for already-carried
units, making it seem there is no capacity left to carry the missile.)
I'm not sure if there are more problems or implications to this,
but this patch seems to fix the immediate problem...
-- David
--- freeciv-cvs/server/unitfunc.c Thu Sep 21 13:39:13 2000
+++ fc-adv/server/unitfunc.c Fri Sep 22 17:06:51 2000
@@ -3304,7 +3304,7 @@
/* Not enough capacity. Take anything we can */
if ((aircap < capacity || miscap < capacity)
&& !(is_ground_unit(ptrans) && ptile->terrain == T_OCEAN)) {
- /* We first take nonmissiles, as missiles can be transpoted on anything,
+ /* We first take nonmissiles, as missiles can be transported on
anything,
but nonmissiles can not */
if (!missiles_only) {
unit_list_iterate(ptile->units, pcargo) {
@@ -3312,6 +3312,7 @@
break;
if (is_air_unit(pcargo)
&& pcargo->id != ptrans->id
+ && pcargo->transported_by != ptrans->id
&& !unit_flag(pcargo->type, F_MISSILE)
&& pcargo->owner == playerid) {
capacity--;
@@ -3327,6 +3328,7 @@
break;
if (is_air_unit(pcargo)
&& pcargo->id != ptrans->id
+ && pcargo->transported_by != ptrans->id
&& (!missiles_only || unit_flag(pcargo->type, F_MISSILE))
&& pcargo->owner == playerid) {
capacity--;
|
|