OpenTTD Source 20241224-master-gee860a5c8e
|
NewGRF definitions and structures for road stops. More...
#include "newgrf_animation_type.h"
#include "newgrf_spritegroup.h"
#include "newgrf_class.h"
#include "newgrf_commons.h"
#include "newgrf_town.h"
#include "road.h"
Go to the source code of this file.
Data Structures | |
struct | RoadStopScopeResolver |
Scope resolver for road stops. More... | |
struct | RoadStopResolverObject |
Road stop resolver. More... | |
struct | RoadStopSpec |
Road stop specification. More... | |
Typedefs | |
using | RoadStopClass = NewGRFClass< RoadStopSpec, RoadStopClassID, ROADSTOP_CLASS_MAX > |
Functions | |
void | DrawRoadStopTile (int x, int y, RoadType roadtype, const RoadStopSpec *spec, StationType type, int view) |
Draw representation of a road stop tile for GUI purposes. | |
uint16_t | GetRoadStopCallback (CallbackID callback, uint32_t param1, uint32_t param2, const RoadStopSpec *roadstopspec, BaseStation *st, TileIndex tile, RoadType roadtype, StationType type, uint8_t view) |
void | AnimateRoadStopTile (TileIndex tile) |
uint8_t | GetRoadStopTileAnimationSpeed (TileIndex tile) |
void | TriggerRoadStopAnimation (BaseStation *st, TileIndex tile, StationAnimationTrigger trigger, CargoID cargo_type=INVALID_CARGO) |
void | TriggerRoadStopRandomisation (Station *st, TileIndex tile, RoadStopRandomTrigger trigger, CargoID cargo_type=INVALID_CARGO) |
Trigger road stop randomisation. | |
bool | GetIfNewStopsByType (RoadStopType rs, RoadType roadtype) |
Checks if there's any new stations by a specific RoadStopType. | |
bool | GetIfClassHasNewStopsByType (const RoadStopClass *roadstopclass, RoadStopType rs, RoadType roadtype) |
Checks if the given RoadStopClass has any specs assigned to it, compatible with the given RoadStopType. | |
bool | GetIfStopIsForType (const RoadStopSpec *roadstopspec, RoadStopType rs, RoadType roadtype) |
Checks if the given RoadStopSpec is compatible with the given RoadStopType. | |
const RoadStopSpec * | GetRoadStopSpec (TileIndex t) |
int | AllocateSpecToRoadStop (const RoadStopSpec *statspec, BaseStation *st, bool exec) |
void | DeallocateSpecFromRoadStop (BaseStation *st, uint8_t specindex) |
void | RoadStopUpdateCachedTriggers (BaseStation *st) |
Update the cached animation trigger bitmask for a station. | |
bool | IsWaypointClass (const RoadStopClass &cls) |
Test if a RoadStopClass is the waypoint class. | |
Variables | |
static const int | NUM_ROADSTOPS_PER_GRF = UINT16_MAX - 1 |
The maximum amount of roadstops a single GRF is allowed to add. | |
static const uint32_t | ROADSTOP_CLASS_LABEL_DEFAULT = 'DFLT' |
static const uint32_t | ROADSTOP_CLASS_LABEL_WAYPOINT = 'WAYP' |
NewGRF definitions and structures for road stops.
Definition in file newgrf_roadstop.h.
Definition at line 175 of file newgrf_roadstop.h.
enum RoadStopAvailabilityType : uint8_t |
Various different options for availability, restricting the roadstop to be only for busses or for trucks.
Enumerator | |
---|---|
ROADSTOPTYPE_PASSENGER | This RoadStop is for passenger (bus) stops. |
ROADSTOPTYPE_FREIGHT | This RoadStop is for freight (truck) stops. |
ROADSTOPTYPE_ALL | This RoadStop is for both types of station road stops. |
Definition at line 49 of file newgrf_roadstop.h.
enum RoadStopClassID : uint16_t |
Enumerator | |
---|---|
ROADSTOP_CLASS_BEGIN | The lowest valid value. |
ROADSTOP_CLASS_DFLT | Default road stop class. |
ROADSTOP_CLASS_WAYP | Waypoint class. |
ROADSTOP_CLASS_MAX | Maximum number of classes. |
Definition at line 28 of file newgrf_roadstop.h.
enum RoadStopDrawMode : uint8_t |
Different draw modes to disallow rendering of some parts of the stop or road.
Definition at line 61 of file newgrf_roadstop.h.
Definition at line 37 of file newgrf_roadstop.h.
enum RoadStopSpecFlags |
Definition at line 69 of file newgrf_roadstop.h.
enum RoadStopView |
Definition at line 79 of file newgrf_roadstop.h.
int AllocateSpecToRoadStop | ( | const RoadStopSpec * | statspec, |
BaseStation * | st, | ||
bool | exec | ||
) |
Definition at line 549 of file newgrf_roadstop.cpp.
void AnimateRoadStopTile | ( | TileIndex | tile | ) |
Definition at line 360 of file newgrf_roadstop.cpp.
void DeallocateSpecFromRoadStop | ( | BaseStation * | st, |
uint8_t | specindex | ||
) |
Definition at line 582 of file newgrf_roadstop.cpp.
void DrawRoadStopTile | ( | int | x, |
int | y, | ||
RoadType | roadtype, | ||
const RoadStopSpec * | spec, | ||
StationType | type, | ||
int | view | ||
) |
Draw representation of a road stop tile for GUI purposes.
x | position x of image. |
y | position y of image. |
image | an int offset for the sprite. |
roadtype | the RoadType of the underlying road. |
spec | the RoadStop's spec. |
Definition at line 281 of file newgrf_roadstop.cpp.
References _local_company, DrawCommonTileSeqInGUI(), DrawSprite(), GB(), GetCustomRoadSprite(), GetRegister(), GetRoadTypeInfo(), DrawTileSprites::ground, GroundSpritePaletteTransform(), HasBit(), INVALID_ROADTYPE, INVALID_TILE, PalSpriteID::pal, SpriteGroup::Resolve(), ROADSTOP_DRAW_MODE_OVERLAY, ROADSTOP_DRAW_MODE_ROAD, ROADSTOP_DRAW_MODE_WAYP_GROUND, ROTSG_GROUND, ROTSG_OVERLAY, ROTSG_ROADSTOP, RSF_DRAW_MODE_REGISTER, PalSpriteID::sprite, and SPRITE_WIDTH.
bool GetIfClassHasNewStopsByType | ( | const RoadStopClass * | roadstopclass, |
RoadStopType | rs, | ||
RoadType | roadtype | ||
) |
Checks if the given RoadStopClass has any specs assigned to it, compatible with the given RoadStopType.
roadstopclass | the RoadStopClass to check. |
rs | the RoadStopType to check. |
roadtype | the RoadType to check. |
Definition at line 500 of file newgrf_roadstop.cpp.
References NewGRFClass< Tspec, Tindex, Tmax >::Specs().
bool GetIfNewStopsByType | ( | RoadStopType | rs, |
RoadType | roadtype | ||
) |
Checks if there's any new stations by a specific RoadStopType.
rs | the RoadStopType to check. |
roadtype | the RoadType to check. |
Definition at line 481 of file newgrf_roadstop.cpp.
References NewGRFClass< Tspec, Tindex, Tmax >::Classes(), IsWaypointClass(), and ROADSTOP_CLASS_DFLT.
bool GetIfStopIsForType | ( | const RoadStopSpec * | roadstopspec, |
RoadStopType | rs, | ||
RoadType | roadtype | ||
) |
Checks if the given RoadStopSpec is compatible with the given RoadStopType.
roadstopspec | the RoadStopSpec to check. |
rs | the RoadStopType to check. |
roadtype | the RoadType to check. |
Definition at line 515 of file newgrf_roadstop.cpp.
References HasBit(), ROADSTOP_BUS, ROADSTOP_TRUCK, ROADSTOPTYPE_ALL, ROADSTOPTYPE_FREIGHT, ROADSTOPTYPE_PASSENGER, RSF_BUILD_MENU_ROAD_ONLY, and RSF_BUILD_MENU_TRAM_ONLY.
uint16_t GetRoadStopCallback | ( | CallbackID | callback, |
uint32_t | param1, | ||
uint32_t | param2, | ||
const RoadStopSpec * | roadstopspec, | ||
BaseStation * | st, | ||
TileIndex | tile, | ||
RoadType | roadtype, | ||
StationType | type, | ||
uint8_t | view | ||
) |
Definition at line 266 of file newgrf_roadstop.cpp.
const RoadStopSpec * GetRoadStopSpec | ( | TileIndex | t | ) |
Definition at line 540 of file newgrf_roadstop.cpp.
|
inline |
Test if a RoadStopClass is the waypoint class.
cls | RoadStopClass to test. |
Definition at line 200 of file newgrf_roadstop.h.
References GB(), and NewGRFClass< Tspec, Tindex, Tmax >::global_id.
Referenced by CmdBuildRailStation(), CmdBuildRailWaypoint(), CmdBuildRoadStop(), CmdBuildRoadWaypoint(), StationPickerCallbacks::GetClassName(), WaypointPickerCallbacks::GetClassName(), RoadWaypointPickerCallbacks::GetClassName(), GetIfNewStopsByType(), StationPickerCallbacks::HasClassChoice(), WaypointPickerCallbacks::HasClassChoice(), RoadWaypointPickerCallbacks::HasClassChoice(), StationPickerCallbacks::IsActive(), WaypointPickerCallbacks::IsActive(), RoadStopPickerCallbacks< roadstoptype >::IsActive(), and RoadWaypointPickerCallbacks::IsActive().
void RoadStopUpdateCachedTriggers | ( | BaseStation * | st | ) |
Update the cached animation trigger bitmask for a station.
st | Station to update. |
Definition at line 623 of file newgrf_roadstop.cpp.
References BaseStation::cached_roadstop_anim_triggers, and BaseStation::cached_roadstop_cargo_triggers.
void TriggerRoadStopAnimation | ( | BaseStation * | st, |
TileIndex | tile, | ||
StationAnimationTrigger | trigger, | ||
CargoID | cargo_type = INVALID_CARGO |
||
) |
Definition at line 368 of file newgrf_roadstop.cpp.
void TriggerRoadStopRandomisation | ( | Station * | st, |
TileIndex | tile, | ||
RoadStopRandomTrigger | trigger, | ||
CargoID | cargo_type | ||
) |
Trigger road stop randomisation.
st | the station being triggered |
tile | the exact tile of the station that should be triggered |
trigger | trigger type |
cargo_type | cargo type causing the trigger |
Definition at line 408 of file newgrf_roadstop.cpp.
References BaseStation::cached_roadstop_cargo_triggers, RoadStopSpec::cargo_triggers, BaseStation::custom_roadstop_tile_data, BaseStation::GetByTile(), GetEmptyMask(), GetStationGfx(), GetStationType(), HasBit(), INVALID_ROADTYPE, IsValidCargoID(), MarkTileDirtyByTile(), BaseStation::random_bits, SpriteGroup::Resolve(), RSRT_CARGO_TAKEN, RSRT_NEW_CARGO, SetBit(), and BaseStation::waiting_triggers.
|
static |
The maximum amount of roadstops a single GRF is allowed to add.
Definition at line 23 of file newgrf_roadstop.h.
|
static |
Definition at line 25 of file newgrf_roadstop.h.
|
static |
Definition at line 26 of file newgrf_roadstop.h.