Mercurial > hg > openttd
diff src/viewport.cpp @ 7579:98c122c8985c draft
(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.
author | rubidium <rubidium@openttd.org> |
---|---|
date | Fri, 14 Sep 2007 21:36:59 +0000 (2007-09-14) |
parents | a41bfe5f3061 |
children | 8ae764721b47 |
line wrap: on
line diff
--- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -1147,9 +1147,9 @@ /* 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,