mirror of
https://github.com/libretro/scummvm.git
synced 2025-03-04 09:18:38 +00:00
SCI: Rewrite Plane::mergeToRectList
The old one would continue reading from outerRect after it was deleted.
This commit is contained in:
parent
19283b94a9
commit
53ed7f6ac1
@ -629,18 +629,26 @@ void Plane::mergeToRectList(const Common::Rect &rect, RectList &rectList) const
|
||||
temp.add(rect);
|
||||
|
||||
for (RectList::size_type i = 0; i < temp.size(); ++i) {
|
||||
Common::Rect *outerRect = temp[i];
|
||||
Common::Rect r = *temp[i];
|
||||
|
||||
for (RectList::size_type j = 0; j < rectList.size(); ++j) {
|
||||
Common::Rect *innerRect = rectList[i];
|
||||
if (innerRect->intersects(*outerRect)) {
|
||||
Common::Rect out[4];
|
||||
int count = splitRects(*outerRect, *innerRect, out);
|
||||
Common::Rect *innerRect = rectList[j];
|
||||
if (innerRect->contains(r)) {
|
||||
temp.erase_at(i);
|
||||
break;
|
||||
}
|
||||
|
||||
Common::Rect out[4];
|
||||
int count = splitRects(r, *innerRect, out);
|
||||
if (count != -1) {
|
||||
for (int k = count - 1; k >= 0; --k) {
|
||||
temp.add(out[k]);
|
||||
}
|
||||
|
||||
temp.erase_at(i);
|
||||
} else {
|
||||
temp.erase_at(i);
|
||||
|
||||
// proceed to the next rect
|
||||
r = *temp[++i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user