diff options
author | Erich Eckner <git@eckner.net> | 2018-11-21 15:29:57 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-11-21 15:29:57 +0100 |
commit | 03fb0f7dc9b784ff2052c3dc29e13dd8fae46086 (patch) | |
tree | 46fe461950895b75da7dc02dc8e598ce8056f6c1 | |
parent | 759a77835aa2bdd2a087c4ada12cb917ed0c9b54 (diff) | |
download | archlinuxewe-03fb0f7dc9b784ff2052c3dc29e13dd8fae46086.tar.xz |
fix underground patch a little more
-rw-r--r-- | openttd-git/PKGBUILD | 2 | ||||
-rw-r--r-- | openttd-git/underground.patch | 139 |
2 files changed, 78 insertions, 63 deletions
diff --git a/openttd-git/PKGBUILD b/openttd-git/PKGBUILD index 4f03ba692..561201847 100644 --- a/openttd-git/PKGBUILD +++ b/openttd-git/PKGBUILD @@ -40,7 +40,7 @@ source=( sha512sums=('SKIP' '1b591b07d5f15c49b5ce0e961398e8cc7db99854724f7da6e23ccdff885cbbf3bcc707c42dc20cc4d6928d1b1e7559fd6e64828f31585da7f8e1d5fac5cbc4a2' 'b9995b78a2cdffbc9a6decd4c3aefcc4d9c821d1420ddf91aa372938bec316573dd85eb9827bdcbad15e6476c30ec8d5217fd5ade614cb4db5b8f9c890040245' - 'ccf09e6ea85f80debef0e41e4dc65f2f86c7d17d69818dc4c098a9c4916c0c0b7fd44c1c9605066f2ab05a83a3367b27de0a5d1ff2bc537ad1c835c4b3242f4e') + '45e03d0a749179de6e71f12a70df40a5324aa0055612f373fe91023ac5d2a6ac0fbb471b8e290b5812bcf35e5084077ea2f12106aaf0cd976727f019c71c5268') pkgver() { printf '%s.%s\n' \ diff --git a/openttd-git/underground.patch b/openttd-git/underground.patch index 2e450417a..e5b40fef3 100644 --- a/openttd-git/underground.patch +++ b/openttd-git/underground.patch @@ -1420,10 +1420,10 @@ index 0000000000..7228fb4b66 + diff --git a/src/layer_func.h b/src/layer_func.h new file mode 100644 -index 0000000000..be060cc27c +index 0000000000..d472d23b50 --- /dev/null +++ b/src/layer_func.h -@@ -0,0 +1,161 @@ +@@ -0,0 +1,102 @@ +/* $Id: layer_func.h 2012-09-07 18:11:11 constructor $ */ + +/* @@ -1454,65 +1454,6 @@ index 0000000000..be060cc27c + +#define FOR_ALL_LAYERS(var) for (uint var = 0; var < LayerCount(); var++) + -+ -+/** -+ * Get the size of the layer along the X -+ * @return the number of tiles along the X of the layer -+ */ -+static inline uint LayerSizeX() -+{ -+ extern uint _map_size_x; -+ return _map_size_x; -+} -+ -+/** -+ * Get the size of the layer along the Y -+ * @return the number of tiles along the Y of the layer -+ */ -+static inline uint LayerSizeY() -+{ -+ extern uint _layer_size_y; -+ return _layer_size_y; -+} -+ -+/** -+ * Gets the maximum X coordinate within the map, including MP_VOID -+ * @return the maximum X coordinate -+ */ -+static inline uint LayerMaxX() -+{ -+ return LayerSizeX() - 1; -+} -+ -+/** -+ * Gets the maximum Y coordinate within the map, including MP_VOID -+ * @return the maximum Y coordinate -+ */ -+static inline uint LayerMaxY() -+{ -+ return LayerSizeY() - 1; -+} -+ -+/** -+ * Get the layer counts -+ * @return the number of layers -+ */ -+static inline uint LayerCount() -+{ -+ extern uint _layer_count; -+ return _layer_count; -+} -+ -+/** -+ * Get the layer counts -+ * @return the number of layers -+ */ -+static inline uint LayerCountLog() -+{ -+ extern uint _layer_count_log; -+ return _layer_count_log; -+} -+ +/** + * Get the X component of a tile + * @param tile the tile to get the X component of @@ -1736,7 +1677,7 @@ index 85590c3e88..c00faa18c1 100644 } else { return CircularTileSearch(tile, size / 2, 0, 0, proc, user_data); diff --git a/src/map_func.h b/src/map_func.h -index 21d69b1382..08cf12b5f0 100644 +index 21d69b1382..b0a59eb148 100644 --- a/src/map_func.h +++ b/src/map_func.h @@ -43,7 +43,7 @@ extern Tile *_m; @@ -1748,6 +1689,80 @@ index 21d69b1382..08cf12b5f0 100644 /** * Logarithm of the map size along the X side. +@@ -115,6 +115,64 @@ static inline uint MapMaxY() + return MapSizeY() - 1; + } + ++/** ++ * Get the size of the layer along the X ++ * @return the number of tiles along the X of the layer ++ */ ++static inline uint LayerSizeX() ++{ ++ extern uint _map_size_x; ++ return _map_size_x; ++} ++ ++/** ++ * Get the size of the layer along the Y ++ * @return the number of tiles along the Y of the layer ++ */ ++static inline uint LayerSizeY() ++{ ++ extern uint _layer_size_y; ++ return _layer_size_y; ++} ++ ++/** ++ * Gets the maximum X coordinate within the map, including MP_VOID ++ * @return the maximum X coordinate ++ */ ++static inline uint LayerMaxX() ++{ ++ return LayerSizeX() - 1; ++} ++ ++/** ++ * Gets the maximum Y coordinate within the map, including MP_VOID ++ * @return the maximum Y coordinate ++ */ ++static inline uint LayerMaxY() ++{ ++ return LayerSizeY() - 1; ++} ++ ++/** ++ * Get the layer counts ++ * @return the number of layers ++ */ ++static inline uint LayerCount() ++{ ++ extern uint _layer_count; ++ return _layer_count; ++} ++ ++/** ++ * Get the layer counts ++ * @return the number of layers ++ */ ++static inline uint LayerCountLog() ++{ ++ extern uint _layer_count_log; ++ return _layer_count_log; ++} ++ + /** + * Scales the given value by the map size, where the given value is + * for a 256 by 256 map. +@@ -125,7 +183,7 @@ static inline uint ScaleByMapSize(uint n) + { + /* Subtract 12 from shift in order to prevent integer overflow + * for large values of n. It's safe since the min mapsize is 64x64. */ +- return CeilDiv(n << (MapLogX() + MapLogY() - 12), 1 << 4); ++ return CeilDiv(n << (MapLogX() + MapLogY() - LayerCountLog() - 12), 1 << 4); + } + + diff --git a/src/misc.cpp b/src/misc.cpp index d9d506993f..f5184c0581 100644 --- a/src/misc.cpp |