diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-26 11:59:39 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-03-26 11:59:39 +0100 |
commit | 0b59e4ce379294c330157efab92ef4419531df25 (patch) | |
tree | 41468869745b9d6c6245a32f289d4b110d53a4e8 /src | |
parent | b740cab3a230d9eb0c5d128bec390959f6dd639d (diff) |
sort hills with equal names by height
Diffstat (limited to 'src')
-rw-r--r-- | src/Hill.cxx | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/Hill.cxx b/src/Hill.cxx index c2971cf..6404ec8 100644 --- a/src/Hill.cxx +++ b/src/Hill.cxx @@ -212,11 +212,17 @@ static int comp_mountains_name(const void *n1, const void *n2) { Hill *m1 = *(Hill **)n1; Hill *m2 = *(Hill **)n2; + int r; - if (m1 && m2) - return strcasecmp(m1->name, m2->name); - else + if (m1 && m2) { + r = strcasecmp(m1->name, m2->name); + if (r == 0) + return (int) (m1->height - m2->height); + else + return r; + } else { return 0; + } } void |