[Freeciv-Dev] Re: (PR#8521) sha.c crashes
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8521 >
On Mon, Apr 19, 2004 at 07:21:36PM -0700, Jason Short wrote:
>
> <URL: http://rt.freeciv.org/Ticket/Display.html?id=8521 >
>
> Raimar Falke wrote:
>
> >>Which leads me to conclude that destroy_unit should be removed and
> >>unit_clone should be clone_unit_virtual.
> >
> >>A "virtual" unit is the part of the unit allocation that is common
> >>between client and server. We don't need two concepts for this.
> >
> > Uhhh. Care to cite something? AFAIK virtual means that the unit
> > doesn't exists (a virtual unit in the client is unknown to the server,
> > a virtual unit in the server-ai is unknown to the server,...). The
> > original reason for it was that some function's wanted "struct unit *"
> > so so you created a virtual unit to pass into them. It was first
> > introduced by Gregory in the air goto patches:
> >
> > +/**********************************************************
> > + * Create a virtual unit to use in build want estimation
> > + *********************************************************/
> > +struct unit *create_unit_virtual(struct player *pplayer, int x, int y,
> > + Unit_Type_id type, bool make_veteran)
>
> Yes. And the units used by the historian agent are "virtual" units in
> this sense. They aren't a part of the normal hierarchy (unit hash,
> pplayer->units, ptile->units) but are tracked internally by sha.c.
I agree that neither virtual units nor "sha units" are part of the
general reference graph. However I think that the construction and use
differ between these two. Virtual units are constructed from a few
bits of data (see parameters above) and are used to pass them to
functions. The sha however wants a data container (a clone) which
holds all data. The sha also doesn't pass the clone around.
> > So we should drop the _virtual and just name it
> > "unit_create". "unit_destroy" can then be used for both "unit_create"
> > and "unit_clone". unittools.c:create_unit should be renamed to
> > unittools.c:server_create_unit or similar to denote that more work is
> > done here.
>
> Possibly. This is just a matter of semantics, however.
>
> My point is that there are only two concepts: server/client unit and
> virtual unit. A server/client unit is a subset/subclass of a virtual
> unit. This may not be how the concept of a virtual unit started but it
> has undeniably evolved into this.
Since we want solutions, what do you suggest?
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Some development methodoligies suck. In fack, I think most of them
do. The Linux kernel development is an unorganized mess. The
OpenBSD kernel development is a closed mess. XFree86 development
is a mysterious mess. And that's before we even get to proprietary
software, which is often ten times worse"
-- John Goerzen in freeciv-dev
|
|