[Freeciv-Dev] Re: [PATCH] city_map_size fix and idea
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, Aug 22, 2001 at 01:14:36AM -0400, Jason Dorje Short wrote:
> Jason Dorje Short wrote:
> >
> > The attached patch fixes all incorrect uses of "2" by replacing it with
> > CITY_MAP_SIZE/2. Note that this is just a very simple correctness fix
> > and doesn't address any of the other outstanding issues with the current
> > system (namely: city_map_iterate really sucks, and pcity->x + x +
> > CITY_MAP_SIZE/2 could be replaced with a macro).
From a previous email:
-------
On Thu, 16 Aug 2001, hawk@xxxxxxxxxxxxxxxxxxxxxxx wrote:
> On Thu, Aug 16, 2001 at 02:15:07AM +0200, Gaute B Strokkenes wrote:
>>
>> + int x1 = pcity->x + x - 2;
>> + int y1 = pcity->y + y - 2;
>
> Can a function created which does this transformation? It is used
> all over the place. This would be the reverse of
> common/city.h:get_citymap_xy().
I think that's a good idea; a macro which loops over the neighbourhood
of a city, skipping unreal tiles and delivering both local city
coordinates and normalised global coordinates would be even better.
[Best of all, we may wish to get rid of the idea of local city
coordinates alltogether and replace them with just a number. As the
above sentence shows, the whole idea of local city map coordinates is
rather confusing anyway.]
-------
The idea of replacing is nice but this just make the code looking more
complex and unpleasant. I like the idea of
/*
* returns -1 if the map_pos isn't "workable" by the city
* >=0 and <n else (n=CITY_MAP_SIZE*CITY_MAP_SIZE-4)
*/
int get_city_tile_index(int map_city_pos_x,
int map_city_pos_y,
int map_pos_x,
int map_pos_y);
and
void get_city_tile_map_pos(int map_city_pos_x,
int map_city_pos_y,
int tile_index,
int *map_pos_x,
int *map_pos_y);
Disadvantage: Can't be used in expressions.
> - if (map_get_tile(pcity->x+x-2, pcity->y+y-2)->worked) {
> + if (map_get_tile(pcity->x+x-CITY_MAP_SIZE/2,
> pcity->y+y-CITY_MAP_SIZE/2)->worked) {
The new is line is really not beautiful.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
One nuclear bomb can ruin your whole day.
- [Freeciv-Dev] [PATCH] city_map_size fix and idea, Jason Dorje Short, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Jason Dorje Short, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea,
Raimar Falke <=
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Ross W. Wetmore, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Raimar Falke, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Ross W. Wetmore, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Trent Piepho, 2001/08/22
- Message not available
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Ross W. Wetmore, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Trent Piepho, 2001/08/22
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Gregory Berkolaiko, 2001/08/24
- [Freeciv-Dev] Re: [PATCH] city_map_size fix and idea, Raimar Falke, 2001/08/23
|
|