View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0000514 | LDMud 3.3 | Runtime | public | 2007-09-10 16:01 | 2018-01-29 21:57 |
Reporter | Gnomi | Assigned To | |||
Priority | normal | Severity | minor | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Platform | i686 | OS | Debian GNU/Linux | OS Version | 3.1 |
Product Version | 3.3.713 | ||||
Fixed in Version | 3.3.717 | ||||
Summary | 0000514: remove_shadow_actions and remove_action don't handle shadow actions very well | ||||
Description | Hi, remove_shadow_action assumes, that the shadow is the only shadow and that there are no shadows between it and the underlying object. But should go through the shadowing list till the underlying object just as add_action does. remove_action doesn't work with actions by shadows at all, that means, only the underlying object can remove such an action, not the shadow itself. Because it searches for an action by the shadow, not by the underlying object. I attached a patch, that should fix both issues. I left remove_action backward compatible in that manner, that the underlying object can still remove actions from its shadows (but shadows can only remove their actions). Greetings, Gnomi | ||||
Tags | No tags attached. | ||||
Attached Files | removeshadowaction.diff (1,767 bytes)
Index: trunk/src/actions.c =================================================================== --- trunk/src/actions.c (Revision 2314) +++ trunk/src/actions.c (Arbeitskopie) @@ -487,7 +487,15 @@ { object_t *item; + object_t *shadowing; + /* Get the real underlying object, just as add_action does. */ + while ((target->flags & O_SHADOW) + && NULL != (shadowing = O_GET_SHADOW(target)->shadowing)) + { + target = shadowing; + } + remove_shadow_action_sent(shadow, target); for (item = target->contains; item; item = item->next_inv) { @@ -1888,7 +1896,7 @@ */ { - object_t *ob; + object_t *ob, *shadow_ob; string_t *verb; sentence_t **sentp; action_t *s; @@ -1917,14 +1925,33 @@ efun_gen_arg_error(1, sp[-1].type, sp); /* NOTREACHED */ } - - /* Now search and remove the sentence */ + rc = 0; sentp = &ob->sent; + ob = current_object; + shadow_ob = NULL; + + /* Look for the underlying object, just as add_action does. */ + if (ob->flags & O_SHADOW && O_GET_SHADOW(ob)->shadowing) + { + object_t *shadowing; + + shadow_ob = ob; + + while ((ob->flags & O_SHADOW) + && NULL != (shadowing = O_GET_SHADOW(ob)->shadowing)) + { + ob = shadowing; + } + } + + /* Now search and remove the sentence */ while ( NULL != (s = (action_t *)*sentp) ) { - if (!SENT_IS_INTERNAL((*sentp)->type) && s->ob == ob && (!verb || s->verb == verb)) + if (!SENT_IS_INTERNAL((*sentp)->type) && s->ob == ob + && (!verb || s->verb == verb) + && (!shadow_ob || s->shadow_ob == shadow_ob)) { #ifdef CHECK_OBJECT_REF if (sentp == &ob->sent) | ||||
Date Modified | Username | Field | Change |
---|---|---|---|
2007-09-10 16:01 | Gnomi | New Issue | |
2007-09-10 16:01 | Gnomi | File Added: removeshadowaction.diff | |
2007-11-11 17:24 |
|
Status | new => resolved |
2007-11-11 17:24 |
|
Fixed in Version | => 3.3.717 |
2007-11-11 17:24 |
|
Resolution | open => fixed |
2007-11-11 17:24 |
|
Assigned To | => lars |
2007-11-11 17:24 |
|
Note Added: 0000575 | |
2009-04-14 12:14 | zesstra | Project | LDMud => LDMud 3.3 |
2010-11-16 09:42 |
|
Source_changeset_attached | => ldmud.git master 1c6725c3 |
2018-01-29 18:59 |
|
Source_changeset_attached | => ldmud.git master 1c6725c3 |
2018-01-29 21:57 |
|
Source_changeset_attached | => ldmud.git master 1c6725c3 |