can now use left/right arrows keys in server browser to select server sorting preference

git-svn-id: svn://svn.code.sf.net/p/actiongame/code/trunk/ac@3059 e016b1c5-ed68-44aa-a2f7-31cac88cffde
This commit is contained in:
Lee Salzman
2008-10-16 00:11:12 +00:00
parent 7868d6ec57
commit 7551774b90
4 changed files with 45 additions and 11 deletions
+24 -1
View File
@@ -452,7 +452,8 @@ void checkpings()
}
}
VARP(serversort, 0, 0, 1);
#define NUMSERVSORT 2
VARP(serversort, 0, 0, NUMSERVSORT-1);
int sicompare(serverinfo **ap, serverinfo **bp)
{
@@ -502,6 +503,12 @@ void refreshservers(void *menu, bool init)
servers.sort(sicompare);
if(menu)
{
static const char *title[NUMSERVSORT] =
{
"\fs\f0ping\fr\tplr\tserver",
"ping\t\fs\f0plr\fr\tserver"
};
menutitle(menu, title[serversort]);
menureset(menu);
loopv(servers)
{
@@ -525,6 +532,22 @@ void refreshservers(void *menu, bool init)
}
}
bool serverskey(void *menu, int code, bool isdown, int unicode)
{
if(!isdown) return false;
switch(code)
{
case SDLK_LEFT:
serversort = (serversort+NUMSERVSORT-1) % NUMSERVSORT;
return true;
case SDLK_RIGHT:
serversort = (serversort+1) % NUMSERVSORT;
return true;
}
return false;
}
void clearservers()
{
resolverclear();