Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2000:
[Freeciv-Dev] Re: Fix of 'Go To' command for reclamation
Home

[Freeciv-Dev] Re: Fix of 'Go To' command for reclamation

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Fix of 'Go To' command for reclamation
From: Jeff Mallatt <jjm@xxxxxxxxxxxx>
Date: Fri, 21 Apr 2000 15:38:31 -0400

At 2000/04/20 15:11 , Cameron Morland wrote:
>Anyone playing with the land reclamation feature to a significant degree
>(added to CVS April 17, it appears) will notice that the 'Go To' command
>cannot be used to send units from one "original" continent to another
>"original" landmass; the problem is that the continent numbers weren't
>updated. This patch fixes the problem.

Thanks for finding this.  The fix is a bit more complex, however.

The terrain ruleset allows for Mining and Irrigation to change terrain, as
well as Transforming.  So, we need to handle those cases.  Also, the
continent information needs to be communicated to the client (which
maintains its own continent map).  The attached patch does the following:

- Adds check_terrain_ocean_land_change() to unitfunc.c to handle side-effects.

- Calls check_terrain_ocean_land_change() from all three of the Mining,
Irrigation and Transforming sections of update_unit_activity().

- Adds a new clause to the "if" statement in handle_tile_info() in
packhand.c so that climap_update_continents() is called whenever ocean is
changed into land.

I had also noticed some other bugs in this same area, that I decided to fix
while I was at it.  The terrain ruleset allows for changing land into ocean
-- but the code didn't handle this case correctly.  The gamelog map becomes
out of date whenever ocean is changed into land (or vice-versa).  To fix
these problems, the attached patch does:

- Makes sure the new check_terrain_ocean_land_change() can handle changing
land into ocean.

- Changes can_unit_do_activity_targeted() to not allow changing the land on
which a city sits into ocean.

- Changes map_mine_tile(), map_irrigate_tile() and map_transform_tile() to
clear all infrastructure when changing from land to ocean.

- Adds a new case in handle_tile_info() that recomputes the client's
continents whenever land is changed into ocean.

- Makes a small change to climap_update_continents() which allows it to
work in the case where the tile "known" flags are set, but the tile
"continent" values are not (it should not affect normal operation).  This
allows a simple implementation of the previous change.

- Adds gamelog() calls to the new check_terrain_ocean_land_change() function.

- Does a klugey thing in gamelog() itself (we should fix the gamelog format
and open/close semantics someday...).

- Finally, to make use of all this, changes default/terrain.ruleset to
allow Transforming Swamp into Ocean (was Swamp->Plains; may still do
Swamp->Forest->Plains (and it's faster!)), and Mining Forest into Swamp.

This patch also:

- Fixes an unrelated bug in the ACTIVITY_MINE case of
can_unit_do_activity_targeted().

Attachment: reclaim_fix_continents-2.diff
Description: Text document

jjm

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