From: Pasi Kallinen Date: Sat, 23 Aug 2008 12:50:43 +0000 (+0000) Subject: Fix a bug where more than one defined game didn't show up or showed gibberish X-Git-Tag: v1.6.1-roc-dev~256 X-Git-Url: https://skyeroc.xyz/gitweb/?a=commitdiff_plain;h=ff4a636ec26962393194d04d65e3afee01b26d58;p=dgamelaunch 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 --- diff --git a/config.y b/config.y index 7750514..f051b99 100644 --- a/config.y +++ b/config.y @@ -454,8 +454,8 @@ definegame : TYPE_DEFINE_GAME '{' } game_definitions '}' { - num_games = ncnf; ncnf++; + num_games = ncnf; } ; diff --git a/dgl-common.c b/dgl-common.c index 96c3dba..50750ca 100644 --- a/dgl-common.c +++ b/dgl-common.c @@ -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);