Is there a variable (like int or sh_int) that holds more than 1 billion? I wish to use it for gold or exp of the such.
Increasing values
Posted by Zeno on Sun 22 Jun 2003 01:03 AM — 14 posts, 29,656 views.
Quick rundown for length of common numeric variable types:
short 32, 767
int/long 2,147,483,647
float ~10^38
double ~10^308
long double ~10^4392
So if I were to change in mud.h -
to
it would increase how the value of how high it can hold exp?
int expto
double expit would increase how the value of how high it can hold exp?
Yep, thats about the extent of it.
rather than
dbl exp
rather than
double exp
Ok, when I did that I got a bunch of error while compiling.
All over
dereferencing pointer to incomplete typeAll over
I tried that and got no errors, however I would be a bit worried about display routines that expect a long but get passed a double.
You could also try a "long long" which will give you 9,223,372,036,854,775,807 (signed) experience points. However you still have the problem of changing appropriate displays so they know they are getting a long long.
Hmm, if you tried that and it worked than perhaps I am not doing it correctly. Around line 2288
After doing a clean recompile I get a lot of
Thats just an example of what I get, there's a lot more of the same.
sh_int numattacks;
dbl gold;
int exp;
EXT_BV act;
After doing a clean recompile I get a lot of
act_comm.c: In function `talk_auction':
act_comm.c:2939: dereferencing pointer to incomplete type
act_comm.c:2940: dereferencing pointer to incomplete type
Thats just an example of what I get, there's a lot more of the same.
The functions that were being passed a gold value are expecting an int value and will all need to be changed to reflect the change of the gold data type to dbl.
dbl - what's that?
The C data type is "double". I did get a warning this time in build.c, for printing exp, on this line:
The error was:
The C data type is "double". I did get a warning this time in build.c, for printing exp, on this line:
fprintf( fpout, "%d %d\n", pMobIndex->gold,
pMobIndex->exp );
The error was:
buildc:5971: warning: int format, double arg (arg 4)
Sorry, too much vb code lately I guess. Yes, C is double for data type.
Err, so what do I use? dbl or double?
Would use double for the value changes but you would need to change any struct that references the value changed to expect double instead of int.
Alright, I see. I'm doing that now, but I think an example would help me of changing any struct references, so if anyone could provide one, it would help me so much.