summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2012-03-25 19:24:32 +0000
committerrubidium <rubidium@openttd.org>2012-03-25 19:24:32 +0000
commit180e4e4c66659e3fb06cdb9dfad51f5d6ef2736a (patch)
treec542cea12ca35ae82d27a01bdd2d822cbd6306f8
parent6db0753a46eea1d3af2a614811d37c9d804e59ac (diff)
downloadopenttd-180e4e4c66659e3fb06cdb9dfad51f5d6ef2736a.tar.xz
(svn r24067) -Change/fix: do not redraw up to 25% of the map when making a new vehicle visible for the first time
-rw-r--r--src/vehicle.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index c6abc3f25..4851a4529 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -1416,12 +1416,16 @@ void VehicleUpdateViewport(Vehicle *v, bool dirty)
v->coord.bottom = pt.y + spr->height + 2 * ZOOM_LVL_BASE;
if (dirty) {
- MarkAllViewportsDirty(
- min(old_coord.left, v->coord.left),
- min(old_coord.top, v->coord.top),
- max(old_coord.right, v->coord.right) + 1 * ZOOM_LVL_BASE,
- max(old_coord.bottom, v->coord.bottom) + 1 * ZOOM_LVL_BASE
- );
+ if (old_coord.left == INVALID_COORD) {
+ MarkSingleVehicleDirty(v);
+ } else {
+ MarkAllViewportsDirty(
+ min(old_coord.left, v->coord.left),
+ min(old_coord.top, v->coord.top),
+ max(old_coord.right, v->coord.right) + 1 * ZOOM_LVL_BASE,
+ max(old_coord.bottom, v->coord.bottom) + 1 * ZOOM_LVL_BASE
+ );
+ }
}
}