Loading

Paste #p3rl9ovhi

  1. Index: src/core/endian_func.hpp
  2. ===================================================================
  3. --- src/core/endian_func.hpp    (revision 27893)
  4. +++ src/core/endian_func.hpp    (working copy)
  5. @@ -40,6 +40,9 @@
  6.         #define TO_LE32X(x)  (x)
  7.  #endif /* TTD_ENDIAN == TTD_BIG_ENDIAN */
  8.  
  9. +#define SHORTSTR16(a, b) TO_LE16(a | b << 8)
  10. +#define SHORTSTR32(a, b, c, d) TO_LE32(a | b << 8 | c << 16 | d << 24)
  11. +
  12.  static inline uint16 ReadLE16Aligned(const void *x)
  13.  {
  14.         return FROM_LE16(*(const uint16*)x);
  15. Index: src/rail_type.h
  16. ===================================================================
  17. --- src/rail_type.h     (revision 27893)
  18. +++ src/rail_type.h     (working copy)
  19. @@ -16,10 +16,10 @@
  20.  
  21.  typedef uint32 RailTypeLabel;
  22.  
  23. -static const RailTypeLabel RAILTYPE_RAIL_LABEL     = 'RAIL';
  24. -static const RailTypeLabel RAILTYPE_ELECTRIC_LABEL = 'ELRL';
  25. -static const RailTypeLabel RAILTYPE_MONO_LABEL     = 'MONO';
  26. -static const RailTypeLabel RAILTYPE_MAGLEV_LABEL   = 'MGLV';
  27. +static const RailTypeLabel RAILTYPE_RAIL_LABEL     = SHORT_STR32('R', 'A', 'I', 'L');
  28. +static const RailTypeLabel RAILTYPE_ELECTRIC_LABEL = SHORT_STR32('E', 'L', 'R', 'L');
  29. +static const RailTypeLabel RAILTYPE_MONO_LABEL     = SHORT_STR32('M', 'O', 'N', 'O');
  30. +static const RailTypeLabel RAILTYPE_MAGLEV_LABEL   = SHORT_STR32('M', 'G', 'L', 'V');
  31.  
  32.  /**
  33.   * Enumeration for all possible railtypes.
  34. Index: src/screenshot.cpp
  35. ===================================================================
  36. --- src/screenshot.cpp  (revision 27893)
  37. +++ src/screenshot.cpp  (working copy)
  38. @@ -137,7 +137,7 @@
  39.  
  40.         /* Setup the file header */
  41.         BitmapFileHeader bfh;
  42. -       bfh.type = TO_LE16('MB');
  43. +       bfh.type = SHORT_STR16('B', 'M');
  44.         bfh.size = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size + bytewidth * h);
  45.         bfh.reserved = 0;
  46.         bfh.off_bits = TO_LE32(sizeof(BitmapFileHeader) + sizeof(BitmapInfoHeader) + pal_size);

Comments