Project

General

Profile

Bug #1278 » 1278_S3_2.patch

Dean Brown, 12/28/2025 06:34 AM

View differences:

common/map.c
This function returns true if the tile at the given location can be
"reclaimed" from ocean into land. This is the case only when there are
a sufficient number of adjacent tiles that are not ocean.
The obvious way to do this would be like in can_channel_land() below -
int land_tiles = count_terrain_class_near_tile(nmap, ptile,
FALSE, TRUE, TC_LAND);
But we want to count Inaccessible and "off-the-map" tiles as land tiles,
so do things differently. Need some extra float calculations to fix bug.
See HR #1278.
***********************************************************************/
bool can_reclaim_ocean(const struct civ_map *nmap,
const struct tile *ptile)
{
int land_tiles = 100 - count_terrain_class_near_tile(nmap, ptile,
FALSE, TRUE,
TC_OCEAN);
int num_surrounding_tiles = wld.map.num_valid_dirs;
float pct = terrain_control.ocean_reclaim_requirement_pct/100.0;
int land_tiles = num_surrounding_tiles -
count_terrain_class_near_tile(nmap, ptile,
FALSE, FALSE, TC_OCEAN);
return land_tiles >= terrain_control.ocean_reclaim_requirement_pct;
return land_tiles >= ceil(pct * num_surrounding_tiles);
}
/*******************************************************************//**
(1-1/2)