diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/common/map.c workdir/common/map.c --- freeciv/common/map.c Tue May 16 15:45:04 2000 +++ workdir/common/map.c Tue May 16 15:47:20 2000 @@ -971,7 +971,6 @@ ***************************************************************/ void tile_init(struct tile *ptile) { - int i; ptile->terrain=T_UNKNOWN; ptile->special=S_NO_SPECIAL; ptile->known=0; @@ -980,8 +979,6 @@ unit_list_init(&ptile->units); ptile->worked = NULL; /* pointer to city working tile */ ptile->assigned = 0; /* bitvector */ - for (i = 0; i < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS; i++) - ptile->seen[i] = 0; } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/common/map.h workdir/common/map.h --- freeciv/common/map.h Tue May 16 15:45:04 2000 +++ workdir/common/map.h Tue May 16 15:47:20 2000 @@ -66,7 +66,6 @@ struct city *worked; /* city working tile, or NULL if none */ signed short continent; signed char move_cost[8]; /* don't know if this helps! */ - unsigned short seen[MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS]; }; diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/barbarian.c workdir/server/barbarian.c --- freeciv/server/barbarian.c Tue May 16 15:45:15 2000 +++ workdir/server/barbarian.c Tue May 16 15:47:20 2000 @@ -434,7 +434,7 @@ if( is_land_barbarian(barbarians) ) notify_player_ex( victim, xu, yu, E_UPRISING, _("Native unrest near %s led by %s."), pc->name, barbarians->name); - else if( map_get_known_and_seen(xu, yu, victim) ) + else if( map_get_known_and_seen(xu, yu, victim->player_no) ) notify_player_ex( victim, xu, yu, E_UPRISING, _("Sea raiders seen near %s!"), pc->name); } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/cityhand.c workdir/server/cityhand.c --- freeciv/server/cityhand.c Tue May 16 15:45:15 2000 +++ workdir/server/cityhand.c Tue May 16 15:47:20 2000 @@ -761,14 +761,14 @@ } if (dest && powner != dest) { /* send info to specific player. */ - if (map_get_known_and_seen(x, y, dest)) { + if (map_get_known_and_seen(x, y, dest->player_no)) { if (pcity) { /* it's there and we see it; update and send */ update_dumb_city(dest, pcity); package_dumb_city(dest, x, y, &packet); send_packet_city_info(dest->conn, &packet); } } else { /* not seen; send old info */ - pdcity = map_get_player_tile(dest, x, y)->city; + pdcity = map_get_player_tile(x, y, dest->player_no)->city; if (pdcity) { package_dumb_city(dest, x, y, &packet); send_packet_city_info(dest->conn, &packet); @@ -781,7 +781,7 @@ if(!dest) { for(o=0; oowner==o) continue; /* allready send above */ - if(map_get_known_and_seen(pcity->x, pcity->y, &game.players[o])) { + if(map_get_known_and_seen(pcity->x, pcity->y, o)) { update_dumb_city(&game.players[o], pcity); package_dumb_city(&game.players[o], pcity->x, pcity->y, &packet); send_packet_city_info(game.players[o].conn, &packet); @@ -862,7 +862,7 @@ game_remove_city(pcity); for(o=0; ocity; + struct dumb_city *pdcity = map_get_player_tile(x, y, pplayer->player_no)->city; struct city *pcity; packet->id=pdcity->id; packet->owner=pdcity->owner; @@ -987,7 +987,7 @@ packet->size=pdcity->size; packet->ppl_happy=0; - if (map_get_known_and_seen(x,y,pplayer)) { + if (map_get_known_and_seen(x, y, pplayer->player_no)) { /* Since the tile is visible the player can see the tile, and if it didn't actually have a city pdcity would be NULL */ pcity = map_get_tile(x,y)->city; @@ -1065,7 +1065,8 @@ **************************************************************************/ void update_dumb_city(struct player *pplayer, struct city *pcity) { - struct player_tile *plrtile = map_get_player_tile(pplayer,pcity->x,pcity->y); + struct player_tile *plrtile = map_get_player_tile(pcity->x, pcity->y, + pplayer->player_no); struct dumb_city *pdcity; if (!plrtile->city) { plrtile->city = fc_malloc(sizeof(struct dumb_city)); @@ -1088,7 +1089,7 @@ { struct packet_generic_integer packet; struct city *pcity; - struct dumb_city *pdcity = map_get_player_tile(pplayer,x,y)->city; + struct dumb_city *pdcity = map_get_player_tile(x, y, pplayer->player_no)->city; if (pdcity) { pcity = map_get_tile(x,y)->city; @@ -1096,7 +1097,7 @@ packet.value=pdcity->id; send_packet_generic_integer(pplayer->conn,PACKET_REMOVE_CITY,&packet); free(pdcity); - map_get_player_tile(pplayer,x,y)->city = NULL; + map_get_player_tile(x, y, pplayer->player_no)->city = NULL; } } } @@ -1115,7 +1116,7 @@ connection_do_buffer(pplayer->conn); for(y=0; ycity) + if(map_get_player_tile(x, y, pplayer->player_no)->city) send_city_info_at_tile(pplayer, x, y); connection_do_unbuffer(pplayer->conn); } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/civserver.c workdir/server/civserver.c --- freeciv/server/civserver.c Tue May 16 15:45:15 2000 +++ workdir/server/civserver.c Tue May 16 15:47:20 2000 @@ -160,7 +160,7 @@ int main(int argc, char *argv[]) { int h=0, v=0, no_meta=1; - int xitr, yitr,i,notfog; + int i; char *log_filename=NULL; char *gamelog_filename=NULL; char *load_filename=NULL; @@ -429,6 +429,9 @@ server_state=RUN_GAME_STATE; send_server_info_to_metaserver(1,0); + /* Before the player map is allocated (and initiailzed)! */ + game.fogofwar_old = game.fogofwar; + if(game.is_new_game) { for(i=0; iseen[i] += notfog; - game.fogofwar_old = game.fogofwar; - send_all_info(0); if(game.is_new_game) @@ -1821,12 +1816,13 @@ static void enable_fog_of_war_player(struct player *pplayer) { int x,y; + int playerid = pplayer->player_no; struct tile *ptile; for (x = 0; x < map.xsize; x++) for (y = 0; y < map.ysize; y++) { ptile = map_get_tile(x,y); - ptile->seen[pplayer->player_no]--; - if (ptile->seen[pplayer->player_no] == 0) + map_change_seen(x, y, playerid, -1); + if (map_get_seen(x, y, playerid) == 0) update_player_tile_last_seen(pplayer, x, y); } send_all_known_tiles(pplayer); @@ -1848,9 +1844,10 @@ static void disable_fog_of_war_player(struct player *pplayer) { int x,y; + int playerid = pplayer->player_no; for (x = 0; x < map.xsize; x++) { for (y = 0; y < map.ysize; y++) { - map_get_tile(x,y)->seen[pplayer->player_no] += 1; + map_change_seen(x, y, playerid, +1); if (map_get_known(x, y, pplayer)) { struct city *pcity = map_get_city(x,y); reality_check_city(pplayer, x, y); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/diplhand.c workdir/server/diplhand.c --- freeciv/server/diplhand.c Tue May 16 15:45:15 2000 +++ workdir/server/diplhand.c Tue May 16 15:47:20 2000 @@ -261,7 +261,7 @@ if(packet->clause_type == CLAUSE_CITY){ struct city *pcity = find_city_by_id(packet->value); - if(pcity && !map_get_known_and_seen(pcity->x, pcity->y, plr1)) + if (pcity && !map_get_known_and_seen(pcity->x, pcity->y, plr1->player_no)) show_area(plr1, pcity->x, pcity->y,2); } diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/gotohand.c workdir/server/gotohand.c --- freeciv/server/gotohand.c Tue May 16 15:45:15 2000 +++ workdir/server/gotohand.c Tue May 16 15:47:20 2000 @@ -933,7 +933,7 @@ int k, possible = 0; if (same_pos(punit->x, punit->y, x, y)) return 1; if (is_ground_unit(punit) && - (omni || map_get_known_and_seen(x, y, pplayer))) { + (omni || map_get_known_and_seen(x, y, pplayer->player_no))) { if (map_get_terrain(x, y) == T_OCEAN) { if (is_transporter_with_free_space(pplayer, x, y)) { for (k = 0; k < 8; k++) { @@ -956,7 +956,7 @@ } return(possible); } else if (is_sailing_unit(punit) && - (omni || map_get_known_and_seen(x, y, pplayer)) && + (omni || map_get_known_and_seen(x, y, pplayer->player_no)) && map_get_terrain(x, y) != T_OCEAN && !map_get_city(x, y) && !is_terrain_near_tile(x, y, T_OCEAN)) { return(0); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/maphand.c workdir/server/maphand.c --- freeciv/server/maphand.c Tue May 16 15:45:15 2000 +++ workdir/server/maphand.c Tue May 16 15:52:43 2000 @@ -167,7 +167,7 @@ info.y = y; for(o=0; oterrain; info.special = ptile->special; @@ -177,12 +177,12 @@ } if(&game.players[o]==dest) { /* specific player */ if (map_get_known(x,y,&game.players[o])) { - if (map_get_seen(x,y,&game.players[o])) { /* known and seen */ + if (map_get_seen(x, y, o)) { /* known and seen */ update_tile_knowledge(&game.players[o],x,y); /* visible; update info */ info.known=TILE_KNOWN; } else /* known but not seen */ info.known = TILE_KNOWN_FOGGED; - plrtile = map_get_player_tile(&game.players[o],x,y); + plrtile = map_get_player_tile(x, y, o); info.type = plrtile->terrain; info.special = plrtile->special; } else { /* unknown (the client needs these sometimes to draw correctly) */ @@ -202,6 +202,7 @@ void unfog_area(struct player *pplayer, int x, int y, int len) { int dx,dy,abs_x,abs_y; + int playerid = pplayer->player_no; struct tile *ptile; struct city *pcity; send_NODRAW_tiles(pplayer,x,y,len); @@ -214,14 +215,14 @@ ptile = map_get_tile(abs_x,abs_y); freelog (LOG_DEBUG, "Unfogging %i,%i. Previous fog: %i.", - abs_x, abs_y, ptile->seen[pplayer->player_no]); + abs_x, abs_y, map_get_seen(abs_x, abs_y, playerid)); /* Did the tile just become visible? - send info about units and cities and the tile itself */ - if (!(ptile->seen[pplayer->player_no]) || - !map_get_known(abs_x,abs_y,pplayer)) { - ptile->seen[pplayer->player_no] += 1; - + if (!map_get_seen(abs_x, abs_y, playerid) || + !map_get_known(abs_x, abs_y, pplayer)) { + map_change_seen(abs_x, abs_y, playerid, +1); + map_set_known(abs_x, abs_y, pplayer); /*discover units*/ @@ -237,7 +238,7 @@ /* send info about the tile itself */ send_tile_info(pplayer, abs_x, abs_y); } else - ptile->seen[pplayer->player_no] += 1; + map_change_seen(abs_x, abs_y, playerid, +1); } } } @@ -282,7 +283,8 @@ **************************************************************************/ void fog_area(struct player *pplayer, int x, int y, int len) { - int dx,dy,abs_x,abs_y; + int dx, dy, abs_x, abs_y, seen; + int playerid = pplayer->player_no; struct tile *ptile; connection_do_buffer(pplayer->conn); for (dx = x-len;dx <= x+len;dx++) { @@ -292,16 +294,18 @@ abs_y = map_adjust_y(dy); ptile = map_get_tile(abs_x,abs_y); freelog (LOG_DEBUG, "Fogging %i,%i. Previous fog: %i.", - x,y,ptile->seen[pplayer->player_no]); - ptile->seen[pplayer->player_no]--; - if (ptile->seen[pplayer->player_no] > 60000) { - freelog(LOG_FATAL, - "Square %i,%i has a seen value > 60000 (wrap) for player %s.", - abs_x, abs_y, pplayer->name); + abs_x, abs_y, map_get_seen(abs_x, abs_y, playerid)); + map_change_seen(abs_x, abs_y, playerid, -1); + + seen = map_get_seen(abs_x, abs_y, playerid); + if (seen > 60000) { + freelog(LOG_FATAL, "square %i,%i has a seen value > 60000 (wrap)" + "for player %s", abs_x, abs_y, pplayer->name); abort(); - } - if (ptile->seen[pplayer->player_no] == 0) { - update_player_tile_last_seen(pplayer,abs_x,abs_y); + } + + if (seen == 0) { + update_player_tile_last_seen(pplayer, abs_x, abs_y); send_tile_info(pplayer, abs_x, abs_y); } } @@ -808,9 +812,10 @@ /************************************************************************** Shows area even if still fogged, sans units and cities. **************************************************************************/ -void show_area(struct player *pplayer,int x, int y, int len) +void show_area(struct player *pplayer, int x, int y, int len) { int dx,dy,abs_x,abs_y; + int playerid = pplayer->player_no; struct city *pcity; freelog(LOG_DEBUG, "Showing %i,%i, len %i",x,y,len); @@ -821,23 +826,24 @@ abs_x = map_adjust_x(x + dx); for (dy = - len; dy <= len; dy++) { abs_y = map_adjust_y(y + dy); - if (!map_get_known_and_seen(x,y,pplayer) && is_real_tile(x,y)) { - map_set_known(abs_x,abs_y,pplayer); + if (!map_get_known_and_seen(abs_x, abs_y, playerid) && is_real_tile(x, y)) { + map_set_known(abs_x, abs_y, pplayer); - /* as the tile may be fogged send_tile_info won't do this for us */ + /* as the tile may be fogged send_tile_info won't always do this for us */ update_tile_knowledge(pplayer, abs_x, abs_y); update_player_tile_last_seen(pplayer, abs_x, abs_y); - send_tile_info(pplayer,abs_x,abs_y); + + send_tile_info(pplayer, abs_x, abs_y); /* remove old cities that exist no more */ reality_check_city(pplayer, abs_x, abs_y); - if ((pcity = map_get_city(abs_x,abs_y))) { + if ((pcity = map_get_city(abs_x, abs_y))) { /* as the tile may be fogged send_city_info won't do this for us */ update_dumb_city(pplayer, pcity); send_city_info(pplayer, pcity); } - if (map_get_seen(abs_x,abs_y,pplayer)) { + if (map_get_seen(abs_x, abs_y, playerid)) { unit_list_iterate(map_get_tile(abs_x, abs_y)->units, punit) send_unit_info(pplayer, punit); unit_list_iterate_end; @@ -860,19 +866,27 @@ /*************************************************************** ... ***************************************************************/ -int map_get_known_and_seen(int x, int y, struct player *pplayer) +int map_get_known_and_seen(int x, int y, int playerid) { - return ((map.tiles+map_adjust_x(x)+ - map_adjust_y(y)*map.xsize)->known)&(1u<player_no) && - map_get_tile(x,y)->seen[pplayer->player_no]; + int offset = map_adjust_x(x)+map_adjust_y(y)*map.xsize; + return ((map.tiles+offset)->known)&(1u<seen; } /*************************************************************** Watch out - this can be true even if the tile is not known. ***************************************************************/ -int map_get_seen(int x, int y, struct player *pplayer) +int map_get_seen(int x, int y, int playerid) { - return map_get_tile(x,y)->seen[pplayer->player_no]; + return map_get_player_tile(x, y, playerid)->seen; +} + +/*************************************************************** +... +***************************************************************/ +void map_change_seen(int x, int y, int playerid, int change) +{ + map_get_player_tile(x, y, playerid)->seen += change; } /*************************************************************** @@ -920,11 +934,12 @@ void map_know_and_see_all(struct player *pplayer) { int x, y; + int playerid = pplayer->player_no; struct city *pcity; for (x = 0; x < map.xsize; ++x) { for (y = 0; y < map.ysize; ++y) { map_set_known(x, y, pplayer); - map_get_tile(x,y)->seen[pplayer->player_no]++; + map_change_seen(x, y, playerid, +1); send_tile_info(pplayer, x, y); @@ -989,31 +1004,35 @@ fc_malloc(map.xsize*map.ysize*sizeof(struct player_tile)); for(y=0; yplayer_no)); } /*************************************************************** -... + We need to use use fogofwar_old here, so the player's tiles get + in the same state as the other players' tiles. ***************************************************************/ -void player_tile_init(struct player_tile *ptile) +void player_tile_init(struct player_tile *plrtile) { - ptile->terrain = T_UNKNOWN; - ptile->special = S_NO_SPECIAL; - ptile->city = NULL; - ptile->seen = 0; - ptile->last_updated = GAME_START_YEAR; + plrtile->terrain = T_UNKNOWN; + plrtile->special = S_NO_SPECIAL; + plrtile->city = NULL; + if (game.fogofwar_old) + plrtile->seen = 0; + else + plrtile->seen = 1; + plrtile->last_updated = GAME_START_YEAR; } /*************************************************************** ... ***************************************************************/ -struct player_tile *map_get_player_tile(struct player *pplayer,int x, int y) +struct player_tile *map_get_player_tile(int x, int y, int playerid) { - if (y<0 || y>=map.ysize) { - freelog(LOG_FATAL, "Trying to get nonexistant tile at %i,%i.", x,y); - abort(); - } - return player_tiles[pplayer->player_no]+map_adjust_x(x)+y*map.xsize; + if(y<0 || y>=map.ysize) { + freelog(LOG_FATAL, "Trying to get nonexistant tile at %i,%i", x,y); + return player_tiles[playerid]+map_adjust_x(x)+map_adjust_y(y)*map.xsize; + } else + return player_tiles[playerid]+map_adjust_x(x)+y*map.xsize; } /*************************************************************** @@ -1022,7 +1041,7 @@ void update_tile_knowledge(struct player *pplayer,int x, int y) { struct tile *ptile = map_get_tile(x,y); - struct player_tile *plrtile = map_get_player_tile(pplayer,x,y); + struct player_tile *plrtile = map_get_player_tile(x, y, pplayer->player_no); plrtile->terrain = ptile->terrain; plrtile->special = ptile->special; @@ -1033,7 +1052,7 @@ ***************************************************************/ void update_player_tile_last_seen(struct player *pplayer, int x, int y) { - map_get_player_tile(pplayer,x,y)->last_updated = game.year; + map_get_player_tile(x, y, pplayer->player_no)->last_updated = game.year; } /*************************************************************** @@ -1044,20 +1063,20 @@ { struct dumb_city *from_city, *dest_city; struct player_tile *from_tile, *dest_tile; - if (!map_get_known_and_seen(x,y,pdest)) { + if (!map_get_known_and_seen(x, y, pdest->player_no)) { /* I can just hear people scream as they try to comprehend this if :). Let me try in words: 1) if the tile is seen by pdest the info is sent to pfrom OR 2) if the tile is known by pfrom AND (he has more resent info OR it is not known by pdest) */ - if (map_get_known_and_seen(x, y, pfrom) + if (map_get_known_and_seen(x, y, pfrom->player_no) || (map_get_known(x,y,pfrom) - && (((map_get_player_tile(pfrom, x, y)->last_updated - > map_get_player_tile(pdest, x, y)->last_updated)) + && (((map_get_player_tile(x, y, pfrom->player_no)->last_updated + > map_get_player_tile(x, y, pdest->player_no)->last_updated)) || !map_get_known(x, y, pdest)))) { - from_tile = map_get_player_tile(pfrom, x, y); - dest_tile = map_get_player_tile(pdest, x, y); + from_tile = map_get_player_tile(x, y, pfrom->player_no); + dest_tile = map_get_player_tile(x, y, pdest->player_no); /* Update and send tile knowledge */ map_set_known(x, y, pdest); dest_tile->terrain = from_tile->terrain; diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/maphand.h workdir/server/maphand.h --- freeciv/server/maphand.h Tue May 16 15:45:15 2000 +++ workdir/server/maphand.h Tue May 16 15:47:20 2000 @@ -60,11 +60,12 @@ void unfog_map_for_ai_players(void); void unfog_map_for_player(struct player *pplayer); +int map_get_known_and_seen(int x, int y, int playerid); +int map_get_seen(int x, int y, int playerid); +void map_change_seen(int x, int y, int playerid, int change); int map_get_known(int x, int y, struct player *pplayer); void map_set_known(int x, int y, struct player *pplayer); void map_clear_known(int x, int y, struct player *pplayer); -int map_get_seen(int x, int y, struct player *pplayer); -int map_get_known_and_seen(int x, int y, struct player *pplayer); int map_get_sent(int x, int y, struct player *pplayer); void map_set_sent(int x, int y, struct player *pplayer); void map_clear_sent(int x, int y, struct player *pplayer); @@ -72,7 +73,7 @@ void map_know_and_see_all(struct player *pplayer); void set_unknown_tiles_to_unsent(struct player *pplayer); void player_map_allocate(struct player *pplayer); -struct player_tile *map_get_player_tile(struct player *pplayer,int x, int y); +struct player_tile *map_get_player_tile(int x, int y, int playerid); void update_tile_knowledge(struct player *pplayer,int x, int y); void update_player_tile_last_seen(struct player *pplayer, int x, int y); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/plrhand.c workdir/server/plrhand.c --- freeciv/server/plrhand.c Tue May 16 15:45:16 2000 +++ workdir/server/plrhand.c Tue May 16 15:54:18 2000 @@ -2329,7 +2329,7 @@ if (!plr->is_alive) for (x=0; xseen[plrno]++; + map_get_player_tile(x, y, plrno)->seen++; /* load map if: 1) it from a fog of war build @@ -2349,7 +2349,7 @@ "at position (%d,%d): %d '%c'", x, y, terline[x], terline[x]); exit(1); } - map_get_player_tile(plr, x, y)->terrain=pch-terrain_chars; + map_get_player_tile(x, y, plrno)->terrain=pch-terrain_chars; } } @@ -2361,14 +2361,14 @@ char ch=terline[x]; if(isxdigit(ch)) { - map_get_player_tile(plr, x, y)->special=ch-(isdigit(ch) ? '0' : ('a'-10)); + map_get_player_tile(x, y, plrno)->special=ch-(isdigit(ch) ? '0' : ('a'-10)); } else if(ch!=' ') { freelog(LOG_FATAL, "unknown special flag(lower) (map.l) in map " "at position(%d,%d): %d '%c'", x, y, ch, ch); exit(1); } else - map_get_player_tile(plr, x, y)->special=S_NO_SPECIAL; + map_get_player_tile(x, y, plrno)->special=S_NO_SPECIAL; } } @@ -2380,7 +2380,7 @@ char ch=terline[x]; if(isxdigit(ch)) { - map_get_player_tile(plr, x, y)->special|=(ch-(isdigit(ch) ? '0' : 'a'-10))<<4; + map_get_player_tile(x, y, plrno)->special|=(ch-(isdigit(ch) ? '0' : 'a'-10))<<4; } else if(ch!=' ') { freelog(LOG_FATAL, "unknown special flag(upper) (map.u) in map " "at position(%d,%d): %d '%c'", x, y, ch, ch); @@ -2398,7 +2398,7 @@ char ch=terline[x]; if(isxdigit(ch)) { - map_get_player_tile(plr,x, y)->special|=(ch-(isdigit(ch) ? '0' : 'a'-10))<<8; + map_get_player_tile(x, y, plrno)->special|=(ch-(isdigit(ch) ? '0' : 'a'-10))<<8; } else if(ch!=' ') { freelog(LOG_FATAL, "unknown special flag(next) (map.n) in map " "at position(%d,%d): %d '%c'", x, y, ch, ch); @@ -2415,7 +2415,7 @@ for(x=0; xlast_updated = ch-(isdigit(ch) ? '0' : ('a'-10)); + map_get_player_tile(x, y, plrno)->last_updated = ch-(isdigit(ch) ? '0' : ('a'-10)); } } @@ -2425,7 +2425,7 @@ for(x=0; xlast_updated |= (ch-(isdigit(ch) ? '0' : 'a'-10))<<4; + map_get_player_tile(x, y, plrno)->last_updated |= (ch-(isdigit(ch) ? '0' : 'a'-10))<<4; } } @@ -2436,7 +2436,7 @@ if (terline) { for(x=0; xlast_updated |= (ch-(isdigit(ch) ? '0' : 'a'-10))<<8; + map_get_player_tile(x, y, plrno)->last_updated |= (ch-(isdigit(ch) ? '0' : 'a'-10))<<8; } } } @@ -2448,7 +2448,7 @@ if (terline) { for(x=0; xlast_updated |= (ch-(isdigit(ch) ? '0' : 'a'-10))<<12; + map_get_player_tile(x, y, plrno)->last_updated |= (ch-(isdigit(ch) ? '0' : 'a'-10))<<12; } } } @@ -2466,7 +2466,7 @@ pdcity->size = secfile_lookup_int(file, "player%d.dc%d.size", plrno, j); pdcity->has_walls = secfile_lookup_int(file, "player%d.dc%d.has_walls", plrno, j); pdcity->owner = secfile_lookup_int(file, "player%d.dc%d.owner", plrno, j); - map_get_player_tile(plr, x, y)->city = pdcity; + map_get_player_tile(x, y, plrno)->city = pdcity; alloc_id(pdcity->id); } } @@ -2691,7 +2691,7 @@ /* put the terrain type */ for(y=0; yterrain]; + pbuf[x]=terrain_chars[map_get_player_tile(x, y, plrno)->terrain]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_t%03d", plrno, y); @@ -2700,7 +2700,7 @@ /* put lower 4 bits of special flags */ for(y=0; yspecial&0xf]; + pbuf[x]=dec2hex[map_get_player_tile(x, y, plrno)->special&0xf]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_l%03d",plrno, y); @@ -2709,7 +2709,7 @@ /* put upper 4 bits of special flags */ for(y=0; yspecial&0xf0)>>4]; + pbuf[x]=dec2hex[(map_get_player_tile(x, y, plrno)->special&0xf0)>>4]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_u%03d", plrno, y); @@ -2718,7 +2718,7 @@ /* put "next" 4 bits of special flags */ for(y=0; yspecial&0xf00)>>8]; + pbuf[x]=dec2hex[(map_get_player_tile(x, y, plrno)->special&0xf00)>>8]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_n%03d", plrno, y); @@ -2727,7 +2727,7 @@ /* put lower 4 bits of updated */ for(y=0; ylast_updated&0xf]; + pbuf[x]=dec2hex[map_get_player_tile(x, y, plrno)->last_updated&0xf]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_ua%03d",plrno, y); @@ -2736,7 +2736,7 @@ /* put upper 4 bits of updated */ for(y=0; ylast_updated&0xf0)>>4]; + pbuf[x]=dec2hex[(map_get_player_tile(x, y, plrno)->last_updated&0xf0)>>4]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_ub%03d", plrno, y); @@ -2745,7 +2745,7 @@ /* put "next" 4 bits of updated */ for(y=0; ylast_updated&0xf00)>>8]; + pbuf[x]=dec2hex[(map_get_player_tile(x, y, plrno)->last_updated&0xf00)>>8]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_uc%03d", plrno, y); @@ -2754,7 +2754,7 @@ /* put "yet next" 4 bits of updated */ for(y=0; ylast_updated&0xf000)>>12]; + pbuf[x]=dec2hex[(map_get_player_tile(x, y, plrno)->last_updated&0xf000)>>12]; pbuf[x]='\0'; secfile_insert_str(file, pbuf, "player%d.map_ud%03d", plrno, y); @@ -2768,7 +2768,7 @@ for (x = 0; x < map.xsize; x++) for (y = 0; y < map.ysize; y++) - if ((pdcity = map_get_player_tile(plr,x,y)->city)) { + if ((pdcity = map_get_player_tile(x, y, plrno)->city)) { secfile_insert_int(file, pdcity->id, "player%d.dc%d.id", plrno, i); secfile_insert_int(file, x, "player%d.dc%d.x", plrno, i); secfile_insert_int(file, y, "player%d.dc%d.y", plrno, i); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unitfunc.c workdir/server/unitfunc.c --- freeciv/server/unitfunc.c Tue May 16 15:45:16 2000 +++ workdir/server/unitfunc.c Tue May 16 15:47:20 2000 @@ -2517,8 +2517,8 @@ for(o=0; oveteran?1:0; for(o=0; ox, punit->y, &game.players[o]) || - map_get_known_and_seen(def_x, def_y, &game.players[o])) + if(map_get_known_and_seen(punit->x, punit->y, o) || + map_get_known_and_seen(def_x, def_y, o)) send_packet_unit_combat(game.players[o].conn, &combat); nearcity1 = dist_nearest_city(get_player(pwinner->owner), def_x, def_y, 0, 0); diff -Nur -X/home/thue/freeciv-dev/freeciv/diff_ignore freeciv/server/unittools.c workdir/server/unittools.c --- freeciv/server/unittools.c Tue May 16 15:45:17 2000 +++ workdir/server/unittools.c Tue May 16 15:47:20 2000 @@ -656,7 +656,7 @@ if (j < 0 || j >= map.ysize) continue; for (i = x - 1; i <= x + 1; i++) { if (same_pos(i, j, x, y)) continue; /* after some contemplation */ - if (!pplayer->ai.control && !map_get_known_and_seen(x, y, pplayer)) continue; + if (!pplayer->ai.control && !map_get_known_and_seen(x, y, punit->owner)) continue; if (is_enemy_city_tile(i, j, punit->owner)) return 1; unit_list_iterate(map_get_tile(i, j)->units, enemy) if (enemy->owner != punit->owner &&