Complete.Org: Mailing Lists: Archives: freeciv-ai: December 2005:
[freeciv-ai] Re: [Freeciv-Dev] (PR#12682) AI Ignores Building Effects fo
Home

[freeciv-ai] Re: [Freeciv-Dev] (PR#12682) AI Ignores Building Effects fo

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [freeciv-ai] Re: [Freeciv-Dev] (PR#12682) AI Ignores Building Effects for Tech. Wants
From: "Benedict Adamson" <badamson@xxxxxxxxxxx>
Date: Tue, 20 Dec 2005 13:42:59 -0800
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12682 >

Vasco Alexandre Da Silva Costa wrote:
...
> IMO this is bad style:
> +    for(t = 0; t != n_needed_techs; ++t) {
...
> Using the less than operator makes the code IMHO more easy to read.
> Using the ++ operator before or after the variable is in this case
> irrelevant.

Sorry, slipped into C++ there.

...
> +  if (0 < v && n_needed_improvements) {
> 
> You can use this instead:
> +  if (v > 0 && n_needed_improvements > 0) {
> 
> Rationale:
> You probably put the '0' before because of the dreaded issue of doing a =
> typo instead of using ==.

I prefer placing order comparisons in ascending order.

...
> As for the other one, since that is an integer variable, I think it is
> good style to do more explicit testing

Agreed.

I'll amend the patch. However, I won't post another version until I've 
got some more feedback.





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