OpenTTD Source 20250331-master-g3c15e0c889
newgrf_act5.cpp File Reference

NewGRF Action 0x05 handler. More...

#include "../stdafx.h"
#include "../debug.h"
#include "../gfx_type.h"
#include "../newgrf_act5.h"
#include "../spritecache.h"
#include "newgrf_bytereader.h"
#include "newgrf_internal.h"
#include "../table/sprites.h"
#include "../safeguards.h"

Go to the source code of this file.

Functions

static uint16_t SanitizeSpriteOffset (uint16_t &num, uint16_t offset, int max_sprites, const std::string_view name)
 Sanitize incoming sprite offsets for Action 5 graphics replacements.
 
std::span< const Action5TypeGetAction5Types ()
 Get list of all action 5 types.
 
static void GraphicsNew (ByteReader &buf)
 
static void SkipAct5 (ByteReader &buf)
 

Variables

static constexpr auto _action5_types
 The information about action 5 types.
 

Detailed Description

NewGRF Action 0x05 handler.

Definition in file newgrf_act5.cpp.

Function Documentation

◆ GetAction5Types()

std::span< const Action5Type > GetAction5Types ( )

Get list of all action 5 types.

Returns
Read-only span of action 5 type information.

Definition at line 87 of file newgrf_act5.cpp.

References _action5_types.

Referenced by SpriteAlignerWindow::GetWidgetString().

◆ GraphicsNew()

static void GraphicsNew ( ByteReader buf)
static

Definition at line 93 of file newgrf_act5.cpp.

◆ SanitizeSpriteOffset()

static uint16_t SanitizeSpriteOffset ( uint16_t &  num,
uint16_t  offset,
int  max_sprites,
const std::string_view  name 
)
static

Sanitize incoming sprite offsets for Action 5 graphics replacements.

Parameters
numThe number of sprites to load.
offsetOffset from the base.
max_spritesThe maximum number of sprites that can be loaded in this action 5.
nameUsed for error warnings.
Returns
The number of sprites that is going to be skipped.

Definition at line 30 of file newgrf_act5.cpp.

◆ SkipAct5()

static void SkipAct5 ( ByteReader buf)
static

Definition at line 182 of file newgrf_act5.cpp.

Variable Documentation

◆ _action5_types

constexpr auto _action5_types
staticconstexpr
Initial value:
= std::to_array<Action5Type>({
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x00" },
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x01" },
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x02" },
{ A5BLOCK_INVALID, 0, 0, 0, "Type 0x03" },
{ A5BLOCK_ALLOW_OFFSET, SPR_SIGNALS_BASE, 1, PRESIGNAL_SEMAPHORE_AND_PBS_SPRITE_COUNT, "Signal graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ELRAIL_BASE, 1, ELRAIL_SPRITE_COUNT, "Rail catenary graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_SLOPES_BASE, 1, NORMAL_AND_HALFTILE_FOUNDATION_SPRITE_COUNT, "Foundation graphics" },
{ A5BLOCK_INVALID, 0, 75, 0, "TTDP GUI graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_CANALS_BASE, 1, CANALS_SPRITE_COUNT, "Canal graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ONEWAY_BASE, 1, ONEWAY_SPRITE_COUNT, "One way road graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_2CCMAP_BASE, 1, TWOCCMAP_SPRITE_COUNT, "2CC colour maps" },
{ A5BLOCK_ALLOW_OFFSET, SPR_TRAMWAY_BASE, 1, TRAMWAY_SPRITE_COUNT, "Tramway graphics" },
{ A5BLOCK_INVALID, 0, 133, 0, "Snowy temperate tree" },
{ A5BLOCK_FIXED, SPR_SHORE_BASE, 16, SHORE_SPRITE_COUNT, "Shore graphics" },
{ A5BLOCK_INVALID, 0, 0, 0, "New Signals graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_TRACKS_FOR_SLOPES_BASE, 1, TRACKS_FOR_SLOPES_SPRITE_COUNT, "Sloped rail track" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AIRPORTX_BASE, 1, AIRPORTX_SPRITE_COUNT, "Airport graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ROADSTOP_BASE, 1, ROADSTOP_SPRITE_COUNT, "Road stop graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AQUEDUCT_BASE, 1, AQUEDUCT_SPRITE_COUNT, "Aqueduct graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AUTORAIL_BASE, 1, AUTORAIL_SPRITE_COUNT, "Autorail graphics" },
{ A5BLOCK_INVALID, 0, 1, 0, "Flag graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_OPENTTD_BASE, 1, OPENTTD_SPRITE_COUNT, "OpenTTD GUI graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_AIRPORT_PREVIEW_BASE, 1, AIRPORT_PREVIEW_SPRITE_COUNT, "Airport preview graphics" },
{ A5BLOCK_ALLOW_OFFSET, SPR_RAILTYPE_TUNNEL_BASE, 1, RAILTYPE_TUNNEL_BASE_COUNT, "Railtype tunnel base" },
{ A5BLOCK_ALLOW_OFFSET, SPR_PALETTE_BASE, 1, PALETTE_SPRITE_COUNT, "Palette" },
{ A5BLOCK_ALLOW_OFFSET, SPR_ROAD_WAYPOINTS_BASE, 1, ROAD_WAYPOINTS_SPRITE_COUNT, "Road waypoints" },
{ A5BLOCK_ALLOW_OFFSET, SPR_OVERLAY_ROCKS_BASE, 1, OVERLAY_ROCKS_SPRITE_COUNT, "Overlay rocks" },
})
@ A5BLOCK_ALLOW_OFFSET
Allow replacing any subset by specifiing an offset.
Definition newgrf_act5.h:16
@ A5BLOCK_INVALID
unknown/not-implemented type
Definition newgrf_act5.h:17
@ A5BLOCK_FIXED
Only allow replacing a whole block of sprites. (TTDP compatible)
Definition newgrf_act5.h:15
static constexpr SpriteID SPR_OVERLAY_ROCKS_BASE
Overlay rocks sprites.
Definition sprites.h:319
static const SpriteID SPR_AQUEDUCT_BASE
Sprites for the Aqueduct.
Definition sprites.h:186
static const SpriteID SPR_OPENTTD_BASE
Extra graphic spritenumbers.
Definition sprites.h:56
static const SpriteID SPR_TRACKS_FOR_SLOPES_BASE
Sprites for 'highlighting' tracks on sloped land.
Definition sprites.h:198
static const SpriteID SPR_ROAD_WAYPOINTS_BASE
Road waypoint sprites.
Definition sprites.h:311
static const SpriteID SPR_RAILTYPE_TUNNEL_BASE
Tunnel sprites with grass only for custom railtype tunnel.
Definition sprites.h:299
static const SpriteID SPR_TRAMWAY_BASE
Tramway sprites.
Definition sprites.h:272
static const SpriteID SPR_AIRPORT_PREVIEW_BASE
Airport preview sprites.
Definition sprites.h:248
static const SpriteID SPR_ONEWAY_BASE
One way road sprites.
Definition sprites.h:293
static const SpriteID SPR_SHORE_BASE
shore tiles - action 05-0D
Definition sprites.h:224

The information about action 5 types.

Definition at line 52 of file newgrf_act5.cpp.

Referenced by GetAction5Types().