[DGD] Inherited objects list
Noah Gibbs
noah_gibbs at yahoo.com
Thu Oct 27 18:40:01 CEST 2005
Oy. This way requires modifying the DGD server, I assume, since this looks
like DGD internals.
Phantasmal just tracks all this stuff in LPC, but you need an ObjectD to do
that.
--- Lord Lerkista <lordlerkista at gmx.net> wrote:
> I need some help to fix this function, don't work like i want, i want to
> use it like "inherits <object>"
> but always gives me information about the object that has the function
> call, ignoring my given object
> I don't remember where i get this code, i had to edit it to make it run
> in my Mud, but i think i made
> something wrong, any help??
>
> /*
> * string *inherits(object obj)
> *
> * obj - the object for which the inherit information is required.
> *
> * Returns an array of the names of the objects that obj inherits.
> */
>
> #ifdef FUNCDEF
> FUNCDEF("inherits", kf_inherits, pt_inherits)
> #else
> char pt_inherits[] = { C_TYPECHECKED | C_STATIC, 1, 0, 0, 7, T_OBJECT,
> T_OBJECT };
>
> int kf_inherits(f)
> register frame *f;
> {
> array *inherit_list;
> control *ctrl;
> object *obj;
> value *v;
> int i;
> char *object_name;
> char buf[17];
>
> /*
> * Get the object argument and its control structure
> */
> obj = &otable[f->oindex];
> ctrl = o_control(obj);
>
> /*
> * Get the "base" name of the object
> */
> if (obj->flags & O_MASTER) {
> object_name = o_name(buf, obj);
> }
> else {
> object_name = o_name(buf, &otable[obj->u_master]);
> }
> if (ctrl->ninherits <= 0) {
> /*
> * This object doesn't inherit any others.
> * Return a "blank" array.
> */
> inherit_list = arr_new(f->data, 0L);
> }
> else {
> /*
> * Create a list of the names of objects inherited by this object
> */
> inherit_list = arr_new(f->data, (long) ctrl->ninherits - 1);
> for (i = 0, v = inherit_list->elts; i < ctrl->ninherits - 1; ) {
> /*
> * Don't include the name of the object's master object
> */
> if (strcmp(OBJR(ctrl->inherits[i].oindex)->chain.name,
> object_name)) {
> v->type = T_STRING;
> str_ref(v->u.string =
> str_new(OBJR(ctrl->inherits[i].oindex)->chain.name,
>
> strlen(OBJR(ctrl->inherits[i].oindex)->chain.name)));
> i++;
> v++;
> }
> }
> }
>
> /*
> * Push the array on the stack
> */
> f->sp->type = T_ARRAY;
> arr_ref(f->sp->u.array = inherit_list);
> return 0;
> }
> #endif /* FUNCDEF */
>
> __________________________________________
> http://mail.dworkin.nl/mailman/listinfo/dgd
>
__________________________________
Yahoo! FareChase: Search multiple travel sites in one click.
http://farechase.yahoo.com
More information about the DGD
mailing list