17#include "../safeguards.h"
32 GrfMsg(1,
"BridgeChangeInfo: Bridge {} is invalid, max {}, ignoring", last,
MAX_BRIDGES);
36 for (uint
id = first;
id < last; ++id) {
62 if (bridge->
speed == 0) bridge->
speed = UINT16_MAX;
68 size_t size = tableid + numtables;
72 bridge->
sprite_table.resize(std::min<size_t>(size, NUM_BRIDGE_PIECES));
75 for (; numtables-- != 0; tableid++) {
76 if (tableid >= NUM_BRIDGE_PIECES) {
77 GrfMsg(1,
"BridgeChangeInfo: Table {} >= {}, skipping", tableid, NUM_BRIDGE_PIECES);
constexpr uint SPRITES_PER_BRIDGE_PIECE
Number of sprites there are per bridge piece.
static const uint MAX_BRIDGES
Maximal number of available bridge specs.
BridgeSpec _bridge[MAX_BRIDGES]
The specification of all bridges.
Class to read from a NewGRF file.
uint32_t ReadDWord()
Read a single DWord (32 bits).
uint16_t ReadWord()
Read a single Word (16 bits).
uint8_t ReadByte()
Read a single byte (8 bits).
static constexpr TimerGame< struct Calendar >::Year MIN_YEAR
The absolute minimum year in OTTD.
static constexpr TimerGame< struct Calendar >::Year ORIGINAL_BASE_YEAR
The minimum starting year/base year of the original TTD.
static constexpr TimerGame< struct Calendar >::Year MAX_YEAR
MAX_YEAR, nicely rounded value of the number of years that can be encoded in a single 32 bits date,...
uint32_t SpriteID
The number of a sprite, without mapping bits and colourtables.
uint32_t PaletteID
The number of the palette.
constexpr T Clamp(const T a, const T min, const T max)
Clamp a value between an interval.
void MapSpriteMappingRecolour(PalSpriteID *grf_sprite)
Map the colour modifiers of TTDPatch to those that Open is using.
NewGRF buffer reader definition.
NewGRF internal processing state.
ChangeInfoResult
Possible return values for the GrfChangeInfoHandler functions.
@ CIR_INVALID_ID
Attempt to modify an invalid ID.
@ CIR_UNKNOWN
Variable is unknown.
@ CIR_UNHANDLED
Variable was parsed but unread.
@ CIR_SUCCESS
Variable was parsed and read.
void AddStringForMapping(GRFStringID source, std::function< void(StringID)> &&func)
Record a static StringID for getting translated later.
NewGRF string mapping definition.
Struct containing information about a single bridge type.
uint16_t price
the price multiplier
uint8_t min_length
the minimum length (not counting start and end tile)
StringID material
the string that contains the bridge description
std::vector< std::vector< PalSpriteID > > sprite_table
table of sprites for drawing the bridge
TimerGameCalendar::Year avail_year
the year where it becomes available
StringID transport_name[2]
description of the bridge, when built for road or rail
uint8_t flags
bit 0 set: disable drawing of far pillars.
uint16_t speed
maximum travel speed (1 unit = 1/1.6 mph = 1 km-ish/h)
uint16_t max_length
the maximum length (not counting start and end tile)
Templated helper to make a type-safe 'typedef' representing a single POD value.