Changeset - r21947:4b2aaf36e24d
[Not reviewed]
master
0 4 0
rubidium - 9 years ago 2015-01-01 20:50:43
rubidium@openttd.org
(svn r27102) -Fix [FS#6194]: money values would end up wrong in strings when outside of the bounds of a 32 bits integer
4 files changed with 4 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/script/api/script_text.cpp
Show inline comments
 
@@ -198,13 +198,13 @@ char *ScriptText::_GetEncodedText(char *
 
		}
 
		if (this->paramt[i] != NULL) {
 
			p += seprintf(p, lastofp, ":");
 
			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++;
 
	}
 

	
 
	return p;
 
}
 

	
src/script/api/script_text.hpp
Show inline comments
 
@@ -126,13 +126,13 @@ public:
 

	
 
	/* virtual */ const char *GetEncodedText();
 

	
 
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;
 

	
 
	/**
 
	 * Internal function for recursive calling this function over multiple
 
	 *  instances, while writing in the same buffer.
src/stdafx.h
Show inline comments
 
@@ -319,12 +319,13 @@
 

	
 
/* MSVCRT of course has to have a different syntax for long long *sigh* */
 
#if defined(_MSC_VER) || defined(__MINGW32__)
 
	#define OTTD_PRINTF64 "%I64d"
 
	#define OTTD_PRINTFHEX64 "%I64x"
 
	#define PRINTF_SIZE "%Iu"
 
	#define strtoull _strtoui64
 
#else
 
	#define OTTD_PRINTF64 "%lld"
 
	#define OTTD_PRINTFHEX64 "%llx"
 
	#define PRINTF_SIZE "%zu"
 
#endif
 

	
src/strings.cpp
Show inline comments
 
@@ -871,13 +871,13 @@ static char *FormatString(char *buff, co
 
						/* Check if we want to look up another string */
 
						WChar l;
 
						size_t len = Utf8Decode(&l, s);
 
						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) {
 
								while (*p != '\0') p++;
 
								str = p;
 
								buff = strecat(buff, "(invalid sub-StringID)", last);
0 comments (0 inline, 0 general)