[SERVER] chparent()
Kai Storbeck (kais@dds.nl)
Wed, 20 Mar 1996 11:14:59 PST
At 6:13 20/3/96, Ranalou wrote:
>I know that it is so with create(), but when a chparent() is done, does
>the :initialize() verb on the changed object get called? If not, why?
>And, if there is no reason why this would be a bad thing, I'd like to add
>it to the wish-list for future servers...
>
That's very easy to hack yourself..
Ron is right in his opinion on calling `initialize' so this function call's
`init_chparent' on the object chparented.
You could add the ++-ed lines in function bf_chparent in the file objects.c
---------------
bf_chparent(Var arglist, Byte next, void *vdata, Objid progr)
{ /* (object, new_parent) */
Objid what =3D arglist.v.list[1].v.obj;
Objid parent =3D arglist.v.list[2].v.obj;
Objid oid;
+ enum error e;
+ Var args;
free_var(arglist);
if (!valid(what)
|| !controls(progr, what)
|| (!valid(parent) && parent !=3D NOTHING)
|| (valid(parent) && !db_object_allows(parent, progr, FLAG_FERTILE)=
))
return make_error_pack(E_PERM);
else {
for (oid =3D parent; oid !=3D NOTHING; oid =3D db_object_parent(oid=
))
if (oid =3D=3D what)
return make_error_pack(E_RECMOVE);
if (!db_change_parent(what, parent))
return make_error_pack(E_INVARG);
else
+ { /* call the verb <object>:init_chparent() */
+ args =3D new_list(0);
+ e =3D call_verb(what, "init_chparent", args, 0);
return no_var_pack();
+ }
}
}
------
I don't know if I missed a free() or something else, but I belive it works.
--Kai
------ kais@moo.dds.nl ----- Mac=81Help for stupid's ------
------- kais@xs4all.net --- http://www.dds.nl/~kais/ -------
-------- ledormant@dds.nl - LeD@ some moo's --------