[Freeciv-Dev] Re: [PATCH] make ai_choice->type enum choice_type (PR#1318
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Dear diary, on Wed, Mar 13, 2002 at 11:47:23AM CET, I got a letter,
where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> On Tue, Mar 12, 2002 at 08:09:59PM +0100, Petr Baudis wrote:
> > Dear diary, on Tue, Mar 12, 2002 at 08:01:28PM CET, I got a letter,
> > where Raimar Falke <hawk@xxxxxxxxxxxxxxxxxxxxxxx> told me, that...
> > > On Mon, Mar 11, 2002 at 11:07:12AM +0100, Petr Baudis wrote:
> > > > Dear diary, on Sun, Mar 10, 2002 at 05:47:33PM CET, I got a letter,
> > > > where
> > > > Markus Linnala <maage@xxxxxxxxx> told me, that...
> > > > >
> > > > > As ai_choice->type is usually of type enum choice_type, make it so.
> > > > > Use
> > > > > common initialisation function, clear_ai_choice. aitech.c used type
> > > > > for
> > > > > something else, so add new field tech_want to ai_choice.
> > > >
> > > > Good thing (tm). However, I believe Ross did something similiar.. and
> > > > it looks
> > > > he did it probably better.
> > > >
> > > > +int init_choice(struct ai_choice *cur)
> > > > + static struct ai_choice choice = { A_NONE, 0, CT_NONE };
> > > > +
> > > > + *cur = choice;
> > > > + return 1;
> > > > +}
> > > >
> > > > I happen to like his approach more and also his choice of function name
> > > > ;).
> > >
> > > *init* is better. The return value is useless. The implementation
> > > contains a memcpy instead of the three assignments. I prefer the three
> > > assignments or an initialization in the "new" format:
> > > static struct ai_choice choice = {
> > > choice: A_NONE,
> > > want: 0,
> > > type: CT_NONE
> > > };
> >
> > Hum.. "new" format.. oh well, after all, why not? :)
> >
> > void init_choice(struct ai_choice *cur)
> > {
> > static struct ai_choice choice = {
> > choice: A_NONE,
> > want: 0,
> > type: CT_NONE,
> > };
> >
> > *cur = choice;
> > }
>
> To be honest I prefer the three assignments over the
> initialization. This static variable with initialization and the
> single struct assignment is just exotic.
Okay, why not.. I don't care so much :).
--
Petr "Pasky" Baudis
* elinks maintainer * IPv6 guy (XS26 co-coordinator)
* IRCnet operator * FreeCiv AI hacker
.
"If you have acquired knowledge, what do you lack?
If you lack knowledge, what have you acquired?"
Lev. R. 1:6
.
Public PGP key && geekcode && homepage: http://pasky.ji.cz/~pasky/
|
|