Complete.Org: Mailing Lists: Archives: freeciv-dev: October 2001:
[Freeciv-Dev] Re: semi-quick tile_is_known patch
Home

[Freeciv-Dev] Re: semi-quick tile_is_known patch

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev <freeciv-dev@xxxxxxxxxxx>
Subject: [Freeciv-Dev] Re: semi-quick tile_is_known patch
From: Jason Dorje Short <vze2zq63@xxxxxxxxxxx>
Date: Sat, 27 Oct 2001 03:39:02 -0400
Reply-to: jdorje@xxxxxxxxxxxx

Mike Kaufman wrote:
> 
> attached is a patch to move tile_is_known() from map.c to climisc.c
> is does this plus add appropriate includes in two files and change a
> ptile->known to the function call in mapctrl.c

As I said, tile_is_known *should* be used by server and common code too.

[jshort@jason freeciv]$ grep -rn "map_get_tile.*known" .
./client/climisc.c:486:    if (!map_get_tile(x2, y2)->known) {
./client/gui-mui/graphics.c:929:      if ((map_get_tile(x-1, y))->known
&&
./client/gui-mui/graphics.c:940:      if((map_get_tile(x, y-1))->known
&&
./client/gui-mui/graphics.c.orig:929:      if ((map_get_tile(x-1,
y))->known &&
./client/gui-mui/graphics.c.orig:940:      if((map_get_tile(x,
y-1))->known &&
./client/gui-win32/mapview.c:308:      if ((map_get_tile(x-1, y))->known
&&
./client/gui-win32/mapview.c:319:      if((map_get_tile(x, y-1))->known
&&
./client/gui-win32/mapview.c.orig:308:      if ((map_get_tile(x-1,
y))->known &&
./client/gui-win32/mapview.c.orig:319:      if((map_get_tile(x,
y-1))->known &&
./server/maphand.c:765:  return map_get_tile(x, y)->known &
(1u<<pplayer->player_no);
./server/maphand.c:826:  map_get_tile(x, y)->known |=
(1u<<pplayer->player_no);
./server/maphand.c:834:  map_get_tile(x, y)->known &=
~(1u<<pplayer->player_no);
./server/savegame.c:406:                  map_get_tile(x, y)->known =
ascii_hex2bin(ch, 0));
./server/savegame.c:408:                  map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 1));
./server/savegame.c:410:                  map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 2));
./server/savegame.c:412:                  map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 3));
./server/savegame.c:417:                    map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 4));
./server/savegame.c:419:                    map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 5));
./server/savegame.c:421:                    map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 6));
./server/savegame.c:423:                    map_get_tile(x, y)->known |=
ascii_hex2bin(ch, 7));
./server/savegame.c:494:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 0),
./server/savegame.c:496:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 1),
./server/savegame.c:498:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 2),
./server/savegame.c:500:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 3),
./server/savegame.c:502:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 4),
./server/savegame.c:504:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 5),
./server/savegame.c:506:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 6),
./server/savegame.c:508:    SAVE_NORMAL_MAP_DATA(file,
bin2ascii_hex(map_get_tile(x, y)->known, 7),

So, I'm somewhat opposed to this movement.  Can you point us again to
the thread where it was discussed before?

> one caveat: the macro MAP_TILE in the body of tile_is_known() has been
> removed. This is because MAP_TILE is defined in map.c rather than map.h
> I did not want to move it until I got feedback from the list. yes, this
> kind of direct access to map.tiles is not good. So respond with a
> suggestion.

You should use map_get_tile.  But won't you then have the same problem
with that function?

> This patch is needed to remove ~60k from the civworld patch.

It seems like a better solution would be to put civworld into freeciv's
CVS, so that source sharing would be much easier.  But I'm sure this has
been discussed before...

Finally, I'd rather see the check_map_pos patch go in before this one. 
It makes this fix simpler...

jason


[Prev in Thread] Current Thread [Next in Thread]