MCPcopy Create free account
hub / github.com/OpenFodder/openfodder / distanceTo

Method distanceTo

Source/Position.hpp:34–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

32 void Clear() { mX = 0; mY = 0; }
33
34 int distanceTo(const cPosition& pPosition) const {
35
36 int X = mX - pPosition.mX;
37 int Y = mY - pPosition.mY;
38
39 if (X < 0)
40 X = -X;
41 if (Y < 0)
42 Y = -Y;
43
44 return X + Y;
45 }
46
47 bool operator== (const cPosition& pPosition) const {
48

Callers 1

SolveMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected