Freeciv-3.1: /fast/freeciv/nightly/S3_1/server/generator/startpos.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Functions | Variables
startpos.c File Reference
`#include <math.h>`
`#include "log.h"`
`#include "fcintl.h"`
`#include "game.h"`
`#include "map.h"`
`#include "movement.h"`
`#include "maphand.h"`
`#include "mapgen_topology.h"`
`#include "mapgen_utils.h"`
`#include "startpos.h"`
`#include "temperature_map.h"`

Go to the source code of this file.

## Data Structures

struct | islands_data_type
struct | start_filter_data

## Functions

static int | get_tile_value (struct tile *ptile)
static bool | check_native_area (const struct unit_type *utype, const struct tile *ptile, int min_area)
static bool | is_valid_start_pos (const struct tile *ptile, const void *dataptr)
static int | compare_islands (const void *A_, const void *B_)
static void | initialize_isle_data (void)
static bool | filter_starters (const struct tile *ptile, const void *data)
bool | create_start_positions (enum map_startpos mode, struct unit_type *initial_unit)

## Variables

static struct islands_data_type * | islands
static int * | islands_index

## Function Documentation

## ◆ check_native_area()

static bool check_native_area | ( | const struct unit_type * | utype,
|  | const struct tile * | ptile,
|  | int | min_area
| ) |  |

static

Check if number of reachable native tiles is sufficient. Initially given tile is assumed to be native (not checked by this function)

Definition at line 130 of file startpos.c.

Referenced by is_valid_start_pos().

## ◆ compare_islands()

static int compare_islands | ( | const void * | A_,
|  | const void * | B_
| ) |  |

static

Helper function for qsort

Definition at line 251 of file startpos.c.

Referenced by create_start_positions().

## ◆ create_start_positions()

bool create_start_positions | ( | enum map_startpos | mode,
|  | struct unit_type * | initial_unit
| ) |  |

where do the different nations start on the map? well this function tries to spread them out on the different islands.

MAPSTARTPOS_SINGLE: one player per isle. MAPSTARTPOS_2or3: 2 players per isle (maybe one isle with 3). MAPSTARTPOS_ALL: all players in asingle isle. MAPSTARTPOS_VARIABLE: at least 2 player per isle.

Assumes assign_continent_numbers() has already been done! Returns true on success

Definition at line 299 of file startpos.c.

Referenced by map_fractal_generate().

## ◆ filter_starters()

static bool filter_starters | ( | const struct tile * | ptile,
|  | const void * | data
| ) |  |

static

A function that filters for TER_STARTER tiles.

Definition at line 282 of file startpos.c.

Referenced by create_start_positions().

## ◆ get_tile_value()

static int get_tile_value | ( | struct tile * | ptile | ) |

static

Return an approximation of the goodness of a tile to a civilization.

Definition at line 51 of file startpos.c.

Referenced by create_start_positions().

## ◆ initialize_isle_data()

static void initialize_isle_data | ( | void |  | ) |

static

Initialize islands data.

Definition at line 261 of file startpos.c.

Referenced by create_start_positions().

## ◆ is_valid_start_pos()

static bool is_valid_start_pos | ( | const struct tile * | ptile,
|  | const void * | dataptr
| ) |  |

static

Return TRUE if tile is a good starting position.

Bad places:

- Islands with no room.
- Non-suitable terrain;
- On a hut;
- Too close to another starter on the same continent: 'dist' is too close (real_map_distance)

Definition at line 187 of file startpos.c.

Referenced by create_start_positions().

## Variable Documentation

## ◆ islands

struct islands_data_type* islands

static

Definition at line 45 of file startpos.c.

Referenced by create_start_positions(), initialize_isle_data(), and is_valid_start_pos().

## ◆ islands_index

int* islands_index

static

Definition at line 46 of file startpos.c.

Referenced by create_start_positions(), initialize_isle_data(), and is_valid_start_pos().