Freeciv-3.3
Loading...
Searching...
No Matches
Functions | Variables
mapgen_topology.c File Reference
#include <math.h>
#include "log.h"
#include "game.h"
#include "map.h"
#include "mapgen_topology.h"

Go to the source code of this file.

Functions

int map_colatitude (const struct tile *ptile)
 
bool near_singularity (const struct tile *ptile)
 
static void set_sizes (double size, int Xratio, int Yratio)
 
static void get_ratios (int *x_ratio, int *y_ratio)
 
void generator_init_topology (bool autosize)
 
int get_sqsize (void)
 

Variables

int ice_base_colatitude = 0
 

Function Documentation

◆ generator_init_topology()

void generator_init_topology ( bool  autosize)

This function sets sizes in a topology-specific way then calls map_init_topology(). Set 'autosize' to TRUE if the xsize/ysize should be calculated.

Definition at line 165 of file mapgen_topology.c.

Referenced by map_fractal_generate().

◆ get_ratios()

static void get_ratios ( int x_ratio,
int y_ratio 
)
static

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

Definition at line 135 of file mapgen_topology.c.

Referenced by generator_init_topology().

◆ get_sqsize()

int get_sqsize ( void  )

An estimate of the linear (1-dimensional) size of the map.

Definition at line 271 of file mapgen_topology.c.

Referenced by generator_init_topology(), make_fracture_map(), and map_fractal_generate().

◆ map_colatitude()

int map_colatitude ( const struct tile ptile)

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

Definition at line 38 of file mapgen_topology.c.

Referenced by create_tmap(), hmap_pole_factor(), make_pseudofractal1_hmap(), make_river(), normalize_hmap_poles(), place_terrain(), and renormalize_hmap_poles().

◆ near_singularity()

bool near_singularity ( const struct tile ptile)

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.

Definition at line 53 of file mapgen_topology.c.

Referenced by create_island(), hmap_pole_factor(), make_pseudofractal1_hmap(), and normalize_hmap_poles().

◆ set_sizes()

static void set_sizes ( double  size,
int  Xratio,
int  Yratio 
)
static

Set the map xsize and ysize based on a base size and ratio (in natural coordinates).

Definition at line 63 of file mapgen_topology.c.

Referenced by generator_init_topology(), and set_sizes().

Variable Documentation

◆ ice_base_colatitude

int ice_base_colatitude = 0

Definition at line 28 of file mapgen_topology.c.

Referenced by generator_init_topology().