Difference for common/item.c from version 1.20 to 1.21


version 1.20 version 1.21
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_item_c =   * static char *rcsid_item_c =
  *   "$Id: item.c,v 1.20 2002/03/03 20:05:57 avogl Exp $";   *   "$Id: item.c,v 1.21 2002/05/31 04:18:32 mwedel Exp $";
  */   */
   
 /*  /*
Line 220
 
Line 220
  return "(null)";   return "(null)";
     if(!op->nrof && !op->weight && !op->title && !is_magical(op))       if(!op->nrof && !op->weight && !op->title && !is_magical(op))
  return op->name; /* To speed things up (or make things slower?) */   return op->name; /* To speed things up (or make things slower?) */
     if(op->nrof) {  
  safe_strcat(buf, get_number(op->nrof), &len, HUGE_BUF);  
   
  if (op->nrof!=1) safe_strcat(buf, " ", &len, HUGE_BUF);      if (op->nrof == 1)
  safe_strcat(buf,op->name, &len, HUGE_BUF);   safe_strcat(buf,op->name, &len, HUGE_BUF);
       else
    safe_strcat(buf,op->name_pl, &len, HUGE_BUF);
   
  if (op->nrof != 1) {  
      char *buf3 = strstr(buf, " of ");  
      if (buf3!=NULL) {  
  strcpy(buf2, buf3);  
  *buf3 = '\0'; /* also changes value in buf */  
      }  
      len=strlen(buf);  
      if(QUERY_FLAG(op,FLAG_NEED_IE)) {  
  char *cp=strrchr(buf,'y');  
   
  if(cp!=NULL) {  
      *cp='\0'; /* Strip the 'y' */  
      len--;  
  }  
  safe_strcat(buf,"ies", &len, HUGE_BUF);  
      } else if (buf[strlen(buf)-1]!='s')   
  /* if the item ends in 's', then adding another one is   
  * not the way to pluralize it.  The only item where this   
  * matters (that I know of) is bracers, as they start of   
  * plural   
  */  
  safe_strcat(buf,"s", &len, HUGE_BUF);  
   
      /* If buf3 is set, then this was a string that contained  
       * something of something (potion of dexterity.)  The part before  
       * the of gets made plural, so now we need to copy the rest  
       * (after and including the " of "), to the buffer string.  
       */  
      if (buf3)  
  safe_strcat(buf, buf2, &len, HUGE_BUF);  
  }  
     } else {  
  /* if nrof is 0, the object is not mergable, and thus, op->name  
     should contain the name to be used. */  
  safe_strcat(buf,op->name, &len, HUGE_BUF);  
     }  
     if (op->title && QUERY_FLAG(op,FLAG_IDENTIFIED)) {      if (op->title && QUERY_FLAG(op,FLAG_IDENTIFIED)) {
  safe_strcat(buf, " ", &len, HUGE_BUF);   safe_strcat(buf, " ", &len, HUGE_BUF);
  safe_strcat(buf, op->title, &len, HUGE_BUF);   safe_strcat(buf, op->title, &len, HUGE_BUF);
Line 414
 
Line 378
  */   */
 char *query_base_name(object *op, int plural) {  char *query_base_name(object *op, int plural) {
     static char buf[MAX_BUF];      static char buf[MAX_BUF];
     char buf2[MAX_BUF];  
     int len;      int len;
   
     if(op->name == NULL)      if((!plural && !op->name) || (plural && !op->name_pl))
  return "(null)";   return "(null)";
   
     if(!op->nrof && !op->weight && !op->title && !is_magical(op))       if(!op->nrof && !op->weight && !op->title && !is_magical(op))
  return op->name; /* To speed things up (or make things slower?) */   return op->name; /* To speed things up (or make things slower?) */
   
       if (!plural)
     strcpy(buf,op->name);      strcpy(buf,op->name);
       else
    strcpy(buf,op->name_pl);
     len=strlen(buf);      len=strlen(buf);
   
     /* This code pretty much taken directly from query_short_name */  
     if (plural) {  
  char *buf3 = strstr(buf, " of ");  
  if (buf3!=NULL) {  
      strcpy(buf2, buf3);  
      *buf3 = '\0';   /* also changes value in buf */  
      len=strlen(buf);  
  }  
   
  if(QUERY_FLAG(op,FLAG_NEED_IE)) {  
      char *cp=strrchr(buf,'y');  
   
      if(cp!=NULL) {  
  *cp='\0'; /* Strip the 'y' */  
  len--;  
      }  
      safe_strcat(buf,"ies", &len, MAX_BUF);  
  } else if (buf[strlen(buf)-1]!='s')   
      /* if the item ends in 's', then adding another one is  
       * not the way to pluralize it.  The only item where this  
       * matters (that I know of) is bracers, as they start of  
       * plural  
       */  
      safe_strcat(buf,"s", &len, MAX_BUF);  
   
  /* If buf3 is set, then this was a string that contained  
  * something of something (potion of dexterity.)  The part before  
  * the of gets made plural, so now we need to copy the rest  
  * (after and including the " of "), to the buffer string.  
  */  
  if (buf3)  
      safe_strcat(buf, buf2, &len, MAX_BUF);  
     }  
   
   
     if (op->title && QUERY_FLAG(op,FLAG_IDENTIFIED)) {      if (op->title && QUERY_FLAG(op,FLAG_IDENTIFIED)) {
  safe_strcat(buf, " ", &len, MAX_BUF);   safe_strcat(buf, " ", &len, MAX_BUF);
  safe_strcat(buf, op->title, &len, MAX_BUF);   safe_strcat(buf, op->title, &len, MAX_BUF);


Legend:
line(s) removed in v.1.20 
line(s) changed
 line(s) added in v.1.21

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