Complete.Org: Mailing Lists: Archives: freeciv-dev: June 1999:
Re: [Freeciv-Dev] Programing style
Home

Re: [Freeciv-Dev] Programing style

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: Nicolas Brunel <brunel@xxxxxxxxxxxxxxxxxxxx>
Cc: freeciv-dev@xxxxxxxxxxx
Subject: Re: [Freeciv-Dev] Programing style
From: Andy Black <ablack@xxxxxxxxxxxxxx>
Date: Thu, 10 Jun 1999 11:22:29 -0600 (MDT)
Reply-to: Andy Black <ablack@xxxxxxxxxxxxxx>

> > 3. lack of function prototypes
> Most be reported.

I'll work on a list of those functions
 
> > 4. inplicit enum conversions
> >     implicit enum conversions ar things like feeding an int to a
> > function that requires an enum or returning an int where an enum is
> > wanted.
> >     one major source is the currently_building item in the city
> > struct. if c suports unions, I would do the folowing:
> > 
> > in city.h, struct city
> > replace
> >   int currently_building;
> > with
> >   union currently_building;
> >   {
> >     unit_type_id unit;
> >     improvement_type_id building;
> >   }
> 
> Here, I'd prefer a patch which does that.
> there are around one hundred places in which currently building is used
> throughout the code. In some places, we don't know if it's a unit
> or a building which is build. I'm not sure using an union will be enough.
> 

you can tell if the object under construction is a building or unit by
checking the value of the variable is_building_unit in the city struct,
and that variable could be passed to other functions if needed.

Andy Black



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