[Freeciv-Dev] Re: (PR#2836) cleanup to client/goto
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
On Wed, Jan 15, 2003 at 10:43:28PM -0800, Jason Short via RT wrote:
>
> The attached patch provides a cleanup to the client_goto_map.
>
> The primary advantage is that indexing using map_inx() (aka
> map_to_index() in Ross's corecleanups) is safe under any topology.
>
> It also removes a few lines of code, makes some accesses more legible
> (IMO), and moves the declaration of "struct client_goto_map" into goto.c
> to provide further encapsulation.
> +struct client_goto_map {
> + short *move_cost;
> + char *vector;
> + unsigned char (*drawn)[4];
> + int unit_id; /* The unit of the goto map */
> + int src_x, src_y;
> +};
IMHO you have to explain here where the 4 comes from. Also that the
type should be bool and not "unsigned char".
> - freelog(LOG_DEBUG, "got %i,%i, at cost %i", *x, *y,
> goto_map.move_cost[*x][*y]);
> + freelog(LOG_DEBUG, "got %i,%i, at cost %i", *x, *y,
> + goto_map.move_cost[map_inx(*x, *y)]);
IMHO we should also use macros here. In the same way as in the warmap.
Raimar
--
email: rf13@xxxxxxxxxxxxxxxxx
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe trying
to produce bigger and better idiots. So far, the Universe is winning."
-- Rich Cook
- [Freeciv-Dev] Re: (PR#2836) cleanup to client/goto,
Raimar Falke via RT <=
|
|