summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-26 11:59:39 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-03-26 11:59:39 +0100
commit0b59e4ce379294c330157efab92ef4419531df25 (patch)
tree41468869745b9d6c6245a32f289d4b110d53a4e8
parentb740cab3a230d9eb0c5d128bec390959f6dd639d (diff)
sort hills with equal names by height
-rw-r--r--src/Hill.cxx12
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