diff options
author | rubidium <rubidium@openttd.org> | 2015-01-01 20:50:43 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2015-01-01 20:50:43 +0000 |
commit | 730773f5f1eb68888738d9022afa7e41469e1f2d (patch) | |
tree | 1dfbb8da6ee943dc2a66ab7d3df439c7b793398d /src | |
parent | 85b93d0e5ef689be756c923bd21b046e48eb019e (diff) | |
download | openttd-730773f5f1eb68888738d9022afa7e41469e1f2d.tar.xz |
(svn r27102) -Fix [FS#6194]: money values would end up wrong in strings when outside of the bounds of a 32 bits integer
Diffstat (limited to 'src')
-rw-r--r-- | src/script/api/script_text.cpp | 2 | ||||
-rw-r--r-- | src/script/api/script_text.hpp | 2 | ||||
-rw-r--r-- | src/stdafx.h | 1 | ||||
-rw-r--r-- | src/strings.cpp | 2 |
4 files changed, 4 insertions, 3 deletions
diff --git a/src/script/api/script_text.cpp b/src/script/api/script_text.cpp index 51fc19863..e692be0ae 100644 --- a/src/script/api/script_text.cpp +++ b/src/script/api/script_text.cpp @@ -201,7 +201,7 @@ char *ScriptText::_GetEncodedText(char *p, char *lastofp, int ¶m_count) p = this->paramt[i]->_GetEncodedText(p, lastofp, param_count); continue; } - p += seprintf(p, lastofp,":%X", (uint32)this->parami[i]); + p += seprintf(p, lastofp,":" OTTD_PRINTFHEX64, this->parami[i]); param_count++; } diff --git a/src/script/api/script_text.hpp b/src/script/api/script_text.hpp index fe38be197..21bf3929f 100644 --- a/src/script/api/script_text.hpp +++ b/src/script/api/script_text.hpp @@ -129,7 +129,7 @@ public: private: StringID string; char *params[SCRIPT_TEXT_MAX_PARAMETERS]; - int parami[SCRIPT_TEXT_MAX_PARAMETERS]; + int64 parami[SCRIPT_TEXT_MAX_PARAMETERS]; ScriptText *paramt[SCRIPT_TEXT_MAX_PARAMETERS]; int paramc; diff --git a/src/stdafx.h b/src/stdafx.h index d26b05c3f..87270c6ca 100644 --- a/src/stdafx.h +++ b/src/stdafx.h @@ -322,6 +322,7 @@ #define OTTD_PRINTF64 "%I64d" #define OTTD_PRINTFHEX64 "%I64x" #define PRINTF_SIZE "%Iu" + #define strtoull _strtoui64 #else #define OTTD_PRINTF64 "%lld" #define OTTD_PRINTFHEX64 "%llx" diff --git a/src/strings.cpp b/src/strings.cpp index 8ce2fde07..a7e60f846 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -874,7 +874,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg bool lookup = (l == SCC_ENCODED); if (lookup) s += len; - param = (int32)strtoul(s, &p, 16); + param = strtoull(s, &p, 16); if (lookup) { if (param >= TAB_SIZE) { |