[Freeciv-Dev] Re: Civserver upgrade building (PR#1585)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Mon, Jun 17, 2002 at 12:55:11PM -0700, dspeyer@xxxxxxxxxxx wrote:
> Full_Name: Daniel Speyer
> Version: CVS
> Distribution: Built from source
> Client: Both (or N/A)
> OS: Gnu/Linux -- Debian woody
> Submission from: (NULL) (12.243.200.32)
>
>
> If you develope musketeers before pikemen, your cities will continue to build
> phalanxes. This can be very annoying. This patch should fix it (apply to
> freeciv/server/cityturn.c):
Looks like I miss something here. The patch looks like it transforms a
while in a for loop. Where is the catch?
> static Unit_Type_id unit_upgrades_to(struct city *pcity, Unit_Type_id id)
> {
> - Unit_Type_id latest_ok = id;
> -
> - if (!can_build_unit_direct(pcity, id))
> - return -1;
> - while(unit_type_exists(id = unit_types[id].obsoleted_by))
> - if (can_build_unit_direct(pcity, id))
> + Unit_Type_id latest_ok = -1;
> +
> + for(; unit_type_exists(id); id = unit_types[id].obsoleted_by){
> + if (can_build_unit_direct(pcity, id)){
> latest_ok = id;
> + }
> + }
>
> return latest_ok;
> }
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Make it idiot-proof and someone will make a better idiot."
|
|