[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 >
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.
> 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.
jason
|
|