summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source
diff options
context:
space:
mode:
authorennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-22 02:50:17 +0000
committerennewalker <ennewalker@c06c8d41-db1a-0410-9941-cceddc491573>2009-04-22 02:50:17 +0000
commit5c8009179acad07659f28a6995438b72a7a6c183 (patch)
tree732824ac2d1901bb7e0acac6901e32eab3a02922 /crawl-ref/source
parent0fdc8a1b6c767621ecd18567d62ab24f9a104510 (diff)
downloadcrawl-ref-5c8009179acad07659f28a6995438b72a7a6c183.tar.gz
crawl-ref-5c8009179acad07659f28a6995438b72a7a6c183.zip
Fixing potential &" crash due to non-stable sorting function. (At least, I suspect this is the issue. My std::sort knowledge is limited.)
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@9674 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source')
-rw-r--r--crawl-ref/source/debug.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc
index 10ff399047..ae8f27fe45 100644
--- a/crawl-ref/source/debug.cc
+++ b/crawl-ref/source/debug.cc
@@ -824,8 +824,12 @@ static bool _sort_monster_list(int a, int b)
return ( m1->name(DESC_PLAIN, true) < m2->name(DESC_PLAIN, true) );
}
- if (mons_char(m1->type) < mons_char(m2->type))
- return (true);
+ const unsigned glyph1 = mons_char(m1->type);
+ const unsigned glyph2 = mons_char(m2->type);
+ if (glyph1 != glyph2)
+ {
+ return (glyph1 < glyph2);
+ }
return (m1->type < m2->type);
}