From d426c3c5d7b064b1568d0f73fd930ba97e88822a Mon Sep 17 00:00:00 2001 From: Jochen Dolze Date: Sun, 6 Feb 2011 19:04:06 +0100 Subject: Added missing files in last commit --- command/marks.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'command/marks.cpp') diff --git a/command/marks.cpp b/command/marks.cpp index f06416d..8442872 100644 --- a/command/marks.cpp +++ b/command/marks.cpp @@ -186,6 +186,25 @@ clMark *clMarks::Get(int Position) return mark; } +clMark *clMarks::GetAround(int Position, int Type, int Mask) +{ + clMark *m1=GetPrev(Position,Type,Mask); + clMark *m2=GetNext(Position,Type,Mask); + + if (!m1 && !m2) return NULL; + if (!m1 && m2) return m2; + if (m1 && !m2) return m1; + + if (abs(m1->position-Position)>abs(m2->position-Position)) + { + return m2; + } + else + { + return m1; + } +} + clMark *clMarks::GetPrev(int Position, int Type, int Mask) { if (!first) return NULL; // no elements yet -- cgit v1.2.3