[freeciv-ai] Re: (PR#8992) Patch: Building ferries
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8992 >
On Mon, Nov 01, 2004 at 11:32:19AM -0800, Jason Short wrote:
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8992 >
>
> Per I. Mathisen wrote:
>
> > You call is_ocean_near_tile(acity->tile) a lot of times. Perhaps we should
> > add a new variable bool pcity->coastal instead, since the function call
> > above is comparatively expensive.
>
> I would be extremely wary of adding new global data fields that will
> need to be kept updated.
actually this is probably one of the best of any of the candidates for a
global data field.
> pcity->coastal would need to be updated at least every turn.
no. this needs to be updated only three times. Once on city creation. Once
when a tile is terraformed. This means looking only at the adjacent tiles
to the terraformed one looking for a city to update. Once when global
warming happens. This will mean iterating over all cities to check for
update. The latter two are very rare events. You stick the check and update
in the functions that do the terraforming and warming. Solved. The first
happens once. You stick the check in create_city().
> This is a problem in many other places in the code. Adding values like
> this that are assumed to be correct creates many dependencies that are
> not easy to keep track of (or even to find). If you do use precomputed
> values, you should always treat them as approximations and assume they
> might be wrong.
this value should only be used in the server. The client should use the
function all the time.
-mike
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Chelsea G Korbach, 2004/11/02
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Jason Short, 2004/11/01
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Jason Short, 2004/11/01
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Benedict Adamson, 2004/11/01
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries,
Mike Kaufman <=
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Jason Short, 2004/11/01
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Benedict Adamson, 2004/11/02
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Benedict Adamson, 2004/11/05
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Gregory Berkolaiko, 2004/11/04
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Per I. Mathisen, 2004/11/05
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Benedict Adamson, 2004/11/05
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Benedict Adamson, 2004/11/05
|
|