Changeset - r17827:e2ae8a6fd081
[Not reviewed]
master
0 2 0
frosch - 13 years ago 2011-07-03 13:53:42
frosch@openttd.org
(svn r22628) -Codechange: Allow passing the textref stack values to use to StartTextRefStackUsage() instead of always using the temporary NewGRF registers.
2 files changed with 5 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/newgrf_text.cpp
Show inline comments
 
@@ -966,23 +966,25 @@ void RestoreTextRefStackBackup(struct Te
 
 *
 
 * After you are done with drawing, you must disable usage of the #TextRefStack
 
 * by calling #StopTextRefStackUsage(), so NewGRF string codes operate on the
 
 * 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;
 

	
 
	_newgrf_textrefstack->ResetStack();
 

	
 
	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++;
 
		}
 
	}
 
}
 

	
 
/** Stop using the TTDP compatible string code parsing */
src/newgrf_text.h
Show inline comments
 
@@ -31,13 +31,13 @@ void AddGRFTextToList(struct GRFText **l
 
void AddGRFTextToList(struct GRFText **list, byte langid, uint32 grfid, const char *text_to_add);
 
void AddGRFTextToList(struct GRFText **list, const char *text_to_add);
 
void CleanUpGRFText(struct GRFText *grftext);
 

	
 
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();
 
void RewindTextRefStack();
 
bool UsingNewGRFTextStack();
 
struct TextRefStack *CreateTextRefStackBackup();
0 comments (0 inline, 0 general)