[Freeciv-Dev] Re: PATCH: AI cleanup Version 2
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> This is a formatting change. See past threads about such changes.
They are meant to improve readibility. But ok.. I only stick on
unit_move_turns() indentation correct, that fault was introduced
by the previous patch anyway, so it wouldn't introduce any diffs
into the code itself.
> I will definitely not accept changes which remove {}.
Ok.
> > +
> > if (pcity->ai.building_want[B_SAM] > 0 && danger4) {
> > i = assess_defense_igwall(pcity);
> > +
> > if (!i) pcity->ai.building_want[B_SAM] = 100 + urgency;
> > else if (danger4 > i * 2) pcity->ai.building_want[B_SAM] = 200 +
> > urgency;
> > else pcity->ai.building_want[B_SAM] = danger4 * 100 / i;
> > }
> > +
> > if (pcity->ai.building_want[B_SDI] > 0 && danger5) {
> > i = assess_defense_igwall(pcity);
> > +
> > if (!i) pcity->ai.building_want[B_SDI] = 100 + urgency;
> > else if (danger5 > i * 2) pcity->ai.building_want[B_SDI] = 200 +
> > urgency;
> > else pcity->ai.building_want[B_SDI] = danger5 * 100 / i;
> > }
> > +
> > pcity->ai.urgency = urgency; /* need to cache this for bodyguards now --
> > Syela */
> > return(urgency);
> > }
>
> Such changes are only noise.
You can read the code reasonably then. Most of applications are written
with sane indentation, so one doesn't have to spend time uselessly decrypting
messy code.
> Also note that i can be declared local
> (which I prefer).
It can't, as above you use it in top-level for. I would have to add special
block for it there, and indent the half of function for that. Too many
useless indendation levels for one variable, it will make it rather worse.
Otherwise, I prefer local declared variables too.
> Overall I have to look at the other changes in detail. It may also be
> nice if you add some docu to the variables. Like in
>
> /*
> * Desire to get the unit denotes by "punit". Value range is [0,100)
> * where 0 means no interest.
> */
> int udesire;
That would, I will add some for variables which looks uncertain in my
opinion. Also, there come more ideas to my mind, what should be cleaned
up there, as I look at the code after some while... I will send you
modified patch w/o some format changes and with several other things
cleaned up this night or tommorow.
--
Petr "Pasky" Baudis
UN*X programmer, UN*X administrator, hobbies = IPv6, IRC
Real Users hate Real Programmers.
Public PGP key, geekcode and stuff: http://pasky.ji.cz/~pasky/
- [Freeciv-Dev] Re: RFC: Fixing movement code, (continued)
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raimar Falke, 2001/11/21
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raahul Kumar, 2001/11/21
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raimar Falke, 2001/11/22
- [Freeciv-Dev] Re: RFC: Fixing movement code, Gregory Berkolaiko, 2001/11/22
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raimar Falke, 2001/11/22
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raahul Kumar, 2001/11/22
- [Freeciv-Dev] Re: RFC: Fixing movement code, Raimar Falke, 2001/11/23
- [Freeciv-Dev] PATCH: AI cleanup Version 2, Raahul Kumar, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2,
Petr Baudis <=
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raahul Kumar, 2001/11/23
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/24
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Raimar Falke, 2001/11/25
- [Freeciv-Dev] Re: PATCH: AI cleanup Version 2, Petr Baudis, 2001/11/25
- [Freeciv-Dev] Coding Guideline, Gregor Zeitlinger, 2001/11/25
- [Freeciv-Dev] Coding Guideline RFC, Gregory Berkolaiko, 2001/11/25
- [Freeciv-Dev] Re: Coding Guideline RFC, Greg Wooledge, 2001/11/25
|
|