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

Function ChangeDirDiff

src/direction_func.h:88–92  ·  view source on GitHub ↗

* Applies two differences together * * This function adds two differences together and returns the resulting * difference. So adding two DIRDIFF_REVERSE together results in the * DIRDIFF_SAME difference. * * @param d The first difference * @param delta The second difference to add on * @return The resulting difference */

Source from the content-addressed store, hash-verified

86 * @return The resulting difference
87 */
88inline DirDiff ChangeDirDiff(DirDiff d, DirDiff delta)
89{
90 /* Cast to uint so compiler can use bitmask. Result can never be negative. */
91 return static_cast<DirDiff>((static_cast<uint>(d) + static_cast<uint>(delta)) % 8);
92}
93
94/**
95 * Change a direction by a given difference

Callers 1

VehicleGetVariableFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected