Difference for common/item.c from version 1.12 to 1.13


version 1.12 version 1.13
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_item_c =   * static char *rcsid_item_c =
  *   "$Id: item.c,v 1.12 2000/11/26 07:20:11 peterm Exp $";   *   "$Id: item.c,v 1.13 2000/12/04 00:40:03 cvs Exp $";
  */   */
   
 /*  /*
Line 54
 
Line 54
   "seventieth","eightieth","ninetieth"    "seventieth","eightieth","ninetieth"
 };  };
   
   /* describe_resistance generates the visible naming for resistances.
    * returns a static array of the description.  This can return
    * a big buffer.
    * if newline is true, we don't put parens around the description
    * but do put a newline at the end.  Useful when dumping to files
    */
   char *describe_resistance(object *op, int newline)
   {
       static char buf[VERY_BIG_BUF];
       char    buf1[VERY_BIG_BUF];
       int tmpvar;
   
       buf[0]=0;
       for (tmpvar=0; tmpvar<NROFATTACKS; tmpvar++) {
          if (op->resist[tmpvar]) {
        if (!newline)
    sprintf(buf1,"(%s %+d)", resist_plus[tmpvar], op->resist[tmpvar]);
        else
    sprintf(buf1,"%s %d\n", resist_plus[tmpvar], op->resist[tmpvar]);
   
        strcat(buf, buf1);
          }
       }
       return buf;
   }
   
   
 /*  /*
  * query_weight(object) returns a character pointer to a static buffer   * query_weight(object) returns a character pointer to a static buffer
Line 147
 
Line 173
  sprintf(buf+strlen(buf), "(dam%+d)", op->stats.dam);   sprintf(buf+strlen(buf), "(dam%+d)", op->stats.dam);
     if(op->stats.ac)      if(op->stats.ac)
  sprintf(buf+strlen(buf), "(ac%+d)", op->stats.ac);   sprintf(buf+strlen(buf), "(ac%+d)", op->stats.ac);
     if(op->armour)  
  sprintf(buf+strlen(buf), "(armour%+d)", op->armour);      strcat(buf,describe_resistance(op, 0));
   
     if (op->stats.food != 0)      if (op->stats.food != 0)
  sprintf(buf+strlen(buf), "(sustenance%+d)", op->stats.food);   sprintf(buf+strlen(buf), "(sustenance%+d)", op->stats.food);
  /*    else if (op->stats.food < 0)   /*    else if (op->stats.food < 0)
Line 171
 
Line 198
  strcat(buf,"(stealth)");   strcat(buf,"(stealth)");
     /* Shorten some of the names, so they appear better in the windows */      /* Shorten some of the names, so they appear better in the windows */
     len=strlen(buf);      len=strlen(buf);
     DESCRIBE_ABILITY_SAFE(buf, op->immune, "Immune", &len, VERY_BIG_BUF);  
     DESCRIBE_ABILITY_SAFE(buf, op->protected, "Pro", &len, VERY_BIG_BUF);  
     DESCRIBE_ABILITY_SAFE(buf, op->vulnerable, "Vuln", &len, VERY_BIG_BUF);  
     DESCRIBE_PATH_SAFE(buf, op->path_attuned, "Attuned", &len, VERY_BIG_BUF);      DESCRIBE_PATH_SAFE(buf, op->path_attuned, "Attuned", &len, VERY_BIG_BUF);
     DESCRIBE_PATH_SAFE(buf, op->path_repelled, "Repelled", &len, VERY_BIG_BUF);      DESCRIBE_PATH_SAFE(buf, op->path_repelled, "Repelled", &len, VERY_BIG_BUF);
     DESCRIBE_PATH_SAFE(buf, op->path_denied, "Denied", &len, VERY_BIG_BUF);      DESCRIBE_PATH_SAFE(buf, op->path_denied, "Denied", &len, VERY_BIG_BUF);
Line 699
 
