Possible to trade more than 9999 gold?

Crimson13

Prince
Joined
Jul 11, 2012
Messages
373
I've noticed that I can't seem to trade more than that in a deal, yet when I ask a civ what they think they can, for example, put 17k in there no problem. But as soon as I delete a number in there I can't put any more back in. So, is it possible to have put in at least 10k in the trade gold box?
 
Nah, I'm using the Community Patch version of Civ IV Diplomatic Features and I'm trying to vassalage another civ.
 
Moderator Action: Moved to Creation & Customization
 
I know that, I'm asking if it's possible to trade more than 9999 gold.

You'll need to edit some core xml UI files, or make a mod that replaces them

In DiploCurrentDeals.xml, DiploTrade.xml and SimpleDiploTrade.xml change all occurrences of MaxLength="4" to MaxLength="5"

THEN be very, very, very careful NOT to enter a number greater than 32767 (or be prepared for weird/bad things to happen)

HTH

W
 
32768, as I recall, is a binary "Magic number" you often find troubles with in many different types of machine code. 2x2x2x2x2x2x2x2x2x2x2x2x2x2x2 = 32768 if I got the correct number of "x2" in there. If I remember correctly, in CIV2 your empire could never have more than 32767 gold.

By machine code I mean such stuff as older machine-tool controllers or PLCs attached to, say, an older power generator.
 
Why shouldn't you enter more than 32767, out of interest? Seems like a bit of an odd place for a cap on it anyway.

This is because the number is an integer, which has a range of -32768 to 32767.... in other words, it can only "hold" a number between the aforementioned values.

Basically a variable is assigned a set amount of "space" inside your computer's memory. The amount of space allocated determines how big the number stored inside can be. The computer stores everything in binary - 0's and 1's, so instead of something like "28", your computer would store it as 11100 which is equivalent to:

1*(2^4) + 1*(2^3) + 1*(2^2) + 0*(2^1) + 0*(2^0).

Conversely, consider the decimal system (i.e. the "28" = "twenty eight") - it can be translated as 2*(10^1) + 8 * (10^0). The logical concept is the same, only the base is different.

The number "28" in binary requires at least 6 bits of data: 5 to hold the number, and 1 to hold the sign bit, with a maximum value of 31 (or [2^5]-1).

A C++ integer has 16 bits, so it can have 15 bits allocated to the actual number (i.e. [2^15]-1 = 32767 maximum value), with 1 bit to hold the sign. If you try to assign a number beyond that, you will encounter a problem known as overflow if the operating environment does not try to crash at that point - think Gandhi in Civ I and his insta-nuking tendencies when he unlocked democracy (I think it was called?): his peacefulness variable went over the limit and reset at 0 or something.


32768, as I recall, is a binary "Magic number" you often find troubles with in many different types of machine code.

By machine code I mean such stuff as older machine-tool controllers or PLCs attached to, say, an older power generator.

Machine code is still alive and well - we just call it Binary nowadays. Most programming languages nowadays also convert their human-readable-code (i.e. C++) into some sort of object or assembly language first before that is converted again into machine/binary (i.e. the stuff actually read by your computer).
 
This is because the number is an integer, which has a range of -32768 to 32767.... in other words, it can only "hold" a number between the aforementioned values.

Basically a variable is assigned a set amount of "space" inside your computer's memory. The amount of space allocated determines how big the number stored inside can be. The computer stores everything in binary - 0's and 1's, so instead of something like "28", your computer would store it as 11100 which is equivalent to:

1*(2^4) + 1*(2^3) + 1*(2^2) + 0*(2^1) + 0*(2^0).

Conversely, consider the decimal system (i.e. the "28" = "twenty eight") - it can be translated as 2*(10^1) + 8 * (10^0). The logical concept is the same, only the base is different.

The number "28" in binary requires at least 6 bits of data: 5 to hold the number, and 1 to hold the sign bit, with a maximum value of 31 (or [2^5]-1).

A C++ integer has 16 bits, so it can have 15 bits allocated to the actual number (i.e. [2^15]-1 = 32767 maximum value), with 1 bit to hold the sign. If you try to assign a number beyond that, you will encounter a problem known as overflow if the operating environment does not try to crash at that point - think Gandhi in Civ I and his insta-nuking tendencies when he unlocked democracy (I think it was called?): his peacefulness variable went over the limit and reset at 0 or something.




Machine code is still alive and well - we just call it Binary nowadays. Most programming languages nowadays also convert their human-readable-code (i.e. C++) into some sort of object or assembly language first before that is converted again into machine/binary (i.e. the stuff actually read by your computer).
I used to work on/with machines that spit a lot of the man-readable "results" of operations out in 4-character hexadecimal, especially for error codes. You knew when you saw FFFF that you were in deep do-do.
 
C++ ints, by default, are 32-bit which is plus/minus two point something billion IIRC. BUT, the DLL code has a habit of packing two ints into a single one for storage efficiency when it's "known" that they won't exceed 32767, which reduces them effectively to old-style 16-bit C ints
 
BUT, the DLL code has a habit of packing two ints into a single one for storage efficiency when it's "known" that they won't exceed 32767, which reduces them effectively to old-style 16-bit C ints

Why on earth... I don't think I want to know why this is done. :sad:
 
Ours is not to reason why ...

If you want really daft ... given a choice between memory size or execution speed in the path-finder and tactical map analysis code what do you think was chosen? Yep, that's right, booleans are packed and unpacked (taking CPU cycles) from single bits of a char (8-bit data) just to save temp memory storage.
 
Back
Top Bottom