summaryrefslogtreecommitdiff
path: root/map.c
diff options
context:
space:
mode:
authorDarkvater <Darkvater@openttd.org>2006-09-05 23:21:41 +0000
committerDarkvater <Darkvater@openttd.org>2006-09-05 23:21:41 +0000
commit7e4d0f112edbe2acb8ceebdf3161fa7c90cd66f9 (patch)
treef2f14fca9ac095b0bf6b46615035b8c207e3ce66 /map.c
parenta53c92464f2d87bcb9e8b31a1f68d5e26e29aded (diff)
downloadopenttd-7e4d0f112edbe2acb8ceebdf3161fa7c90cd66f9.tar.xz
(svn r6406) -Codechange: Rename TileOffsByDir to TileOffsByDiagDir because it accepts
DiagDirections, and add TileOffsByDir that handles Directions. -Codechange: Make the treeloop use TileOffsByDir().
Diffstat (limited to 'map.c')
-rw-r--r--map.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/map.c b/map.c
index 306ccb83b..7a1c565d0 100644
--- a/map.c
+++ b/map.c
@@ -120,11 +120,22 @@ uint TileAddWrap(TileIndex tile, int addx, int addy)
return INVALID_TILE;
}
+const TileIndexDiffC _tileoffs_by_diagdir[] = {
+ {-1, 0}, // DIAGDIR_NE
+ { 0, 1}, // DIAGDIR_SE
+ { 1, 0}, // DIAGDIR_SW
+ { 0, -1} // DIAGDIR_NW
+};
+
const TileIndexDiffC _tileoffs_by_dir[] = {
- {-1, 0},
- { 0, 1},
- { 1, 0},
- { 0, -1}
+ {-1, -1}, // DIR_N
+ {-1, 0}, // DIR_NE
+ {-1, 1}, // DIR_E
+ { 0, 1}, // DIR_SE
+ { 1, 1}, // DIR_S
+ { 1, 0}, // DIR_SW
+ { 1, -1}, // DIR_W
+ { 0, -1} // DIR_NW
};
uint DistanceManhattan(TileIndex t0, TileIndex t1)