Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2001:
[Freeciv-Dev] Re: map_same_continent().
Home

[Freeciv-Dev] Re: map_same_continent().

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: map_same_continent().
From: Gaute B Strokkenes <gs234@xxxxxxxxx>
Date: Tue, 25 Sep 2001 23:53:36 +0200

On Wed, 19 Sep 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Wed, Sep 19, 2001 at 01:55:44AM +0200, Gaute B Strokkenes wrote:
>> 
>> The function map_same_continent() is used only 7 places in the
>> code.  Its sole task is to call map_get_continent() twice and
>> compare the results.
>> 
>> On the other hand, there are lots of places that do exactly the
>> same thing manually, either directly or by caching one of the
>> results in a variable.
>> 
>> As such, I do not believe that map_same_continent() serves any
>> appreciable purpose other than save a few characters' worth of
>> screen real estate in just a couple of functions.  Therefore, I
>> propose to remove it entirely, so that future generations of
>> Freeciv source readers will have one less function to digest.
> 
> Pro (leave it): 
>  - it encapsulate things (decrease the entropy) it is possible that

I don't see what is encapsulated here, apart from the fact that you
can compare the values of the continent field in a tile struct.

By the same logic, it would be good to have functions same_unit(),
same_city(), same_int()... [We do have same_pos() already, but in this
case we need to take normalization into account].

Speaking more generally, there are a lot of places in Freeciv where
someone once added something they thought was a good idea, but then
they never put in the effort to the good idea anything other than a
curiosity, and then those who tinkered with the code afterwards never
took notice of it either.  In such cases, we might as well do away
with the whole thing.

>  - there is a faster way to implement it (an item "fast continent
>  - iteration (or at least an abstraction)" is still on my wishlist)
> 
> Con (remove):
>  - it is unlikly that another implementation is faster that the
>  current one - if you do it manually you can cache one value

The following patch is a couple of days old, but it should still
apply, mutatis mutandis.

Attachment: msc.diff
Description: Text document

-- 
Big Gaute                               http://www.srcf.ucam.org/~gs234/
You mean now I can SHOOT YOU in the back and further BLUR
 th' distinction between FANTASY and REALITY?

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