equal
deleted
inserted
replaced
38 * NPF scale, ie the number of full tiles multiplied by NPF_TILE_LENGTH to |
38 * NPF scale, ie the number of full tiles multiplied by NPF_TILE_LENGTH to |
39 * prevent rounding. |
39 * prevent rounding. |
40 */ |
40 */ |
41 static uint NPFDistanceTrack(TileIndex t0, TileIndex t1) |
41 static uint NPFDistanceTrack(TileIndex t0, TileIndex t1) |
42 { |
42 { |
43 const uint dx = delta(TileX(t0), TileX(t1)); |
43 const uint dx = Delta(TileX(t0), TileX(t1)); |
44 const uint dy = delta(TileY(t0), TileY(t1)); |
44 const uint dy = Delta(TileY(t0), TileY(t1)); |
45 |
45 |
46 const uint straightTracks = 2 * min(dx, dy); /* The number of straight (not full length) tracks */ |
46 const uint straightTracks = 2 * min(dx, dy); /* The number of straight (not full length) tracks */ |
47 /* OPTIMISATION: |
47 /* OPTIMISATION: |
48 * Original: diagTracks = max(dx, dy) - min(dx,dy); |
48 * Original: diagTracks = max(dx, dy) - min(dx,dy); |
49 * Proof: |
49 * Proof: |