00001
00002
00012 #include "stdafx.h"
00013 #include "debug.h"
00014 #include "openttd.h"
00015 #include "variables.h"
00016 #include "newgrf.h"
00017 #include "newgrf_text.h"
00018 #include "strings_func.h"
00019 #include "core/alloc_func.hpp"
00020 #include "newgrf_storage.h"
00021 #include "string_func.h"
00022
00023 #include "table/strings.h"
00024 #include "table/control_codes.h"
00025
00026 #define GRFTAB 28
00027 #define TABSIZE 11
00028
00034 enum grf_base_languages {
00035 GRFLB_AMERICAN = 0x01,
00036 GRFLB_ENGLISH = 0x02,
00037 GRFLB_GERMAN = 0x04,
00038 GRFLB_FRENCH = 0x08,
00039 GRFLB_SPANISH = 0x10,
00040 GRFLB_GENERIC = 0x80,
00041 };
00042
00043 enum grf_extended_languages {
00044 GRFLX_AMERICAN = 0x00,
00045 GRFLX_ENGLISH = 0x01,
00046 GRFLX_GERMAN = 0x02,
00047 GRFLX_FRENCH = 0x03,
00048 GRFLX_SPANISH = 0x04,
00049 GRFLX_ESPERANTO = 0x05,
00050 GRFLX_RUSSIAN = 0x07,
00051 GRFLX_CZECH = 0x15,
00052 GRFLX_SLOVAK = 0x16,
00053 GRFLX_BULGARIAN = 0x18,
00054 GRFLX_AFRIKAANS = 0x1B,
00055 GRFLX_GREEK = 0x1E,
00056 GRFLX_DUTCH = 0x1F,
00057 GRFLX_CATALAN = 0x22,
00058 GRFLX_HUNGARIAN = 0x24,
00059 GRFLX_ITALIAN = 0x27,
00060 GRFLX_ROMANIAN = 0x28,
00061 GRFLX_ICELANDIC = 0x29,
00062 GRFLX_LATVIAN = 0x2A,
00063 GRFLX_LITHUANIAN = 0x2B,
00064 GRFLX_SLOVENIAN = 0x2C,
00065 GRFLX_DANISH = 0x2D,
00066 GRFLX_SWEDISH = 0x2E,
00067 GRFLX_NORWEGIAN = 0x2F,
00068 GRFLX_POLISH = 0x30,
00069 GRFLX_GALICIAN = 0x31,
00070 GRFLX_FRISIAN = 0x32,
00071 GRFLX_UKRAINIAN = 0x33,
00072 GRFLX_ESTONIAN = 0x34,
00073 GRFLX_FINNISH = 0x35,
00074 GRFLX_PORTUGUESE = 0x36,
00075 GRFLX_BRAZILIAN = 0x37,
00076 GRFLX_CROATIAN = 0x38,
00077 GRFLX_JAPANESE = 0x39,
00078 GRFLX_KOREAN = 0x3A,
00079 GRFLX_TURKISH = 0x3E,
00080 GRFLX_UNSPECIFIED = 0x7F,
00081 };
00082
00083
00084 struct iso_grf {
00085 char code[6];
00086 byte grfLangID;
00087 };
00088
00097 const iso_grf iso_codes[] = {
00098 {"en_US", GRFLX_AMERICAN},
00099 {"en_GB", GRFLX_ENGLISH},
00100 {"de_DE", GRFLX_GERMAN},
00101 {"fr_FR", GRFLX_FRENCH},
00102 {"es_ES", GRFLX_SPANISH},
00103 {"af_ZA", GRFLX_AFRIKAANS},
00104 {"hr_HR", GRFLX_CROATIAN},
00105 {"cs_CZ", GRFLX_CZECH},
00106 {"ca_ES", GRFLX_CATALAN},
00107 {"da_DA", GRFLX_DANISH},
00108 {"nl_NL", GRFLX_DUTCH},
00109 {"et_ET", GRFLX_ESTONIAN},
00110 {"fi_FI", GRFLX_FINNISH},
00111 {"fy_NL", GRFLX_FRISIAN},
00112 {"gl_ES", GRFLX_GALICIAN},
00113 {"el_GR", GRFLX_GREEK},
00114 {"hu_HU", GRFLX_HUNGARIAN},
00115 {"is_IS", GRFLX_ICELANDIC},
00116 {"it_IT", GRFLX_ITALIAN},
00117 {"lv_LV", GRFLX_LATVIAN},
00118 {"lt_LT", GRFLX_LITHUANIAN},
00119 {"nb_NO", GRFLX_NORWEGIAN},
00120 {"pl_PL", GRFLX_POLISH},
00121 {"pt_PT", GRFLX_PORTUGUESE},
00122 {"pt_BR", GRFLX_BRAZILIAN},
00123 {"ro_RO", GRFLX_ROMANIAN},
00124 {"ru_RU", GRFLX_RUSSIAN},
00125 {"sk_SK", GRFLX_SLOVAK},
00126 {"sl_SL", GRFLX_SLOVENIAN},
00127 {"sv_SE", GRFLX_SWEDISH},
00128 {"tr_TR", GRFLX_TURKISH},
00129 {"uk_UA", GRFLX_UKRAINIAN},
00130 {"eo_EO", GRFLX_ESPERANTO},
00131 {"bg_BG", GRFLX_BULGARIAN},
00132 {"ja_JP", GRFLX_JAPANESE},
00133 {"ko_KR", GRFLX_KOREAN},
00134 {"gen", GRFLB_GENERIC}
00135 };
00136
00137
00143 struct GRFText {
00144 public:
00145 static GRFText* New(byte langid, const char* text)
00146 {
00147 return new(strlen(text) + 1) GRFText(langid, text);
00148 }
00149
00150 private:
00151 GRFText(byte langid_, const char* text_) : next(NULL), langid(langid_)
00152 {
00153 strcpy(text, text_);
00154 }
00155
00156 void* operator new(size_t size, size_t extra)
00157 {
00158 return ::operator new(size + extra);
00159 }
00160
00161 public:
00162
00163
00164
00165 void operator delete(void *p, size_t extra)
00166 {
00167 return ::operator delete(p);
00168 }
00169
00170 public:
00171 GRFText *next;
00172 byte langid;
00173 char text[VARARRAY_SIZE];
00174 };
00175
00176
00182 struct GRFTextEntry {
00183 uint32 grfid;
00184 uint16 stringid;
00185 StringID def_string;
00186 GRFText *textholder;
00187 };
00188
00189
00190 static uint _num_grf_texts = 0;
00191 static GRFTextEntry _grf_text[(1 << TABSIZE) * 3];
00192 static byte _currentLangID = GRFLX_ENGLISH;
00193
00194
00195 char *TranslateTTDPatchCodes(uint32 grfid, const char *str)
00196 {
00197 char *tmp = MallocT<char>(strlen(str) * 10 + 1);
00198 char *d = tmp;
00199 bool unicode = false;
00200 WChar c;
00201 size_t len = Utf8Decode(&c, str);
00202
00203 if (c == 0x00DE) {
00204
00205 unicode = true;
00206 str += len;
00207 }
00208
00209 for (;;) {
00210 if (unicode && Utf8EncodedCharLen(*str) != 0) {
00211 c = Utf8Consume(&str);
00212
00213 if (GB(c, 8, 8) == 0xE0) c = GB(c, 0, 8);
00214 } else {
00215 c = (byte)*str++;
00216 }
00217 if (c == 0) break;
00218
00219 switch (c) {
00220 case 0x01:
00221 d += Utf8Encode(d, SCC_SETX);
00222 *d++ = *str++;
00223 break;
00224 case 0x0A: break;
00225 case 0x0D: *d++ = 0x0A; break;
00226 case 0x0E: d += Utf8Encode(d, SCC_TINYFONT); break;
00227 case 0x0F: d += Utf8Encode(d, SCC_BIGFONT); break;
00228 case 0x1F:
00229 d += Utf8Encode(d, SCC_SETXY);
00230 *d++ = *str++;
00231 *d++ = *str++;
00232 break;
00233 case 0x7B:
00234 case 0x7C:
00235 case 0x7D:
00236 case 0x7E:
00237 case 0x7F:
00238 case 0x80: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD + c - 0x7B); break;
00239 case 0x81: {
00240 StringID string;
00241 string = ((uint8)*str++);
00242 string |= ((uint8)*str++) << 8;
00243 d += Utf8Encode(d, SCC_STRING_ID);
00244 d += Utf8Encode(d, MapGRFStringID(grfid, string));
00245 break;
00246 }
00247 case 0x82:
00248 case 0x83:
00249 case 0x84: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_SPEED + c - 0x82); break;
00250 case 0x85: d += Utf8Encode(d, SCC_NEWGRF_DISCARD_WORD); break;
00251 case 0x86: d += Utf8Encode(d, SCC_NEWGRF_ROTATE_TOP_4_WORDS); break;
00252 case 0x87: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_LITRES); break;
00253 case 0x88: d += Utf8Encode(d, SCC_BLUE); break;
00254 case 0x89: d += Utf8Encode(d, SCC_SILVER); break;
00255 case 0x8A: d += Utf8Encode(d, SCC_GOLD); break;
00256 case 0x8B: d += Utf8Encode(d, SCC_RED); break;
00257 case 0x8C: d += Utf8Encode(d, SCC_PURPLE); break;
00258 case 0x8D: d += Utf8Encode(d, SCC_LTBROWN); break;
00259 case 0x8E: d += Utf8Encode(d, SCC_ORANGE); break;
00260 case 0x8F: d += Utf8Encode(d, SCC_GREEN); break;
00261 case 0x90: d += Utf8Encode(d, SCC_YELLOW); break;
00262 case 0x91: d += Utf8Encode(d, SCC_DKGREEN); break;
00263 case 0x92: d += Utf8Encode(d, SCC_CREAM); break;
00264 case 0x93: d += Utf8Encode(d, SCC_BROWN); break;
00265 case 0x94: d += Utf8Encode(d, SCC_WHITE); break;
00266 case 0x95: d += Utf8Encode(d, SCC_LTBLUE); break;
00267 case 0x96: d += Utf8Encode(d, SCC_GRAY); break;
00268 case 0x97: d += Utf8Encode(d, SCC_DKBLUE); break;
00269 case 0x98: d += Utf8Encode(d, SCC_BLACK); break;
00270 case 0x9A:
00271 switch (*str++) {
00272 case 0:
00273 case 1:
00274 d += Utf8Encode(d, SCC_NEWGRF_PRINT_QWORD_CURRENCY);
00275 break;
00276 case 3: {
00277 uint16 tmp = ((uint8)*str++);
00278 tmp |= ((uint8)*str++) << 8;
00279 d += Utf8Encode(d, SCC_NEWGRF_PUSH_WORD);
00280 d += Utf8Encode(d, tmp);
00281 } break;
00282 case 4:
00283 d += Utf8Encode(d, SCC_NEWGRF_UNPRINT);
00284 d += Utf8Encode(d, *str++);
00285 break;
00286 default:
00287 grfmsg(1, "missing handler for extended format code");
00288 break;
00289 }
00290 break;
00291
00292 case 0x9E: d += Utf8Encode(d, 0x20AC); break;
00293 case 0x9F: d += Utf8Encode(d, 0x0178); break;
00294 case 0xA0: d += Utf8Encode(d, SCC_UPARROW); break;
00295 case 0xAA: d += Utf8Encode(d, SCC_DOWNARROW); break;
00296 case 0xAC: d += Utf8Encode(d, SCC_CHECKMARK); break;
00297 case 0xAD: d += Utf8Encode(d, SCC_CROSS); break;
00298 case 0xAF: d += Utf8Encode(d, SCC_RIGHTARROW); break;
00299 case 0xB4: d += Utf8Encode(d, SCC_TRAIN); break;
00300 case 0xB5: d += Utf8Encode(d, SCC_LORRY); break;
00301 case 0xB6: d += Utf8Encode(d, SCC_BUS); break;
00302 case 0xB7: d += Utf8Encode(d, SCC_PLANE); break;
00303 case 0xB8: d += Utf8Encode(d, SCC_SHIP); break;
00304 case 0xB9: d += Utf8Encode(d, SCC_SUPERSCRIPT_M1); break;
00305 case 0xBC: d += Utf8Encode(d, SCC_SMALLUPARROW); break;
00306 case 0xBD: d += Utf8Encode(d, SCC_SMALLDOWNARROW); break;
00307 default:
00308
00309 if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
00310 d += Utf8Encode(d, c);
00311 break;
00312 }
00313 }
00314
00315 *d = '\0';
00316 tmp = ReallocT(tmp, strlen(tmp) + 1);
00317 return tmp;
00318 }
00319
00320
00324 StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, bool new_scheme, const char *text_to_add, StringID def_string)
00325 {
00326 char *translatedtext;
00327 uint id;
00328
00329
00330
00331
00332
00333
00334
00335 if (!new_scheme) {
00336 if (HASBITS(langid_to_add, GRFLB_AMERICAN | GRFLB_ENGLISH)) {
00337 langid_to_add = GRFLX_ENGLISH;
00338 } else {
00339 StringID ret = STR_EMPTY;
00340 if (langid_to_add & GRFLB_GERMAN) ret = AddGRFString(grfid, stringid, GRFLX_GERMAN, true, text_to_add, def_string);
00341 if (langid_to_add & GRFLB_FRENCH) ret = AddGRFString(grfid, stringid, GRFLX_FRENCH, true, text_to_add, def_string);
00342 if (langid_to_add & GRFLB_SPANISH) ret = AddGRFString(grfid, stringid, GRFLX_SPANISH, true, text_to_add, def_string);
00343 return ret;
00344 }
00345 }
00346
00347 for (id = 0; id < _num_grf_texts; id++) {
00348 if (_grf_text[id].grfid == grfid && _grf_text[id].stringid == stringid) {
00349 break;
00350 }
00351 }
00352
00353
00354 if (id == lengthof(_grf_text)) return STR_EMPTY;
00355
00356 translatedtext = TranslateTTDPatchCodes(grfid, text_to_add);
00357
00358 GRFText *newtext = GRFText::New(langid_to_add, translatedtext);
00359
00360 free(translatedtext);
00361
00362
00363 if (id == _num_grf_texts) _num_grf_texts++;
00364
00365 if (_grf_text[id].textholder == NULL) {
00366 _grf_text[id].grfid = grfid;
00367 _grf_text[id].stringid = stringid;
00368 _grf_text[id].def_string = def_string;
00369 _grf_text[id].textholder = newtext;
00370 } else {
00371 GRFText **ptext, *text;
00372 bool replaced = false;
00373
00374
00375 for (ptext = &_grf_text[id].textholder; (text = *ptext) != NULL; ptext = &text->next) {
00376 if (text->langid != langid_to_add) continue;
00377 newtext->next = text->next;
00378 *ptext = newtext;
00379 delete text;
00380 replaced = true;
00381 break;
00382 }
00383
00384
00385 if (!replaced) *ptext = newtext;
00386 }
00387
00388 grfmsg(3, "Added 0x%X: grfid %08X string 0x%X lang 0x%X string '%s'", id, grfid, stringid, newtext->langid, newtext->text);
00389
00390 return (GRFTAB << TABSIZE) + id;
00391 }
00392
00393
00394 static uint32 _last_grfid = 0;
00395
00399 StringID GetGRFStringID(uint32 grfid, uint16 stringid)
00400 {
00401 uint id;
00402
00403
00404 if (grfid == 0) grfid = _last_grfid;
00405
00406 for (id = 0; id < _num_grf_texts; id++) {
00407 if (_grf_text[id].grfid == grfid && _grf_text[id].stringid == stringid) {
00408 return (GRFTAB << TABSIZE) + id;
00409 }
00410 }
00411
00412 return STR_UNDEFINED;
00413 }
00414
00415
00416 const char *GetGRFStringPtr(uint16 stringid)
00417 {
00418 const GRFText *default_text = NULL;
00419 const GRFText *search_text;
00420
00421 assert(_grf_text[stringid].grfid != 0);
00422
00423
00424 _last_grfid = _grf_text[stringid].grfid;
00425
00426
00427 for (search_text = _grf_text[stringid].textholder; search_text != NULL; search_text = search_text->next) {
00428 if (search_text->langid == _currentLangID) {
00429 return search_text->text;
00430 }
00431
00432
00433
00434 if (search_text->langid == GRFLX_UNSPECIFIED || (default_text == NULL && (search_text->langid == GRFLX_ENGLISH || search_text->langid == GRFLX_AMERICAN))) {
00435 default_text = search_text;
00436 }
00437 }
00438
00439
00440 if (default_text != NULL) return default_text->text;
00441
00442
00443 return GetStringPtr(_grf_text[stringid].def_string);
00444 }
00445
00456 void SetCurrentGrfLangID(const char *iso_name)
00457 {
00458
00459 byte ret = GRFLX_ENGLISH;
00460 byte i;
00461
00462 for (i=0; i < lengthof(iso_codes); i++) {
00463 if (strncmp(iso_codes[i].code, iso_name, strlen(iso_codes[i].code)) == 0) {
00464
00465 ret = iso_codes[i].grfLangID;
00466 break;
00467 }
00468 }
00469 _currentLangID = ret;
00470 }
00471
00472 bool CheckGrfLangID(byte lang_id, byte grf_version)
00473 {
00474 if (grf_version < 7) {
00475 switch (_currentLangID) {
00476 case GRFLX_GERMAN: return (lang_id & GRFLB_GERMAN) != 0;
00477 case GRFLX_FRENCH: return (lang_id & GRFLB_FRENCH) != 0;
00478 case GRFLX_SPANISH: return (lang_id & GRFLB_SPANISH) != 0;
00479 default: return (lang_id & (GRFLB_ENGLISH | GRFLB_AMERICAN)) != 0;
00480 }
00481 }
00482
00483 return (lang_id == _currentLangID || lang_id == GRFLX_UNSPECIFIED);
00484 }
00485
00490 void CleanUpStrings()
00491 {
00492 uint id;
00493
00494 for (id = 0; id < _num_grf_texts; id++) {
00495 GRFText *grftext = _grf_text[id].textholder;
00496 while (grftext != NULL) {
00497 GRFText *grftext2 = grftext->next;
00498 delete grftext;
00499 grftext = grftext2;
00500 }
00501 _grf_text[id].grfid = 0;
00502 _grf_text[id].stringid = 0;
00503 _grf_text[id].textholder = NULL;
00504 }
00505
00506 _num_grf_texts = 0;
00507 }
00508
00509 struct TextRefStack {
00510 byte stack[0x30];
00511 byte position;
00512 bool used;
00513
00514 TextRefStack() : used(false) {}
00515
00516 uint8 PopUnsignedByte() { assert(this->position < lengthof(this->stack)); return this->stack[this->position++]; }
00517 int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); }
00518
00519 uint16 PopUnsignedWord()
00520 {
00521 uint16 val = this->PopUnsignedByte();
00522 return val | (this->PopUnsignedByte() << 8);
00523 }
00524 int16 PopSignedWord() { return (int32)this->PopUnsignedWord(); }
00525
00526 uint32 PopUnsignedDWord()
00527 {
00528 uint32 val = this->PopUnsignedWord();
00529 return val | (this->PopUnsignedWord() << 16);
00530 }
00531 int32 PopSignedDWord() { return (int32)this->PopUnsignedDWord(); }
00532
00533 uint64 PopUnsignedQWord()
00534 {
00535 uint64 val = this->PopUnsignedDWord();
00536 return val | (((uint64)this->PopUnsignedDWord()) << 32);
00537 }
00538 int64 PopSignedQWord() { return (int64)this->PopUnsignedQWord(); }
00539
00541 void RotateTop4Words()
00542 {
00543 byte tmp[2];
00544 for (int i = 0; i < 2; i++) tmp[i] = this->stack[this->position + i + 6];
00545 for (int i = 5; i >= 0; i--) this->stack[this->position + i + 2] = this->stack[this->position + i];
00546 for (int i = 0; i < 2; i++) this->stack[this->position + i] = tmp[i];
00547 }
00548
00549 void PushWord(uint16 word)
00550 {
00551 if (this->position >= 2) {
00552 this->position -= 2;
00553 } else {
00554 for (int i = lengthof(stack) - 1; i >= this->position + 2; i--) {
00555 this->stack[i] = this->stack[i - 2];
00556 }
00557 }
00558 this->stack[this->position] = GB(word, 0, 8);
00559 this->stack[this->position + 1] = GB(word, 8, 8);
00560 }
00561
00562 void ResetStack() { this->position = 0; this->used = true; }
00563 void RewindStack() { this->position = 0; }
00564 };
00565
00566 static TextRefStack _newgrf_normal_textrefstack;
00567 static TextRefStack _newgrf_error_textrefstack;
00568
00570 static TextRefStack *_newgrf_textrefstack = &_newgrf_normal_textrefstack;
00571
00576 void PrepareTextRefStackUsage(byte numEntries)
00577 {
00578 extern TemporaryStorageArray<uint32, 0x110> _temp_store;
00579
00580 _newgrf_textrefstack->ResetStack();
00581
00582 byte *p = _newgrf_textrefstack->stack;
00583 for (uint i = 0; i < numEntries; i++) {
00584 for (uint j = 0; j < 32; j += 8) {
00585 *p = GB(_temp_store.Get(0x100 + i), j, 8);
00586 p++;
00587 }
00588 }
00589 }
00590
00592 void StopTextRefStackUsage() { _newgrf_textrefstack->used = false; }
00593
00594 void SwitchToNormalRefStack()
00595 {
00596 _newgrf_textrefstack = &_newgrf_normal_textrefstack;
00597 }
00598
00599 void SwitchToErrorRefStack()
00600 {
00601 _newgrf_textrefstack = &_newgrf_error_textrefstack;
00602 }
00603
00604 void RewindTextRefStack()
00605 {
00606 _newgrf_textrefstack->RewindStack();
00607 }
00608
00615 uint RemapNewGRFStringControlCode(uint scc, char **buff, const char **str, int64 *argv)
00616 {
00617 if (_newgrf_textrefstack->used) {
00618 switch (scc) {
00619 default: NOT_REACHED();
00620 case SCC_NEWGRF_PRINT_SIGNED_BYTE: *argv = _newgrf_textrefstack->PopSignedByte(); break;
00621 case SCC_NEWGRF_PRINT_SIGNED_WORD: *argv = _newgrf_textrefstack->PopSignedWord(); break;
00622 case SCC_NEWGRF_PRINT_QWORD_CURRENCY: *argv = _newgrf_textrefstack->PopUnsignedQWord(); break;
00623
00624 case SCC_NEWGRF_PRINT_DWORD_CURRENCY:
00625 case SCC_NEWGRF_PRINT_DWORD: *argv = _newgrf_textrefstack->PopSignedDWord(); break;
00626
00627 case SCC_NEWGRF_PRINT_WORD_SPEED:
00628 case SCC_NEWGRF_PRINT_WORD_LITRES:
00629 case SCC_NEWGRF_PRINT_UNSIGNED_WORD: *argv = _newgrf_textrefstack->PopUnsignedWord(); break;
00630
00631 case SCC_NEWGRF_PRINT_DATE:
00632 case SCC_NEWGRF_PRINT_MONTH_YEAR: *argv = _newgrf_textrefstack->PopSignedWord() + DAYS_TILL_ORIGINAL_BASE_YEAR; break;
00633
00634 case SCC_NEWGRF_DISCARD_WORD: _newgrf_textrefstack->PopUnsignedWord(); break;
00635
00636 case SCC_NEWGRF_ROTATE_TOP_4_WORDS: _newgrf_textrefstack->RotateTop4Words(); break;
00637 case SCC_NEWGRF_PUSH_WORD: _newgrf_textrefstack->PushWord(Utf8Consume(str)); break;
00638 case SCC_NEWGRF_UNPRINT: *buff -= Utf8Consume(str); break;
00639
00640 case SCC_NEWGRF_PRINT_STRING_ID:
00641 *argv = _newgrf_textrefstack->PopUnsignedWord();
00642 if (*argv == STR_NULL) *argv = STR_EMPTY;
00643 break;
00644 }
00645 }
00646
00647 switch (scc) {
00648 default: NOT_REACHED();
00649 case SCC_NEWGRF_PRINT_DWORD:
00650 case SCC_NEWGRF_PRINT_SIGNED_WORD:
00651 case SCC_NEWGRF_PRINT_SIGNED_BYTE:
00652 case SCC_NEWGRF_PRINT_UNSIGNED_WORD:
00653 return SCC_COMMA;
00654
00655 case SCC_NEWGRF_PRINT_DWORD_CURRENCY:
00656 case SCC_NEWGRF_PRINT_QWORD_CURRENCY:
00657 return SCC_CURRENCY;
00658
00659 case SCC_NEWGRF_PRINT_STRING_ID:
00660 return SCC_STRING1;
00661
00662 case SCC_NEWGRF_PRINT_DATE:
00663 return SCC_DATE_LONG;
00664
00665 case SCC_NEWGRF_PRINT_MONTH_YEAR:
00666 return SCC_DATE_TINY;
00667
00668 case SCC_NEWGRF_PRINT_WORD_SPEED:
00669 return SCC_VELOCITY;
00670
00671 case SCC_NEWGRF_PRINT_WORD_LITRES:
00672 return SCC_VOLUME;
00673
00674 case SCC_NEWGRF_DISCARD_WORD:
00675 case SCC_NEWGRF_ROTATE_TOP_4_WORDS:
00676 case SCC_NEWGRF_PUSH_WORD:
00677 case SCC_NEWGRF_UNPRINT:
00678 return 0;
00679 }
00680 }