Loading

Paste #pu3qrnwrg

  1. Index: src/newgrf_text.cpp
  2. ===================================================================
  3. --- src/newgrf_text.cpp (revision 27702)
  4. +++ src/newgrf_text.cpp (working copy)
  5. @@ -527,6 +527,7 @@
  6.                     case 0x1B:
  7.                     case 0x1C:
  8.                     case 0x1D:
  9. +                   case 0x1E:
  10.                         d += Utf8Encode(d, SCC_NEWGRF_PRINT_DWORD_DATE_LONG + code - 0x16);
  11.                         break;
  12.  
  13. @@ -996,6 +997,7 @@
  14.         case SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT:
  15.         case SCC_NEWGRF_PRINT_WORD_POWER:
  16.         case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
  17. +       case SCC_NEWGRF_PRINT_BYTE_CARGO_NAME:
  18.             if (argv_size < 1) {
  19.                 DEBUG(misc, 0, "Too many NewGRF string parameters.");
  20.                 return 0;
  21. @@ -1059,6 +1061,10 @@
  22.             case SCC_NEWGRF_PRINT_WORD_STRING_ID:
  23.                 *argv = MapGRFStringID(_newgrf_textrefstack.grffile->grfid, _newgrf_textrefstack.PopUnsignedWord());
  24.                 break;
  25. +
  26. +           case SCC_NEWGRF_PRINT_BYTE_CARGO_NAME:
  27. +               *argv = 1 << GetCargoTranslation(_newgrf_textrefstack.PopUnsignedByte(), _newgrf_textrefstack.grffile);
  28. +               break;
  29.         }
  30.     } else {
  31.         /* Consume additional parameter characters */
  32. @@ -1128,6 +1134,9 @@
  33.         case SCC_NEWGRF_PRINT_WORD_CARGO_TINY:
  34.             return SCC_CARGO_TINY;
  35.  
  36. +       case SCC_NEWGRF_PRINT_BYTE_CARGO_NAME:
  37. +           return SCC_CARGO_LIST;
  38. +
  39.         case SCC_NEWGRF_PRINT_WORD_STATION_NAME:
  40.             return SCC_STATION_NAME;
  41.  
  42. Index: src/table/control_codes.h
  43. ===================================================================
  44. --- src/table/control_codes.h   (revision 27702)
  45. +++ src/table/control_codes.h   (working copy)
  46. @@ -118,35 +118,36 @@
  47.      * It uses a "stack" of bytes and reads from there.
  48.      */
  49.     SCC_NEWGRF_FIRST,
  50. -   SCC_NEWGRF_PRINT_DWORD_SIGNED = SCC_NEWGRF_FIRST, ///< Read 4 bytes from the stack
  51. -   SCC_NEWGRF_PRINT_WORD_SIGNED,                     ///< Read 2 bytes from the stack as signed value
  52. -   SCC_NEWGRF_PRINT_BYTE_SIGNED,                     ///< Read 1 byte from the stack as signed value
  53. -   SCC_NEWGRF_PRINT_WORD_UNSIGNED,                   ///< Read 2 bytes from the stack as unsigned value
  54. -   SCC_NEWGRF_PRINT_DWORD_CURRENCY,                  ///< Read 4 bytes from the stack as currency
  55. -   SCC_NEWGRF_PRINT_WORD_STRING_ID,                  ///< Read 2 bytes from the stack as String ID
  56. -   SCC_NEWGRF_PRINT_WORD_DATE_LONG,                  ///< Read 2 bytes from the stack as base 1920 date
  57. -   SCC_NEWGRF_PRINT_WORD_DATE_SHORT,                 ///< Read 2 bytes from the stack as base 1920 date
  58. -   SCC_NEWGRF_PRINT_WORD_SPEED,                      ///< Read 2 bytes from the stack as signed speed
  59. -   SCC_NEWGRF_PRINT_WORD_VOLUME_LONG,                ///< Read 2 bytes from the stack as long signed volume
  60. -   SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG,                ///< Read 2 bytes from the stack as long unsigned weight
  61. -   SCC_NEWGRF_PRINT_WORD_STATION_NAME,               ///< Read 2 bytes from the stack as station name
  62. -   SCC_NEWGRF_PRINT_QWORD_CURRENCY,                  ///< Read 8 bytes from the stack as currency
  63. -   SCC_NEWGRF_PRINT_BYTE_HEX,                        ///< Read 1 byte from the stack and print it as hex
  64. -   SCC_NEWGRF_PRINT_WORD_HEX,                        ///< Read 2 bytes from the stack and print it as hex
  65. -   SCC_NEWGRF_PRINT_DWORD_HEX,                       ///< Read 4 bytes from the stack and print it as hex
  66. -   SCC_NEWGRF_PRINT_QWORD_HEX,                       ///< Read 8 bytes from the stack and print it as hex
  67. -   SCC_NEWGRF_PRINT_DWORD_DATE_LONG,                 ///< Read 4 bytes from the stack as base 0 date
  68. -   SCC_NEWGRF_PRINT_DWORD_DATE_SHORT,                ///< Read 4 bytes from the stack as base 0 date
  69. -   SCC_NEWGRF_PRINT_WORD_POWER,                      ///< Read 2 bytes from the stack as unsigned power
  70. -   SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT,               ///< Read 2 bytes from the stack as short signed volume
  71. -   SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT,               ///< Read 2 bytes from the stack as short unsigned weight
  72. -   SCC_NEWGRF_PRINT_WORD_CARGO_LONG,                 ///< Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
  73. -   SCC_NEWGRF_PRINT_WORD_CARGO_SHORT,                ///< Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
  74. -   SCC_NEWGRF_PRINT_WORD_CARGO_TINY,                 ///< Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
  75. -   SCC_NEWGRF_PUSH_WORD,                             ///< Pushes 2 bytes onto the stack
  76. -   SCC_NEWGRF_UNPRINT,                               ///< "Unprints" the given number of bytes from the string
  77. -   SCC_NEWGRF_DISCARD_WORD,                          ///< Discard the next two bytes
  78. -   SCC_NEWGRF_ROTATE_TOP_4_WORDS,                    ///< Rotate the top 4 words of the stack (W4 W1 W2 W3)
  79. +   SCC_NEWGRF_PRINT_DWORD_SIGNED = SCC_NEWGRF_FIRST, ///< 7B: Read 4 bytes from the stack
  80. +   SCC_NEWGRF_PRINT_WORD_SIGNED,                     ///< 7C: Read 2 bytes from the stack as signed value
  81. +   SCC_NEWGRF_PRINT_BYTE_SIGNED,                     ///< 7D: Read 1 byte from the stack as signed value
  82. +   SCC_NEWGRF_PRINT_WORD_UNSIGNED,                   ///< 7E: Read 2 bytes from the stack as unsigned value
  83. +   SCC_NEWGRF_PRINT_DWORD_CURRENCY,                  ///< 8F: Read 4 bytes from the stack as currency
  84. +   SCC_NEWGRF_PRINT_WORD_STRING_ID,                  ///< 81: Read 2 bytes from the stack as String ID
  85. +   SCC_NEWGRF_PRINT_WORD_DATE_LONG,                  ///< 82: Read 2 bytes from the stack as base 1920 date
  86. +   SCC_NEWGRF_PRINT_WORD_DATE_SHORT,                 ///< 83: Read 2 bytes from the stack as base 1920 date
  87. +   SCC_NEWGRF_PRINT_WORD_SPEED,                      ///< 84: Read 2 bytes from the stack as signed speed
  88. +   SCC_NEWGRF_PRINT_WORD_VOLUME_LONG,                ///< 87: Read 2 bytes from the stack as long signed volume
  89. +   SCC_NEWGRF_PRINT_WORD_WEIGHT_LONG,                ///< 9A 0D: Read 2 bytes from the stack as long unsigned weight
  90. +   SCC_NEWGRF_PRINT_WORD_STATION_NAME,               ///< 9A 0C: Read 2 bytes from the stack as station name
  91. +   SCC_NEWGRF_PRINT_QWORD_CURRENCY,                  ///< 9A 01: Read 8 bytes from the stack as currency
  92. +   SCC_NEWGRF_PRINT_BYTE_HEX,                        ///< 9A 06: Read 1 byte from the stack and print it as hex
  93. +   SCC_NEWGRF_PRINT_WORD_HEX,                        ///< 9A 07: Read 2 bytes from the stack and print it as hex
  94. +   SCC_NEWGRF_PRINT_DWORD_HEX,                       ///< 9A 08: Read 4 bytes from the stack and print it as hex
  95. +   SCC_NEWGRF_PRINT_QWORD_HEX,                       ///< 9A 0B: Read 8 bytes from the stack and print it as hex
  96. +   SCC_NEWGRF_PRINT_DWORD_DATE_LONG,                 ///< 9A 16: Read 4 bytes from the stack as base 0 date
  97. +   SCC_NEWGRF_PRINT_DWORD_DATE_SHORT,                ///< 9A 17: Read 4 bytes from the stack as base 0 date
  98. +   SCC_NEWGRF_PRINT_WORD_POWER,                      ///< 9A 18: Read 2 bytes from the stack as unsigned power
  99. +   SCC_NEWGRF_PRINT_WORD_VOLUME_SHORT,               ///< 9A 19: Read 2 bytes from the stack as short signed volume
  100. +   SCC_NEWGRF_PRINT_WORD_WEIGHT_SHORT,               ///< 9A 1A: Read 2 bytes from the stack as short unsigned weight
  101. +   SCC_NEWGRF_PRINT_WORD_CARGO_LONG,                 ///< 9A 1B: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
  102. +   SCC_NEWGRF_PRINT_WORD_CARGO_SHORT,                ///< 9A 1C: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
  103. +   SCC_NEWGRF_PRINT_WORD_CARGO_TINY,                 ///< 9A 1D: Read 2 + 2 bytes from the stack as cargo type (translated) and unsigned cargo amount
  104. +   SCC_NEWGRF_PRINT_BYTE_CARGO_NAME,                 ///< 9A 1E: Read 1 byte from the stack as cargo name
  105. +   SCC_NEWGRF_PUSH_WORD,                             ///< 9A 03: Pushes 2 bytes onto the stack
  106. +   SCC_NEWGRF_UNPRINT,                               ///< 9A 04: "Unprints" the given number of bytes from the string
  107. +   SCC_NEWGRF_DISCARD_WORD,                          ///< 85: Discard the next two bytes
  108. +   SCC_NEWGRF_ROTATE_TOP_4_WORDS,                    ///< 86: Rotate the top 4 words of the stack (W4 W1 W2 W3)
  109.     SCC_NEWGRF_LAST = SCC_NEWGRF_ROTATE_TOP_4_WORDS,
  110.  
  111.     SCC_NEWGRF_STRINL,                                ///< Inline another string at the current position, StringID is encoded in the string
  112.  

Comments