From ef74f4b176888521692c8d9aae81f967a433ff98 Mon Sep 17 00:00:00 2001 From: stpohle Date: Wed, 7 May 2003 18:57:22 +0000 Subject: [PATCH] menu_dir_select cpu usage problem fixed. --- src/menu.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/menu.c b/src/menu.c index 5351c96..ed5bbb4 100644 --- a/src/menu.c +++ b/src/menu.c @@ -1,4 +1,4 @@ -/* $Id: menu.c,v 1.13 2003/05/07 18:48:05 patty21 Exp $ */ +/* $Id: menu.c,v 1.14 2003/05/07 18:57:22 stpohle Exp $ */ /* menu's for the game */ #include @@ -400,7 +400,7 @@ char *menu_dir_select (char *title, char *path, signed char dirflags) { _direntry *destart, *de; SDL_Event event; Uint8 *keys; - int max = 0, sel = 0, keypressed = 0, done = 0, listend = 0, liststart = 0; + int max = 0, sel = 0, keypressed = 0, done = 0, listend = 0, liststart = 0, oldsel = -1; /* get the directory list and count the numbers */ destart = s_getdir (path); @@ -412,8 +412,11 @@ char *menu_dir_select (char *title, char *path, signed char dirflags) { while (done == 0 || (done == 1 && keypressed == 1)) { /* do the network loop if we have to */ - listend = menu_dir_draw (title, destart, liststart, sel); - SDL_Flip (gfx.screen); + if (oldsel != sel) { + listend = menu_dir_draw (title, destart, liststart, sel); + SDL_Flip (gfx.screen); + oldsel = sel; + } if (bman.gametype == GT_multi && bman.sock != -1) network_loop ();