Freeciv21
Develop your civilization from humble roots to a global empire
citymap.cpp File Reference
#include "log.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"
+ Include dependency graph for citymap.cpp:

Go to the source code of this file.

Macros

#define log_citymap   log_debug
 

Functions

void citymap_turn_init (struct player *pplayer)
 Initialize citymap by reserving worked tiles and establishing the crowdedness of (virtual) cities. More...
 
void citymap_free ()
 Free resources allocated for citymap. More...
 
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. More...
 
void citymap_free_city_spot (struct tile *ptile, int id)
 Reverse any reservations we have made in the surrounding area. More...
 
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) More...
 
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. More...
 
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. More...
 

Variables

std::vector< int > citymap
 

Macro Definition Documentation

◆ log_citymap

#define log_citymap   log_debug

Definition at line 45 of file citymap.cpp.

Function Documentation

◆ citymap_free()

void citymap_free ( )

Free resources allocated for citymap.

Definition at line 106 of file citymap.cpp.

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 141 of file citymap.cpp.

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 178 of file citymap.cpp.

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 172 of file citymap.cpp.

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 113 of file citymap.cpp.

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 158 of file citymap.cpp.

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 51 of file citymap.cpp.

Referenced by auto_settlers_player().

Variable Documentation

◆ citymap