Follow-up Comment #8, patch #1141 (project wesnoth):
Here are few comments about the patch.
I'm not convinced about the std::unique call on events. This will unbalance
events if two rectangles have the same left (or right) side but have
different right (or left) side. As a consequence, whole lines will be
refreshed, or worse they won't be refreshed at all.
Since segments are cheap structures, you can make the code a lot more
readable (and faster) by merging the pairs find/insert into single insert
calls when creating the lower an upper objects.
The assignments lower->x / upper->x = prev->x seem bad. If you have a
diagonal of overlapping rectangles, you will end up refreshing most of the
screen. Indeed, even if you merge only with the previous segment, this one
was already merged with the previous one, and so on. In the end, any segment
potentially starts from column 0, whatever its actual size.
It seems like you are pushing rectangles into update_rects much too early. In
particular, you are pushing way past the current event column, so there are
relevant events that haven't been handled yet.
Please add many comments. Sweep algorithms aren't trivial, and this part of
Wesnoth is much too critical for it to contain hard to track bugs.
_______________________________________________________
Reply to this item at:
<http://gna.org/patch/?1141>
_______________________________________________
Message posté via/par Gna!
http://gna.org/
_______________________________________________
Wesnoth-bugs mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-bugs