[CF-Devel] monster.c:communicate "feature"

Pertti Karppinen (OH6KTR) pjka at cc.jyu.fi
Wed Jan 10 07:59:39 CST 2001


In line 1348-1349 in monster.c function communicate we see:

if (talk_to_npc(npc,txt))
    return; /* Can be crowded */

This seems to have funny side effect: You can be standing on a magic ear and
say the 'magic' words, but if there's' a npc earlier in the search path, the
ear never gets the message (provided that npc has match * or otherwise a
match for what You have said).

This also brings with it a restriction for map makers, as they need to place
'important' NPCs far enough away from other NPCs, so one can talk to them.
The magic ear should still always get the message IMO. Easy fix, which
retains the behaviour, that only one NPC needs to hear us, follows:

void communicate(object *op, char *txt) {
  object *npc;
  int i;
  int flag=1;
  for(i = 0; i <= SIZEOFFREE2; i++)
    if (!out_of_map(op->map, op->x+freearr_x[i], op->y+freearr_y[i]))
      for(npc = get_map_ob(op->map,op->x+freearr_x[i],op->y+freearr_y[i]);
	  npc != NULL; npc = npc->above) {
	if (npc->type == MAGIC_EAR)
	  (void) talk_to_wall(npc, txt);
	/* Maybe exit after 1. success? */
        else if(flag) {
	  if (talk_to_npc(npc,txt))
	    flag=0; /* Can be crowded */
	}
      }
}

-- 
BSc. Pertti Karppinen <
     
     pjka at iki.fi
     
     >                   |'Bridge Players |
Systems Designer, University of Jyvaskyla, Finland    |      Do        |
     
     http://www.iki.fi/~pjka/
     
      | Office  : +358 14 260 2088 |      It        |
HAM: OH6KTR QTH: KP22UF  | Cellular: +358 40 564 0786 | on the Table'  |

    
    


More information about the crossfire mailing list