[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 >
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.
pcity->coastal would need to be updated at least every turn.
In some cases it may even become stale during the course of a turn. Say
the value was calculated, then unit activities/global warming/whatever
was done, then it were used. The real danger is that this could cause a
fatal error. If the above caused a crash, for instance, it would be
extremely difficult to track down.
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.
jason
- [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 <=
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Benedict Adamson, 2004/11/01
- [freeciv-ai] Re: (PR#8992) Patch: Building ferries, Mike Kaufman, 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/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
|
|