-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Using Track Block Get Previous
Pasted from gitter.
Track blocks are what you place when you use the ride construction window i.e. they can be made up of multiple map elements. I know for your function its only one element but we should use track block get previous as it adds some protection. You have to pass the x
and y
coordinates of the start of the track block and the map_element
of the tile. I suggest doing it like thus:
rct_map_element* trackElement =
map_get_track_element_at_of_type_seq(
x,
y,
z / 8,
trackType,
0);
rct_xy_element input;
input.x = x;
input.y = y;
input.element = trackElement;
track_begin_end output;
The output
is a track_begin_end
structure. The track_begin_end
structure should in theory give x
, y
coordinates of the start and end of a track block and the map_element
's associated with either end. In general you should only concern yourself with the begin variables.
Now using track_block_get_previous
is pretty simple. It returns false
if it fails to find the next track block and true
if it does find another block. On failure do not trust the contents of the output
.
- Home
- FAQ & Common Issues
- Roadmap
- Installation
- Building
- Features
- Development
- Benchmarking & stress testing OpenRCT2
- Coding Style
- Commit Messages
- Data Structures
- CSS1.DAT
- Custom Music and Ride Music Objects
- Game Actions
- G1 Elements Layout
- game.cfg structure
- Maps
- Music Cleanup
- Objects
- Official extended scenery set
- Peep AI
- Peep Sprite Type
- RCT1 ride and vehicle types and their RCT2 equivalents
- RCT12_MAX_SOMETHING versus MAX_SOMETHING
- Ride rating calculation
- SV6 Ride Structure
- Settings in config.ini
- Sizes and angles in the game world
- Sprite List csg1.dat
- Sprite List g1.dat
- Strings used in RCT1
- Strings used in the game
- TD6 format
- Terminology
- Track Data
- Track Designs
- Track drawers, RTDs and vehicle types
- Track types
- Vehicle Sprite Layout
- Widget colours
- Debugging OpenRCT2 on macOS
- OpenGL renderer
- Overall program structure
- Rebase and Sync fork with OpenRCT2
- Release Checklist
- Replay System
- Using minidumps from crash reports
- Using Track Block Get Previous
- History
- Testing