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

Function RoadVehGetNewDirection

src/roadveh_cmd.cpp:751–764  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

749}
750
751static Direction RoadVehGetNewDirection(const RoadVehicle *v, int x, int y)
752{
753 static const Direction _roadveh_new_dir[] = {
754 DIR_N , DIR_NW, DIR_W , INVALID_DIR,
755 DIR_NE, DIR_N , DIR_SW, INVALID_DIR,
756 DIR_E , DIR_SE, DIR_S
757 };
758
759 x = x - v->x_pos + 1;
760 y = y - v->y_pos + 1;
761
762 if ((uint)x > 2 || (uint)y > 2) return v->direction;
763 return _roadveh_new_dir[y * 4 + x];
764}
765
766static Direction RoadVehGetSlidingDirection(const RoadVehicle *v, int x, int y)
767{

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected