Re: [Freeciv-Dev] (PR#12682) AI Ignores Building Effects for Tech. Wants
"Benedict Adamson" <[email protected]> Tue, 20 Dec 2005 13:42:59 -0800
| Newsgroups | gmane.games.freeciv.ai |
|---|---|
| Message-ID | <[email protected]> |
<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.