Author: cazfi Date: Fri Jun 24 08:51:44 2016 New Revision: 32989 URL: http://svn.gna.org/viewcvs/freeciv?rev=32989&view=rev Log: Fixed some shadow warnings seen on OpenBSD.
See patch #7299 Modified: trunk/client/mapview_common.c trunk/client/overview_common.c trunk/server/generator/height_map.c Modified: trunk/client/mapview_common.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/mapview_common.c?rev=32989&r1=32988&r2=32989&view=diff ============================================================================== --- trunk/client/mapview_common.c (original) +++ trunk/client/mapview_common.c Fri Jun 24 08:51:44 2016 @@ -3135,11 +3135,11 @@ if (!map_is_empty() && can_client_change_view()) { if (tile_size_changed) { if (center_tile != NULL) { - int x0, y0; + int x_left, y_top; float gui_x, gui_y; - index_to_map_pos(&x0, &y0, tile_index(center_tile)); - map_to_gui_pos(tileset, &gui_x, &gui_y, x0, y0); + index_to_map_pos(&x_left, &y_top, tile_index(center_tile)); + map_to_gui_pos(tileset, &gui_x, &gui_y, x_left, y_top); /* Put the center pixel of the tile at the exact center of the mapview. */ gui_x -= (mapview.width - tileset_tile_width(tileset) * map_zoom) / 2; @@ -3374,7 +3374,7 @@ int xd = width / 20, yd = height / 20; int xlen = width / 3, ylen = height / 3; float canvas_x, canvas_y; - int x0, x1, y0, y1; + int x_left, x_right, y_top, y_bottom; struct tile *ptile = link_mark_tile(pmark); struct color *pcolor = link_mark_color(pmark); @@ -3382,22 +3382,22 @@ return; } - x0 = canvas_x + xd; - x1 = canvas_x + width - xd; - y0 = canvas_y + yd; - y1 = canvas_y + height - yd; - - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x0, y0, xlen, 0); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x0, y0, 0, ylen); + x_left = canvas_x + xd; + x_right = canvas_x + width - xd; + y_top = canvas_y + yd; + y_bottom = canvas_y + height - yd; + + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_left, y_top, xlen, 0); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_left, y_top, 0, ylen); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x1, y0, -xlen, 0); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x1, y0, 0, ylen); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_right, y_top, -xlen, 0); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_right, y_bottom, 0, ylen); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x0, y1, xlen, 0); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x0, y1, 0, -ylen); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_left, y_bottom, xlen, 0); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_left, y_bottom, 0, -ylen); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x1, y1, -xlen, 0); - canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x1, y1, 0, -ylen); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_right, y_bottom, -xlen, 0); + canvas_put_line(mapview.store, pcolor, LINE_TILE_FRAME, x_right, y_bottom, 0, -ylen); } /********************************************************************** Modified: trunk/client/overview_common.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/overview_common.c?rev=32989&r1=32988&r2=32989&view=diff ============================================================================== --- trunk/client/overview_common.c (original) +++ trunk/client/overview_common.c Fri Jun 24 08:51:44 2016 @@ -1,4 +1,4 @@ -/********************************************************************** +/*********************************************************************** Freeciv - Copyright (C) 1996-2005 - Freeciv Development Team This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -208,15 +208,15 @@ { struct canvas *src = gui_options.overview.map; struct canvas *dst = gui_options.overview.window; - int x0 = gui_options.overview.map_x0 * OVERVIEW_TILE_SIZE; - int y0 = gui_options.overview.map_y0 * OVERVIEW_TILE_SIZE; - int ix = gui_options.overview.width - x0; - int iy = gui_options.overview.height - y0; - - canvas_copy(dst, src, 0, 0, ix, iy, x0, y0); - canvas_copy(dst, src, 0, y0, ix, 0, x0, iy); - canvas_copy(dst, src, x0, 0, 0, iy, ix, y0); - canvas_copy(dst, src, x0, y0, 0, 0, ix, iy); + int x_left = gui_options.overview.map_x0 * OVERVIEW_TILE_SIZE; + int y_top = gui_options.overview.map_y0 * OVERVIEW_TILE_SIZE; + int ix = gui_options.overview.width - x_left; + int iy = gui_options.overview.height - y_top; + + canvas_copy(dst, src, 0, 0, ix, iy, x_left, y_top); + canvas_copy(dst, src, 0, y_top, ix, 0, x_left, iy); + canvas_copy(dst, src, x_left, 0, 0, iy, ix, y_top); + canvas_copy(dst, src, x_left, y_top, 0, 0, ix, iy); } gui_to_overview_pos(tileset, &x[0], &y[0], Modified: trunk/server/generator/height_map.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/generator/height_map.c?rev=32989&r1=32988&r2=32989&view=diff ============================================================================== --- trunk/server/generator/height_map.c (original) +++ trunk/server/generator/height_map.c Fri Jun 24 08:51:44 2016 @@ -211,7 +211,7 @@ int xmax = game.map.xsize - (xnowrap ? 1 : 0); int ymax = game.map.ysize - (ynowrap ? 1 : 0); - int xn, yn; + int x_current, y_current; /* just need something > log(max(xsize, ysize)) for the recursion */ int step = game.map.xsize + game.map.ysize; /* edges are avoided more strongly as this increases */ @@ -223,9 +223,9 @@ INITIALIZE_ARRAY(height_map, MAP_INDEX_SIZE, 0); /* set initial points */ - for (xn = 0; xn < xdiv2; xn++) { - for (yn = 0; yn < ydiv2; yn++) { - do_in_map_pos(ptile, (xn * xmax / xdiv), (yn * ymax / ydiv)) { + for (x_current = 0; x_current < xdiv2; x_current++) { + for (y_current = 0; y_current < ydiv2; y_current++) { + do_in_map_pos(ptile, (x_current * xmax / xdiv), (y_current * ymax / ydiv)) { /* set initial points */ hmap(ptile) = fc_rand(2 * step) - (2 * step) / 2; @@ -243,10 +243,10 @@ } /* calculate recursively on each block */ - for (xn = 0; xn < xdiv; xn++) { - for (yn = 0; yn < ydiv; yn++) { - gen5rec(step, xn * xmax / xdiv, yn * ymax / ydiv, - (xn + 1) * xmax / xdiv, (yn + 1) * ymax / ydiv); + for (x_current = 0; x_current < xdiv; x_current++) { + for (y_current = 0; y_current < ydiv; y_current++) { + gen5rec(step, x_current * xmax / xdiv, y_current * ymax / ydiv, + (x_current + 1) * xmax / xdiv, (y_current + 1) * ymax / ydiv); } } _______________________________________________ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits