Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2003:
[Freeciv-Dev] Re: (PR#4372) Missile carriers with limited fuel always cr
Home

[Freeciv-Dev] Re: (PR#4372) Missile carriers with limited fuel always cr

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: cameron@xxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#4372) Missile carriers with limited fuel always crash
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Tue, 10 Jun 2003 10:09:08 -0700
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, 6 Jun 2003, Cameron Morland wrote:
> I was experimenting some months back with the Fantasy modpack, and I
> wanted to make an air unit with limited range ("stormcloud") which could
> carry missiles ("lightning bolts"). Unfortunately adding Missile_Carrier
> to a unit with limited fuelcauses said unit to always crash, even when
> on an aircraft carrier or in a city (ie my stormcloud would die on the
> second turn even if it stays in a city). The attached patch fixes this.

The problem is that we use punit->fuel variable temporarily for carrier
refuelling of aircraft and missiles, assuming stupidly that a fuel limited
unit can never itself be a carrier.

I think the fix is wrong. Adding a variable to the unit struct for
something will only be used inside one function and then be thrown away is
a waste of good memory. Instead, for each of pplayer->units, if punit is a
carrier, find and refuel as many air units stacked with you as you have
carrier capacity.

  - Per




[Prev in Thread] Current Thread [Next in Thread]