View Issue Details

IDProjectCategoryView StatusLast Update
0000505LDMud 3.3Implementationpublic2018-01-29 22:57
Reporterzesstra Assigned Tozesstra  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.3 
Fixed in Version3.3.717 
Summary0000505: tell_room() does not send to 'room' itself, only the contained objects
Descriptiontell_room() sends the message only to objects contained in 'room', unlike say(), which sends the message also the environment itself, if suitable (interactive or living).
Some wizard build containers/rooms/environments which are marked as living and define catch_tell(). In that cases, it would be very nice, if tell_room() and say() would have the same behaviour.
Steps To ReproduceDefine catch_tell() in /room/room1.c and call enable_commands() in its create() and call tell_room("/room/room1","bla").
Additional InformationIn object.c:
e_say() adds the environment to the list of recipients, e_tell_room() does not. The attached patch for e_tell_room() adds 'room' to the list of recipients, if 'room' is interactive or marked as living.
TagsNo tags attached.

Activities

2007-06-27 16:41

 

tell_room.patch (1,676 bytes)   
--- ldmud-3.3.714.orig/src/object.c	2006-07-10 04:43:01.000000000 +0200
+++ ldmud-3.3.714/src/object.c	2007-06-27 22:37:36.000000000 +0200
@@ -4895,12 +4895,15 @@
 {
     object_t *ob;
     object_t *save_command_giver;
-    int num_recipients = 0;
+    // start with num_recipients==1 because the room/container itself is 1 
+    // recipient, which is not counted in the for-loop (see below)
+    int num_recipients = 1;
     object_t *some_recipients[20];
     object_t **recipients;
     object_t **curr_recipient;
     char *message;
     static svalue_t stmp = { T_OBJECT, } ;
+    interactive_t *ip;        
 
     /* Like in say(), collect the possible recipients.
      * First count how many there are.
@@ -4908,8 +4911,6 @@
 
     for (ob = room->contains; ob; ob = ob->next_inv)
     {
-        interactive_t *ip;
-
         if ( ob->flags & O_ENABLE_COMMANDS
          ||  O_SET_INTERACTIVE(ip, ob))
         {
@@ -4926,10 +4927,14 @@
 
     /* Now fill the table */
     curr_recipient = recipients;
+    /* The environment itself? */
+    if (room->flags & O_ENABLE_COMMANDS
+        || O_SET_INTERACTIVE(ip, room)) {
+            *curr_recipient++ = room;
+    }
+    // now the objects in the room/container
     for (ob = room->contains; ob; ob = ob->next_inv)
     {
-        interactive_t *ip;
-
         if ( ob->flags & O_ENABLE_COMMANDS
          ||  O_SET_INTERACTIVE(ip, ob))
         {
@@ -4996,8 +5001,6 @@
 
     for (curr_recipient = recipients; NULL != (ob = *curr_recipient++); )
     {
-        interactive_t *ip;
-
         if (ob->flags & O_DESTRUCTED) continue;
         stmp.u.ob = ob;
         if (lookup_key(&stmp, avoid) >= 0) continue;
tell_room.patch (1,676 bytes)   

Gnomi

2008-07-01 05:14

manager   ~0000641

ACK. (Except for the codestyle. ;-)

zesstra

2008-07-16 15:56

administrator   ~0000729

Changed codestyle ;-) and applied in r2389.

Issue History

Date Modified Username Field Change
2007-06-27 16:41 zesstra New Issue
2007-06-27 16:41 zesstra File Added: tell_room.patch
2008-06-30 04:58 zesstra Status new => assigned
2008-06-30 04:58 zesstra Assigned To => zesstra
2008-07-01 05:14 Gnomi Note Added: 0000641
2008-07-16 15:56 zesstra Status assigned => resolved
2008-07-16 15:56 zesstra Fixed in Version => 3.3.717
2008-07-16 15:56 zesstra Resolution open => fixed
2008-07-16 15:56 zesstra Note Added: 0000729
2010-11-16 10:42 zesstra Source_changeset_attached => ldmud.git master 493cccf3
2018-01-29 19:59 zesstra Source_changeset_attached => ldmud.git master 493cccf3
2018-01-29 22:57 zesstra Source_changeset_attached => ldmud.git master 493cccf3