Re: [Freeciv-Dev] Programing style
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
> > 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
Re: [Freeciv-Dev] Programing style,
Andy Black <=
|
|