diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/client/packhand.c freeciv/client/packhand.c --- FreecivCVS/client/packhand.c Thu Jul 6 11:48:16 2000 +++ freeciv/client/packhand.c Fri Jul 7 10:32:39 2000 @@ -1643,6 +1643,7 @@ terrain_control.may_mine = p->may_mine; terrain_control.may_transform = p->may_transform; terrain_control.ocean_reclaim_requirement = p->ocean_reclaim_requirement; + terrain_control.land_channel_requirement = p->land_channel_requirement; terrain_control.river_move_mode = p->river_move_mode; terrain_control.river_defense_bonus = p->river_defense_bonus; terrain_control.river_trade_incr = p->river_trade_incr; diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/common/capstr.c freeciv/common/capstr.c --- FreecivCVS/common/capstr.c Thu Jul 6 11:48:16 2000 +++ freeciv/common/capstr.c Fri Jul 7 14:57:14 2000 @@ -70,7 +70,8 @@ * are not directly related to the capability strings discussed here.) */ -#define CAPABILITY "+1.11 diplomat_investigate_fix production_change_fix" +#define CAPABILITY "+1.11 diplomat_investigate_fix production_change_fix + land_channel_requirement" /* "+1.11" is protocol for 1.11.0 stable release @@ -81,6 +82,10 @@ "production_change_fix" extends the protocol so that city production changes are correctly accounted for, allowing for recovery of penalty when changing back to original class. + + "land_channel_requirement" extends the protocol for the requirement + of a minimum number of ocean tiles adjacent to a land tile wished to + be changed to ocean. */ void init_our_capability(void) diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/common/map.h freeciv/common/map.h --- FreecivCVS/common/map.h Thu Jun 22 13:39:40 2000 +++ freeciv/common/map.h Fri Jul 7 10:33:06 2000 @@ -58,6 +58,7 @@ int may_transform; /* boolean: may transform terrain */ /* parameters */ int ocean_reclaim_requirement; /* # adjacent land tiles for reclaim */ + int land_channel_requirement; /* # adjacent ocean tiles for channel */ enum special_river_move river_move_mode; int river_defense_bonus; /* % added to defense if Civ2 river */ int river_trade_incr; /* added to trade if Civ2 river */ diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/common/packets.c freeciv/common/packets.c --- FreecivCVS/common/packets.c Thu Jul 6 11:48:17 2000 +++ freeciv/common/packets.c Fri Jul 7 10:34:44 2000 @@ -2962,6 +2962,9 @@ cptr=put_uint8(cptr, packet->may_mine); cptr=put_uint8(cptr, packet->may_transform); cptr=put_uint8(cptr, packet->ocean_reclaim_requirement); +if (pc && has_capability("land_channel_requirement", pc->capability)) { + cptr=put_uint8(cptr, packet->land_channel_requirement); +} cptr=put_uint8(cptr, packet->river_move_mode); cptr=put_uint16(cptr, packet->river_defense_bonus); cptr=put_uint16(cptr, packet->river_trade_incr); @@ -3000,6 +3003,11 @@ iget_uint8(&iter, &packet->may_mine); iget_uint8(&iter, &packet->may_transform); iget_uint8(&iter, (int*)&packet->ocean_reclaim_requirement); +if (pc && has_capability("land_channel_requirement", pc->capability)) { + iget_uint8(&iter, (int*)&packet->land_channel_requirement); +} else { + packet->land_channel_requirement = 1; +} iget_uint8(&iter, (int*)&packet->river_move_mode); iget_uint16(&iter, &packet->river_defense_bonus); iget_uint16(&iter, &packet->river_trade_incr); diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/common/unit.c freeciv/common/unit.c --- FreecivCVS/common/unit.c Fri Jun 23 13:06:35 2000 +++ freeciv/common/unit.c Fri Jul 7 14:50:41 2000 @@ -838,6 +838,34 @@ } /************************************************************************** +This function returns true if the tile at the given location can be +"channeled" from land into ocean. This is the case only when there are +a sufficient number of adjacent tiles that are ocean. +**************************************************************************/ +static int can_channel_land(int x, int y) +{ + int i, j, oceantiles; + + if (terrain_control.land_channel_requirement >= 9) + return 0; + + oceantiles = 0; + for (i = -1; i <= 1; i++) { + for (j = -1; j <= 1; j++) { + if (i || j) { + if (map_get_tile(x+i, y+j)->terrain == T_OCEAN) { + oceantiles++; + } + if (oceantiles >= terrain_control.land_channel_requirement) + return 1; + } + } + } + + return 0; +} + +/************************************************************************** ... **************************************************************************/ int can_unit_do_activity(struct unit *punit, enum unit_activity activity) @@ -885,8 +913,10 @@ !(ptile->special&S_MINE)) || (ptile->terrain!=type->mining_result && type->mining_result!=T_LAST && - (ptile->terrain!=T_OCEAN || + (ptile->terrain!=T_OCEAN || type->mining_result==T_OCEAN || can_reclaim_ocean(punit->x, punit->y)) && + (ptile->terrain==T_OCEAN || type->mining_result!=T_OCEAN || + can_channel_land(punit->x, punit->y)) && (type->mining_result!=T_OCEAN || !(map_get_city(punit->x, punit->y)))) )) { unit_list_iterate(ptile->units, tunit) { @@ -908,8 +938,10 @@ is_water_adjacent_to_tile(punit->x, punit->y)) || (ptile->terrain!=type->irrigation_result && type->irrigation_result!=T_LAST && - (ptile->terrain!=T_OCEAN || + (ptile->terrain!=T_OCEAN || type->irrigation_result==T_OCEAN || can_reclaim_ocean(punit->x, punit->y)) && + (ptile->terrain==T_OCEAN || type->irrigation_result!=T_OCEAN || + can_channel_land(punit->x, punit->y)) && (type->irrigation_result!=T_OCEAN || !(map_get_city(punit->x, punit->y)))) )) { unit_list_iterate(ptile->units, tunit) { @@ -974,14 +1006,16 @@ return (is_ground_unit(punit) || is_sailing_unit(punit)); case ACTIVITY_TRANSFORM: - return terrain_control.may_transform && - (type->transform_result!=T_LAST) && - (ptile->terrain!=type->transform_result) && - (ptile->terrain!=T_OCEAN || - can_reclaim_ocean(punit->x, punit->y)) && - (type->transform_result!=T_OCEAN || - !(map_get_city(punit->x, punit->y))) && - unit_flag(punit->type, F_TRANSFORM); + return (terrain_control.may_transform && + (type->transform_result!=T_LAST) && + (ptile->terrain!=type->transform_result) && + (ptile->terrain!=T_OCEAN || type->transform_result==T_OCEAN || + can_reclaim_ocean(punit->x, punit->y)) && + (ptile->terrain==T_OCEAN || type->transform_result!=T_OCEAN || + can_channel_land(punit->x, punit->y)) && + (type->transform_result!=T_OCEAN || + !(map_get_city(punit->x, punit->y))) && + unit_flag(punit->type, F_TRANSFORM)); default: freelog(LOG_NORMAL,"Unknown activity %d\n",activity); diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset --- FreecivCVS/data/civ1/terrain.ruleset Sun Apr 16 08:53:22 2000 +++ freeciv/data/civ1/terrain.ruleset Fri Jul 7 10:46:31 2000 @@ -27,6 +27,10 @@ ; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere) ocean_reclaim_requirement=9 +; number of "ocean" tiles required to be adjacent to a land tile before +; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere) +land_channel_requirement=9 + ; special movement costs for rivers: ; 0 - normal movement cost for rivers (matches Civ1) ; 1 - 1/3 movement cost, but only when moving exactly along rivers, diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset --- FreecivCVS/data/civ2/terrain.ruleset Sun Apr 16 08:53:23 2000 +++ freeciv/data/civ2/terrain.ruleset Fri Jul 7 10:46:37 2000 @@ -27,6 +27,10 @@ ; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere) ocean_reclaim_requirement=9 +; number of "ocean" tiles required to be adjacent to a land tile before +; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere) +land_channel_requirement=9 + ; special movement costs for rivers: ; 0 - normal movement cost for rivers (matches Civ1) ; 1 - 1/3 movement cost, but only when moving exactly along rivers, diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/data/classic/terrain.ruleset freeciv/data/classic/terrain.ruleset --- FreecivCVS/data/classic/terrain.ruleset Sun Apr 16 08:53:23 2000 +++ freeciv/data/classic/terrain.ruleset Fri Jul 7 10:46:18 2000 @@ -27,6 +27,10 @@ ; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere) ocean_reclaim_requirement=9 +; number of "ocean" tiles required to be adjacent to a land tile before +; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere) +land_channel_requirement=9 + ; special movement costs for rivers: ; 0 - normal movement cost for rivers (matches Civ1) ; 1 - 1/3 movement cost, but only when moving exactly along rivers, diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/data/default/terrain.ruleset freeciv/data/default/terrain.ruleset --- FreecivCVS/data/default/terrain.ruleset Tue Apr 25 08:00:53 2000 +++ freeciv/data/default/terrain.ruleset Fri Jul 7 10:45:56 2000 @@ -27,6 +27,10 @@ ; it may be "reclaimed" into a land tile (0-9; 0=anywhere, 9=nowhere) ocean_reclaim_requirement=3 +; number of "ocean" tiles required to be adjacent to a land tile before +; it may be "channeled" into an ocean tile (0-9; 0=anywhere, 9=nowhere) +land_channel_requirement=1 + ; special movement costs for rivers: ; 0 - normal movement cost for rivers (matches Civ1) ; 1 - 1/3 movement cost, but only when moving exactly along rivers, diff -ru -X /home/jjm/cvs/no.freeciv FreecivCVS/server/ruleset.c freeciv/server/ruleset.c --- FreecivCVS/server/ruleset.c Tue Jun 27 08:11:19 2000 +++ freeciv/server/ruleset.c Fri Jul 7 10:45:08 2000 @@ -1147,6 +1147,8 @@ terrain_control.ocean_reclaim_requirement = secfile_lookup_int_default(&file, 9, "parameters.ocean_reclaim_requirement"); + terrain_control.land_channel_requirement = + secfile_lookup_int_default(&file, 9, "parameters.land_channel_requirement"); terrain_control.river_move_mode = secfile_lookup_int_default(&file, RMV_FAST_STRICT, "parameters.river_move_mode"); terrain_control.river_defense_bonus =