Feature #2246 ยป 0067-generator-Replace-NULL-with-nullptr.patch
| server/generator/mapgen_topology.c | ||
|---|---|---|
|
int ice_base_colatitude = 0 ;
|
||
|
/************************************************************************//**
|
||
|
Returns the colatitude of this map position. This is a value in the
|
||
|
Returns the colatitude of this map position. This is a value in the
|
||
|
range of 0 to MAX_COLATITUDE (inclusive).
|
||
|
This function is wanted to concentrate the topology information
|
||
|
all generator code has to use colatitude and others topology safe
|
||
|
functions instead (x,y) coordinate to place terrains
|
||
|
colatitude is 0 at poles and MAX_COLATITUDE at equator
|
||
|
This function is wanted to concentrate the topology information.
|
||
|
All generator code has to use colatitude and other topology safe
|
||
|
functions instead (x, y) coordinate to place terrains.
|
||
|
Colatitude is 0 at poles and MAX_COLATITUDE at equator.
|
||
|
****************************************************************************/
|
||
|
int map_colatitude(const struct tile *ptile)
|
||
|
{
|
||
|
int latitude;
|
||
|
fc_assert_ret_val(ptile != NULL, MAX_COLATITUDE / 2);
|
||
|
fc_assert_ret_val(ptile != nullptr, MAX_COLATITUDE / 2);
|
||
|
latitude = map_signed_latitude(ptile);
|
||
|
latitude = MAX(latitude, -latitude);
|
||
| ... | ... | |
|
}
|
||
|
/************************************************************************//**
|
||
|
Return TRUE if the map in a typical city radius is SINGULAR. This is
|
||
|
Return TRUE if the map in a typical city radius is SINGULAR. This is
|
||
|
used to avoid putting (non-polar) land near the edge of the map.
|
||
|
****************************************************************************/
|
||
|
bool near_singularity(const struct tile *ptile)
|
||
| ... | ... | |
|
return is_singular_tile(ptile, CITY_MAP_DEFAULT_RADIUS);
|
||
|
}
|
||
|
/************************************************************************//**
|
||
|
Set the map xsize and ysize based on a base size and ratio (in natural
|
||
|
coordinates).
|
||
| ... | ... | |
|
*/
|
||
|
const int i_size
|
||
|
= sqrt((float)(size)
|
||
|
/ (float)(Xratio * Yratio * iso * even * even)) + 0.49;
|
||
|
/ (float)(Xratio * Yratio * iso * even * even)) + 0.49;
|
||
|
/* Now build xsize and ysize value as described above. */
|
||
|
wld.map.xsize = Xratio * i_size * even;
|
||
| ... | ... | |
|
/************************************************************************//**
|
||
|
Return the default ratios for known topologies.
|
||
|
The factor x_ratio * y_ratio determines the accuracy of the size.
|
||
|
Small ratios work better than large ones; 3:2 is not the same as 6:4
|
||
|
The factor x_ratio * y_ratio determines the accuracy of the size.
|
||
|
Small ratios work better than large ones; 3:2 is not the same as 6:4
|
||
|
****************************************************************************/
|
||
|
static void get_ratios(int *x_ratio, int *y_ratio)
|
||
|
{
|
||
| server/generator/temperature_map.c | ||
|---|---|---|
|
#endif /* FREECIV_DEBUG */
|
||
|
/**********************************************************************//**
|
||
|
Return TRUE if temperateure_map is initialized
|
||
|
Return TRUE if temperature_map is initialized
|
||
|
**************************************************************************/
|
||
|
bool temperature_is_initialized(void)
|
||
|
{
|
||
|
return temperature_map != NULL;
|
||
|
return temperature_map != nullptr;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| ... | ... | |
|
adjc_iterate(&(wld.map), ptile, tile1) {
|
||
|
if (BOOL_VAL(tmap(tile1) & (tt))) {
|
||
|
return TRUE;
|
||
|
};
|
||
|
}
|
||
|
} adjc_iterate_end;
|
||
|
return FALSE;
|
||
| ... | ... | |
|
**************************************************************************/
|
||
|
void destroy_tmap(void)
|
||
|
{
|
||
|
fc_assert_ret(NULL != temperature_map);
|
||
|
fc_assert_ret(temperature_map != nullptr);
|
||
|
free(temperature_map);
|
||
|
temperature_map = NULL;
|
||
|
temperature_map = nullptr;
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
|
Initialize the temperature_map
|
||
|
if arg is FALSE, create a dummy tmap == map_colatitude
|
||
|
Initialize the temperature_map.
|
||
|
If arg is FALSE, create a dummy tmap == map_colatitude
|
||
|
to be used if hmap or oceans are not placed gen 2-4
|
||
|
**************************************************************************/
|
||
|
void create_tmap(bool real)
|
||
| ... | ... | |
|
/* If map is defined this is not changed. */
|
||
|
/* TODO: Load if from scenario game with tmap */
|
||
|
/* to debug, never load at this time */
|
||
|
fc_assert_ret(NULL == temperature_map);
|
||
|
fc_assert_ret(temperature_map == nullptr);
|
||
|
temperature_map = fc_malloc(sizeof(*temperature_map) * MAP_INDEX_SIZE);
|
||
|
whole_map_iterate(&(wld.map), ptile) {
|
||