Defining gold.

Posted by USER007 on Fri 17 Jun 2005 12:02 AM — 2 posts, 11,789 views.

#0
I've managed to upgrade the gold system to use long double instead of int everything compiles cleanly/works fine. I then decided to add:

#define MAX_GOLD 50000000000

and replace all the hard coded values, but when I compile I get this warning on several files:

warning: integer constant is too large for "long" type

And the lines that are giving me the warning are:

if ( newbet > MAX_GOLD )
{

Where exactly would I need to change this to allow me to go past int, if its too much of a hassle then I think I'll just leave the numbers hard coded.
Amended on Fri 17 Jun 2005 12:04 AM by USER007
USA #1
Why are you using a long double for your gold? Why is not a long or a long-long (64-bit) enough? An unsigned long-long gives you 18,446,744,073,709,551,616 possible values and even a normal unsigned, 32-bit long (usually, long = int, by the way) gives you 4,294,967,296 possible values. I note that your max is more than that (which is an 'interesting' game design) but still, you really don't need to use a long double. That's just silly. 128 bits is monstrous overkill.

Anyhow, you're getting an error because your constant is too large for type long. (46 billion too large.) Either change the type of 'newbet' or make your maximum within the bounds of the long type.