summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2011-11-25 23:02:39 +0000
committerpeter1138 <peter1138@openttd.org>2011-11-25 23:02:39 +0000
commit2f05d090fb17437039c2559ece4025bbb4f47499 (patch)
treed8a15e857a667ebf08706e7452a5d12b56e8b589 /src
parent6dde12a0e86c30288eabdc1b0284d7c7a9ce7f47 (diff)
downloadopenttd-2f05d090fb17437039c2559ece4025bbb4f47499.tar.xz
(svn r23328) -Change: Make the viewport vehicle position hash cover the same area.
Diffstat (limited to 'src')
-rw-r--r--src/vehicle.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index be9ea58fd..8ddd6213f 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -56,7 +56,7 @@
#include "table/strings.h"
-#define GEN_HASH(x, y) ((GB((y), 6, 6) << 6) + GB((x), 7, 6))
+#define GEN_HASH(x, y) ((GB((y), 6 + ZOOM_LVL_SHIFT, 6) << 6) + GB((x), 7 + ZOOM_LVL_SHIFT, 6))
VehicleID _new_vehicle_id;
uint16 _returned_refit_capacity; ///< Stores the capacity after a refit operation.
@@ -980,18 +980,18 @@ void ViewportAddVehicles(DrawPixelInfo *dpi)
/* The hash area to scan */
int xl, xu, yl, yu;
- if (dpi->width + (70 * ZOOM_LVL_BASE) < (1 << (7 + 6))) {
- xl = GB(l - (70 * ZOOM_LVL_BASE), 7, 6);
- xu = GB(r, 7, 6);
+ if (dpi->width + (70 * ZOOM_LVL_BASE) < (1 << (7 + 6 + ZOOM_LVL_SHIFT))) {
+ xl = GB(l - (70 * ZOOM_LVL_BASE), 7 + ZOOM_LVL_SHIFT, 6);
+ xu = GB(r, 7 + ZOOM_LVL_SHIFT, 6);
} else {
/* scan whole hash row */
xl = 0;
xu = 0x3F;
}
- if (dpi->height + (70 * ZOOM_LVL_BASE) < (1 << (6 + 6))) {
- yl = GB(t - (70 * ZOOM_LVL_BASE), 6, 6) << 6;
- yu = GB(b, 6, 6) << 6;
+ if (dpi->height + (70 * ZOOM_LVL_BASE) < (1 << (6 + 6 + ZOOM_LVL_SHIFT))) {
+ yl = GB(t - (70 * ZOOM_LVL_BASE), 6 + ZOOM_LVL_SHIFT, 6) << 6;
+ yu = GB(b, 6 + ZOOM_LVL_SHIFT, 6) << 6;
} else {
/* scan whole column */
yl = 0;