MoO3 Patcher
Spreadsheet Modding

The way a number is represented on a computer is based on the number of 'bits' that it uses. The formula is a simple one, 2^x. That is, two to the power of x, where x is the number of bits. So a single bit can represent 2^1, or 2 numbers (those numbers being 0 and 1). With 8 bits, you can represent 2^8 numbers, or 256. With 16 bits, you can represent 2^16 numbers, or 65,536. And finally with 32 bits, you can represent 2^32 numbers, or 4,294,967,296 numbers. Those numbers can be divided up in one of two ways. They can be numbers from 0...4,294,967,295, or -2,147,483,648...2,147,483,647. Note, the amount of numbers is the same in both cases, but one allows negatives, and the other doesn't.

Now what happens if you are using the latter example (the one with negatives), and the number you are trying to represent is larger than 2,147,483,647? The best way to explain it is with some number translations. Computers don't use base10, or decimal, the number system that most people use. Instead, they use base16, or hexadecimal. So the number 2,147,483,647 looks like 7FFFFFFF. The number -2,147,483,648 looks like 80000000. I'm sure you can see where this is going. If you take 2,147,483,647 and add 1 to it, you'd get 80000000 as far as the computer is concerned. But it considers that number to be -2,147,483,648. So you've gone from having a really large positive number to a really large negative number.

That, in a nutshell, is what happens with the financial wraparound bug (which, obviously, is a 32 bit number). The money in your treasury goes over the 2,147,483,647 limit, and so becomes negative, causing your empire to go into bankruptcy.

What the patch does, is check to see if you've gone over that limit. If you have, it changes your account back to 2,147,483,647, so that you still have a positive balance. This means that you are losing some of your income, but you won't go bankrupt, which is preferable.

email: bhruic@gmail.com
Copyright © Mental Static Software 2005