mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Formatting, eof newline
@@ -1,7 +1,6 @@
|
||||
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:
|
||||
|
||||
```C
|
||||
rct_map_element* trackElement =
|
||||
map_get_track_element_at_of_type_seq(
|
||||
@@ -18,7 +17,6 @@ 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`.
|
||||
Reference in New Issue
Block a user