MCPcopy Create free account
hub / github.com/DFHack/dfhack / calc_distance

Function calc_distance

plugins/channel-safely/include/inlines.h:23–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21}
22
23inline uint32_t calc_distance(df::coord p1, df::coord p2) {
24 // calculate chebyshev (chessboard) distance
25 uint32_t distance = abs(p2.z - p1.z);
26 distance += std::max(abs(p2.x - p1.x), abs(p2.y - p1.y));
27 return distance;
28}
29
30inline void get_connected_neighbours(const df::coord &map_pos, df::coord(&neighbours)[4]) {
31 neighbours[0] = map_pos;

Callers 2

find_dwarfFunction · 0.85
possible_caveinMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected