Unsigned number problem

Posted by Zeno on Fri 18 Jul 2003 01:25 AM — 8 posts, 19,629 views.

USA #0
I made a variable in mud.h that is unsigned long long, and displayed it with %llu. Now when I do a copyover, and the number is above 2 billion (or whatever the last number was) it changes to another number, seemingly a random one, like 18446744072414584320. Could anyone help me with this?
Amended on Fri 18 Jul 2003 01:30 AM by Zeno
USA #1
Ok, I know what it is, kinda. I'm getting a overflow whenever a copyover is done. If the variable is below 2bil (int) then it doesn't overflow. But I don't know how to fix it. I'm still looking into it, but if someone could reply, it'd save me time.
Australia Forum Administrator #2
I haven't used copyover so I can't help, sorry. How does the player data get saved and restored after a copyover? Is there a temporary variable that is only an int, for instance?
USA #3
Actually it happens also with a reboot, so its not copyover.
Australia Forum Administrator #4
Check how the variable is read in - the read routine is probably not designed for long long.
USA #5
Err, where would I find that?
Australia Forum Administrator #6
You said you made a variable - where do you save it, and where do you read it in on a restart? If you don't know that, then it probably isn't read in anyway. Try searching for the variable name in all the .c files.
USA #7
My bad. I just had to change fread_number to unsigned long long.