Difference for common/living.c from version 1.56 to 1.57


version 1.56 version 1.57
Line 1
 
Line 1
 /*  /*
  * static char *rcsid_living_c =   * static char *rcsid_living_c =
  *   "$Id: living.c,v 1.56 2003/11/07 19:54:49 ryo_saeba Exp $";   *   "$Id: living.c,v 1.57 2003/11/10 05:39:50 mwedel Exp $";
  */   */
   
 /*  /*
Line 1590
 
Line 1590
  * flag is what to do if the player doesn't have the skill:   * flag is what to do if the player doesn't have the skill:
  */   */
   
 static void add_player_exp(object *op, int exp, char *skill_name, int flag)  static void add_player_exp(object *op, sint64 exp, char *skill_name, int flag)
 {  {
     object *skill_obj=NULL;      object *skill_obj=NULL;
     sint64 limit, exp_to_add;      sint64 limit, exp_to_add;
Line 1694
 
Line 1694
  * exp is the amount of exp to subtract - thus, it should be   * exp is the amount of exp to subtract - thus, it should be
  * a postive number.   * a postive number.
  */   */
 static void subtract_player_exp(object *op, int exp, char *skill, int flag)  static void subtract_player_exp(object *op, sint64 exp, char *skill, int flag)
 {  {
     float fraction = (float) exp/(float) op->stats.exp;      float fraction = (float) exp/(float) op->stats.exp;
     object *tmp;      object *tmp;
     int del_exp;      sint64 del_exp;
   
     for(tmp=op->inv;tmp;tmp=tmp->below)      for(tmp=op->inv;tmp;tmp=tmp->below)
  if(tmp->type==SKILL && tmp->stats.exp) {    if(tmp->type==SKILL && tmp->stats.exp) {
Line 1715
 
Line 1715
  player_lvl_adj(op, tmp);   player_lvl_adj(op, tmp);
      }       }
  }   }
       if (flag != SK_SUBTRACT_SKILL_EXP) {
     op->stats.exp -= exp;   del_exp = check_exp_loss(op, exp);
    op->stats.exp -= del_exp;
     player_lvl_adj(op,NULL);       player_lvl_adj(op,NULL);
 }  }
   }
   
   
   
Line 1732
 
Line 1734
  * these last two values are only used for players.   * these last two values are only used for players.
  */   */
    
 void change_exp(object *op, int exp, char *skill_name, int flag) {  void change_exp(object *op, sint64 exp, char *skill_name, int flag) {
     uint64  exp_to_add = exp;  
       
   
 #ifdef EXP_DEBUG  #ifdef EXP_DEBUG
     LOG(llevDebug,"add_exp() called for %s, exp = %lld\n",query_name(op),exp);       LOG(llevDebug,"chnage_exp() called for %s, exp = %lld\n",query_name(op),exp);
 #endif  #endif
   
     /* safety */      /* safety */
Line 1755
 
Line 1755
      * MAX_EXPERIENCE to prevent overflows.  If the player somehow has       * MAX_EXPERIENCE to prevent overflows.  If the player somehow has
      * more than max exp, just return.       * more than max exp, just return.
      */       */
     if (exp_to_add > 0 && ( op->stats.exp > (MAX_EXPERIENCE - exp_to_add))) {      if (exp > 0 && ( op->stats.exp > (MAX_EXPERIENCE - exp))) {
  exp_to_add = MAX_EXPERIENCE - op->stats.exp;   exp = MAX_EXPERIENCE - op->stats.exp;
  if (exp_to_add < 0) return;   if (exp < 0) return;
     }      }
   
     /* Monsters are easy - we just adjust their exp - we         /* Monsters are easy - we just adjust their exp - we   
Line 1768
 
Line 1768
     if(op->type != PLAYER) {      if(op->type != PLAYER) {
  /* Sanity check */   /* Sanity check */
  if (!QUERY_FLAG(op, FLAG_ALIVE)) return;   if (!QUERY_FLAG(op, FLAG_ALIVE)) return;
  op->stats.exp += exp_to_add;   op->stats.exp += exp;
     }      }
     else { /* Players only */       else { /* Players only */
  if(exp>0)    if(exp>0)


Legend:
line(s) removed in v.1.56 
line(s) changed
 line(s) added in v.1.57

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