Difference for server/monster.c from version 1.77 to 1.78


version 1.77 version 1.78
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_monster_c =   * static char *rcsid_monster_c =
  *    "$Id: monster.c,v 1.77 2005/05/15 20:03:34 akirschbaum Exp $";   *    "$Id: monster.c,v 1.78 2005/07/14 16:21:34 ryo_saeba Exp $";
  */   */
   
 /*  /*
Line 1500
 
Line 1500
  * match in 'match', and returns the portion of the message.  This   * match in 'match', and returns the portion of the message.  This
  * returned portion is in a malloc'd buf that should be freed.   * returned portion is in a malloc'd buf that should be freed.
  * Returns NULL if no match is found.   * Returns NULL if no match is found.
    * The player is passed too, so that quest-related messages can be checked too.
  */   */
 static char *find_matching_message(char *msg, char *match)  static char *find_matching_message(object* pl, char *msg, char *match)
 {  {
     char *cp=msg, *cp1, *cp2, regex[MAX_BUF], *cp3, gotmatch=0;      char *cp=msg, *cp1, *cp2, regex[MAX_BUF], *cp3, gotmatch=0;
   
Line 1540
 
Line 1541
      }       }
  }   }
      }       }
      if (gotmatch) {       if (gotmatch && ( cp2 = quest_message_check( cp2 + 1, pl ) ) ) {
  if (cp1) {   if (cp1) {
      cp3 = malloc(cp1 - cp2 + 1);       cp3 = malloc(cp1 - cp2);
      strncpy(cp3, cp2+1, cp1 - cp2);       strncpy(cp3, cp2, cp1 - cp2 - 1);
      cp3[cp1 - cp2] = 0;       cp3[cp1 - cp2 - 1] = 0;
  }   }
  else { /* if no next match, just want the rest of the string */   else { /* if no next match, just want the rest of the string */
      cp3 = strdup_local(cp2 + 1);       cp3 = strdup_local(cp2);
  }   }
  return cp3;   return cp3;
      }       }
           gotmatch = 0;
      if (cp1) cp = cp1 + 1;       if (cp1) cp = cp1 + 1;
      else return NULL;       else return NULL;
  }   }
Line 1594
 
Line 1596
   
  for(npc = get_map_ob(mp,x,y); npc != NULL; npc = npc->above) {   for(npc = get_map_ob(mp,x,y); npc != NULL; npc = npc->above) {
      if (npc->type == MAGIC_EAR) {       if (npc->type == MAGIC_EAR) {
  (void) talk_to_wall(npc, txt); /* Maybe exit after 1. success? */   (void) talk_to_wall(op, npc, txt); /* Maybe exit after 1. success? */
  if (orig_map != op->map) {   if (orig_map != op->map) {
      LOG(llevDebug,"Warning: Forced to swap out very recent map - MAX_OBJECTS should probably be increased\n");       LOG(llevDebug,"Warning: Forced to swap out very recent map - MAX_OBJECTS should probably be increased\n");
      return;       return;
Line 1671
 
Line 1673
     if(npc->msg == NULL || *npc->msg != '@')      if(npc->msg == NULL || *npc->msg != '@')
  return 0;   return 0;
   
     cp = find_matching_message(npc->msg, txt);      cp = find_matching_message(op, npc->msg, txt );
     if (cp) {      if (cp) {
         sprintf(buf,"%s says:",query_name(npc));          sprintf(buf,"%s says:",query_name(npc));
  new_info_map(NDI_NAVY|NDI_UNIQUE, npc->map,buf);   new_info_map(NDI_NAVY|NDI_UNIQUE, npc->map,buf);
Line 1682
 
Line 1684
     return 0;      return 0;
 }  }
   
 int talk_to_wall(object *npc, char *txt) {  int talk_to_wall(object* pl, object *npc, char *txt) {
     char *cp;      char *cp;
   
     if(npc->msg == NULL || *npc->msg != '@')      if(npc->msg == NULL || *npc->msg != '@')
  return 0;   return 0;
   
     cp = find_matching_message(npc->msg, txt);      cp = find_matching_message(pl, npc->msg, txt);
     if (!cp)      if (!cp)
  return 0;   return 0;
   


Legend:
line(s) removed in v.1.77 
line(s) changed
 line(s) added in v.1.78

File made using version 1.98 of cvs2html by leaf at 2011-07-21 17:37