Added visual feedback for when there are no games available in the lobby, we notify the user of that fact.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@5833 4a71c877-e1ca-e34f-864e-861f7616d084
master
Buginator 2008-08-17 18:18:31 +00:00
parent dd5a740143
commit eaffd089b3
2 changed files with 41 additions and 11 deletions

View File

@ -274,6 +274,7 @@ BOOL runGameOptions4Menu (void);
#define FRONTEND_TEXTURESZ 31422
#define FRONTEND_TEXTURESZ_R 31423
#define FRONTEND_TAKESEFFECT 31424
#define FRONTEND_NOGAMESAVAILABLE 31666 // Used when no games are available in lobby
#define FRONTEND_SEQUENCE 20097
#define FRONTEND_SEQUENCE_R 20098

View File

@ -593,19 +593,22 @@ static void addGames(void)
sButInit.FontID = font_regular;
sButInit.pDisplay = displayRemoteGame;
for(i=0;i<MaxGames;i++) // draw games
// only have to do this if we have any games available.
if (gcount)
{
widgDelete(psWScreen, GAMES_GAMESTART+i); // remove old icon.
if( NetPlay.games[i].desc.dwSize !=0)
for(i=0;i<MaxGames;i++) // draw games
{
sButInit.id = GAMES_GAMESTART+i;
if(gcount < 6) // only center column needed.
widgDelete(psWScreen, GAMES_GAMESTART+i); // remove old icon.
if( NetPlay.games[i].desc.dwSize !=0)
{
sButInit.x = 125;
sButInit.y = (UWORD)(30+((5+GAMES_GAMEHEIGHT)*i) );
}
sButInit.id = GAMES_GAMESTART+i;
if(gcount < 6) // only center column needed.
{
sButInit.x = 125;
sButInit.y = (UWORD)(30+((5+GAMES_GAMEHEIGHT)*i) );
}
else
{
if(i<6) //column 1
@ -621,11 +624,37 @@ static void addGames(void)
}
sButInit.pTip = NetPlay.games[i].name;
sButInit.UserData = i;
widgAddButton(psWScreen, &sButInit);
}
}
}
else
{
// display that no games are available in lobby.
// This is a 'button', not text so it can be hilighted/centered.
const char *txt = _("NO GAMES ARE AVAILABLE");
W_BUTINIT sButInit;
// delete old widget if necessary
widgDelete(psWScreen,FRONTEND_NOGAMESAVAILABLE);
memset(&sButInit, 0, sizeof(W_BUTINIT));
sButInit.formID = FRONTEND_BOTFORM;
sButInit.id = FRONTEND_NOGAMESAVAILABLE;
sButInit.x = 20;
sButInit.y = 50;
sButInit.style = WBUT_PLAIN | WBUT_TXTCENTRE;
sButInit.width = FRONTEND_BUTWIDTH;
sButInit.UserData = 0; // store disable state
sButInit.height = FRONTEND_BUTHEIGHT;
sButInit.pDisplay = displayTextOption;
sButInit.FontID = font_large;
sButInit.pText = txt;
widgAddButton(psWScreen, &sButInit);
}
}