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:50:57 -0700
Reply-to: bugs@xxxxxxxxxxx

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

Vasco Alexandre da Silva Costa wrote:

> Why not do it the other way around? i.e. Replace pcity->is_building_unit
> and pcity->currently_building with pcity->production which is a cid or
> wid, whatever?

Because cid is an overloaded integer: not very pretty, not typesafe, etc.

> A unique identifier for things which can be produced at a city is useful
> in lots of places and I am uncertain turning this into a struct is a very
> good idea.

In that case I'd rather have a unique identifier for all items -
including techs, etc.  Tech production works at the player level exactly
as unit/building production works at the city level.

If we were object-oriented we could use some sort of class hierarchy.
The C version would be to just use a void* (pointer-to-building,
pointer-to-unit, pointer-to-tech) and determine the type as needed.

Why does a unique identifier need to be an integer rather than a pointer
or a struct?

-jason





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