summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-09-14 21:36:59 +0000
committerrubidium <rubidium@openttd.org>2007-09-14 21:36:59 +0000
commit6762862edcc4f8e99c4c32693708818034d8f99f (patch)
tree4cb158ec2b460b3b96cde83dc31d9994bc4837a3 /src/viewport.cpp
parentfaa183a060249be6d941c91ad1527c14395ff41d (diff)
downloadopenttd-6762862edcc4f8e99c4c32693708818034d8f99f.tar.xz
(svn r11104) -Fix: bounding boxes also overlap when the min of a bounding box is equal to the max of another bounding box. Patch by frosch.
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 5880c445f..a40ba6392 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -1147,9 +1147,9 @@ static void ViewportSortParentSprites(ParentSpriteToDraw *psd[])
/* Decide which comparator to use, based on whether the bounding
* boxes overlap
*/
- if (ps->xmax > ps2->xmin && ps->xmin < ps2->xmax && // overlap in X?
- ps->ymax > ps2->ymin && ps->ymin < ps2->ymax && // overlap in Y?
- ps->zmax > ps2->zmin && ps->zmin < ps2->zmax) { // overlap in Z?
+ if (ps->xmax >= ps2->xmin && ps->xmin <= ps2->xmax && // overlap in X?
+ ps->ymax >= ps2->ymin && ps->ymin <= ps2->ymax && // overlap in Y?
+ ps->zmax >= ps2->zmin && ps->zmin <= ps2->zmax) { // overlap in Z?
/* Use X+Y+Z as the sorting order, so sprites closer to the bottom of
* the screen and with higher Z elevation, are drawn in front.
* Here X,Y,Z are the coordinates of the "center of mass" of the sprite,