? fix.diff Index: client/packhand.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v retrieving revision 1.192 diff -u -r1.192 packhand.c --- client/packhand.c 2001/09/25 19:58:09 1.192 +++ client/packhand.c 2001/10/01 09:55:04 @@ -380,9 +380,13 @@ for(x=0; x<CITY_MAP_SIZE; x++) { if (city_is_new) { /* Need to pre-initialize before set_worker_city() -- dwp */ - pcity->city_map[x][y] = C_TILE_EMPTY; + pcity->city_map[x][y] = + is_valid_city_coords(x, y) ? C_TILE_EMPTY : C_TILE_UNAVAILABLE; } - set_worker_city(pcity,x,y,packet->city_map[i++]-'0'); + if (is_valid_city_coords(x, y)) { + set_worker_city(pcity, x, y, packet->city_map[i] - '0'); + } + i++; } } Index: client/gui-gtk/citydlg.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk/citydlg.c,v retrieving revision 1.94 diff -u -r1.94 citydlg.c --- client/gui-gtk/citydlg.c 2001/09/30 21:27:02 1.94 +++ client/gui-gtk/citydlg.c 2001/10/01 09:55:06 @@ -1438,32 +1438,28 @@ struct city *pcity=pdialog->pcity; for(y=0; y<CITY_MAP_SIZE; y++) for(x=0; x<CITY_MAP_SIZE; x++) { - if (is_valid_city_coords(x, y)) { - int map_x, map_y, is_real; + int map_x, map_y; - is_real = city_map_to_map(&map_x, &map_y, pcity, x, y); - assert(is_real); - - if (tile_is_known(map_x, map_y)) { - pixmap_put_tile(pdialog->map_canvas_store, map_x, map_y, - x * NORMAL_TILE_WIDTH, y * NORMAL_TILE_HEIGHT, - 1); - if (pcity->city_map[x][y] == C_TILE_WORKER) - put_city_tile_output(pdialog->map_canvas_store, - x * NORMAL_TILE_WIDTH, - y * NORMAL_TILE_HEIGHT, - city_get_food_tile(x, y, pcity), - city_get_shields_tile(x, y, pcity), - city_get_trade_tile(x, y, pcity)); - else if (pcity->city_map[x][y] == C_TILE_UNAVAILABLE) - pixmap_frame_tile_red(pdialog->map_canvas_store, - x * NORMAL_TILE_WIDTH, - y * NORMAL_TILE_HEIGHT); - } else { - pixmap_put_black_tile(pdialog->map_canvas_store, + if (is_valid_city_coords(x, y) + && city_map_to_map(&map_x, &map_y, pcity, x, y) + && tile_is_known(map_x, map_y)) { + pixmap_put_tile(pdialog->map_canvas_store, map_x, map_y, + x * NORMAL_TILE_WIDTH, y * NORMAL_TILE_HEIGHT, 1); + if (pcity->city_map[x][y] == C_TILE_WORKER) + put_city_tile_output(pdialog->map_canvas_store, + x * NORMAL_TILE_WIDTH, + y * NORMAL_TILE_HEIGHT, + city_get_food_tile(x, y, pcity), + city_get_shields_tile(x, y, pcity), + city_get_trade_tile(x, y, pcity)); + else if (pcity->city_map[x][y] == C_TILE_UNAVAILABLE) + pixmap_frame_tile_red(pdialog->map_canvas_store, x * NORMAL_TILE_WIDTH, y * NORMAL_TILE_HEIGHT); - } + } else { + pixmap_put_black_tile(pdialog->map_canvas_store, + x * NORMAL_TILE_WIDTH, + y * NORMAL_TILE_HEIGHT); } } } Index: common/city.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/common/city.c,v retrieving revision 1.124 diff -u -r1.124 city.c --- common/city.c 2001/09/30 21:27:07 1.124 +++ common/city.c 2001/10/01 09:55:07 @@ -153,19 +153,21 @@ Set the worker on the citymap. Also sets the worked field in the map. **************************************************************************/ void set_worker_city(struct city *pcity, int city_x, int city_y, - enum city_tile_type type) + enum city_tile_type type) { int map_x, map_y; if (city_map_to_map(&map_x, &map_y, pcity, city_x, city_y)) { struct tile *ptile = map_get_tile(map_x, map_y); - if (pcity->city_map[city_x][city_y] == C_TILE_WORKER) - if (ptile->worked == pcity) - ptile->worked = NULL; + + if (pcity->city_map[city_x][city_y] == C_TILE_WORKER + && ptile->worked == pcity) + ptile->worked = NULL; pcity->city_map[city_x][city_y] = type; if (type == C_TILE_WORKER) ptile->worked = pcity; - } else{ + } else { + assert(type == C_TILE_UNAVAILABLE); pcity->city_map[city_x][city_y] = type; } } Index: server/savegame.c =================================================================== RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v retrieving revision 1.32 diff -u -r1.32 savegame.c --- server/savegame.c 2001/09/30 21:27:10 1.32 +++ server/savegame.c 2001/10/01 09:55:09 @@ -995,7 +995,8 @@ p=secfile_lookup_str(file, "player%d.c%d.workers", plrno, i); for(y=0; y<CITY_MAP_SIZE; y++) { for(x=0; x<CITY_MAP_SIZE; x++) { - pcity->city_map[x][y] = C_TILE_EMPTY; + pcity->city_map[x][y] = + is_valid_city_coords(x, y) ? C_TILE_EMPTY : C_TILE_UNAVAILABLE; if (*p=='0') { set_worker_city(pcity, x, y, C_TILE_EMPTY); } else if (*p=='1') { @@ -1014,7 +1015,11 @@ set_worker_city(pcity, x, y, C_TILE_WORKER); } } else { - set_worker_city(pcity, x, y, C_TILE_UNAVAILABLE); + assert(*p == '2'); + if (is_valid_city_coords(x, y)) { + set_worker_city(pcity, x, y, C_TILE_UNAVAILABLE); + } + assert(pcity->city_map[x][y] == C_TILE_UNAVAILABLE); } p++; }