~ubuntu-branches/debian/sid/freeciv/sid

« back to all changes in this revision

Viewing changes to common/improvement.h

  • Committer: Package Import Robot
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2011-08-28 22:40:00 UTC
  • mfrom: (1.2.19 upstream)
  • Revision ID: package-import@ubuntu.com-20110828224000-j2r1erewlem25dox
Tags: 2.3.0-1
[ Karl Goetz ]
* New upstream version.
* Fix themes_sdl_use_system_fonts.diff to apply cleanly on 2.3.0
* Massage work_around_unity_induced_breakage.diff to get it
  applying to the new codebase (The patch assumes commits made
  after 2.3.0 was tagged upstream).

[ Clint Adams ]
* Fudge build system to think there is no libtool mismatch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
 
16
16
/* City Improvements, including Wonders.  (Alternatively "Buildings".) */
17
17
 
18
 
#include "shared.h"             /* bool */
 
18
/* utility */
 
19
#include "bitvector.h"
 
20
#include "support.h"            /* bool */
19
21
 
 
22
/* common */
20
23
#include "fc_types.h"
21
 
 
 
24
#include "name_translation.h"
22
25
#include "requirements.h"
23
26
 
 
27
struct strvec;          /* Actually defined in "utility/string_vector.h". */
 
28
 
24
29
/* B_LAST is a value that is guaranteed to be larger than all
25
30
 * actual Impr_type_id values.  It is used as a flag value; it can
26
31
 * also be used for fixed allocations to ensure ability to hold the
32
37
 
33
38
#define B_NEVER (NULL)
34
39
 
35
 
 
36
40
/* Changing these breaks network compatibility. */
37
 
enum impr_flag_id {
38
 
  IF_VISIBLE_BY_OTHERS,  /* improvement should be visible to others without spying */
39
 
  IF_SAVE_SMALL_WONDER,  /* this small wonder is moved to another city if game.savepalace is on. */
40
 
  IF_GOLD,               /* when built, gives gold */
41
 
  IF_LAST
42
 
};
 
41
#define SPECENUM_NAME impr_flag_id
 
42
/* improvement should be visible to others without spying */
 
43
#define SPECENUM_VALUE0 IF_VISIBLE_BY_OTHERS
 
44
#define SPECENUM_VALUE0NAME "VisibleByOthers"
 
45
/* this small wonder is moved to another city if game.savepalace is on. */
 
46
#define SPECENUM_VALUE1 IF_SAVE_SMALL_WONDER
 
47
#define SPECENUM_VALUE1NAME "SaveSmallWonder"
 
48
/* when built, gives gold */
 
49
#define SPECENUM_VALUE2 IF_GOLD
 
50
#define SPECENUM_VALUE2NAME "Gold"
 
51
#define SPECENUM_COUNT IF_COUNT
 
52
#include "specenum_gen.h"
43
53
 
44
 
enum impr_genus_id {
45
 
  IG_GREAT_WONDER,
46
 
  IG_SMALL_WONDER,
47
 
  IG_IMPROVEMENT,
48
 
  IG_SPECIAL,
49
 
  IG_LAST
50
 
};
 
54
#define SPECENUM_NAME impr_genus_id
 
55
#define SPECENUM_VALUE0 IG_GREAT_WONDER
 
56
#define SPECENUM_VALUE0NAME "GreatWonder"
 
57
#define SPECENUM_VALUE1 IG_SMALL_WONDER
 
58
#define SPECENUM_VALUE1NAME "SmallWonder"
 
59
#define SPECENUM_VALUE2 IG_IMPROVEMENT
 
60
#define SPECENUM_VALUE2NAME "Improvement"
 
61
#define SPECENUM_VALUE3 IG_SPECIAL
 
62
#define SPECENUM_VALUE3NAME "Special"
 
63
#include "specenum_gen.h"
51
64
 
52
65
BV_DEFINE(bv_imprs, B_LAST);
 
66
BV_DEFINE(bv_impr_flags, IF_COUNT);
53
67
 
