~ubuntu-branches/debian/squeeze/freeciv/squeeze

« back to all changes in this revision

Viewing changes to server/scripting/api_methods.c

  • Committer: Bazaar Package Importer
  • Author(s): Clint Adams, Karl Goetz, Clint Adams
  • Date: 2010-02-23 22:09:02 UTC
  • mfrom: (1.2.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20100223220902-kiyrmr9i4152cka5
Tags: 2.2.0-1
[ Karl Goetz ]
* Remove civserver files in /etc/ggzd/ (Closes: 523772, 517787)
* Adding ${misc:Depends} to all binary packages (lintian warnings)

[ Clint Adams ]
* New upstream version.
  - Drop data_dsc_use_bindir.diff (binary pathnames have changed).

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
#include <config.h>
16
16
#endif
17
17
 
 
18
#include "government.h"
 
19
#include "improvement.h"
 
20
#include "nation.h"
 
21
#include "tech.h"
 
22
#include "terrain.h"
18
23
#include "unitlist.h"
 
24
#include "unittype.h"
19
25
 
20
26
#include "api_methods.h"
21
27
#include "script.h"
22
28
 
23
29
/**************************************************************************
 
30
  Can punit found a city on its tile?
 
31
**************************************************************************/
 
32
bool api_methods_unit_city_can_be_built_here(Unit *punit)
 
33
{
 
34
  return city_can_be_built_here(punit->tile, punit);
 
35
}
 
36
 
 
37
/**************************************************************************
24
38
  Return the number of cities pplayer has.
25
39
**************************************************************************/
26
40
int api_methods_player_num_cities(Player *pplayer)
67
81
}
68
82
 
69
83
/**************************************************************************
 
84
  Return TRUE there is a city inside city radius from ptile
 
85
**************************************************************************/
 
86
 
 
87
bool api_methods_tile_city_exists_within_city_radius(Tile *ptile, 
 
88
                                              bool may_be_on_center)
 
89
{
 
90
  return city_exists_within_city_radius(ptile, may_be_on_center);
 
91
}
 
92
 
 
93
/**************************************************************************
70
94
  Return TRUE if pbuilding is a wonder.
71
95
**************************************************************************/
72
96
bool api_methods_building_type_is_wonder(Building_Type *pbuilding)
73
97
{
74
 
  return is_wonder(pbuilding->index);
 
98
  return is_wonder(pbuilding);
75
99
}
76
100
 
77
101
/**************************************************************************
79
103
**************************************************************************/
80
104
bool api_methods_building_type_is_great_wonder(Building_Type *pbuilding)
81
105
{
82
 
  return is_great_wonder(pbuilding->index);
 
106
  return is_great_wonder(pbuilding);
83
107
}
84
108
 
85
109
/**************************************************************************
87
111
**************************************************************************/
88
112
bool api_methods_building_type_is_small_wonder(Building_Type *pbuilding)
89
113
{
90
 
  return is_small_wonder(pbuilding->index);
 
114
  return is_small_wonder(pbuilding);
91
115
}
92
116
 
93
117
/**************************************************************************
95
119
**************************************************************************/
96
120
bool api_methods_building_type_is_improvement(Building_Type *pbuilding)
97
121
{
98
 
  return is_improvement(pbuilding->index);
99
 
}
100
 
 
101
 
 
 
122
  return is_improvement(pbuilding);
 
123
}
 
124
 
 
125
/**************************************************************************
 
126
  Return rule name for Government
 
127
**************************************************************************/
 
128
const char *api_methods_government_rule_name(Government *pgovernment)
 
129
{
 
130
  return government_rule_name(pgovernment);
 
131
}
 
132
 
 
133
/**************************************************************************
 
134
  Return translated name for Government
 
135
**************************************************************************/
 
136
const char *api_methods_government_name_translation(Government *pgovernment)
 
137
{
 
138
  return government_name_translation(pgovernment);
 
139
}
 
140
 
 
141
/**************************************************************************
 
142
  Return rule name for Nation_Type
 
143
**************************************************************************/
 
