MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / RoadVehGetSlidingDirection

Function RoadVehGetSlidingDirection

src/roadveh_cmd.cpp:766–775  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

764}
765
766static Direction RoadVehGetSlidingDirection(const RoadVehicle *v, int x, int y)
767{
768 Direction new_dir = RoadVehGetNewDirection(v, x, y);
769 Direction old_dir = v->direction;
770 DirDiff delta;
771
772 if (new_dir == old_dir) return old_dir;
773 delta = (DirDifference(new_dir, old_dir) > DIRDIFF_REVERSE ? DIRDIFF_45LEFT : DIRDIFF_45RIGHT);
774 return ChangeDir(old_dir, delta);
775}
776
777struct OvertakeData {
778 const RoadVehicle *u;

Callers 1

Calls 3

RoadVehGetNewDirectionFunction · 0.85
DirDifferenceFunction · 0.85
ChangeDirFunction · 0.85

Tested by

no test coverage detected