Hi,

I ran into an issue with the Level class when attempting to sort all of the 
levels for a user interface. The problem appears to revolve around the 
Level.Compare method and the "ALL" level.

The last line of the Level.Compare method is as follows:

return l.m_levelValue - r.m_levelValue;

The above will function for all non-negative values. Unfortunately the ALL 
value is int.MinValue (a negative number ready to overflow).

ALL as the 'l' or 'r' parameter will cause an overflow producing undesirable 
results.

I worked around this by creating a compare that returned 1/0/-1 based on>/==/< 
compares.

Thanks,
Tim
                                          

Reply via email to