From: Holger Schemel Date: Tue, 15 Feb 2022 18:33:26 +0000 (+0100) Subject: moved code to draw "choose tree" screen to separate function X-Git-Tag: 4.3.2.0~124 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=84f1052a556ca679cd09b417a16fc136d455ebf2;p=rocksndiamonds.git moved code to draw "choose tree" screen to separate function --- diff --git a/src/screens.c b/src/screens.c index 750aaae4..6f18bf31 100644 --- a/src/screens.c +++ b/src/screens.c @@ -4972,6 +4972,18 @@ static void drawChooseTreeCursorAndText(int y, boolean active, TreeInfo *ti) drawChooseTreeText(y, active, ti); } +static void drawChooseTreeScreen(TreeInfo *ti) +{ + int num_entries = numTreeInfoInGroup(ti); + int num_page_entries = MIN(num_entries, NUM_MENU_ENTRIES_ON_SCREEN); + + drawChooseTreeList(ti->cl_first, num_page_entries, ti); + drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti); + drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti); + + AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, ti->cl_first, ti); +} + static void HandleChooseTree(int mx, int my, int dx, int dy, int button, TreeInfo **ti_ptr) { @@ -5013,13 +5025,8 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, if (position_set_by_scrollbar) ti->cl_first = dy; - else - AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, - ti->cl_first, ti); - drawChooseTreeList(ti->cl_first, num_page_entries, ti); - drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti); - drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti); + drawChooseTreeScreen(ti); return; } @@ -5127,14 +5134,7 @@ static void HandleChooseTree(int mx, int my, int dx, int dy, int button, } if (redraw) - { - drawChooseTreeList(ti->cl_first, num_page_entries, ti); - drawChooseTreeInfo(ti->cl_first + ti->cl_cursor, ti); - drawChooseTreeCursorAndText(ti->cl_cursor, TRUE, ti); - - AdjustChooseTreeScrollbar(SCREEN_CTRL_ID_SCROLL_VERTICAL, - ti->cl_first, ti); - } + drawChooseTreeScreen(ti); return; }