[CF-Devel] Living.c / experience question

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Fri Sep 26 00:04:20 CDT 2003


Nicolas Weeger wrote:
>
     
      Browsing living.c, and trying to erase warnings during compilation under 
     
     >
     
      Windows, i have a question regarding those 2 functions:
     
     >
     
     
     >
     
      int check_exp_loss(object *op, int exp)
     
     >
     
      int check_exp_adjust(object *op, int exp)
     
     >
     
     
     >
     
      Sometimes exp is given as an int64 (since experience)
     
     >
     
      Like loss = check_exp_loss(tmp, MIN(loss_3l, loss_20p)); (line 1796)
     
     >
     
      with loss_3l & loss_20p being sint64
     
     >
     
     
     >
     
      So shouldn't be those function more like sint64(object*, sint64) ?
     
     
  Yep - I'll fix that.

>
     
     
     >
     
      Also in living.c, we have (line 1442)
     
     >
     
      (*dragon_gain_func)(who, abil->stats.exp,
     
     >
     
                        (int)((1+abil->resist[abil->stats.exp])/5.));
     
     >
     
     
     >
     
      except the function prototype expects int as 2nd parameter...
     
     
  that one is a bit odder.  Looking at the code, abil->stats.exp doesn't contain 
an actual exp value, but instead points to the ability/resistance to increase. 
Thus, there is no worry about the value being truncated, overflowed, etc.

  I'll toss a cast in there which should clean up any warnings.


_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list