diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-12-14 17:23:17 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2006-12-14 17:23:17 +0100 |
commit | 489bdd091ea9dae275717e95340a9fdd07dcba8c (patch) | |
tree | 414e271dae25ad7532ca20e829c4daf9b7c2e447 /src/Hill.cxx | |
parent | c3a34dad14632abed6cc15679a57997f91b99560 (diff) |
change Projection::comp_params() to allow a variable amount of known mountains
Diffstat (limited to 'src/Hill.cxx')
-rw-r--r-- | src/Hill.cxx | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/src/Hill.cxx b/src/Hill.cxx index d5ce1f6..c5708f2 100644 --- a/src/Hill.cxx +++ b/src/Hill.cxx @@ -269,6 +269,27 @@ Hills::clear() { num = 0; } +int +Hills::contains(const Hill *m) const { + for(int i=0; i<get_num();i++) { + if (get(i) == m) { + return 1; + } + } + + return 0; +} + +void +Hills::remove(const Hill *h) { + for(int i=0; i<get_num();i++) { + if (get(i) == h) { + memmove(&m[i], &m[i+1], (get_num() - i - 1) * sizeof(Hill*)); + num--; + } + } +} + void Hills::clobber() { int i; @@ -283,12 +304,12 @@ Hills::clobber() { } int -Hills::get_num() { +Hills::get_num() const { return num; } Hill * -Hills::get(int n) { +Hills::get(int n) const { if (n < 0 || n >= num) { return NULL; } else { |