[Freeciv-Dev] Re: build_cost_prime (PR#1194)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
--- Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> wrote:
> On Thu, Jan 03, 2002 at 05:45:37AM -0800, Gregory Berkolaiko wrote:
> > Hi,
> >
> > the variable with an expressive name "fprime" is calculated in the
> same
> > way in 3 different places. I propose to separate the calculation
> into a
> > function and supply it with a comment. The patch is attached.
>
> Can you create a better name? Or can you explain the "prime"?
No I can't explain "prime" :(
better name? build_cost_weird? build_cost_corrupted?
build_cost_balanced? please choose.
> You may also remove the fprime variable in the callers.
No, this will be done during the cleanup of the callers.
I remember somebody saying that patches should be short and localized :)
My patch is short and localised.
> > +int build_cost_prime(Unit_Type_id i)
> > +{
> > + int res;
> > +
> > + res = 2 * unit_types[i].build_cost * unit_types[i].attack_strength
> /
> > + (unit_types[i].attack_strength +
> unit_types[i].defense_strength);
> > + return res;
> > +}
>
> Make it a simple return statement.
I wasn't sure what is the preferred way of doing small functions (my
personal preferred way is just simple return). In any case, I just moved
to a new job and don't even have a proper computer yet. So please apply
the patch with any changes you want (i.e. to the name of the function and
to the function itself) and add your name to the author list ;) It will
save my and your time alike.
It's a small patch of noncontroversial nature, stop discussing it, just
apply.
Best,
G.
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] Re: build_cost_prime (PR#1194),
Gregory Berkolaiko <=
|
|