summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Hill.H4
-rw-r--r--src/Hill.cxx21
-rw-r--r--src/Panorama.cxx4
3 files changed, 26 insertions, 3 deletions
diff --git a/src/Hill.H b/src/Hill.H
index 71135d0..b850425 100644
--- a/src/Hill.H
+++ b/src/Hill.H
@@ -1,5 +1,5 @@
//
-// "$Id: Hill.H,v 1.7 2005/05/03 20:04:14 hofmann Exp $"
+// "$Id: Hill.H,v 1.8 2005/05/03 20:16:40 hofmann Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
@@ -71,6 +71,8 @@ class Mountains {
void add(Mountain *m);
+ void sort();
+
void clear();
void clobber();
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) {
diff --git a/src/Panorama.cxx b/src/Panorama.cxx
index 670f96e..095db14 100644
--- a/src/Panorama.cxx
+++ b/src/Panorama.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Panorama.cxx,v 1.21 2005/05/03 20:04:14 hofmann Exp $"
+// "$Id: Panorama.cxx,v 1.22 2005/05/03 20:16:40 hofmann Exp $"
//
// PSEditWidget routines.
//
@@ -435,6 +435,8 @@ Panorama::update_visible_mountains() {
}
}
}
+
+ visible_mountains->sort();
}
double