diff options
author | peter1138 <peter1138@openttd.org> | 2006-04-21 06:55:47 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2006-04-21 06:55:47 +0000 |
commit | 5f1ae3f4c6932112a7e9f3f9acd6ce7329971b56 (patch) | |
tree | 7132f8d79b660e8c3d159a1ea5341f4282a7f219 | |
parent | aab91d287ae5830bd89c92df102692de5af8e821 (diff) | |
download | openttd-5f1ae3f4c6932112a7e9f3f9acd6ce7329971b56.tar.xz |
(svn r4494) - NewGRF: Clean up and reset custom texts
-rw-r--r-- | newgrf_text.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/newgrf_text.c b/newgrf_text.c index 7a6121a3b..ccdb06ab4 100644 --- a/newgrf_text.c +++ b/newgrf_text.c @@ -236,15 +236,24 @@ void SetCurrentGrfLangID( const char *iso_name ) /** * House cleaning. - * TODO : Have to be written. + * Remove all strings and reset the text counter. */ void CleanUpStrings(void) { uint id; - GRFText *text_to_clear; - for (id = 0; id < _num_grf_texts; id++) { - text_to_clear = _grf_text[id].textholder; + GRFText *grftext = _grf_text[id].textholder; + while (grftext != NULL) { + GRFText *grftext2 = grftext->next; + free(grftext->text); + free(grftext); + grftext = grftext2; + } + _grf_text[id].grfid = 0; + _grf_text[id].stringid = 0; + _grf_text[id].textholder = NULL; } + + _num_grf_texts = 0; } |