Flags (Pondering)
Just pondering...
NetLane
The 🍦 vanilla NetLane.m_flags member is a ushort containing 16 bits. Can we concatenate a 🚦 TM:PE custom ushort flags on to it, creating a 32-bit uint word?
In theory, it should be as simple as (pseudocode): lane_flags = lane.m_flags | tmpeLane.flags.
In the table below, I list the 32 bits (1-indexed) and their purpose. As you can see, this combines the following features:
- Vanilla flags 
- Vehicle restrictions 
- Parking restrictions 
- Lane customisations (see #515) 
More could be added if a 64-bit word was used, and I think that would be useful to consider; we could encode lots of useful info in the flags, for example:
- Whether the lane exits by segment start/end node (two flags, so if direction is both, both flags would be set) 
- Lane speed limit as an index (or value if sufficient bits available) 
- Anything that can reduce calculations required for vehicle AIs and pathfinder 
While moving to 64-bit might seem excessive, particularly for lanes, it could significantly reduce the number of data sources required and would make code much more legible. In addition, the save/load process could potentially be greatly simplified in to just 3 main collections (the flags for lanes, segments and nodes).
| bit | from | name | meaning | 
|---|---|---|---|
| 🍦 | 
 | ||
| 
 | 🍦 | 
 | Created; can use. | 
| 
 | 🍦 | 
 | Deleted; do not use. | 
| 
 | 🍦 | 
 | ? | 
| 
 | 🍦 | 
 | ? | 
| 🍦 | 
 | 
 | |
| 
 | 🍦 | 
 | Arrow forward | 
| 
 | 🍦 | 
 | Arrow left | 
| 
 | 🍦 | 
 | Arrow right | 
| 
 | 🍦 | 
 | Arrow merge | 
| 🍦 | 
 | 
 | |
| 🍦 | 
 | 
 | |
| 🍦 | 
 | 
 | |
| 🍦 | 
 | 
 | |
| 
 | 🍦 | 
 | Bus stop | 
| 
 | 🍦 | 
 | Tram stop | 
| 🍦 | 
 | 
 | |
| 
 | 🍦 | 
 | |
| 
 | 🍦 | 
 | |
| 
 | 🍦 | 
 | |
| 
 | 🍦 | 
 | |
| 
 | 🍦 | 
 | |
| 
 | 🍦 | 
 | |
| 🍦 | 
 | 
 | |
| 🍦 | 
 | 
 | |
| 🍦 | 
 | 
 | |
| 🍦 | 
 | 
 | |
| 
 | 🚦 | 
 | Allow passenger cars | 
| 
 | 🚦 | 
 | |
| 
 | 🚦 | 
 | Allow cargo trucks/trains | 
| 
 | 🚦 | 
 | Allow PT vehicles | 
| 
 | 🚦 | 
 | Allow city service vehicles | 
| 
 | 🚦 | 
 | Allow emergency services | 
| 
 | 🚦 | 
 | Allow local vehicles | 
| 
 | 🚦 | 
 | Allow city vehicles | 
| 
 | 🚦 | 
 | Allow regional vehicles | 
| 
 | 🚦 | 
 | Allow parking forward lane | 
| 
 | 🚦 | 
 | Allow parking backward lane | 
| 
 | 🚦 | 
 | |
| 
 | 🚦 | 
 | |
| 
 | 🚦 | 
 | |
| 
 | 🚦 | 
 | |
| 
 | 🚦 | 
 | 
NetSegment
todo
NetNode
todo