Freeciv21
Develop your civilization from humble roots to a global empire
base.h File Reference
#include "fc_types.h"
#include "requirements.h"
#include "specenum_gen.h"
+ Include dependency graph for base.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  base_type
 

Macros

#define SPECENUM_NAME   base_gui_type
 
#define SPECENUM_VALUE0   BASE_GUI_FORTRESS
 
#define SPECENUM_VALUE0NAME   "Fortress"
 
#define SPECENUM_VALUE1   BASE_GUI_AIRBASE
 
#define SPECENUM_VALUE1NAME   "Airbase"
 
#define SPECENUM_VALUE2   BASE_GUI_OTHER
 
#define SPECENUM_VALUE2NAME   "Other"
 
#define SPECENUM_NAME   base_flag_id
 
#define SPECENUM_VALUE0   BF_NOT_AGGRESSIVE
 
#define SPECENUM_VALUE0NAME   N_("NoAggressive")
 
#define SPECENUM_COUNT   BF_COUNT
 
#define SPECENUM_BITVECTOR   bv_base_flags
 
#define BASE_NONE   -1
 
#define base_deps_iterate(_reqs, _dep)
 
#define base_deps_iterate_end
 

Functions

Base_type_id base_count ()
 Return the number of base_types. More...
 
Base_type_id base_number (const struct base_type *pbase)
 Return the base index. More...
 
struct base_typebase_by_number (const Base_type_id id)
 Returns base_type entry for an ID value. More...
 
struct extra_typebase_extra_get (const struct base_type *pbase)
 Return extra that base is. More...
 
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_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...
 
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...
 

Macro Definition Documentation

◆ base_deps_iterate

#define base_deps_iterate (   _reqs,
  _dep 
)
Value:
{ \
requirement_vector_iterate(_reqs, preq) \
{ \
if (preq->source.kind == VUT_EXTRA && preq->present \
&& is_extra_caused_by(preq->source.value.extra, EC_BASE)) { \
struct base_type *_dep = extra_base_get(preq->source.value.extra);
#define is_extra_caused_by(e, c)
Definition: extras.h:182
#define extra_base_get(_e_)
Definition: extras.h:170
Definition: base.h:43

Definition at line 91 of file base.h.

◆ base_deps_iterate_end

#define base_deps_iterate_end
Value:
} \
} \
requirement_vector_iterate_end; \
}

Definition at line 99 of file base.h.

◆ BASE_NONE

#define BASE_NONE   -1

Definition at line 56 of file base.h.

◆ SPECENUM_BITVECTOR

#define SPECENUM_BITVECTOR   bv_base_flags

Definition at line 38 of file base.h.

◆ SPECENUM_COUNT

#define SPECENUM_COUNT   BF_COUNT

Definition at line 37 of file base.h.

◆ SPECENUM_NAME [1/2]

#define SPECENUM_NAME   base_gui_type

Definition at line 30 of file base.h.

◆ SPECENUM_NAME [2/2]

#define SPECENUM_NAME   base_flag_id

Definition at line 30 of file base.h.

◆ SPECENUM_VALUE0 [1/2]

#define SPECENUM_VALUE0   BASE_GUI_FORTRESS

Definition at line 32 of file base.h.

◆ SPECENUM_VALUE0 [2/2]

#define SPECENUM_VALUE0   BF_NOT_AGGRESSIVE

Definition at line 32 of file base.h.

◆ SPECENUM_VALUE0NAME [1/2]

#define SPECENUM_VALUE0NAME   "Fortress"

Definition at line 35 of file base.h.

◆ SPECENUM_VALUE0NAME [2/2]

#define SPECENUM_VALUE0NAME   N_("NoAggressive")

Definition at line 35 of file base.h.

◆ SPECENUM_VALUE1

#define SPECENUM_VALUE1   BASE_GUI_AIRBASE

Definition at line 23 of file base.h.

◆ SPECENUM_VALUE1NAME

#define SPECENUM_VALUE1NAME   "Airbase"

Definition at line 24 of file base.h.

◆ SPECENUM_VALUE2

#define SPECENUM_VALUE2   BASE_GUI_OTHER

Definition at line 25 of file base.h.

◆ SPECENUM_VALUE2NAME

#define SPECENUM_VALUE2NAME   "Other"

Definition at line 26 of file base.h.

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)