Complete.Org: Mailing Lists: Archives: freeciv-dev: February 2002:
[Freeciv-Dev] Re: [FreeCiv-Cvs] kauf: general cleanup of find_a_directio
Home

[Freeciv-Dev] Re: [FreeCiv-Cvs] kauf: general cleanup of find_a_directio

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Gregory Berkolaiko <gberkolaiko@xxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: [FreeCiv-Cvs] kauf: general cleanup of find_a_direction() as well ...
From: Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 7 Feb 2002 20:44:22 +0100
Reply-to: rf13@xxxxxxxxxxxxxxxxxxxxxx

On Thu, Feb 07, 2002 at 07:12:22PM +0000, Gregory Berkolaiko wrote:
>  --- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote: 
> > On Thu, Feb 07, 2002 at 03:27:14PM +0000, Gregory Berkolaiko wrote:
> 
> <...>
> 
> > 
> > What about a "const int"? But I think that
> 
> well, const is slightly better.
> at least you know where to look for a variable initialisation.
> but define can be put anywhere...

Nitpicking: you also place const ints anywhere.

> >   /* reduce bla bla */
> >   a -= (a*6)/100;
> > 
> > is bad. IMHO each function should declare such constants at the start
> > of the function or file.
> 
> I really don't see why.
> numerical constant is as transperent as you can get.
> unless there are two places in which the constants should be the same...
> 
> if you want to change this factor, I guess it's marginally easier to find
> it if it was given a name.  but if this factor is used only once there is
> a great chance that you wouldn't know about it's existence until you
> stuble upon it in the first place.
> 
> but I am not really bothered, I just think that making the code few lines
> shorter is good provided you don't jeopardise readability and
> flexibility.

I'm probably overcautious but just look at a random part of the AI and
see numbers without any unit and without any comment. I want to avoid
this.

> > rating_of_best_ally is in another scope. And this is not a mistake. It
> > is just a "private" variable of the find-best-ally part.
> 
> I know.  I just think that often you go to extremes to force some
> concept.

If there wouldn't be this many parameters I would also make this an
extra function.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
  Windows: From the people who brought you edlin...


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