summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorbelugas <belugas@openttd.org>2008-02-14 15:13:36 +0000
committerbelugas <belugas@openttd.org>2008-02-14 15:13:36 +0000
commit6c932166414ac0164fc53658b880d5b05a9d7a7e (patch)
treef5627ffb6ca96128f65442285a6d4a6794f3b551 /src/viewport.cpp
parentbe47b475072c0755b80e0a7c9898eed11678ac6f (diff)
downloadopenttd-6c932166414ac0164fc53658b880d5b05a9d7a7e.tar.xz
(svn r12140) -Codechange: A bit of code style fixes(Geektoo).
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 0a8893978..f4c20c3e5 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -361,7 +361,7 @@ ViewPort *IsPtInWindowViewport(const Window *w, int x, int y)
ViewPort *vp = w->viewport;
if (vp != NULL &&
- IsInsideMM(x, vp->left, vp->left + vp->width) &&
+ IsInsideMM(x, vp->left, vp->left + vp->width) &&
IsInsideMM(y, vp->top, vp->top + vp->height))
return vp;
@@ -689,6 +689,7 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
top = ps->top = (pt.y += spr->y_offs);
bottom = (pt.y + spr->height);
}
+
if (_draw_bounding_boxes && (image != SPR_EMPTY_BOUNDING_BOX)) {
/* Compute maximal extents of sprite and it's bounding box */
left = min(left , RemapCoords(x + w , y + bb_offset_y, z + bb_offset_z).x);
@@ -696,9 +697,10 @@ void AddSortableSpriteToDraw(SpriteID image, SpriteID pal, int x, int y, int w,
top = min(top , RemapCoords(x + bb_offset_x, y + bb_offset_y, z + dz ).y);
bottom = max(bottom, RemapCoords(x + w , y + h , z + bb_offset_z).y + 1);
}
+
/* Do not add the sprite to the viewport, if it is outside */
if (left >= vd->dpi.left + vd->dpi.width ||
- right <= vd->dpi.left ||
+ right <= vd->dpi.left ||
top >= vd->dpi.top + vd->dpi.height ||
bottom <= vd->dpi.top) {
return;
@@ -1592,6 +1594,7 @@ void ViewportDoDraw(const ViewPort *vp, int left, int top, int right, int bottom
ViewportSortParentSprites(parent_list);
ViewportDrawParentSprites(parent_list);
+
if (_draw_bounding_boxes) ViewportDrawBoundingBoxes(parent_list);
if (vd.first_string != NULL) ViewportDrawStrings(&vd.dpi, vd.first_string);
@@ -1706,6 +1709,7 @@ void UpdateViewportPosition(Window *w)
}
ClampViewportToMap(vp, WP(w, vp_d).scrollpos_x, WP(w, vp_d).scrollpos_y);
+
SetViewportPosition(w, WP(w, vp_d).scrollpos_x, WP(w, vp_d).scrollpos_y);
}
}