changeset 17837:b6608baed897 draft

(svn r22628) -Codechange: Allow passing the textref stack values to use to StartTextRefStackUsage() instead of always using the temporary NewGRF registers.
author frosch <frosch@openttd.org>
date Sun, 03 Jul 2011 13:53:42 +0000
parents e20af6605036
children 8d2357ed5379
files src/newgrf_text.cpp src/newgrf_text.h
diffstat 2 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/newgrf_text.cpp
+++ b/src/newgrf_text.cpp
@@ -969,8 +969,9 @@
  * normal string parameters again.
  *
  * @param numEntries number of entries to copy from the registers
+ * @param values values to copy onto the stack; if NULL the temporary NewGRF registers will be used instead
  */
-void StartTextRefStackUsage(byte numEntries)
+void StartTextRefStackUsage(byte numEntries, const uint32 *values)
 {
 	extern TemporaryStorageArray<int32, 0x110> _temp_store;
 
@@ -978,8 +979,9 @@
 
 	byte *p = _newgrf_textrefstack->stack;
 	for (uint i = 0; i < numEntries; i++) {
+		uint32 value = values != NULL ? values[i] : _temp_store.GetValue(0x100 + i);
 		for (uint j = 0; j < 32; j += 8) {
-			*p = GB(_temp_store.GetValue(0x100 + i), j, 8);
+			*p = GB(value, j, 8);
 			p++;
 		}
 	}
--- a/src/newgrf_text.h
+++ b/src/newgrf_text.h
@@ -34,7 +34,7 @@
 
 bool CheckGrfLangID(byte lang_id, byte grf_version);
 
-void StartTextRefStackUsage(byte numEntries);
+void StartTextRefStackUsage(byte numEntries, const uint32 *values = NULL);
 void StopTextRefStackUsage();
 void SwitchToNormalRefStack();
 void SwitchToErrorRefStack();