Freeciv21
Develop your civilization from humble roots to a global empire
base.cpp File Reference
#include "extras.h"
#include "game.h"
#include "map.h"
#include "tile.h"
#include "unit.h"
#include "base.h"
+ Include dependency graph for base.cpp:

Go to the source code of this file.

Functions

bool base_has_flag (const struct base_type *pbase, enum base_flag_id flag)
 Check if base provides effect. More...
 
bool is_base_flag_card_near (const struct tile *ptile, enum base_flag_id flag)
 Returns TRUE iff any cardinally adjacent tile contains a base with the given flag (does not check ptile itself) More...
 
bool is_base_flag_near_tile (const struct tile *ptile, enum base_flag_id flag)
 Returns TRUE iff any adjacent tile contains a base with the given flag (does not check ptile itself) More...
 
bool base_flag_is_retired (enum base_flag_id flag)
 Returns TRUE iff the given flag is retired. More...
 
bool base_has_flag_for_utype (const struct base_type *pbase, enum base_flag_id flag, const struct unit_type *punittype)
 Base provides base flag for unit? Checks if base provides flag and if base is native to unit. More...
 
bool can_build_base (const struct unit *punit, const struct base_type *pbase, const struct tile *ptile)
 Can unit build base to given tile? More...
 
struct base_typebase_by_number (const Base_type_id id)
 Returns base_type entry for an ID value. More...
 
Base_type_id base_number (const struct base_type *pbase)
 Return the base index. More...
 
struct extra_typebase_extra_get (const struct base_type *pbase)
 Return extra that base is. More...
 
Base_type_id base_count ()
 Return the number of base_types. More...
 
void base_type_init (struct extra_type *pextra, int idx)
 Initialize base_type structures. More...
 
void base_types_free ()
 Free the memory associated with base types. More...
 
struct base_typeget_base_by_gui_type (enum base_gui_type type, const struct unit *punit, const struct tile *ptile)
 Get best gui_type base for given parameters. More...
 
bool territory_claiming_base (const struct base_type *pbase)
 Does this base type claim territory? More...
 

Function Documentation

◆ base_by_number()

struct base_type* base_by_number ( const Base_type_id  id)

Returns base_type entry for an ID value.

Definition at line 119 of file base.cpp.

Referenced by handle_ruleset_base(), set_unit_activity_base(), and sg_load_player_unit().

◆ base_count()

Base_type_id base_count ( )

Return the number of base_types.

Definition at line 152 of file base.cpp.

Referenced by editor_tool_is_usable(), and tab_misc::refresh_stats().

◆ base_extra_get()

struct extra_type* base_extra_get ( const struct base_type pbase)

◆ base_flag_is_retired()

bool base_flag_is_retired ( enum base_flag_id  flag)

Returns TRUE iff the given flag is retired.

Definition at line 78 of file base.cpp.

Referenced by load_ruleset_terrain(), and sanity_check_ruleset_data().

◆ base_has_flag()

bool base_has_flag ( const struct base_type pbase,
enum base_flag_id  flag 
)

◆ base_has_flag_for_utype()

bool base_has_flag_for_utype ( const struct base_type pbase,
enum base_flag_id  flag,
const struct unit_type punittype 
)

Base provides base flag for unit? Checks if base provides flag and if base is native to unit.

Definition at line 90 of file base.cpp.

Referenced by tile_has_base_flag_for_unit().

◆ base_number()

Base_type_id base_number ( const struct base_type pbase)

Return the base index.

Definition at line 135 of file base.cpp.

Referenced by load_ruleset_terrain(), send_ruleset_bases(), and sg_load_player_unit().

◆ base_type_init()

void base_type_init ( struct extra_type pextra,
int  idx 
)

Initialize base_type structures.

Definition at line 157 of file base.cpp.

Referenced by handle_ruleset_extra(), and load_terrain_names().

◆ base_types_free()

void base_types_free ( )

Free the memory associated with base types.

Definition at line 170 of file base.cpp.

Referenced by extras_free().

◆ can_build_base()

bool can_build_base ( const struct unit punit,
const struct base_type pbase,
const struct tile ptile 
)

Can unit build base to given tile?

Definition at line 101 of file base.cpp.

Referenced by get_base_by_gui_type().

◆ get_base_by_gui_type()

struct base_type* get_base_by_gui_type ( enum base_gui_type  type,
const struct unit punit,
const struct tile ptile 
)

Get best gui_type base for given parameters.

Definition at line 175 of file base.cpp.

Referenced by can_units_do_base_gui(), key_unit_airbase(), key_unit_fortress(), and sg_load_player_unit().

◆ is_base_flag_card_near()

bool is_base_flag_card_near ( const struct tile ptile,
enum base_flag_id  flag 
)

Returns TRUE iff any cardinally adjacent tile contains a base with the given flag (does not check ptile itself)

Definition at line 33 of file base.cpp.

◆ is_base_flag_near_tile()

bool is_base_flag_near_tile ( const struct tile ptile,
enum base_flag_id  flag 
)

Returns TRUE iff any adjacent tile contains a base with the given flag (does not check ptile itself)

Definition at line 56 of file base.cpp.

◆ territory_claiming_base()

bool territory_claiming_base ( const struct base_type pbase)