diff options
author | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 17:05:51 +0000 |
---|---|---|
committer | Johannes Hofmann <johannes.hofmann@gmx.de> | 2005-05-10 17:05:51 +0000 |
commit | 44fa849f653871e0a8cad8159e997cc806f4fb4a (patch) | |
tree | a623dfec88b94310732c1085cb21d5615cc0c372 /src | |
parent | 59535eb31b258ef2f7b23648e3602c2424b8a34c (diff) |
fix set_cur_mountain
fix set_cur_mountain
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index e38e5b9..b611bf0 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -1,5 +1,5 @@ // -// "$Id: GipfelWidget.cxx,v 1.29 2005/05/10 18:45:29 hofmann Exp $" +// "$Id: GipfelWidget.cxx,v 1.30 2005/05/10 19:05:51 hofmann Exp $" // // GipfelWidget routines. // @@ -198,13 +198,15 @@ int GipfelWidget::set_cur_mountain(int m_x, int m_y) { Hills *mnts = pan->get_visible_mountains(); Hill *m; - int center = w() / 2; + int center_x = w() / 2; + int center_y = h() / 2; int i; for (i=0; i<mnts->get_num(); i++) { m = mnts->get(i); - if (m_x - center >= m->x - 2 && m_x - center < m->x + 2) { + if (m_x - center_x >= m->x - 2 && m_x - center_x < m->x + 2 && + m_y - center_y >= m->y - 2 && m_y - center_y < m->y + 2) { cur_mountain = m; if (m1 != NULL && m2 != NULL) { fprintf(stderr, "Resetting m1 and m2\n"); @@ -228,7 +230,8 @@ GipfelWidget::set_cur_mountain(int m_x, int m_y) { for (i=0; i<marker->get_num(); i++) { m = marker->get(i); - if (m_x - center >= m->x - 2 && m_x - center < m->x + 2) { + if (m_x - center_x >= m->x - 2 && m_x - center_x < m->x + 2 && + m_y - center_y >= m->y - 2 && m_y - center_y < m->y + 2) { cur_mountain = m; redraw(); return 0; |