MOO-cows Mailing List Archive

[Prev][Next][Index][Thread]

Re: [SERVER] chparent()



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 = arglist.v.list[1].v.obj;
     Objid       parent = 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 != NOTHING)
         || (valid(parent) && !db_object_allows(parent, progr, FLAG_FERTILE)))
         return make_error_pack(E_PERM);
     else {
         for (oid = parent; oid != NOTHING; oid = db_object_parent(oid))
             if (oid == 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 = new_list(0);
+            e = 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Help for stupid's    ------
-------  kais@xs4all.net  ---  http://www.dds.nl/~kais/ -------
-------- ledormant@dds.nl  -      LeD@ some moo's      --------




Follow-Ups:

Home | Subject Index | Thread Index