Line 723
     }      }
   }    }
   if(!need_identify(op) || QUERY_FLAG(op,FLAG_IDENTIFIED) || QUERY_FLAG(op,FLAG_BEEN_APPLIED)) {    if(!need_identify(op) || QUERY_FLAG(op,FLAG_IDENTIFIED) || QUERY_FLAG(op,FLAG_BEEN_APPLIED)) {
     if(op->armour) {  
       sprintf(buf,"(armour%+d)",op->armour);  
       strcat(retbuf,buf);  
     }  
     if(QUERY_FLAG(op,FLAG_XRAYS))      if(QUERY_FLAG(op,FLAG_XRAYS))
       strcat(retbuf,"(xray-vision)");        strcat(retbuf,"(xray-vision)");
     if(QUERY_FLAG(op,FLAG_FLYING))      if(QUERY_FLAG(op,FLAG_FLYING))
Line 781
 
Line 801
      QUERY_FLAG(op,FLAG_MONSTER)) {       QUERY_FLAG(op,FLAG_MONSTER)) {
 /*    if (op->attacktype != 1)*/  /*    if (op->attacktype != 1)*/
       DESCRIBE_ABILITY(retbuf, op->attacktype, "Attacks");        DESCRIBE_ABILITY(retbuf, op->attacktype, "Attacks");
       DESCRIBE_ABILITY(retbuf, op->immune, "Immune");        strcat(retbuf,describe_resistance(op, 0));
       DESCRIBE_ABILITY(retbuf, op->protected, "Protected");  
       DESCRIBE_ABILITY(retbuf, op->vulnerable, "Vulnerable");  
       DESCRIBE_PATH(retbuf, op->path_attuned, "Attuned");        DESCRIBE_PATH(retbuf, op->path_attuned, "Attuned");
       DESCRIBE_PATH(retbuf, op->path_repelled, "Repelled");        DESCRIBE_PATH(retbuf, op->path_repelled, "Repelled");
       DESCRIBE_PATH(retbuf, op->path_denied, "Denied");        DESCRIBE_PATH(retbuf, op->path_denied, "Denied");
Line 792
 
Line 810
 }  }
   
 /* Return true if the item is magical.  A magical item is one that  /* Return true if the item is magical.  A magical item is one that
  * increases/decreases any abilities, provides protection, immunity,   * increases/decreases any abilities, provides a resistance,
  * or vulnerability, has a generic magical bonus, or is an artifact.   * has a generic magical bonus, or is an artifact.
  * This function is used by detect_magic to determine if an item   * This function is used by detect_magic to determine if an item
  * should be marked as magical.   * should be marked as magical.
  */   */
Line 836
 
Line 854
  (op->type==WAND && op->stats.food))   (op->type==WAND && op->stats.food))
      return 1;       return 1;
   
     /* if something protects, immunes or vulnerables, it must be magical.      /* if something gives a protection, either positive or negative, its magical */
      * power crystal, spellbooks, and scrolls are always magical.      for (i=0; i<NROFATTACKS; i++)
      */   if (op->resist[i]) return 1;
     if (op->immune || op->protected || op->vulnerable || op->magic ||  
  op->type==POWER_CRYSTAL || op->type==SPELLBOOK || op->type==SCROLL ||     /* power crystal, spellbooks, and scrolls are always magical.  */
  op->type==GIRDLE)     if (op->magic || op->type==POWER_CRYSTAL || op->type==SPELLBOOK ||
    op->type==SCROLL || op->type==GIRDLE)
      return 1;       return 1;
   
     /* Check to see if it increases/decreases any stats */      /* Check to see if it increases/decreases any stats */
Line 853
 
Line 872
      */       */
     return 0;      return 0;
 }  }
 #if 0  
 int always_magical(object *op) {  
   switch(op->type) {  
   case RING:  
   case BRACERS:  
   case AMULET:  
   case GIRDLE:  
   case ROD:  
   case SCROLL:  
   case SPELLBOOK:  
   case POTION:  
     return 1;  
   case WAND:  
     if (op->stats.food)  
       return 1;  
   }  
   return 0;  
 }  
 #endif  
   
 /* need_identify returns true if the item should be identified.  This   /* need_identify returns true if the item should be identified.  This
  * function really should not exist - by default, any item not identified   * function really should not exist - by default, any item not identified


Legend:
line(s) removed in v.1.12 
line(s) changed
 line(s) added in v.1.13

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