| 56 | } |
| 57 | |
| 58 | static uint32_t GetPatchVariable(uint8_t param) |
| 59 | { |
| 60 | switch (param) { |
| 61 | /* start year - 1920 */ |
| 62 | case 0x0B: return (std::max(_settings_game.game_creation.starting_year, CalendarTime::ORIGINAL_BASE_YEAR) - CalendarTime::ORIGINAL_BASE_YEAR).base(); |
| 63 | |
| 64 | /* freight trains weight factor */ |
| 65 | case 0x0E: return _settings_game.vehicle.freight_trains; |
| 66 | |
| 67 | /* empty wagon speed increase */ |
| 68 | case 0x0F: return 0; |
| 69 | |
| 70 | /* plane speed factor; our patch option is reversed from TTDPatch's, |
| 71 | * the following is good for 1x, 2x and 4x (most common?) and... |
| 72 | * well not really for 3x. */ |
| 73 | case 0x10: |
| 74 | switch (_settings_game.vehicle.plane_speed) { |
| 75 | default: |
| 76 | case 4: return 1; |
| 77 | case 3: return 2; |
| 78 | case 2: return 2; |
| 79 | case 1: return 4; |
| 80 | } |
| 81 | |
| 82 | |
| 83 | /* 2CC colourmap base sprite */ |
| 84 | case 0x11: return SPR_2CCMAP_BASE; |
| 85 | |
| 86 | /* map size: format = -MABXYSS |
| 87 | * M : the type of map |
| 88 | * bit 0 : set : squared map. Bit 1 is now not relevant |
| 89 | * clear : rectangle map. Bit 1 will indicate the bigger edge of the map |
| 90 | * bit 1 : set : Y is the bigger edge. Bit 0 is clear |
| 91 | * clear : X is the bigger edge. |
| 92 | * A : minimum edge(log2) of the map |
| 93 | * B : maximum edge(log2) of the map |
| 94 | * XY : edges(log2) of each side of the map. |
| 95 | * SS : combination of both X and Y, thus giving the size(log2) of the map |
| 96 | */ |
| 97 | case 0x13: { |
| 98 | uint8_t map_bits = 0; |
| 99 | uint8_t log_X = Map::LogX() - 6; // subtraction is required to make the minimal size (64) zero based |
| 100 | uint8_t log_Y = Map::LogY() - 6; |
| 101 | uint8_t max_edge = std::max(log_X, log_Y); |
| 102 | |
| 103 | if (log_X == log_Y) { // we have a squared map, since both edges are identical |
| 104 | SetBit(map_bits, 0); |
| 105 | } else { |
| 106 | if (max_edge == log_Y) SetBit(map_bits, 1); // edge Y been the biggest, mark it |
| 107 | } |
| 108 | |
| 109 | return (map_bits << 24) | (std::min(log_X, log_Y) << 20) | (max_edge << 16) | |
| 110 | (log_X << 12) | (log_Y << 8) | (log_X + log_Y); |
| 111 | } |
| 112 | |
| 113 | /* The maximum height of the map. */ |
| 114 | case 0x14: |
| 115 | return _settings_game.construction.map_height_limit; |