summaryrefslogtreecommitdiff
path: root/src/Hill.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <johannes.hofmann@gmx.de>2005-05-03 18:16:40 +0000
committerJohannes Hofmann <johannes.hofmann@gmx.de>2005-05-03 18:16:40 +0000
commitb03d66723210ae436b08f433848e1ae72361e916 (patch)
tree67a678969357e9876910b05a414f2a2f34cf2e97 /src/Hill.cxx
parent16c6d891d2236a30bb742c5bd4d0ac4e56bb901e (diff)
add sort
add sort
Diffstat (limited to 'src/Hill.cxx')
-rw-r--r--src/Hill.cxx21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/Hill.cxx b/src/Hill.cxx
index 8d9c4f8..b0c738f 100644
--- a/src/Hill.cxx
+++ b/src/Hill.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Hill.cxx,v 1.5 2005/05/03 20:04:14 hofmann Exp $"
+// "$Id: Hill.cxx,v 1.6 2005/05/03 20:16:40 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -120,6 +120,25 @@ Mountains::add(Mountain *m1) {
m[num++] = m1;
}
+
+static int
+comp_mountains(const void *m1, const void *m2) {
+ if (m1 && m2) {
+ return ((Mountain *)m1)->alph > ((Mountain *)m2)->alph;
+ } else {
+ return 0;
+ }
+}
+
+void
+Mountains::sort() {
+ if (!m) {
+ return;
+ }
+
+ qsort(m, num, sizeof(class Mountain *), comp_mountains);
+}
+
void
Mountains::clear() {
if (m) {