Matthieu Fertré wrote:
> So, in my opinion, the detection of duplicated rectangles must be done 
> in Map::OptimizeCache(). Methods Map::ToRedrawOnScreen() and 
> Map::ToRedrawOnMap() should stay silly methods.

This follows from where I have found the assertions to come from, inside 
OptimizeCache. Most likely a fix could come from simply removing the 
duplicates before calling sort, since sort doesn't seem to like the 
duplicates. Of course, sorting the list is what makes it easy to remove 
the duplicates in the first place...

According to MSDN, the comparator that is passed to sort must provide a 
strict weak ordering upon items. "Strict" is defined as 
CompareRectangles(a,a) == false. "Weak" is !CompareRectangles(a,b) && 
!CompareRectangles(b,a) can be true. "Ordering" is A<B && B<C implies 
A<C. The <, >, less(a,b), greater(b,a) operators are examples of 
operators that match these requirements, while <= and >= are explicitly 
said to fail. Since we use <= in CompareRectangles, this could be the 
problem.

With this known now, I believe it is possible to simply change 
CompareRectangles such that it returns false if the rectangles are 
equal, thus fixing the "weak" part of the requirement. Since it is very 
late at night here, and early in the morning where the rest of the devs 
are, I'll give somebody else a chance to take a crack at it or find a 
flaw in my reasoning before I give it a go.

Kyle

_______________________________________________
Wormux-dev mailing list
Wormux-dev@gna.org
https://mail.gna.org/listinfo/wormux-dev

Répondre à