duplicated code, was Re: [Freeciv-Dev] helpdata.txt patch
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Greg Wooledge wrote:
>
> map.c, reset_move_costs():
>
> else if ((tile0->special & tile1->special) & S_RAILROAD) c = 0;
> else if ((tile0->special & tile1->special) & S_ROAD) c = 1;
> else if (tile0->terrain == T_RIVER && tile1->terrain == T_RIVER) c = 1;
> else c = get_tile_type(tile1->terrain)->movement_cost*3;
>
> This code, or something much like it, appears twice in reset_move_costs()
> and once in initialize_move_costs(). Should it be consolidated?
I haven't looked closely at this particular case, but I'm definitely
in favour of consolidating duplicated code, where feasible.
There are a few other cases like this which I've been meaning
to tidy up for ages, but there always seems to be something
else more urgent (or more interesting/fun/etc) to do...
-- David
|
|