Freeciv-3.2: /fast/freeciv/nightly/S3_2/common/base.h Source File

Freeciv-3.2

Loading...
Searching...
No Matches
base.h
Go to the documentation of this file.
1/***********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
6 any later version.
7
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12***********************************************************************/
13#ifndef FC__BASE_H
14#define FC__BASE_H
15
16#ifdef __cplusplus
17extern "C" {
18#endif /* __cplusplus */
19
20/* utility */
21#include "bitvector.h"
22
23/* common */
24#include "fc_types.h"
25#include "requirements.h"
26
27struct strvec; /* Actually defined in "utility/string_vector.h". */
28
29/* Used in the network protocol. */
30#define SPECENUM_NAME base_gui_type
31#define SPECENUM_VALUE0 BASE_GUI_FORTRESS
32#define SPECENUM_VALUE0NAME "Fortress"
33#define SPECENUM_VALUE1 BASE_GUI_AIRBASE
34#define SPECENUM_VALUE1NAME "Airbase"
35#define SPECENUM_VALUE2 BASE_GUI_OTHER
36#define SPECENUM_VALUE2NAME "Other"
37#include "specenum_gen.h"
38
39struct extra_type;
40
41 struct base_type {
42 Base_type_id item_number;
43 enum base_gui_type gui_type;
44 int border_sq;
45 int vision_main_sq;
46 int vision_invis_sq;
47 int vision_subs_sq;
48
49 struct extra_type *self;
50};
51
52#define BASE_NONE -1
53
54/* General base accessor functions. */
55 Base_type_id base_count(void);
56 Base_type_id base_number(const struct base_type *pbase);
57
58struct base_type *base_by_number(const Base_type_id id);
59
60struct extra_type *base_extra_get(const struct base_type *pbase);
61
62/* Ancillary functions */
63bool can_build_base(const struct unit *punit, const struct base_type *pbase,
64 const struct tile *ptile);
65bool player_can_build_base(const struct base_type *pbase,
66 const struct player *pplayer,
67 const struct tile *ptile);
68
69struct base_type *get_base_by_gui_type(enum base_gui_type type,
70 const struct unit *punit,
71 const struct tile *ptile);
72
73bool territory_claiming_base(const struct base_type *pbase);
74
75/* Initialization and iteration */
76void base_type_init(struct extra_type *pextra, int idx);
77void base_types_free(void);
78
79#ifdef __cplusplus
80}
81#endif /* __cplusplus */
82
83#endif /* FC__BASE_H */
base_number
Base_type_id base_number(const struct base_type *pbase)
Definition base.c:92
base_type_init
void base_type_init(struct extra_type *pextra, int idx)
Definition base.c:117
base_types_free
void base_types_free(void)
Definition base.c:132
player_can_build_base
bool player_can_build_base(const struct base_type *pbase, const struct player *pplayer, const struct tile *ptile)
Definition base.c:30
base_count
Base_type_id base_count(void)
Definition base.c:109
base_extra_get
struct extra_type * base_extra_get(const struct base_type *pbase)
Definition base.c:101
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)
Definition base.c:139
can_build_base
bool can_build_base(const struct unit *punit, const struct base_type *pbase, const struct tile *ptile)
Definition base.c:53
base_by_number
struct base_type * base_by_number(const Base_type_id id)
Definition base.c:76
territory_claiming_base
bool territory_claiming_base(const struct base_type *pbase)
Definition base.c:158
bitvector.h
incite_cost
char * incite_cost
Definition comments.c:74
punit
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
fc_types.h
Base_type_id
int Base_type_id
Definition fc_types.h:386
type
GType type
Definition repodlgs.c:1313
requirements.h
specenum_gen.h
base_type
Definition base.h:41
base_type::border_sq
int border_sq
Definition base.h:44
base_type::vision_main_sq
int vision_main_sq
Definition base.h:45
base_type::gui_type
enum base_gui_type gui_type
Definition base.h:43
base_type::self
struct extra_type * self
Definition base.h:49
base_type::vision_invis_sq
int vision_invis_sq
Definition base.h:46
base_type::item_number
Base_type_id item_number
Definition base.h:42
base_type::vision_subs_sq
int vision_subs_sq
Definition base.h:47
extra_type
Definition extras.h:88
player
Definition player.h:247
strvec
Definition string_vector.c:29
tile
Definition tile.h:50
unit
Definition unit.h:138