54
68
/* Type of improvement. (Read from buildings.ruleset file.) */
55
69
struct impr_type {
64
78
  int upkeep;
65
79
  int sabotage;         /* Base chance of diplomat sabotage succeeding. */
66
80
  enum impr_genus_id genus;             /* genus; e.g. GreatWonder */
67
 
  unsigned int flags;
68
 
  char *helptext;
 
81
  bv_impr_flags flags;
 
82
  struct strvec *helptext;
69
83
  char soundtag[MAX_LEN_NAME];
70
84
  char soundtag_alt[MAX_LEN_NAME];
71
85
 
83
97
struct impr_type *valid_improvement(struct impr_type *pimprove);
84
98
struct impr_type *valid_improvement_by_number(const Impr_type_id id);
85
99
 
86
 
struct impr_type *find_improvement_by_rule_name(const char *name);
87
 
struct impr_type *find_improvement_by_translated_name(const char *name);
 
100
struct impr_type *improvement_by_rule_name(const char *name);
 
101
struct impr_type *improvement_by_translated_name(const char *name);
88
102
 
89
103
const char *improvement_rule_name(const struct impr_type *pimprove);
90
 
const char *improvement_name_translation(struct impr_type *pimprove);
 
104
const char *improvement_name_translation(const struct impr_type *pimprove);
91
105
 
92
106
/* General improvement flag accessor routines */
93
107
bool improvement_has_flag(const struct impr_type *pimprove,
94
 
                          enum impr_flag_id flag);
95
 
enum impr_flag_id find_improvement_flag_by_rule_name(const char *s);
 
108
                          enum impr_flag_id flag);
96
109
 
97
110
/* Ancillary routines */
98
111
int impr_build_shield_cost(const struct impr_type *pimprove);
126
139
 
127
140
bool wonder_is_built(const struct player *pplayer,
128
141
                     const struct impr_type *pimprove);
129
 
struct city *find_city_from_wonder(const struct player *pplayer,
130
 
                                   const struct impr_type *pimprove);
 
142
struct city *city_from_wonder(const struct player *pplayer,
 
143
                              const struct impr_type *pimprove);
131
144
 
132
145
bool great_wonder_is_built(const struct impr_type *pimprove);
133
146
bool great_wonder_is_destroyed(const struct impr_type *pimprove);
134
147
bool great_wonder_is_available(const struct impr_type *pimprove);
135
 
struct city *find_city_from_great_wonder(const struct impr_type *pimprove);
 
148
struct city *city_from_great_wonder(const struct impr_type *pimprove);
136
149
struct player *great_wonder_owner(const struct impr_type *pimprove);
137
150
 
138
151
bool small_wonder_is_built(const struct player *pplayer,
139
152
                           const struct impr_type *pimprove);
140
 
struct city *find_city_from_small_wonder(const struct player *pplayer,
141
 
                                         const struct impr_type *pimprove);
 
153
struct city *city_from_small_wonder(const struct player *pplayer,
 
154
                                    const struct impr_type *pimprove);
142
155
 
143
156
/* player related improvement functions */
144
157
bool improvement_obsolete(const struct player *pplayer,
145
158
                          const struct impr_type *pimprove);
146
159
bool impr_provides_buildable_units(const struct player *pplayer,
147
160
                                   const struct impr_type *pimprove);
 
161
bool is_improvement_redundant(const struct city *pcity,
 
162
                              struct impr_type *pimprove);
148
163
 
149
164
bool can_player_build_improvement_direct(const struct player *p,
150
165
                                         struct impr_type *pimprove);
153
168
bool can_player_build_improvement_now(const struct player *p,
154
169
                                      struct impr_type *pimprove);
155
170
 
156
 
/* General genus accessor routines */
157
 
enum impr_genus_id find_genus_by_rule_name(const char *s);
158
 
 
159
171
/* Initialization and iteration */
160
172
void improvements_init(void);
161
173
void improvements_free(void);