Re: Changing exp needed...

From: Al Figliolia (
Date: 05/19/96

On Sun, 19 May 1996, Corey Hoitsma wrote:
>    unsigned long int exp;            /* The experience of the player   */
>    ^^ line #694

> 	   unsigned long int exp;
> 	   ^^ line #1019
> And everywhere that GET_EXP is called I have %lu.
> And I STILL get all the warnings:
> class.c:712: warning: integer constant out of range
> class.c:712: warning: decimal constant is so large that it is unsigned
> class.c:713: warning: integer constant out of range
> class.c:713: warning: decimal constant is so large that it is unsigned
> The exp numbers for these lines are:
>   {"the Mage (98)", "the Mage (98)", 4829856768},
>   {"the Mage (99)", "the Mage (99)", 5312842240},
> Should I use a double?
> If so, what do I use to display with sprintf? %f?
> Maybe my numbers are too high.. but I can't really tell 'cause
> the MUD changes them to negavtives, so it doesn't help to much:P

This may be wrong, but this is what I have observed... on 32 bit machines 
long int's are 32 bit long variables... so a unsigned long int would be a 
number between 0 and 2^32 which is 4294967296... so when it says the number
4829856768 is out of range it means that it is larger than the maximum 
size for the variable which is 2^32...

On my mud, I turned exp into a struct, I don't have the exact code in 
front of me, but this is pretty close I think:

struct exp_type {
  unsigned int high;
  unsigned int mid;
  unsigned int low;

then in the player file I just defined exp as: struct exp_type exp;

and in all of my functions dealing with exp I just told it to could mid 
and low in billions... so if mid = 50 and low = 100 and high = 72000, you 
would have 72000000000050000000100 exp... this may be a bit much, but I 
like to be excessive :) (this will give you a max exp of 
4294967296000000000000000000 exp)

Al Figliolia - IMP of the siteless Crimson Realms

This archive was generated by hypermail 2b30 : 12/18/00 PST