[Freeciv-Dev] Re: AI cleanup - first wave
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > It is prolly better to do }\nelse if here.
> I think indent will cover this.
It really does, it's smarter than I thought.
> > And if you will run it thru indent anyway...
> I run the parts which are changed thru indent.
90% of functions were changed.
> > > A
> > > if (is_barbarian(pplayer)) {
> > > ....
> > > /* If not barbarian, ... */
> > > } else {
> > >
> > > B
> > > if (is_barbarian(pplayer)) {
> > > ....
> > > } else { /* If not barbarian, ... */
> > >
> > > C
> > > if (is_barbarian(pplayer)) {
> > > ....
> > > } else {
> > > /* If not barbarian, ... */
> > I vote for A ;-).
> I'm for C.
Well, if you do
/* If 1, */
if (1) {
...
/* If not 1, */
} else {
...
}
it is IMHO more readable than
/* If 1, */
if (1) {
...
} else {
/* If not 1, */
...
}
> > > + Unit_Type_id unit = get_role_unit(L_BARBARIAN_BUILD, role);
> > > ^^^^^^^^^^^^^^^^^
> > >
> > > IMHO this shouldn't be named "unit" but "unit_type" or "utype" or "type".
> > Well, I wanted it to be something descriptive, nts, not_too_long, however I
> > didn't succeed much here, it looks ;-).
> > I will change it to utype, thanks.
>
> As you may have notice I prefer longer names. So I would prefer
> "unit_type" but I think we should try to have discussion about this
> (with other people).
I prefer longer names only in cases when it wouldn't be really clear what that
variable is otherwise or if the variable is referenced only really rarely.
Otherwise short and descriptive enough names are better, IMHO.
> > > As for the question you have asked: we should try one function at a time
> > > and
> > > see how this works.
> > Ok, should I feed it to you or you will dig it by yourself after we will
> > tune
> > it?
>
> Remember: we (well I) want review from others -> to freeciv-dev.
That was meant by that 'tune it' ;-).
--
Petr "Pasky" Baudis
UN*X programmer, UN*X administrator, hobbies = IPv6, IRC, FreeCiv hacking
.
"A common mistake that people make, when trying to design
something completely foolproof is to underestimate the
ingenuity of complete fools."
-- Douglas Adams in Mostly Harmless
.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/
|
|