In the watching-menu, keep the same player selected even when resorting the entries.

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@493 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2009-10-18 14:29:46 +00:00
parent c237c27478
commit e6fb6ecafe
1 changed files with 14 additions and 0 deletions

View File

@ -383,6 +383,8 @@ inprogressmenu (int gameid)
int max_height = -1;
int selected = -1;
char *selectedgame = NULL;
int abs_max_height;
int top_banner_hei = 5;
int btm_banner_hei = 3;
@ -622,8 +624,20 @@ watchgame:
}
}
if (selected >= 0 && selected < len)
selectedgame = strdup(games[selected]->name);
games = populate_games (gameid, &len, me);
games = sort_games (games, len, sortmode);
if (selectedgame) {
selected = -1;
for (i = 0; i < len; i++)
if (!strcmp(games[i]->name, selectedgame)) {
selected = i;
break;
}
free(selectedgame);
selectedgame = NULL;
}
}
if (is_nhext) free(is_nhext);
free_populated_games(games, len);