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]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#13474) a city_production struct
From: "Vasco Alexandre da Silva Costa" <vasc@xxxxxxxxxxxxxx>
Date: Fri, 15 Jul 2005 15:54:33 -0700
Reply-to: bugs@xxxxxxxxxxx

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

On Thu, 14 Jul 2005, Jason Short wrote:

> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13474 >
>
> I'd rather have
>
> struct {
>   bool is_unit
>   struct impr_type *building;
>   struct unit_type *unit;
> };

My gut tells me all this replacement of ids and indexes with pointers will
eventually lead to tears, but whatever! :)

This should be using a union though:

struct {
  enum prod_type type;
  union {
    struct impr_type *building;
    struct unit_type *unit;
  } item;
};

Wastes less memory, makes it more obvious there can only be one item at a
time, etc.

---
Vasco Alexandre da Silva Costa @ Instituto Superior Tecnico, Lisboa





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