forked from OpenLoco/OpenLoco
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Track.h
72 lines (68 loc) · 2.07 KB
/
Track.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#pragma once
#include "Types.hpp"
#include <OpenLoco/Engine/Map.hpp>
#include <utility>
namespace OpenLoco::Map::Track
{
struct TrackConnections
{
uint32_t size;
uint16_t data[16];
void push_back(uint16_t value);
uint16_t pop_back()
{
return data[--size];
}
};
static_assert(sizeof(TrackConnections) == 0x24);
enum class TrackId : uint8_t
{
straight,
diagonal,
leftCurveVerySmall,
rightCurveVerySmall,
leftCurveSmall,
rightCurveSmall,
leftCurve,
rightCurve,
leftCurveLarge,
rightCurveLarge,
diagonalLeftCurveLarge,
diagonalRightCurveLarge,
sBendLeft,
sBendRight,
straightSlopeUp,
straightSlopeDown,
straightSteepSlopeUp,
straightSteepSlopeDown,
leftCurveSmallSlopeUp,
rightCurveSmallSlopeUp,
leftCurveSmallSlopeDown,
rightCurveSmallSlopeDown,
leftCurveSmallSteepSlopeUp,
rightCurveSmallSteepSlopeUp,
leftCurveSmallSteepSlopeDown,
rightCurveSmallSteepSlopeDown,
unkStraight1,
unkStraight2,
unkLeftCurveVerySmall1,
unkLeftCurveVerySmall2,
unkRightCurveVerySmall1,
unkRightCurveVerySmall2,
unkSBendRight,
unkSBendLeft,
unkStraightSteepSlopeUp1,
unkStraightSteepSlopeUp2,
unkStraightSteepSlopeDown1,
unkStraightSteepSlopeDown2,
sBendToDualTrack,
sBendToSingleTrack,
unkSBendToDualTrack,
unkSBendToSingleTrack,
turnaround,
unkTurnaround,
};
void getRoadConnections(const Map::Pos3& pos, TrackConnections& data, const CompanyId company, const uint8_t roadObjectId, const uint16_t trackAndDirection);
void getTrackConnections(const Map::Pos3& nextTrackPos, const uint8_t nextRotation, TrackConnections& data, const CompanyId company, const uint8_t trackObjectId);
std::pair<Map::Pos3, uint8_t> getTrackConnectionEnd(const Map::Pos3& pos, const uint16_t trackAndDirection);
}