Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2002:
[Freeciv-Dev] Re: [PATCH] city_landlocked_sell_coastal_improvements gene
Home

[Freeciv-Dev] Re: [PATCH] city_landlocked_sell_coastal_improvements gene

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jjc@xxxxxxxxxxxxxxxxxx
Cc: freeciv-dev@xxxxxxxxxxx, bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [PATCH] city_landlocked_sell_coastal_improvements generalisation (PR#1105)
From: Ben Webb <ben@xxxxxxxxxxxxxxxxxxxxxx>
Date: Wed, 22 May 2002 10:47:52 +0100

On Tue, May 21, 2002 at 07:58:29PM -0700, jjc@xxxxxxxxxxxxxxxxxx wrote:
> It could be simplified by changing 
> +        while (improvement_types[impr].terr_gate[i] != T_OCEAN
> +               && improvement_types[impr].terr_gate[i] != T_LAST) {
> +          ++i;
> +        }
> +        if (improvement_types[impr].terr_gate[i] == T_OCEAN
> +            && !city_has_terr_spec_gate(pcity, impr)) {
> to 
> if(!city_has_terr_spec_gate(pcity, impr) { 
> but that would decrease speed.

        This would also change the behaviour of the function. It wouldn't
sell just "coastal" improvements, but _any_ improvements that no longer
have their terrain requirements satisfied. While it could be argued that
such improvements should be sold anyway, that's not the current Freeciv
behaviour.

> I agree with the comment that at some point it should be generalized
> to sell all relevant buildings after a terrain change.  For the 
> present building.ruleset this is irrelevant.

That's where you're wrong. Hydro Plant. (Although IIRC the other
rulesets prevent you from transforming River or Mountains.)

> It might be a good idea to use is_terrain_near_tile rather than 
> adjc_iterate to check for nearness to T_OCEAN.

        You want to replace the current "loop over all buildings adjacent
to the ocean tile at (x,y)" with "loop over all cities and check for
adjacent ocean tiles" ? That would be much more expensive.

        Ben
-- 
ben@xxxxxxxxxxxxxxxxxxxxxx           http://bellatrix.pcl.ox.ac.uk/~ben/
"The dog did nothing in the night-time." "That was the curious 
incident," remarked Sherlock Holmes.
        - 'Silver Blaze', Sir Arthur Conan Doyle


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