00001
00002
00003
00004
00005
00006
00007
00008
00009
00019 #include "stdafx.h"
00020 #include "newgrf.h"
00021 #include "strings_func.h"
00022 #include "newgrf_storage.h"
00023 #include "string_func.h"
00024 #include "date_type.h"
00025 #include "debug.h"
00026
00027 #include "table/strings.h"
00028 #include "table/control_codes.h"
00029
00030 #define GRFTAB 28
00031 #define TABSIZE 11
00032
00040 StringID TTDPStringIDToOTTDStringIDMapping(StringID str)
00041 {
00042
00043 static const StringID units_volume[] = {
00044 STR_NOTHING, STR_PASSENGERS, STR_TONS, STR_BAGS,
00045 STR_LITERS, STR_ITEMS, STR_CRATES, STR_TONS,
00046 STR_TONS, STR_TONS, STR_TONS, STR_BAGS,
00047 STR_TONS, STR_TONS, STR_TONS, STR_BAGS,
00048 STR_TONS, STR_TONS, STR_BAGS, STR_LITERS,
00049 STR_TONS, STR_LITERS, STR_TONS, STR_NOTHING,
00050 STR_BAGS, STR_LITERS, STR_TONS, STR_NOTHING,
00051 STR_TONS, STR_NOTHING, STR_LITERS, STR_NOTHING
00052 };
00053
00054
00055 if (IsInsideMM(str, 0xD000, 0xD7FF) || IsInsideMM(str, 0xDC00, 0xDCFF)) return str;
00056
00057 #define TEXTID_TO_STRINGID(begin, end, stringid) if (str >= begin && str <= end) return str + (stringid - begin)
00058
00059 TEXTID_TO_STRINGID(0x000E, 0x002D, STR_CARGO_PLURAL_NOTHING);
00060 TEXTID_TO_STRINGID(0x002E, 0x004D, STR_CARGO_SINGULAR_NOTHING);
00061 if (str >= 0x004E && str <= 0x006D) return units_volume[str - 0x004E];
00062 TEXTID_TO_STRINGID(0x006E, 0x008D, STR_QUANTITY_NOTHING);
00063 TEXTID_TO_STRINGID(0x008E, 0x00AD, STR_ABBREV_NOTHING);
00064
00065
00066
00067
00068 TEXTID_TO_STRINGID(0x200F, 0x201F, STR_TOWN_BUILDING_NAME_TALL_OFFICE_BLOCK_1);
00069 TEXTID_TO_STRINGID(0x2036, 0x2041, STR_TOWN_BUILDING_NAME_COTTAGES_1);
00070 TEXTID_TO_STRINGID(0x2059, 0x205C, STR_TOWN_BUILDING_NAME_IGLOO_1);
00071
00072
00073 TEXTID_TO_STRINGID(0x4802, 0x4826, STR_INDUSTRY_NAME_COAL_MINE);
00074 TEXTID_TO_STRINGID(0x482D, 0x482E, STR_NEWS_INDUSTRY_CONSTRUCTION);
00075 TEXTID_TO_STRINGID(0x4832, 0x4834, STR_NEWS_INDUSTRY_CLOSURE_GENERAL);
00076 TEXTID_TO_STRINGID(0x4835, 0x4838, STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_GENERAL);
00077 TEXTID_TO_STRINGID(0x4839, 0x483A, STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL);
00078
00079 switch (str) {
00080 case 0x4830: return STR_ERROR_CAN_T_CONSTRUCT_THIS_INDUSTRY;
00081 case 0x4831: return STR_ERROR_FOREST_CAN_ONLY_BE_PLANTED;
00082 case 0x483B: return STR_ERROR_CAN_ONLY_BE_POSITIONED;
00083 }
00084 #undef TEXTID_TO_STRINGID
00085
00086 if (str == STR_NULL) return STR_EMPTY;
00087
00088 DEBUG(grf, 0, "Unknown StringID 0x%04X remapped to STR_EMPTY. Please open a Feature Request if you need it", str);
00089
00090 return STR_EMPTY;
00091 }
00092
00098 enum GRFBaseLanguages {
00099 GRFLB_AMERICAN = 0x01,
00100 GRFLB_ENGLISH = 0x02,
00101 GRFLB_GERMAN = 0x04,
00102 GRFLB_FRENCH = 0x08,
00103 GRFLB_SPANISH = 0x10,
00104 GRFLB_GENERIC = 0x80,
00105 };
00106
00107 enum GRFExtendedLanguages {
00108 GRFLX_AMERICAN = 0x00,
00109 GRFLX_ENGLISH = 0x01,
00110 GRFLX_GERMAN = 0x02,
00111 GRFLX_FRENCH = 0x03,
00112 GRFLX_SPANISH = 0x04,
00113 GRFLX_UNSPECIFIED = 0x7F,
00114 };
00115
00121 struct GRFText {
00122 public:
00123 static GRFText *New(byte langid, const char *text)
00124 {
00125 return new (strlen(text) + 1) GRFText(langid, text);
00126 }
00127
00133 void *operator new(size_t size)
00134 {
00135 NOT_REACHED();
00136 }
00137
00142 void operator delete(void *p)
00143 {
00144 free(p);
00145 }
00146 private:
00147 GRFText(byte langid_, const char *text_) : next(NULL), langid(langid_)
00148 {
00149 strcpy(text, text_);
00150 }
00151
00158 void *operator new(size_t size, size_t extra)
00159 {
00160 return MallocT<byte>(size + extra);
00161 }
00162
00163 public:
00164 GRFText *next;
00165 byte langid;
00166 char text[];
00167 };
00168
00169
00175 struct GRFTextEntry {
00176 uint32 grfid;
00177 uint16 stringid;
00178 StringID def_string;
00179 GRFText *textholder;
00180 };
00181
00182
00183 static uint _num_grf_texts = 0;
00184 static GRFTextEntry _grf_text[(1 << TABSIZE) * 3];
00185 static byte _currentLangID = GRFLX_ENGLISH;
00186
00187
00188 char *TranslateTTDPatchCodes(uint32 grfid, const char *str)
00189 {
00190 char *tmp = MallocT<char>(strlen(str) * 10 + 1);
00191 char *d = tmp;
00192 bool unicode = false;
00193 WChar c;
00194 size_t len = Utf8Decode(&c, str);
00195
00196 if (c == 0x00DE) {
00197
00198 unicode = true;
00199 str += len;
00200 }
00201
00202 for (;;) {
00203 if (unicode && Utf8EncodedCharLen(*str) != 0) {
00204 c = Utf8Consume(&str);
00205
00206 if (GB(c, 8, 8) == 0xE0) {
00207 c = GB(c, 0, 8);
00208 } else if (c >= 0x20) {
00209 if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
00210 d += Utf8Encode(d, c);
00211 continue;
00212 }
00213 } else {
00214 c = (byte)*str++;
00215 }
00216 if (c == 0) break;
00217
00218 switch (c) {
00219 case 0x01:
00220 d += Utf8Encode(d, SCC_SETX);
00221 *d++ = *str++;
00222 break;
00223 case 0x0A: break;
00224 case 0x0D: *d++ = 0x0A; break;
00225 case 0x0E: d += Utf8Encode(d, SCC_TINYFONT); break;
00226 case 0x0F: d += Utf8Encode(d, SCC_BIGFONT); break;
00227 case 0x1F:
00228 d += Utf8Encode(d, SCC_SETXY);
00229 *d++ = *str++;
00230 *d++ = *str++;
00231 break;
00232 case 0x7B:
00233 case 0x7C:
00234 case 0x7D:
00235 case 0x7E:
00236 case 0x7F:
00237 case 0x80: d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD + c - 0x7B); break;
00238 case 0x81: {
00239 StringID string;
00240 string = ((uint8)*str++);
00241 string |= ((uint8)*str++) << 8;
00242 d += Utf8Encode(d, SCC_STRING_ID);
00243 d += Utf8Encode(d, MapGRFStringID(grfid, string));
00244 break;
00245 }
00246 case 0x82:
00247 case 0x83:
00248 case 0x84: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_SPEED + c - 0x82); break;
00249 case 0x85: d += Utf8Encode(d, SCC_NEWGRF_DISCARD_WORD); break;
00250 case 0x86: d += Utf8Encode(d, SCC_NEWGRF_ROTATE_TOP_4_WORDS); break;
00251 case 0x87: d += Utf8Encode(d, SCC_NEWGRF_PRINT_WORD_LITRES); break;
00252 case 0x88: d += Utf8Encode(d, SCC_BLUE); break;
00253 case 0x89: d += Utf8Encode(d, SCC_SILVER); break;
00254 case 0x8A: d += Utf8Encode(d, SCC_GOLD); break;
00255 case 0x8B: d += Utf8Encode(d, SCC_RED); break;
00256 case 0x8C: d += Utf8Encode(d, SCC_PURPLE); break;
00257 case 0x8D: d += Utf8Encode(d, SCC_LTBROWN); break;
00258 case 0x8E: d += Utf8Encode(d, SCC_ORANGE); break;
00259 case 0x8F: d += Utf8Encode(d, SCC_GREEN); break;
00260 case 0x90: d += Utf8Encode(d, SCC_YELLOW); break;
00261 case 0x91: d += Utf8Encode(d, SCC_DKGREEN); break;
00262 case 0x92: d += Utf8Encode(d, SCC_CREAM); break;
00263 case 0x93: d += Utf8Encode(d, SCC_BROWN); break;
00264 case 0x94: d += Utf8Encode(d, SCC_WHITE); break;
00265 case 0x95: d += Utf8Encode(d, SCC_LTBLUE); break;
00266 case 0x96: d += Utf8Encode(d, SCC_GRAY); break;
00267 case 0x97: d += Utf8Encode(d, SCC_DKBLUE); break;
00268 case 0x98: d += Utf8Encode(d, SCC_BLACK); break;
00269 case 0x9A:
00270 switch (*str++) {
00271 case 0:
00272 case 1:
00273 d += Utf8Encode(d, SCC_NEWGRF_PRINT_QWORD_CURRENCY);
00274 break;
00275 case 3: {
00276 uint16 tmp = ((uint8)*str++);
00277 tmp |= ((uint8)*str++) << 8;
00278 d += Utf8Encode(d, SCC_NEWGRF_PUSH_WORD);
00279 d += Utf8Encode(d, tmp);
00280 } break;
00281 case 4:
00282 d += Utf8Encode(d, SCC_NEWGRF_UNPRINT);
00283 d += Utf8Encode(d, *str++);
00284 break;
00285 case 6:
00286 d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_BYTE);
00287 break;
00288 case 7:
00289 d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_WORD);
00290 break;
00291 case 8:
00292 d += Utf8Encode(d, SCC_NEWGRF_PRINT_HEX_DWORD);
00293 break;
00294
00295 default:
00296 grfmsg(1, "missing handler for extended format code");
00297 break;
00298 }
00299 break;
00300
00301 case 0x9E: d += Utf8Encode(d, 0x20AC); break;
00302 case 0x9F: d += Utf8Encode(d, 0x0178); break;
00303 case 0xA0: d += Utf8Encode(d, SCC_UPARROW); break;
00304 case 0xAA: d += Utf8Encode(d, SCC_DOWNARROW); break;
00305 case 0xAC: d += Utf8Encode(d, SCC_CHECKMARK); break;
00306 case 0xAD: d += Utf8Encode(d, SCC_CROSS); break;
00307 case 0xAF: d += Utf8Encode(d, SCC_RIGHTARROW); break;
00308 case 0xB4: d += Utf8Encode(d, SCC_TRAIN); break;
00309 case 0xB5: d += Utf8Encode(d, SCC_LORRY); break;
00310 case 0xB6: d += Utf8Encode(d, SCC_BUS); break;
00311 case 0xB7: d += Utf8Encode(d, SCC_PLANE); break;
00312 case 0xB8: d += Utf8Encode(d, SCC_SHIP); break;
00313 case 0xB9: d += Utf8Encode(d, SCC_SUPERSCRIPT_M1); break;
00314 case 0xBC: d += Utf8Encode(d, SCC_SMALLUPARROW); break;
00315 case 0xBD: d += Utf8Encode(d, SCC_SMALLDOWNARROW); break;
00316 default:
00317
00318 if (!IsValidChar(c, CS_ALPHANUMERAL)) c = '?';
00319 d += Utf8Encode(d, c);
00320 break;
00321 }
00322 }
00323
00324 *d = '\0';
00325 tmp = ReallocT(tmp, strlen(tmp) + 1);
00326 return tmp;
00327 }
00328
00329
00333 StringID AddGRFString(uint32 grfid, uint16 stringid, byte langid_to_add, bool new_scheme, const char *text_to_add, StringID def_string)
00334 {
00335 char *translatedtext;
00336 uint id;
00337
00338
00339
00340
00341
00342
00343
00344 if (!new_scheme) {
00345 if (langid_to_add & (GRFLB_AMERICAN | GRFLB_ENGLISH)) {
00346 langid_to_add = GRFLX_ENGLISH;
00347 } else {
00348 StringID ret = STR_EMPTY;
00349 if (langid_to_add & GRFLB_GERMAN) ret = AddGRFString(grfid, stringid, GRFLX_GERMAN, true, text_to_add, def_string);
00350 if (langid_to_add & GRFLB_FRENCH) ret = AddGRFString(grfid, stringid, GRFLX_FRENCH, true, text_to_add, def_string);
00351 if (langid_to_add & GRFLB_SPANISH) ret = AddGRFString(grfid, stringid, GRFLX_SPANISH, true, text_to_add, def_string);
00352 return ret;
00353 }
00354 }
00355
00356 for (id = 0; id < _num_grf_texts; id++) {
00357 if (_grf_text[id].grfid == grfid && _grf_text[id].stringid == stringid) {
00358 break;
00359 }
00360 }
00361
00362
00363 if (id == lengthof(_grf_text)) return STR_EMPTY;
00364
00365 translatedtext = TranslateTTDPatchCodes(grfid, text_to_add);
00366
00367 GRFText *newtext = GRFText::New(langid_to_add, translatedtext);
00368
00369 free(translatedtext);
00370
00371
00372 if (id == _num_grf_texts) _num_grf_texts++;
00373
00374 if (_grf_text[id].textholder == NULL) {
00375 _grf_text[id].grfid = grfid;
00376 _grf_text[id].stringid = stringid;
00377 _grf_text[id].def_string = def_string;
00378 _grf_text[id].textholder = newtext;
00379 } else {
00380 GRFText **ptext, *text;
00381 bool replaced = false;
00382
00383
00384 for (ptext = &_grf_text[id].textholder; (text = *ptext) != NULL; ptext = &text->next) {
00385 if (text->langid != langid_to_add) continue;
00386 newtext->next = text->next;
00387 *ptext = newtext;
00388 delete text;
00389 replaced = true;
00390 break;
00391 }
00392
00393
00394 if (!replaced) *ptext = newtext;
00395 }
00396
00397 grfmsg(3, "Added 0x%X: grfid %08X string 0x%X lang 0x%X string '%s'", id, grfid, stringid, newtext->langid, newtext->text);
00398
00399 return (GRFTAB << TABSIZE) + id;
00400 }
00401
00402
00403 static uint32 _last_grfid = 0;
00404
00408 StringID GetGRFStringID(uint32 grfid, uint16 stringid)
00409 {
00410 uint id;
00411
00412
00413 if (grfid == 0) grfid = _last_grfid;
00414
00415 for (id = 0; id < _num_grf_texts; id++) {
00416 if (_grf_text[id].grfid == grfid && _grf_text[id].stringid == stringid) {
00417 return (GRFTAB << TABSIZE) + id;
00418 }
00419 }
00420
00421 return STR_UNDEFINED;
00422 }
00423
00424
00425 const char *GetGRFStringPtr(uint16 stringid)
00426 {
00427 const GRFText *default_text = NULL;
00428 const GRFText *search_text;
00429
00430 assert(_grf_text[stringid].grfid != 0);
00431
00432
00433 _last_grfid = _grf_text[stringid].grfid;
00434
00435
00436 for (search_text = _grf_text[stringid].textholder; search_text != NULL; search_text = search_text->next) {
00437 if (search_text->langid == _currentLangID) {
00438 return search_text->text;
00439 }
00440
00441
00442
00443 if (search_text->langid == GRFLX_UNSPECIFIED || (default_text == NULL && (search_text->langid == GRFLX_ENGLISH || search_text->langid == GRFLX_AMERICAN))) {
00444 default_text = search_text;
00445 }
00446 }
00447
00448
00449 if (default_text != NULL) return default_text->text;
00450
00451
00452 return GetStringPtr(_grf_text[stringid].def_string);
00453 }
00454
00463 void SetCurrentGrfLangID(byte language_id)
00464 {
00465 _currentLangID = language_id;
00466 }
00467
00468 bool CheckGrfLangID(byte lang_id, byte grf_version)
00469 {
00470 if (grf_version < 7) {
00471 switch (_currentLangID) {
00472 case GRFLX_GERMAN: return (lang_id & GRFLB_GERMAN) != 0;
00473 case GRFLX_FRENCH: return (lang_id & GRFLB_FRENCH) != 0;
00474 case GRFLX_SPANISH: return (lang_id & GRFLB_SPANISH) != 0;
00475 default: return (lang_id & (GRFLB_ENGLISH | GRFLB_AMERICAN)) != 0;
00476 }
00477 }
00478
00479 return (lang_id == _currentLangID || lang_id == GRFLX_UNSPECIFIED);
00480 }
00481
00486 void CleanUpStrings()
00487 {
00488 uint id;
00489
00490 for (id = 0; id < _num_grf_texts; id++) {
00491 GRFText *grftext = _grf_text[id].textholder;
00492 while (grftext != NULL) {
00493 GRFText *grftext2 = grftext->next;
00494 delete grftext;
00495 grftext = grftext2;
00496 }
00497 _grf_text[id].grfid = 0;
00498 _grf_text[id].stringid = 0;
00499 _grf_text[id].textholder = NULL;
00500 }
00501
00502 _num_grf_texts = 0;
00503 }
00504
00505 struct TextRefStack {
00506 byte stack[0x30];
00507 byte position;
00508 bool used;
00509
00510 TextRefStack() : used(false) {}
00511
00512 uint8 PopUnsignedByte() { assert(this->position < lengthof(this->stack)); return this->stack[this->position++]; }
00513 int8 PopSignedByte() { return (int8)this->PopUnsignedByte(); }
00514
00515 uint16 PopUnsignedWord()
00516 {
00517 uint16 val = this->PopUnsignedByte();
00518 return val | (this->PopUnsignedByte() << 8);
00519 }
00520 int16 PopSignedWord() { return (int32)this->PopUnsignedWord(); }
00521
00522 uint32 PopUnsignedDWord()
00523 {
00524 uint32 val = this->PopUnsignedWord();
00525 return val | (this->PopUnsignedWord() << 16);
00526 }
00527 int32 PopSignedDWord() { return (int32)this->PopUnsignedDWord(); }
00528
00529 uint64 PopUnsignedQWord()
00530 {
00531 uint64 val = this->PopUnsignedDWord();
00532 return val | (((uint64)this->PopUnsignedDWord()) << 32);
00533 }
00534 int64 PopSignedQWord() { return (int64)this->PopUnsignedQWord(); }
00535
00537 void RotateTop4Words()
00538 {
00539 byte tmp[2];
00540 for (int i = 0; i < 2; i++) tmp[i] = this->stack[this->position + i + 6];
00541 for (int i = 5; i >= 0; i--) this->stack[this->position + i + 2] = this->stack[this->position + i];
00542 for (int i = 0; i < 2; i++) this->stack[this->position + i] = tmp[i];
00543 }
00544
00545 void PushWord(uint16 word)
00546 {
00547 if (this->position >= 2) {
00548 this->position -= 2;
00549 } else {
00550 for (int i = lengthof(stack) - 1; i >= this->position + 2; i--) {
00551 this->stack[i] = this->stack[i - 2];
00552 }
00553 }
00554 this->stack[this->position] = GB(word, 0, 8);
00555 this->stack[this->position + 1] = GB(word, 8, 8);
00556 }
00557
00558 void ResetStack() { this->position = 0; this->used = true; }
00559 void RewindStack() { this->position = 0; }
00560 };
00561
00562 static TextRefStack _newgrf_normal_textrefstack;
00563 static TextRefStack _newgrf_error_textrefstack;
00564
00566 static TextRefStack *_newgrf_textrefstack = &_newgrf_normal_textrefstack;
00567
00572 void PrepareTextRefStackUsage(byte numEntries)
00573 {
00574 extern TemporaryStorageArray<uint32, 0x110> _temp_store;
00575
00576 _newgrf_textrefstack->ResetStack();
00577
00578 byte *p = _newgrf_textrefstack->stack;
00579 for (uint i = 0; i < numEntries; i++) {
00580 for (uint j = 0; j < 32; j += 8) {
00581 *p = GB(_temp_store.Get(0x100 + i), j, 8);
00582 p++;
00583 }
00584 }
00585 }
00586
00588 void StopTextRefStackUsage() { _newgrf_textrefstack->used = false; }
00589
00590 void SwitchToNormalRefStack()
00591 {
00592 _newgrf_textrefstack = &_newgrf_normal_textrefstack;
00593 }
00594
00595 void SwitchToErrorRefStack()
00596 {
00597 _newgrf_textrefstack = &_newgrf_error_textrefstack;
00598 }
00599
00600 void RewindTextRefStack()
00601 {
00602 _newgrf_textrefstack->RewindStack();
00603 }
00604
00613 uint RemapNewGRFStringControlCode(uint scc, char **buff, const char **str, int64 *argv)
00614 {
00615 if (_newgrf_textrefstack->used) {
00616 switch (scc) {
00617 default: NOT_REACHED();
00618 case SCC_NEWGRF_PRINT_SIGNED_BYTE: *argv = _newgrf_textrefstack->PopSignedByte(); break;
00619 case SCC_NEWGRF_PRINT_SIGNED_WORD: *argv = _newgrf_textrefstack->PopSignedWord(); break;
00620 case SCC_NEWGRF_PRINT_QWORD_CURRENCY: *argv = _newgrf_textrefstack->PopUnsignedQWord(); break;
00621
00622 case SCC_NEWGRF_PRINT_DWORD_CURRENCY:
00623 case SCC_NEWGRF_PRINT_DWORD: *argv = _newgrf_textrefstack->PopSignedDWord(); break;
00624
00625 case SCC_NEWGRF_PRINT_HEX_BYTE: *argv = _newgrf_textrefstack->PopUnsignedByte(); break;
00626 case SCC_NEWGRF_PRINT_HEX_DWORD: *argv = _newgrf_textrefstack->PopUnsignedDWord(); break;
00627
00628 case SCC_NEWGRF_PRINT_HEX_WORD:
00629 case SCC_NEWGRF_PRINT_WORD_SPEED:
00630 case SCC_NEWGRF_PRINT_WORD_LITRES:
00631 case SCC_NEWGRF_PRINT_UNSIGNED_WORD: *argv = _newgrf_textrefstack->PopUnsignedWord(); break;
00632
00633 case SCC_NEWGRF_PRINT_DATE:
00634 case SCC_NEWGRF_PRINT_MONTH_YEAR: *argv = _newgrf_textrefstack->PopSignedWord() + DAYS_TILL_ORIGINAL_BASE_YEAR; break;
00635
00636 case SCC_NEWGRF_DISCARD_WORD: _newgrf_textrefstack->PopUnsignedWord(); break;
00637
00638 case SCC_NEWGRF_ROTATE_TOP_4_WORDS: _newgrf_textrefstack->RotateTop4Words(); break;
00639 case SCC_NEWGRF_PUSH_WORD: _newgrf_textrefstack->PushWord(Utf8Consume(str)); break;
00640 case SCC_NEWGRF_UNPRINT: *buff -= Utf8Consume(str); break;
00641
00642 case SCC_NEWGRF_PRINT_STRING_ID:
00643 *argv = TTDPStringIDToOTTDStringIDMapping(_newgrf_textrefstack->PopUnsignedWord());
00644 break;
00645 }
00646 }
00647
00648 switch (scc) {
00649 default: NOT_REACHED();
00650 case SCC_NEWGRF_PRINT_DWORD:
00651 case SCC_NEWGRF_PRINT_SIGNED_WORD:
00652 case SCC_NEWGRF_PRINT_SIGNED_BYTE:
00653 case SCC_NEWGRF_PRINT_UNSIGNED_WORD:
00654 return SCC_COMMA;
00655
00656 case SCC_NEWGRF_PRINT_HEX_BYTE:
00657 case SCC_NEWGRF_PRINT_HEX_WORD:
00658 case SCC_NEWGRF_PRINT_HEX_DWORD:
00659 return SCC_HEX;
00660
00661 case SCC_NEWGRF_PRINT_DWORD_CURRENCY:
00662 case SCC_NEWGRF_PRINT_QWORD_CURRENCY:
00663 return SCC_CURRENCY;
00664
00665 case SCC_NEWGRF_PRINT_STRING_ID:
00666 return SCC_STRING1;
00667
00668 case SCC_NEWGRF_PRINT_DATE:
00669 return SCC_DATE_LONG;
00670
00671 case SCC_NEWGRF_PRINT_MONTH_YEAR:
00672 return SCC_DATE_TINY;
00673
00674 case SCC_NEWGRF_PRINT_WORD_SPEED:
00675 return SCC_VELOCITY;
00676
00677 case SCC_NEWGRF_PRINT_WORD_LITRES:
00678 return SCC_VOLUME;
00679
00680 case SCC_NEWGRF_DISCARD_WORD:
00681 case SCC_NEWGRF_ROTATE_TOP_4_WORDS:
00682 case SCC_NEWGRF_PUSH_WORD:
00683 case SCC_NEWGRF_UNPRINT:
00684 return 0;
00685 }
00686 }