[Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
At 09:17 AM 01/10/05 +0200, Raimar Falke wrote:
>On Thu, Oct 04, 2001 at 10:06:52PM -0400, Ross W. Wetmore wrote:
>> At 11:00 AM 01/10/03 +0200, Raimar Falke wrote:
>> >On Tue, Oct 02, 2001 at 09:58:01PM -0400, Ross W. Wetmore wrote:
[...]
>> is_real_tile() should be the first element of normalize_map_pos(),
>> whether this is coded explicitly or implicitly.
>>
>> But more importantly, it is used when you just want to do the first
>> part, i.e. the check, and don't want to update any values, which is
>> where normalize_map_pos() should do most of its work.
>>
>> This is why it is used in asserts. But there are other places where
>> the functionality will be needed, so it should always be considered.
>>
>> If you are always going to proceed to use the values after a successful
>> check, then I agree that normalize_map_pos() is pretty much all that
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>> will normally be required.
^^^^^^^^^^^^^^^^^^^^^^^^^^
>>
>> You should always code normalize_map_pos() to NOT become more expensive
>> unless you need to do the expensive things. That is why you check first
>> before doing the heavy work, and that is why you may want to have an
>> is_real_tile()-ish macro version to precheck and then make an expensive
>> function call.
>
>IMHO there are two places where map positions had to be
>checked/normalized:
> - map generation: (various iterates, MAPSTEP) a normalization is
> always required.
... but you might be able to optimize the checks with an is_border_tile
when you are going to work on an iterated region. *Always* might be too
strong in this case, and you might want a MAPSTEP_unchecked for instance.
> - input checking at the server: we want to discard invalid inputs but
> we want also to normalize the good ones. normalize_map_pos can do
> this.
>
>So in the long run there should be very few instances of is_real_tile
>left.
Agreed, Raimar. But few is not "none". As long as you aren't mentally
going that far we are fully in agreement.
Cheers,
RossW
=====
- [Freeciv-Dev] Re: [UPDATE] Corecleanup_08 patch to cvs-Sep28, Gregory Berkolaiko, 2001/10/03
- [Freeciv-Dev] AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Gregory Berkolaiko, 2001/10/05
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Ross W. Wetmore, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Raimar Falke, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Gregory Berkolaiko, 2001/10/09
- [Freeciv-Dev] Re: AI - cleaning (Was: Re: [UPDATE] Corecleanup_08 patch), Raimar Falke, 2001/10/09
|
|