Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] Re: (PR#13474) a city_production struct
Home

[Freeciv-Dev] Re: (PR#13474) a city_production struct

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] Re: (PR#13474) a city_production struct
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Fri, 15 Jul 2005 19:52:53 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13474 >

Benoit Hudson wrote:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13474 >
> 
>>Wastes less memory, makes it more obvious there can only be one item at a
>>time, etc.
> 
> 
> where "etc" maps to "more likely to call unit_type functions on a
> impr_type and crash in mysterious ways.  Unions are dangerous; unless
> we're extremely pinched on space (which for city structs we aren't)
> they are to be avoided.
> 
> Of course, currently we're likely to occasionally use an
> improvement-type index as a unit-type.

Yes, it would still be better than the current situation.  We have (or
should have) lots of sanity checks like

  assert(&improvements[b->index] == b);

that will catch an error here.

However memory isn't an issue here (the city struct is 2000 bytes, 4
more won't matter).  A union requires more typing
(pcity->production.value.impr versus pcity->production.impr) but
otherwise I don't really care.

-jason





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