144
const char *api_methods_nation_type_rule_name(Nation_Type *pnation)
 
145
{
 
146
  return nation_rule_name(pnation);
 
147
}
 
148
 
 
149
/**************************************************************************
 
150
  Return translated adjective for Nation_Type
 
151
**************************************************************************/
 
152
const char *api_methods_nation_type_name_translation(Nation_Type *pnation)
 
153
{
 
154
  return nation_adjective_translation(pnation);
 
155
}
 
156
 
 
157
/**************************************************************************
 
158
  Return translated plural noun for Nation_Type
 
159
**************************************************************************/
 
160
const char *api_methods_nation_type_plural_translation(Nation_Type *pnation)
 
161
{
 
162
  return nation_plural_translation(pnation);
 
163
}
 
164
 
 
165
/**************************************************************************
 
166
  Return rule name for Building_Type
 
167
**************************************************************************/
 
168
const char *api_methods_building_type_rule_name(Building_Type *pbuilding)
 
169
{
 
170
  return improvement_rule_name(pbuilding);
 
171
}
 
172
 
 
173
/**************************************************************************
 
174
  Return translated name for Building_Type
 
175
**************************************************************************/
 
176
const char *api_methods_building_type_name_translation(Building_Type 
 
177
                                                       *pbuilding)
 
178
{
 
179
  return improvement_name_translation(pbuilding);
 
180
}
 
181
 
 
182
/**************************************************************************
 
183
  Return rule name for Unit_Type
 
184
**************************************************************************/
 
185
const char *api_methods_unit_type_rule_name(Unit_Type *punit_type)
 
186
{
 
187
  return utype_rule_name(punit_type);
 
188
}
 
189
 
 
190
/**************************************************************************
 
191
  Return translated name for Unit_Type
 
192
**************************************************************************/
 
193
const char *api_methods_unit_type_name_translation(Unit_Type *punit_type)
 
194
{
 
195
  return utype_name_translation(punit_type);
 
196
}
 
197
 
 
198
/**************************************************************************
 
199
  Return rule name for Tech_Type
 
200
**************************************************************************/
 
201
const char *api_methods_tech_type_rule_name(Tech_Type *ptech)
 
202
{
 
203
  return advance_rule_name(ptech);
 
204
}
 
205
 
 
206
/**************************************************************************
 
207
  Return translated name for Tech_Type
 
208
**************************************************************************/
 
209
const char *api_methods_tech_type_name_translation(Tech_Type *ptech)
 
210
{
 
211
  return advance_name_translation(ptech);
 
212
}
 
213
 
 
214
/**************************************************************************
 
215
  Return rule name for Terrain
 
216
**************************************************************************/
 
217
const char *api_methods_terrain_rule_name(Terrain *pterrain)
 
218
{
 
219
  return terrain_rule_name(pterrain);
 
220
}
 
221
 
 
222
/**************************************************************************
 
223
  Return translated name for Terrain
 
224
**************************************************************************/
 
225
const char *api_methods_terrain_name_translation(Terrain *pterrain)
 
226
{
 
227
  return terrain_name_translation(pterrain);
 
228
}
 
229
 
 
230
/**************************************************************************
 
231
  Return TRUE iff city has building
 
232
**************************************************************************/
 
233
bool api_methods_city_has_building(City *pcity, Building_Type *building)
 
234
{
 
235
  return city_has_building(pcity, building);
 
236
}
 
237
 
 
238
/**************************************************************************
 
239
  Return TRUE iff player has wonder
 
240
**************************************************************************/
 
241
bool api_methods_player_has_wonder(Player *pplayer, Building_Type *building)
 
242
{
 
243
  return wonder_is_built(pplayer, building);
 
244
}
 
245
 
 
246
/**************************************************************************
 
247
  Make player winner of the scenario
 
248
**************************************************************************/
 
249
void api_methods_player_victory(Player *pplayer)
 
250
{
 
251
  player_set_winner(pplayer);
 
252
}