From: David B. <dav...@gm...> - 2009-07-21 22:25:02
|
Hi Luc, >From the Win machine I'm sitting at I can't do much, but: > /boot/home/develop/games/tuxmath_w_fonts-1.7.2/src/game.c: > In function `game_initialize': > /boot/home/develop/games/tuxmath_w_fonts-1.7.2/src/game.c:484: > warning: statement with no effect These warnings somehow get generated from the "tmdprintf()" debug statements in some conditions, and AFAIK are harmless. > In function `game_draw_misc': > /boot/home/develop/games/tuxmath_w_fonts-1.7.2/src/game.c:2202: > syntax error before `*' > /boot/home/develop/games/tuxmath_w_fonts-1.7.2/src/game.c:2204: > `loc' undeclared (first use in this function) Here is the corresponding code: for (i = 0; i < mp_get_parameter(PLAYERS); ++i) { snprintf(str, 64, "%s: %d", mp_get_player_name(i),mp_get_player_score(i)); SDL_Surface* score = BlackOutline(str, DEFAULT_MENU_FONT_SIZE, &white); SDL_Rect loc = {screen->w - score->w, score->h * (i + 2), 0, 0}; SDL_BlitSurface(score, NULL, screen, &loc); } I think the problem may be the declarations of 'score' and 'loc' coming after the function call to snprintf() in the block - IIRC, C originally required that all declarations precede all function calls in a block, but more recent standards may have relaxed that. It may be a difference between gcc 2.95 and 4.3.3. In svn I changed it to the following - try pasting this in: for (i = 0; i < mp_get_parameter(PLAYERS); ++i) { SDL_Surface* score; snprintf(str, 64, "%s: %d", mp_get_player_name(i),mp_get_player_score(i)); score = BlackOutline(str, DEFAULT_MENU_FONT_SIZE, &white); if(score) { SDL_Rect loc; loc.w = screen->w - score->w; loc.h = score->h * (i + 2); loc.x = 0; loc.y = 0; SDL_BlitSurface(score, NULL, screen, &loc); } } hth, David |