TimeShipPathLeg
function · objectlayer · primitive
- Address
0x5f9120· 600 bytes, up to0x5f9377- Signature
void __thiscall (void *this, void *points, void *stops, uint32_t leg)- Meaning
- Sets a ship leg's curve to its nodes and times it: each span by constant acceleration, rounded to ms, with its stops
- Confidence
- verified, proof one
- Finding
- objectlayer/transports#leg-timing
- Test
objectlayer::leg_time_difftest,objectlayer::leg_time_special_values_difftest,objectlayer::ship_path_build_difftest
Finding: Leg timing in objectlayer: transports
Each span between stops, and the last to the leg's end, takes the time of a constant acceleration a to the speed v; a span with a stop at both ends speeds up and slows down, one at a leg's edge does only one. With ta = float((1/a)·v) and da = (v·0.5)·ta, each test compares da at 53 bits and each formula uses float(da):
| span | time, s |
|---|---|
| no stops | seg / v |
| first or last | da < seg: (seg − da) / v + ta; else sqrt(seg·(1/a)·2) |
| between stops | da < seg/2: (seg − 2·da) / v + 2·ta; else 2·sqrt(seg·(1/a)) |
Each span rounds to ms on its own: t·1000, ±0.5 away from zero, truncated. Stop i holds the leg's travel time to it plus the waits before it, its distance and its wait; the last entry holds the whole leg and wait 0.
The derivation is in the doc.
Callers 1
- MovingTransportHandlerOnRecordArrived objectlayer
Callees 4
- __ftol crt
- SumSegmentLengthsMinusOne spline
- SetSplinePath spline
- GrowLegStops objectlayer
Calls and jumps by a bare address, from tables/calls.tsv.