Fix a bug where more than one defined game didn't show up or showed gibberish

git-svn-id: svn://katsu.triplehelix.org/dgamelaunch/trunk@452 db0b04b0-f4d1-0310-9a6d-de3e77497b0e
This commit is contained in:
Pasi Kallinen 2008-08-23 12:50:43 +00:00
parent d2be5b05d6
commit ff4a636ec2
2 changed files with 3 additions and 3 deletions

View File

@ -454,8 +454,8 @@ definegame : TYPE_DEFINE_GAME '{'
}
game_definitions '}'
{
num_games = ncnf;
ncnf++;
num_games = ncnf;
}
;

View File

@ -117,7 +117,7 @@ dgl_format_str(int game, struct dg_user *me, char *str)
p++;
break;
case 'g':
if (game >= 0 && game <=num_games && myconfig[game]) snprintf (p, end + 1 - p, "%s", myconfig[game]->game_name);
if (game >= 0 && game < num_games && myconfig[game]) snprintf (p, end + 1 - p, "%s", myconfig[game]->game_name);
while (*p != '\0')
p++;
break;
@ -381,7 +381,7 @@ populate_games (int xgame, int *l)
len = 0;
for (game = ((xgame < 0) ? 0 : xgame); game <= ((xgame < 0) ? num_games : xgame); game++) {
for (game = ((xgame < 0) ? 0 : xgame); game < ((xgame <= 0) ? num_games : (xgame+1)); game++) {
slen = strlen(globalconfig.dglroot) + strlen(myconfig[game]->inprogressdir) + 1;
dir = malloc(slen);