More accurate sort by difficulty – now uses the average HP for that monster class. Minor code cleanups.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@3856 c06c8d41-db1a-0410-9941-cceddc491573
G3BGTWSXRETYVNLG24E4O7SRMTB352REOQAFOIL4WB7X74P4RDIAC
// skip forward to the end of the range of identical monsters
monsters* m1 = mons[start];
unsigned int cur = start;
while (true)
// skip forward to past the end of the range of identical monsters
unsigned int end;
for (end=start+1; end < mons.size(); ++end)
if (cur + 1 == mons.size()) break;
// If m1 < m2, they can't be "equal"
// (and since array is sorted, they are otherwise "equal")
if (_by_attitude_and_experience(m1, mons[cur])) break;
cur += 1;
// Array is sorted, so if !(m1 < m2), m1 and m2 are "equal"
if (_by_attitude_and_experience(mons[start], mons[end]))
break;