Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/aicore/citymap.c File Reference

Freeciv-3.2

Loading...
Searching...
No Matches
Macros | Functions | Variables
citymap.c File Reference
`#include <stdio.h>`
`#include <string.h>`
`#include "log.h"`
`#include "mem.h"`
`#include "support.h"`
`#include "city.h"`
`#include "game.h"`
`#include "map.h"`
`#include "unit.h"`
`#include "unitlist.h"`
`#include "unittype.h"`
`#include "citymap.h"`

Go to the source code of this file.

## Macros

#define | log_citymap log_debug

## Functions

void | citymap_turn_init (struct player *pplayer)
void | citymap_free (void)
void | citymap_reserve_city_spot (struct tile *ptile, int id)
void | citymap_free_city_spot (struct tile *ptile, int id)
void | citymap_reserve_tile (struct tile *ptile, int id)
int | citymap_read (struct tile *ptile)
bool | citymap_is_reserved (struct tile *ptile)

## Variables

static int * | citymap = NULL

## Macro Definition Documentation

## ◆ log_citymap

#define log_citymap log_debug

Definition at line 55 of file citymap.c.

## Function Documentation

## ◆ citymap_free()

void citymap_free | ( | void |  | ) |

Free resources allocated for citymap.

Definition at line 110 of file citymap.c.

Referenced by server_game_free().

## ◆ citymap_free_city_spot()

void citymap_free_city_spot | ( | struct tile * | ptile,
|  | int | id
| ) |  |

Reverse any reservations we have made in the surrounding area.

Definition at line 150 of file citymap.c.

Referenced by dai_unit_new_task().

## ◆ citymap_is_reserved()

bool citymap_is_reserved | ( | struct tile * | ptile | ) |

A tile is reserved if it contains a city or unit id, or a worker is assigned to it.

Definition at line 190 of file citymap.c.

Referenced by city_desirability(), and citymap_reserve_tile().

## ◆ citymap_read()

int citymap_read | ( | struct tile * | ptile | ) |

Returns a positive value if within a city radius, which is 1 x number of cities you are within the radius of, or zero or less if not. A negative value means this tile is reserved by a city and should not be taken.

Definition at line 181 of file citymap.c.

Referenced by cityresult_fill().

## ◆ citymap_reserve_city_spot()

void citymap_reserve_city_spot | ( | struct tile * | ptile,
|  | int | id
| ) |  |

This function reserves a single tile for a (possibly virtual) city with a settler's or a city's id. Then it 'crowds' tiles that this city can use to make them less attractive to other cities we may consider making.

Definition at line 122 of file citymap.c.

Referenced by dai_unit_new_task().

## ◆ citymap_reserve_tile()

void citymap_reserve_tile | ( | struct tile * | ptile,
|  | int | id
| ) |  |

Reserve additional tiles as desired (eg I would reserve best available food tile in addition to adjacent tiles)

Definition at line 167 of file citymap.c.

Referenced by dai_auto_settler_run().

## ◆ citymap_turn_init()

void citymap_turn_init | ( | struct player * | pplayer | ) |

Initialize citymap by reserving worked tiles and establishing the crowdedness of (virtual) cities.

Definition at line 61 of file citymap.c.

Referenced by auto_settlers_player().

## Variable Documentation

## ◆ citymap

int* citymap = NULL

static

Definition at line 53 of file citymap.c.

Referenced by citymap_free(), citymap_free_city_spot(), citymap_is_reserved(), citymap_read(), citymap_reserve_city_spot(), citymap_reserve_tile(), and citymap_turn_init().