diff options
author | rubidium <rubidium@openttd.org> | 2007-06-19 00:05:26 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2007-06-19 00:05:26 +0000 |
commit | 16ce2192e45cbc4d2ba01267578ea5c3943caf0f (patch) | |
tree | b07b07a2f5f04c71f8608530c990ebe9bdf603e1 /src/economy.cpp | |
parent | 23af871615557914fd36744afe46a93a360603ce (diff) | |
download | openttd-16ce2192e45cbc4d2ba01267578ea5c3943caf0f.tar.xz |
(svn r10212) -Fix [FS#723]: money overflow bugs in many locations.
Diffstat (limited to 'src/economy.cpp')
-rw-r--r-- | src/economy.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/economy.cpp b/src/economy.cpp index dd51e0911..fde538feb 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -660,8 +660,8 @@ static void PlayersGenStatistics() static void AddSingleInflation(Money *value, uint16 *frac, int32 amt) { /* Is it safe to add inflation ? */ - if ((MAX_UVALUE(Money) / 2 / amt) > (*value + *frac + 1)) { - *value = MAX_UVALUE(Money); + if ((INT64_MAX / amt) < (*value + 1)) { + *value = INT64_MAX / amt; *frac = 0; } else { int64 tmp = (int64)*value * amt + *frac; |