1 /*
2 ** Lua binding: server
3 */
4 
5 #include "tolua.h"
6 
7 #ifndef __cplusplus
8 #include <stdlib.h>
9 #endif
10 #ifdef __cplusplus
11  extern "C" int tolua_bnd_takeownership (lua_State* L); // from tolua_map.c
12 #else
13  int tolua_bnd_takeownership (lua_State* L); /* from tolua_map.c */
14 #endif
15 #include <string.h>
16 
17 /* Exported function */
18 TOLUA_API int tolua_server_open (lua_State* tolua_S);
19 LUALIB_API int luaopen_server (lua_State* tolua_S);
20 
21 #ifdef HAVE_CONFIG_H
22 #include <fc_config.h>
23 #endif
24 #include "luascript_types.h"
25 #include "commands.h"
26 #include "console.h"
27 #include "api_server_edit.h"
28 #include "api_server_base.h"
29 #include "api_server_notify.h"
30 #include "api_server_game_methods.h"
31 #include "script_server.h"
32 
33 /* function to register type */
tolua_reg_types(lua_State * tolua_S)34 static void tolua_reg_types (lua_State* tolua_S)
35 {
36  tolua_usertype(tolua_S,"Player");
37  tolua_usertype(tolua_S,"Unit");
38  tolua_usertype(tolua_S,"Nation_Type");
39  tolua_usertype(tolua_S,"Tile");
40  tolua_usertype(tolua_S,"Tech_Type");
41  tolua_usertype(tolua_S,"City");
42  tolua_usertype(tolua_S,"Unit_Type");
43  tolua_usertype(tolua_S,"Direction");
44 }
45 
46 /* function: api_server_save */
tolua_server_server_save00(lua_State * tolua_S)47 static int tolua_server_server_save00(lua_State* tolua_S)
48 {
49 #ifndef TOLUA_RELEASE
50  tolua_Error tolua_err;
51  if (
52  !tolua_isstring(tolua_S,1,0,&tolua_err) ||
53  !tolua_isnoobj(tolua_S,2,&tolua_err)
54  )
55  goto tolua_lerror;
56  else
57 #endif
58  {
59   lua_State* L =  tolua_S;
60   const char* filename = ((const char*)  tolua_tostring(tolua_S,1,0));
61  {
62   bool tolua_ret = (bool)  api_server_save(L,filename);
63  tolua_pushboolean(tolua_S,(bool)tolua_ret);
64  }
65  }
66  return 1;
67 #ifndef TOLUA_RELEASE
68  tolua_lerror:
69  tolua_error(tolua_S,"#ferror in function 'save'.",&tolua_err);
70  return 0;
71 #endif
72 }
73 
74 /* function: api_server_was_started */
tolua_server_server_started00(lua_State * tolua_S)75 static int tolua_server_server_started00(lua_State* tolua_S)
76 {
77 #ifndef TOLUA_RELEASE
78  tolua_Error tolua_err;
79  if (
80  !tolua_isnoobj(tolua_S,1,&tolua_err)
81  )
82  goto tolua_lerror;
83  else
84 #endif
85  {
86   lua_State* L =  tolua_S;
87  {
88   bool tolua_ret = (bool)  api_server_was_started(L);
89  tolua_pushboolean(tolua_S,(bool)tolua_ret);
90  }
91  }
92  return 1;
93 #ifndef TOLUA_RELEASE
94  tolua_lerror:
95  tolua_error(tolua_S,"#ferror in function 'started'.",&tolua_err);
96  return 0;
97 #endif
98 }
99 
100 /* function: api_server_player_civilization_score */
tolua_server_server_civilization_score00(lua_State * tolua_S)101 static int tolua_server_server_civilization_score00(lua_State* tolua_S)
102 {
103 #ifndef TOLUA_RELEASE
104  tolua_Error tolua_err;
105  if (
106  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
107  !tolua_isnoobj(tolua_S,2,&tolua_err)
108  )
109  goto tolua_lerror;
110  else
111 #endif
112  {
113   lua_State* L =  tolua_S;
114   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
115  {
116   int tolua_ret = (int)  api_server_player_civilization_score(L,pplayer);
117  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
118  }
119  }
120  return 1;
121 #ifndef TOLUA_RELEASE
122  tolua_lerror:
123  tolua_error(tolua_S,"#ferror in function 'civilization_score'.",&tolua_err);
124  return 0;
125 #endif
126 }
127 
128 /* function: api_play_music */
tolua_server_server_play_music00(lua_State * tolua_S)129 static int tolua_server_server_play_music00(lua_State* tolua_S)
130 {
131 #ifndef TOLUA_RELEASE
132  tolua_Error tolua_err;
133  if (
134  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
135  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
136  !tolua_isnoobj(tolua_S,3,&tolua_err)
137  )
138  goto tolua_lerror;
139  else
140 #endif
141  {
142   lua_State* L =  tolua_S;
143   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
144   const char* tag = ((const char*)  tolua_tostring(tolua_S,2,0));
145  {
146   bool tolua_ret = (bool)  api_play_music(L,pplayer,tag);
147  tolua_pushboolean(tolua_S,(bool)tolua_ret);
148  }
149  }
150  return 1;
151 #ifndef TOLUA_RELEASE
152  tolua_lerror:
153  tolua_error(tolua_S,"#ferror in function 'play_music'.",&tolua_err);
154  return 0;
155 #endif
156 }
157 
158 /* function: api_server_setting_get */
tolua_server_server_setting_get00(lua_State * tolua_S)159 static int tolua_server_server_setting_get00(lua_State* tolua_S)
160 {
161 #ifndef TOLUA_RELEASE
162  tolua_Error tolua_err;
163  if (
164  !tolua_isstring(tolua_S,1,0,&tolua_err) ||
165  !tolua_isnoobj(tolua_S,2,&tolua_err)
166  )
167  goto tolua_lerror;
168  else
169 #endif
170  {
171   lua_State* L =  tolua_S;
172   const char* setting_name = ((const char*)  tolua_tostring(tolua_S,1,0));
173  {
174   const char* tolua_ret = (const char*)  api_server_setting_get(L,setting_name);
175  tolua_pushstring(tolua_S,(const char*)tolua_ret);
176  }
177  }
178  return 1;
179 #ifndef TOLUA_RELEASE
180  tolua_lerror:
181  tolua_error(tolua_S,"#ferror in function 'get'.",&tolua_err);
182  return 0;
183 #endif
184 }
185 
186 /* function: api_notify_embassies_msg */
tolua_server_notify_embassies_msg00(lua_State * tolua_S)187 static int tolua_server_notify_embassies_msg00(lua_State* tolua_S)
188 {
189 #ifndef TOLUA_RELEASE
190  tolua_Error tolua_err;
191  if (
192  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
193  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
194  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
195  !tolua_isstring(tolua_S,4,0,&tolua_err) ||
196  !tolua_isnoobj(tolua_S,5,&tolua_err)
197  )
198  goto tolua_lerror;
199  else
200 #endif
201  {
202   lua_State* L =  tolua_S;
203   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
204   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,2,0));
205   int event = ((int)  tolua_tonumber(tolua_S,3,0));
206   const char* message = ((const char*)  tolua_tostring(tolua_S,4,0));
207  {
208   api_notify_embassies_msg(L,pplayer,ptile,event,message);
209  }
210  }
211  return 0;
212 #ifndef TOLUA_RELEASE
213  tolua_lerror:
214  tolua_error(tolua_S,"#ferror in function 'embassies_msg'.",&tolua_err);
215  return 0;
216 #endif
217 }
218 
219 /* function: api_notify_research_msg */
tolua_server_notify_research_msg00(lua_State * tolua_S)220 static int tolua_server_notify_research_msg00(lua_State* tolua_S)
221 {
222 #ifndef TOLUA_RELEASE
223  tolua_Error tolua_err;
224  if (
225  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
226  !tolua_isboolean(tolua_S,2,0,&tolua_err) ||
227  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
228  !tolua_isstring(tolua_S,4,0,&tolua_err) ||
229  !tolua_isnoobj(tolua_S,5,&tolua_err)
230  )
231  goto tolua_lerror;
232  else
233 #endif
234  {
235   lua_State* L =  tolua_S;
236   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
237   bool include_plr = ((bool)  tolua_toboolean(tolua_S,2,0));
238   int event = ((int)  tolua_tonumber(tolua_S,3,0));
239   const char* message = ((const char*)  tolua_tostring(tolua_S,4,0));
240  {
241   api_notify_research_msg(L,pplayer,include_plr,event,message);
242  }
243  }
244  return 0;
245 #ifndef TOLUA_RELEASE
246  tolua_lerror:
247  tolua_error(tolua_S,"#ferror in function 'research_msg'.",&tolua_err);
248  return 0;
249 #endif
250 }
251 
252 /* function: api_notify_research_embassies_msg */
tolua_server_notify_research_embassies_msg00(lua_State * tolua_S)253 static int tolua_server_notify_research_embassies_msg00(lua_State* tolua_S)
254 {
255 #ifndef TOLUA_RELEASE
256  tolua_Error tolua_err;
257  if (
258  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
259  !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
260  !tolua_isstring(tolua_S,3,0,&tolua_err) ||
261  !tolua_isnoobj(tolua_S,4,&tolua_err)
262  )
263  goto tolua_lerror;
264  else
265 #endif
266  {
267   lua_State* L =  tolua_S;
268   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
269   int event = ((int)  tolua_tonumber(tolua_S,2,0));
270   const char* message = ((const char*)  tolua_tostring(tolua_S,3,0));
271  {
272   api_notify_research_embassies_msg(L,pplayer,event,message);
273  }
274  }
275  return 0;
276 #ifndef TOLUA_RELEASE
277  tolua_lerror:
278  tolua_error(tolua_S,"#ferror in function 'research_embassies_msg'.",&tolua_err);
279  return 0;
280 #endif
281 }
282 
283 /* function: api_notify_event_msg */
tolua_server_notify_event_msg00(lua_State * tolua_S)284 static int tolua_server_notify_event_msg00(lua_State* tolua_S)
285 {
286 #ifndef TOLUA_RELEASE
287  tolua_Error tolua_err;
288  if (
289  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
290  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
291  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
292  !tolua_isstring(tolua_S,4,0,&tolua_err) ||
293  !tolua_isnoobj(tolua_S,5,&tolua_err)
294  )
295  goto tolua_lerror;
296  else
297 #endif
298  {
299   lua_State* L =  tolua_S;
300   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
301   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,2,0));
302   int event = ((int)  tolua_tonumber(tolua_S,3,0));
303   const char* message = ((const char*)  tolua_tostring(tolua_S,4,0));
304  {
305   api_notify_event_msg(L,pplayer,ptile,event,message);
306  }
307  }
308  return 0;
309 #ifndef TOLUA_RELEASE
310  tolua_lerror:
311  tolua_error(tolua_S,"#ferror in function 'event_msg'.",&tolua_err);
312  return 0;
313 #endif
314 }
315 
316 /* function: api_edit_create_unit */
tolua_server_edit_create_unit00(lua_State * tolua_S)317 static int tolua_server_edit_create_unit00(lua_State* tolua_S)
318 {
319 #ifndef TOLUA_RELEASE
320  tolua_Error tolua_err;
321  if (
322  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
323  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
324  !tolua_isusertype(tolua_S,3,"Unit_Type",0,&tolua_err) ||
325  !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
326  !tolua_isusertype(tolua_S,5,"City",0,&tolua_err) ||
327  !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
328  !tolua_isnoobj(tolua_S,7,&tolua_err)
329  )
330  goto tolua_lerror;
331  else
332 #endif
333  {
334   lua_State* L =  tolua_S;
335   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
336   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,2,0));
337   Unit_Type* ptype = ((Unit_Type*)  tolua_tousertype(tolua_S,3,0));
338   int veteran_level = ((int)  tolua_tonumber(tolua_S,4,0));
339   City* homecity = ((City*)  tolua_tousertype(tolua_S,5,0));
340   int moves_left = ((int)  tolua_tonumber(tolua_S,6,0));
341  {
342   Unit* tolua_ret = (Unit*)  api_edit_create_unit(L,pplayer,ptile,ptype,veteran_level,homecity,moves_left);
343  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Unit");
344  }
345  }
346  return 1;
347 #ifndef TOLUA_RELEASE
348  tolua_lerror:
349  tolua_error(tolua_S,"#ferror in function 'create_unit'.",&tolua_err);
350  return 0;
351 #endif
352 }
353 
354 /* function: api_edit_create_unit_full */
tolua_server_edit_create_unit_full00(lua_State * tolua_S)355 static int tolua_server_edit_create_unit_full00(lua_State* tolua_S)
356 {
357 #ifndef TOLUA_RELEASE
358  tolua_Error tolua_err;
359  if (
360  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
361  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
362  !tolua_isusertype(tolua_S,3,"Unit_Type",0,&tolua_err) ||
363  !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
364  !tolua_isusertype(tolua_S,5,"City",0,&tolua_err) ||
365  !tolua_isnumber(tolua_S,6,0,&tolua_err) ||
366  !tolua_isnumber(tolua_S,7,0,&tolua_err) ||
367  !tolua_isusertype(tolua_S,8,"Unit",0,&tolua_err) ||
368  !tolua_isnoobj(tolua_S,9,&tolua_err)
369  )
370  goto tolua_lerror;
371  else
372 #endif
373  {
374   lua_State* L =  tolua_S;
375   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
376   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,2,0));
377   Unit_Type* ptype = ((Unit_Type*)  tolua_tousertype(tolua_S,3,0));
378   int veteran_level = ((int)  tolua_tonumber(tolua_S,4,0));
379   City* homecity = ((City*)  tolua_tousertype(tolua_S,5,0));
380   int moves_left = ((int)  tolua_tonumber(tolua_S,6,0));
381   int hp_left = ((int)  tolua_tonumber(tolua_S,7,0));
382   Unit* ptransport = ((Unit*)  tolua_tousertype(tolua_S,8,0));
383  {
384   Unit* tolua_ret = (Unit*)  api_edit_create_unit_full(L,pplayer,ptile,ptype,veteran_level,homecity,moves_left,hp_left,ptransport);
385  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Unit");
386  }
387  }
388  return 1;
389 #ifndef TOLUA_RELEASE
390  tolua_lerror:
391  tolua_error(tolua_S,"#ferror in function 'create_unit_full'.",&tolua_err);
392  return 0;
393 #endif
394 }
395 
396 /* function: api_edit_unit_teleport */
tolua_server_edit_unit_teleport00(lua_State * tolua_S)397 static int tolua_server_edit_unit_teleport00(lua_State* tolua_S)
398 {
399 #ifndef TOLUA_RELEASE
400  tolua_Error tolua_err;
401  if (
402  !tolua_isusertype(tolua_S,1,"Unit",0,&tolua_err) ||
403  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
404  !tolua_isnoobj(tolua_S,3,&tolua_err)
405  )
406  goto tolua_lerror;
407  else
408 #endif
409  {
410   lua_State* L =  tolua_S;
411   Unit* self = ((Unit*)  tolua_tousertype(tolua_S,1,0));
412   Tile* dest = ((Tile*)  tolua_tousertype(tolua_S,2,0));
413  {
414   bool tolua_ret = (bool)  api_edit_unit_teleport(L,self,dest);
415  tolua_pushboolean(tolua_S,(bool)tolua_ret);
416  }
417  }
418  return 1;
419 #ifndef TOLUA_RELEASE
420  tolua_lerror:
421  tolua_error(tolua_S,"#ferror in function 'unit_teleport'.",&tolua_err);
422  return 0;
423 #endif
424 }
425 
426 /* function: api_edit_unit_kill */
tolua_server_edit_unit_kill00(lua_State * tolua_S)427 static int tolua_server_edit_unit_kill00(lua_State* tolua_S)
428 {
429 #ifndef TOLUA_RELEASE
430  tolua_Error tolua_err;
431  if (
432  !tolua_isusertype(tolua_S,1,"Unit",0,&tolua_err) ||
433  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
434  !tolua_isusertype(tolua_S,3,"Player",0,&tolua_err) ||
435  !tolua_isnoobj(tolua_S,4,&tolua_err)
436  )
437  goto tolua_lerror;
438  else
439 #endif
440  {
441   lua_State* L =  tolua_S;
442   Unit* self = ((Unit*)  tolua_tousertype(tolua_S,1,0));
443   const char* reason = ((const char*)  tolua_tostring(tolua_S,2,0));
444   Player* killer = ((Player*)  tolua_tousertype(tolua_S,3,0));
445  {
446   api_edit_unit_kill(L,self,reason,killer);
447  }
448  }
449  return 0;
450 #ifndef TOLUA_RELEASE
451  tolua_lerror:
452  tolua_error(tolua_S,"#ferror in function 'unit_kill'.",&tolua_err);
453  return 0;
454 #endif
455 }
456 
457 /* function: api_edit_create_city */
tolua_server_edit_create_city00(lua_State * tolua_S)458 static int tolua_server_edit_create_city00(lua_State* tolua_S)
459 {
460 #ifndef TOLUA_RELEASE
461  tolua_Error tolua_err;
462  if (
463  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
464  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
465  !tolua_isstring(tolua_S,3,0,&tolua_err) ||
466  !tolua_isnoobj(tolua_S,4,&tolua_err)
467  )
468  goto tolua_lerror;
469  else
470 #endif
471  {
472   lua_State* L =  tolua_S;
473   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
474   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,2,0));
475   const char* name = ((const char*)  tolua_tostring(tolua_S,3,0));
476  {
477   api_edit_create_city(L,pplayer,ptile,name);
478  }
479  }
480  return 0;
481 #ifndef TOLUA_RELEASE
482  tolua_lerror:
483  tolua_error(tolua_S,"#ferror in function 'create_city'.",&tolua_err);
484  return 0;
485 #endif
486 }
487 
488 /* function: api_edit_create_extra */
tolua_server_edit_create_extra00(lua_State * tolua_S)489 static int tolua_server_edit_create_extra00(lua_State* tolua_S)
490 {
491 #ifndef TOLUA_RELEASE
492  tolua_Error tolua_err;
493  if (
494  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
495  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
496  !tolua_isnoobj(tolua_S,3,&tolua_err)
497  )
498  goto tolua_lerror;
499  else
500 #endif
501  {
502   lua_State* L =  tolua_S;
503   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
504   const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
505  {
506   api_edit_create_extra(L,ptile,name);
507  }
508  }
509  return 0;
510 #ifndef TOLUA_RELEASE
511  tolua_lerror:
512  tolua_error(tolua_S,"#ferror in function 'create_extra'.",&tolua_err);
513  return 0;
514 #endif
515 }
516 
517 /* function: api_edit_create_base */
tolua_server_edit_create_base00(lua_State * tolua_S)518 static int tolua_server_edit_create_base00(lua_State* tolua_S)
519 {
520 #ifndef TOLUA_RELEASE
521  tolua_Error tolua_err;
522  if (
523  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
524  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
525  !tolua_isusertype(tolua_S,3,"Player",0,&tolua_err) ||
526  !tolua_isnoobj(tolua_S,4,&tolua_err)
527  )
528  goto tolua_lerror;
529  else
530 #endif
531  {
532   lua_State* L =  tolua_S;
533   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
534   const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
535   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,3,0));
536  {
537   api_edit_create_base(L,ptile,name,pplayer);
538  }
539  }
540  return 0;
541 #ifndef TOLUA_RELEASE
542  tolua_lerror:
543  tolua_error(tolua_S,"#ferror in function 'create_base'.",&tolua_err);
544  return 0;
545 #endif
546 }
547 
548 /* function: api_edit_create_road */
tolua_server_edit_create_road00(lua_State * tolua_S)549 static int tolua_server_edit_create_road00(lua_State* tolua_S)
550 {
551 #ifndef TOLUA_RELEASE
552  tolua_Error tolua_err;
553  if (
554  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
555  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
556  !tolua_isnoobj(tolua_S,3,&tolua_err)
557  )
558  goto tolua_lerror;
559  else
560 #endif
561  {
562   lua_State* L =  tolua_S;
563   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
564   const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
565  {
566   api_edit_create_road(L,ptile,name);
567  }
568  }
569  return 0;
570 #ifndef TOLUA_RELEASE
571  tolua_lerror:
572  tolua_error(tolua_S,"#ferror in function 'create_road'.",&tolua_err);
573  return 0;
574 #endif
575 }
576 
577 /* function: api_edit_remove_extra */
tolua_server_edit_remove_extra00(lua_State * tolua_S)578 static int tolua_server_edit_remove_extra00(lua_State* tolua_S)
579 {
580 #ifndef TOLUA_RELEASE
581  tolua_Error tolua_err;
582  if (
583  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
584  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
585  !tolua_isnoobj(tolua_S,3,&tolua_err)
586  )
587  goto tolua_lerror;
588  else
589 #endif
590  {
591   lua_State* L =  tolua_S;
592   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
593   const char* name = ((const char*)  tolua_tostring(tolua_S,2,0));
594  {
595   api_edit_remove_extra(L,ptile,name);
596  }
597  }
598  return 0;
599 #ifndef TOLUA_RELEASE
600  tolua_lerror:
601  tolua_error(tolua_S,"#ferror in function 'remove_extra'.",&tolua_err);
602  return 0;
603 #endif
604 }
605 
606 /* function: api_edit_tile_set_label */
tolua_server_edit_tile_set_label00(lua_State * tolua_S)607 static int tolua_server_edit_tile_set_label00(lua_State* tolua_S)
608 {
609 #ifndef TOLUA_RELEASE
610  tolua_Error tolua_err;
611  if (
612  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
613  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
614  !tolua_isnoobj(tolua_S,3,&tolua_err)
615  )
616  goto tolua_lerror;
617  else
618 #endif
619  {
620   lua_State* L =  tolua_S;
621   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
622   const char* label = ((const char*)  tolua_tostring(tolua_S,2,0));
623  {
624   api_edit_tile_set_label(L,ptile,label);
625  }
626  }
627  return 0;
628 #ifndef TOLUA_RELEASE
629  tolua_lerror:
630  tolua_error(tolua_S,"#ferror in function 'tile_set_label'.",&tolua_err);
631  return 0;
632 #endif
633 }
634 
635 /* function: api_edit_create_player */
tolua_server_edit_create_player00(lua_State * tolua_S)636 static int tolua_server_edit_create_player00(lua_State* tolua_S)
637 {
638 #ifndef TOLUA_RELEASE
639  tolua_Error tolua_err;
640  if (
641  !tolua_isstring(tolua_S,1,0,&tolua_err) ||
642  !tolua_isusertype(tolua_S,2,"Nation_Type",0,&tolua_err) ||
643  !tolua_isstring(tolua_S,3,0,&tolua_err) ||
644  !tolua_isnoobj(tolua_S,4,&tolua_err)
645  )
646  goto tolua_lerror;
647  else
648 #endif
649  {
650   lua_State* L =  tolua_S;
651   const char* username = ((const char*)  tolua_tostring(tolua_S,1,0));
652   Nation_Type* nation = ((Nation_Type*)  tolua_tousertype(tolua_S,2,0));
653   const char* ai = ((const char*)  tolua_tostring(tolua_S,3,0));
654  {
655   Player* tolua_ret = (Player*)  api_edit_create_player(L,username,nation,ai);
656  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Player");
657  }
658  }
659  return 1;
660 #ifndef TOLUA_RELEASE
661  tolua_lerror:
662  tolua_error(tolua_S,"#ferror in function 'create_player'.",&tolua_err);
663  return 0;
664 #endif
665 }
666 
667 /* function: api_edit_change_gold */
tolua_server_edit_change_gold00(lua_State * tolua_S)668 static int tolua_server_edit_change_gold00(lua_State* tolua_S)
669 {
670 #ifndef TOLUA_RELEASE
671  tolua_Error tolua_err;
672  if (
673  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
674  !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
675  !tolua_isnoobj(tolua_S,3,&tolua_err)
676  )
677  goto tolua_lerror;
678  else
679 #endif
680  {
681   lua_State* L =  tolua_S;
682   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
683   int amount = ((int)  tolua_tonumber(tolua_S,2,0));
684  {
685   api_edit_change_gold(L,pplayer,amount);
686  }
687  }
688  return 0;
689 #ifndef TOLUA_RELEASE
690  tolua_lerror:
691  tolua_error(tolua_S,"#ferror in function 'change_gold'.",&tolua_err);
692  return 0;
693 #endif
694 }
695 
696 /* function: api_edit_give_technology */
tolua_server_edit_give_tech00(lua_State * tolua_S)697 static int tolua_server_edit_give_tech00(lua_State* tolua_S)
698 {
699 #ifndef TOLUA_RELEASE
700  tolua_Error tolua_err;
701  if (
702  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
703  !tolua_isusertype(tolua_S,2,"Tech_Type",0,&tolua_err) ||
704  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
705  !tolua_isboolean(tolua_S,4,0,&tolua_err) ||
706  !tolua_isstring(tolua_S,5,0,&tolua_err) ||
707  !tolua_isnoobj(tolua_S,6,&tolua_err)
708  )
709  goto tolua_lerror;
710  else
711 #endif
712  {
713   lua_State* L =  tolua_S;
714   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
715   Tech_Type* ptech = ((Tech_Type*)  tolua_tousertype(tolua_S,2,0));
716   int cost = ((int)  tolua_tonumber(tolua_S,3,0));
717   bool notify = ((bool)  tolua_toboolean(tolua_S,4,0));
718   const char* reason = ((const char*)  tolua_tostring(tolua_S,5,0));
719  {
720   Tech_Type* tolua_ret = (Tech_Type*)  api_edit_give_technology(L,pplayer,ptech,cost,notify,reason);
721  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Tech_Type");
722  }
723  }
724  return 1;
725 #ifndef TOLUA_RELEASE
726  tolua_lerror:
727  tolua_error(tolua_S,"#ferror in function 'give_tech'.",&tolua_err);
728  return 0;
729 #endif
730 }
731 
732 /* function: api_edit_trait_mod_set */
tolua_server_edit_trait_mod00(lua_State * tolua_S)733 static int tolua_server_edit_trait_mod00(lua_State* tolua_S)
734 {
735 #ifndef TOLUA_RELEASE
736  tolua_Error tolua_err;
737  if (
738  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
739  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
740  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
741  !tolua_isnoobj(tolua_S,4,&tolua_err)
742  )
743  goto tolua_lerror;
744  else
745 #endif
746  {
747   lua_State* L =  tolua_S;
748   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
749   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
750   const int mod = ((const int)  tolua_tonumber(tolua_S,3,0));
751  {
752   bool tolua_ret = (bool)  api_edit_trait_mod_set(L,pplayer,tname,mod);
753  tolua_pushboolean(tolua_S,(bool)tolua_ret);
754  }
755  }
756  return 1;
757 #ifndef TOLUA_RELEASE
758  tolua_lerror:
759  tolua_error(tolua_S,"#ferror in function 'trait_mod'.",&tolua_err);
760  return 0;
761 #endif
762 }
763 
764 /* function: api_edit_unleash_barbarians */
tolua_server_edit_unleash_barbarians00(lua_State * tolua_S)765 static int tolua_server_edit_unleash_barbarians00(lua_State* tolua_S)
766 {
767 #ifndef TOLUA_RELEASE
768  tolua_Error tolua_err;
769  if (
770  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
771  !tolua_isnoobj(tolua_S,2,&tolua_err)
772  )
773  goto tolua_lerror;
774  else
775 #endif
776  {
777   lua_State* L =  tolua_S;
778   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
779  {
780   bool tolua_ret = (bool)  api_edit_unleash_barbarians(L,ptile);
781  tolua_pushboolean(tolua_S,(bool)tolua_ret);
782  }
783  }
784  return 1;
785 #ifndef TOLUA_RELEASE
786  tolua_lerror:
787  tolua_error(tolua_S,"#ferror in function 'unleash_barbarians'.",&tolua_err);
788  return 0;
789 #endif
790 }
791 
792 /* function: api_edit_place_partisans */
tolua_server_edit_place_partisans00(lua_State * tolua_S)793 static int tolua_server_edit_place_partisans00(lua_State* tolua_S)
794 {
795 #ifndef TOLUA_RELEASE
796  tolua_Error tolua_err;
797  if (
798  !tolua_isusertype(tolua_S,1,"Tile",0,&tolua_err) ||
799  !tolua_isusertype(tolua_S,2,"Player",0,&tolua_err) ||
800  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
801  !tolua_isnumber(tolua_S,4,0,&tolua_err) ||
802  !tolua_isnoobj(tolua_S,5,&tolua_err)
803  )
804  goto tolua_lerror;
805  else
806 #endif
807  {
808   lua_State* L =  tolua_S;
809   Tile* ptile = ((Tile*)  tolua_tousertype(tolua_S,1,0));
810   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,2,0));
811   int count = ((int)  tolua_tonumber(tolua_S,3,0));
812   int sq_radius = ((int)  tolua_tonumber(tolua_S,4,0));
813  {
814   api_edit_place_partisans(L,ptile,pplayer,count,sq_radius);
815  }
816  }
817  return 0;
818 #ifndef TOLUA_RELEASE
819  tolua_lerror:
820  tolua_error(tolua_S,"#ferror in function 'place_partisans'.",&tolua_err);
821  return 0;
822 #endif
823 }
824 
825 /* function: api_edit_climate_change */
tolua_server_edit_climate_change00(lua_State * tolua_S)826 static int tolua_server_edit_climate_change00(lua_State* tolua_S)
827 {
828 #ifndef TOLUA_RELEASE
829  tolua_Error tolua_err;
830  if (
831  !tolua_isnumber(tolua_S,1,0,&tolua_err) ||
832  !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
833  !tolua_isnoobj(tolua_S,3,&tolua_err)
834  )
835  goto tolua_lerror;
836  else
837 #endif
838  {
839   lua_State* L =  tolua_S;
840   enum climate_change_type type = ((enum climate_change_type) (int)  tolua_tonumber(tolua_S,1,0));
841   int effect = ((int)  tolua_tonumber(tolua_S,2,0));
842  {
843   api_edit_climate_change(L,type,effect);
844  }
845  }
846  return 0;
847 #ifndef TOLUA_RELEASE
848  tolua_lerror:
849  tolua_error(tolua_S,"#ferror in function 'climate_change'.",&tolua_err);
850  return 0;
851 #endif
852 }
853 
854 /* function: api_edit_civil_war */
tolua_server_edit_civil_war00(lua_State * tolua_S)855 static int tolua_server_edit_civil_war00(lua_State* tolua_S)
856 {
857 #ifndef TOLUA_RELEASE
858  tolua_Error tolua_err;
859  if (
860  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
861  !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
862  !tolua_isnoobj(tolua_S,3,&tolua_err)
863  )
864  goto tolua_lerror;
865  else
866 #endif
867  {
868   lua_State* L =  tolua_S;
869   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
870   int probability = ((int)  tolua_tonumber(tolua_S,2,0));
871  {
872   Player* tolua_ret = (Player*)  api_edit_civil_war(L,pplayer,probability);
873  tolua_pushusertype(tolua_S,(void*)tolua_ret,"Player");
874  }
875  }
876  return 1;
877 #ifndef TOLUA_RELEASE
878  tolua_lerror:
879  tolua_error(tolua_S,"#ferror in function 'civil_war'.",&tolua_err);
880  return 0;
881 #endif
882 }
883 
884 /* function: api_edit_unit_turn */
tolua_server_edit_unit_turn00(lua_State * tolua_S)885 static int tolua_server_edit_unit_turn00(lua_State* tolua_S)
886 {
887 #ifndef TOLUA_RELEASE
888  tolua_Error tolua_err;
889  if (
890  !tolua_isusertype(tolua_S,1,"Unit",0,&tolua_err) ||
891  !tolua_isusertype(tolua_S,2,"Direction",0,&tolua_err) ||
892  !tolua_isnoobj(tolua_S,3,&tolua_err)
893  )
894  goto tolua_lerror;
895  else
896 #endif
897  {
898   lua_State* L =  tolua_S;
899   Unit* punit = ((Unit*)  tolua_tousertype(tolua_S,1,0));
900   Direction dir = *((Direction*)  tolua_tousertype(tolua_S,2,0));
901  {
902   api_edit_unit_turn(L,punit,dir);
903  }
904  }
905  return 0;
906 #ifndef TOLUA_RELEASE
907  tolua_lerror:
908  tolua_error(tolua_S,"#ferror in function 'unit_turn'.",&tolua_err);
909  return 0;
910 #endif
911 }
912 
913 /* function: api_edit_player_victory */
tolua_server_edit_player_victory00(lua_State * tolua_S)914 static int tolua_server_edit_player_victory00(lua_State* tolua_S)
915 {
916 #ifndef TOLUA_RELEASE
917  tolua_Error tolua_err;
918  if (
919  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
920  !tolua_isnoobj(tolua_S,2,&tolua_err)
921  )
922  goto tolua_lerror;
923  else
924 #endif
925  {
926   lua_State* L =  tolua_S;
927   Player* self = ((Player*)  tolua_tousertype(tolua_S,1,0));
928  {
929   api_edit_player_victory(L,self);
930  }
931  }
932  return 0;
933 #ifndef TOLUA_RELEASE
934  tolua_lerror:
935  tolua_error(tolua_S,"#ferror in function 'player_victory'.",&tolua_err);
936  return 0;
937 #endif
938 }
939 
940 /* function: api_edit_unit_move */
tolua_server_edit_unit_move00(lua_State * tolua_S)941 static int tolua_server_edit_unit_move00(lua_State* tolua_S)
942 {
943 #ifndef TOLUA_RELEASE
944  tolua_Error tolua_err;
945  if (
946  !tolua_isusertype(tolua_S,1,"Unit",0,&tolua_err) ||
947  !tolua_isusertype(tolua_S,2,"Tile",0,&tolua_err) ||
948  !tolua_isnumber(tolua_S,3,0,&tolua_err) ||
949  !tolua_isnoobj(tolua_S,4,&tolua_err)
950  )
951  goto tolua_lerror;
952  else
953 #endif
954  {
955   lua_State* L =  tolua_S;
956   Unit* self = ((Unit*)  tolua_tousertype(tolua_S,1,0));
957   Tile* moveto = ((Tile*)  tolua_tousertype(tolua_S,2,0));
958   int movecost = ((int)  tolua_tonumber(tolua_S,3,0));
959  {
960   bool tolua_ret = (bool)  api_edit_unit_move(L,self,moveto,movecost);
961  tolua_pushboolean(tolua_S,(bool)tolua_ret);
962  }
963  }
964  return 1;
965 #ifndef TOLUA_RELEASE
966  tolua_lerror:
967  tolua_error(tolua_S,"#ferror in function 'unit_move'.",&tolua_err);
968  return 0;
969 #endif
970 }
971 
972 /* function: api_edit_city_add_history */
tolua_server_edit_add_city_history00(lua_State * tolua_S)973 static int tolua_server_edit_add_city_history00(lua_State* tolua_S)
974 {
975 #ifndef TOLUA_RELEASE
976  tolua_Error tolua_err;
977  if (
978  !tolua_isusertype(tolua_S,1,"City",0,&tolua_err) ||
979  !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
980  !tolua_isnoobj(tolua_S,3,&tolua_err)
981  )
982  goto tolua_lerror;
983  else
984 #endif
985  {
986   lua_State* L =  tolua_S;
987   City* self = ((City*)  tolua_tousertype(tolua_S,1,0));
988   int amount = ((int)  tolua_tonumber(tolua_S,2,0));
989  {
990   api_edit_city_add_history(L,self,amount);
991  }
992  }
993  return 0;
994 #ifndef TOLUA_RELEASE
995  tolua_lerror:
996  tolua_error(tolua_S,"#ferror in function 'add_city_history'.",&tolua_err);
997  return 0;
998 #endif
999 }
1000 
1001 /* function: api_edit_player_add_history */
tolua_server_edit_add_player_history00(lua_State * tolua_S)1002 static int tolua_server_edit_add_player_history00(lua_State* tolua_S)
1003 {
1004 #ifndef TOLUA_RELEASE
1005  tolua_Error tolua_err;
1006  if (
1007  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
1008  !tolua_isnumber(tolua_S,2,0,&tolua_err) ||
1009  !tolua_isnoobj(tolua_S,3,&tolua_err)
1010  )
1011  goto tolua_lerror;
1012  else
1013 #endif
1014  {
1015   lua_State* L =  tolua_S;
1016   Player* self = ((Player*)  tolua_tousertype(tolua_S,1,0));
1017   int amount = ((int)  tolua_tonumber(tolua_S,2,0));
1018  {
1019   api_edit_player_add_history(L,self,amount);
1020  }
1021  }
1022  return 0;
1023 #ifndef TOLUA_RELEASE
1024  tolua_lerror:
1025  tolua_error(tolua_S,"#ferror in function 'add_player_history'.",&tolua_err);
1026  return 0;
1027 #endif
1028 }
1029 
1030 /* function: api_methods_player_trait */
tolua_server_Player_trait00(lua_State * tolua_S)1031 static int tolua_server_Player_trait00(lua_State* tolua_S)
1032 {
1033 #ifndef TOLUA_RELEASE
1034  tolua_Error tolua_err;
1035  if (
1036  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
1037  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
1038  !tolua_isnoobj(tolua_S,3,&tolua_err)
1039  )
1040  goto tolua_lerror;
1041  else
1042 #endif
1043  {
1044   lua_State* L =  tolua_S;
1045   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
1046   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
1047  {
1048   int tolua_ret = (int)  api_methods_player_trait(L,pplayer,tname);
1049  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
1050  }
1051  }
1052  return 1;
1053 #ifndef TOLUA_RELEASE
1054  tolua_lerror:
1055  tolua_error(tolua_S,"#ferror in function 'trait'.",&tolua_err);
1056  return 0;
1057 #endif
1058 }
1059 
1060 /* function: api_methods_player_trait_base */
tolua_server_Player_trait_base00(lua_State * tolua_S)1061 static int tolua_server_Player_trait_base00(lua_State* tolua_S)
1062 {
1063 #ifndef TOLUA_RELEASE
1064  tolua_Error tolua_err;
1065  if (
1066  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
1067  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
1068  !tolua_isnoobj(tolua_S,3,&tolua_err)
1069  )
1070  goto tolua_lerror;
1071  else
1072 #endif
1073  {
1074   lua_State* L =  tolua_S;
1075   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
1076   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
1077  {
1078   int tolua_ret = (int)  api_methods_player_trait_base(L,pplayer,tname);
1079  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
1080  }
1081  }
1082  return 1;
1083 #ifndef TOLUA_RELEASE
1084  tolua_lerror:
1085  tolua_error(tolua_S,"#ferror in function 'trait_base'.",&tolua_err);
1086  return 0;
1087 #endif
1088 }
1089 
1090 /* function: api_methods_player_trait_current_mod */
tolua_server_Player_trait_current_mod00(lua_State * tolua_S)1091 static int tolua_server_Player_trait_current_mod00(lua_State* tolua_S)
1092 {
1093 #ifndef TOLUA_RELEASE
1094  tolua_Error tolua_err;
1095  if (
1096  !tolua_isusertype(tolua_S,1,"Player",0,&tolua_err) ||
1097  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
1098  !tolua_isnoobj(tolua_S,3,&tolua_err)
1099  )
1100  goto tolua_lerror;
1101  else
1102 #endif
1103  {
1104   lua_State* L =  tolua_S;
1105   Player* pplayer = ((Player*)  tolua_tousertype(tolua_S,1,0));
1106   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
1107  {
1108   int tolua_ret = (int)  api_methods_player_trait_current_mod(L,pplayer,tname);
1109  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
1110  }
1111  }
1112  return 1;
1113 #ifndef TOLUA_RELEASE
1114  tolua_lerror:
1115  tolua_error(tolua_S,"#ferror in function 'trait_current_mod'.",&tolua_err);
1116  return 0;
1117 #endif
1118 }
1119 
1120 /* function: api_methods_nation_trait_min */
tolua_server_Nation_Type_trait_min00(lua_State * tolua_S)1121 static int tolua_server_Nation_Type_trait_min00(lua_State* tolua_S)
1122 {
1123 #ifndef TOLUA_RELEASE
1124  tolua_Error tolua_err;
1125  if (
1126  !tolua_isusertype(tolua_S,1,"Nation_Type",0,&tolua_err) ||
1127  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
1128  !tolua_isnoobj(tolua_S,3,&tolua_err)
1129  )
1130  goto tolua_lerror;
1131  else
1132 #endif
1133  {
1134   lua_State* L =  tolua_S;
1135   Nation_Type* pnation = ((Nation_Type*)  tolua_tousertype(tolua_S,1,0));
1136   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
1137  {
1138   int tolua_ret = (int)  api_methods_nation_trait_min(L,pnation,tname);
1139  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
1140  }
1141  }
1142  return 1;
1143 #ifndef TOLUA_RELEASE
1144  tolua_lerror:
1145  tolua_error(tolua_S,"#ferror in function 'trait_min'.",&tolua_err);
1146  return 0;
1147 #endif
1148 }
1149 
1150 /* function: api_methods_nation_trait_max */
tolua_server_Nation_Type_trait_max00(lua_State * tolua_S)1151 static int tolua_server_Nation_Type_trait_max00(lua_State* tolua_S)
1152 {
1153 #ifndef TOLUA_RELEASE
1154  tolua_Error tolua_err;
1155  if (
1156  !tolua_isusertype(tolua_S,1,"Nation_Type",0,&tolua_err) ||
1157  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
1158  !tolua_isnoobj(tolua_S,3,&tolua_err)
1159  )
1160  goto tolua_lerror;
1161  else
1162 #endif
1163  {
1164   lua_State* L =  tolua_S;
1165   Nation_Type* pnation = ((Nation_Type*)  tolua_tousertype(tolua_S,1,0));
1166   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
1167  {
1168   int tolua_ret = (int)  api_methods_nation_trait_max(L,pnation,tname);
1169  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
1170  }
1171  }
1172  return 1;
1173 #ifndef TOLUA_RELEASE
1174  tolua_lerror:
1175  tolua_error(tolua_S,"#ferror in function 'trait_max'.",&tolua_err);
1176  return 0;
1177 #endif
1178 }
1179 
1180 /* function: api_methods_nation_trait_default */
tolua_server_Nation_Type_trait_default00(lua_State * tolua_S)1181 static int tolua_server_Nation_Type_trait_default00(lua_State* tolua_S)
1182 {
1183 #ifndef TOLUA_RELEASE
1184  tolua_Error tolua_err;
1185  if (
1186  !tolua_isusertype(tolua_S,1,"Nation_Type",0,&tolua_err) ||
1187  !tolua_isstring(tolua_S,2,0,&tolua_err) ||
1188  !tolua_isnoobj(tolua_S,3,&tolua_err)
1189  )
1190  goto tolua_lerror;
1191  else
1192 #endif
1193  {
1194   lua_State* L =  tolua_S;
1195   Nation_Type* pnation = ((Nation_Type*)  tolua_tousertype(tolua_S,1,0));
1196   const char* tname = ((const char*)  tolua_tostring(tolua_S,2,0));
1197  {
1198   int tolua_ret = (int)  api_methods_nation_trait_default(L,pnation,tname);
1199  tolua_pushnumber(tolua_S,(lua_Number)tolua_ret);
1200  }
1201  }
1202  return 1;
1203 #ifndef TOLUA_RELEASE
1204  tolua_lerror:
1205  tolua_error(tolua_S,"#ferror in function 'trait_default'.",&tolua_err);
1206  return 0;
1207 #endif
1208 }
1209 
1210 /* Open lib function */
luaopen_server(lua_State * tolua_S)1211 LUALIB_API int luaopen_server (lua_State* tolua_S)
1212 {
1213  tolua_open(tolua_S);
1214  tolua_reg_types(tolua_S);
1215  tolua_module(tolua_S,NULL,0);
1216  tolua_beginmodule(tolua_S,NULL);
1217  tolua_module(tolua_S,"server",0);
1218  tolua_beginmodule(tolua_S,"server");
1219  tolua_function(tolua_S,"save",tolua_server_server_save00);
1220  tolua_function(tolua_S,"started",tolua_server_server_started00);
1221  tolua_function(tolua_S,"civilization_score",tolua_server_server_civilization_score00);
1222  tolua_function(tolua_S,"play_music",tolua_server_server_play_music00);
1223  tolua_module(tolua_S,"setting",0);
1224  tolua_beginmodule(tolua_S,"setting");
1225  tolua_function(tolua_S,"get",tolua_server_server_setting_get00);
1226  tolua_endmodule(tolua_S);
1227  tolua_endmodule(tolua_S);
1228  tolua_module(tolua_S,"notify",0);
1229  tolua_beginmodule(tolua_S,"notify");
1230  tolua_function(tolua_S,"embassies_msg",tolua_server_notify_embassies_msg00);
1231  tolua_function(tolua_S,"research_msg",tolua_server_notify_research_msg00);
1232  tolua_function(tolua_S,"research_embassies_msg",tolua_server_notify_research_embassies_msg00);
1233  tolua_function(tolua_S,"event_msg",tolua_server_notify_event_msg00);
1234  tolua_endmodule(tolua_S);
1235 
1236  { /* begin embedded lua code */
1237  static unsigned char B[] = {
1238   10,102,117,110, 99,116,105,111,110, 32,110,111,116,105,102,
1239  121, 46, 97,108,108, 40, 46, 46, 46, 41, 10,108,111, 99, 97,
1240  108, 32, 97,114,103, 32, 61, 32,116, 97, 98,108,101, 46,112,
1241   97, 99,107, 40, 46, 46, 46, 41, 59, 10,110,111,116,105,102,
1242  121, 46,101,118,101,110,116, 95,109,115,103, 40,110,105,108,
1243   44, 32,110,105,108, 44, 32, 69, 46, 83, 67, 82, 73, 80, 84,
1244   44, 32,115,116,114,105,110,103, 46,102,111,114,109, 97,116,
1245   40,116, 97, 98,108,101, 46,117,110,112, 97, 99,107, 40, 97,
1246  114,103, 41, 41, 41, 10,101,110,100, 10,102,117,110, 99,116,
1247  105,111,110, 32,110,111,116,105,102,121, 46,112,108, 97,121,
1248  101,114, 40,112,108, 97,121,101,114, 44, 32, 46, 46, 46, 41,
1249   10,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32,116, 97,
1250   98,108,101, 46,112, 97, 99,107, 40, 46, 46, 46, 41, 59, 10,
1251  110,111,116,105,102,121, 46,101,118,101,110,116, 95,109,115,
1252  103, 40,112,108, 97,121,101,114, 44, 32,110,105,108, 44, 32,
1253   69, 46, 83, 67, 82, 73, 80, 84, 44, 32,115,116,114,105,110,
1254  103, 46,102,111,114,109, 97,116, 40,116, 97, 98,108,101, 46,
1255  117,110,112, 97, 99,107, 40, 97,114,103, 41, 41, 41, 10,101,
1256  110,100, 10,102,117,110, 99,116,105,111,110, 32,110,111,116,
1257  105,102,121, 46,101,118,101,110,116, 40,112,108, 97,121,101,
1258  114, 44, 32,116,105,108,101, 44, 32,101,118,101,110,116, 44,
1259   32, 46, 46, 46, 41, 10,108,111, 99, 97,108, 32, 97,114,103,
1260   32, 61, 32,116, 97, 98,108,101, 46,112, 97, 99,107, 40, 46,
1261   46, 46, 41, 59, 10,110,111,116,105,102,121, 46,101,118,101,
1262  110,116, 95,109,115,103, 40,112,108, 97,121,101,114, 44, 32,
1263  116,105,108,101, 44, 32,101,118,101,110,116, 44, 32,115,116,
1264  114,105,110,103, 46,102,111,114,109, 97,116, 40,116, 97, 98,
1265  108,101, 46,117,110,112, 97, 99,107, 40, 97,114,103, 41, 41,
1266   41, 10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32,
1267  110,111,116,105,102,121, 46,101,109, 98, 97,115,115,105,101,
1268  115, 40,112,108, 97,121,101,114, 44, 32,112,116,105,108,101,
1269   44, 32,101,118,101,110,116, 44, 32, 46, 46, 46, 41, 10,108,
1270  111, 99, 97,108, 32, 97,114,103, 32, 61, 32,116, 97, 98,108,
1271  101, 46,112, 97, 99,107, 40, 46, 46, 46, 41, 59, 10,110,111,
1272  116,105,102,121, 46,101,109, 98, 97,115,115,105,101,115, 95,
1273  109,115,103, 40,112,108, 97,121,101,114, 44, 32,112,116,105,
1274  108,101, 44, 32,101,118,101,110,116, 44, 32,115,116,114,105,
1275  110,103, 46,102,111,114,109, 97,116, 40,116, 97, 98,108,101,
1276   46,117,110,112, 97, 99,107, 40, 97,114,103, 41, 41, 41, 10,
1277  101,110,100, 10,102,117,110, 99,116,105,111,110, 32,110,111,
1278  116,105,102,121, 46,114,101,115,101, 97,114, 99,104, 40,112,
1279  108, 97,121,101,114, 44, 32,115,101,108,102,109,115,103, 44,
1280   32,101,118,101,110,116, 44, 32, 46, 46, 46, 41, 10,108,111,
1281   99, 97,108, 32, 97,114,103, 32, 61, 32,116, 97, 98,108,101,
1282   46,112, 97, 99,107, 40, 46, 46, 46, 41, 59, 10,110,111,116,
1283  105,102,121, 46,114,101,115,101, 97,114, 99,104, 95,109,115,
1284  103, 40,112,108, 97,121,101,114, 44, 32,115,101,108,102,109,
1285  115,103, 44, 32,101,118,101,110,116, 44, 32,115,116,114,105,
1286  110,103, 46,102,111,114,109, 97,116, 40,116, 97, 98,108,101,
1287   46,117,110,112, 97, 99,107, 40, 97,114,103, 41, 41, 41, 10,
1288  101,110,100, 10,102,117,110, 99,116,105,111,110, 32,110,111,
1289  116,105,102,121, 46,114,101,115,101, 97,114, 99,104, 95,101,
1290  109, 98, 97,115,115,105,101,115, 40,112,108, 97,121,101,114,
1291   44, 32,101,118,101,110,116, 44, 32, 46, 46, 46, 41, 10,108,
1292  111, 99, 97,108, 32, 97,114,103, 32, 61, 32,116, 97, 98,108,
1293  101, 46,112, 97, 99,107, 40, 46, 46, 46, 41, 59, 10,110,111,
1294  116,105,102,121, 46,114,101,115,101, 97,114, 99,104, 95,101,
1295  109, 98, 97,115,115,105,101,115, 95,109,115,103, 40,112,108,
1296   97,121,101,114, 44, 32,101,118,101,110,116, 44, 32,115,116,
1297  114,105,110,103, 46,102,111,114,109, 97,116, 40,116, 97, 98,
1298  108,101, 46,117,110,112, 97, 99,107, 40, 97,114,103, 41, 41,
1299   41, 10,101,110,100,32
1300  };
1301  if (luaL_loadbuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code") == LUA_OK)
1302  lua_pcall(tolua_S,0,LUA_MULTRET,0);
1303  } /* end of embedded lua code */
1304 
1305  tolua_module(tolua_S,"edit",0);
1306  tolua_beginmodule(tolua_S,"edit");
1307  tolua_function(tolua_S,"create_unit",tolua_server_edit_create_unit00);
1308  tolua_function(tolua_S,"create_unit_full",tolua_server_edit_create_unit_full00);
1309  tolua_function(tolua_S,"unit_teleport",tolua_server_edit_unit_teleport00);
1310  tolua_function(tolua_S,"unit_kill",tolua_server_edit_unit_kill00);
1311  tolua_function(tolua_S,"create_city",tolua_server_edit_create_city00);
1312  tolua_function(tolua_S,"create_extra",tolua_server_edit_create_extra00);
1313  tolua_function(tolua_S,"create_base",tolua_server_edit_create_base00);
1314  tolua_function(tolua_S,"create_road",tolua_server_edit_create_road00);
1315  tolua_function(tolua_S,"remove_extra",tolua_server_edit_remove_extra00);
1316  tolua_function(tolua_S,"tile_set_label",tolua_server_edit_tile_set_label00);
1317  tolua_function(tolua_S,"create_player",tolua_server_edit_create_player00);
1318  tolua_function(tolua_S,"change_gold",tolua_server_edit_change_gold00);
1319  tolua_function(tolua_S,"give_tech",tolua_server_edit_give_tech00);
1320  tolua_function(tolua_S,"trait_mod",tolua_server_edit_trait_mod00);
1321  tolua_function(tolua_S,"unleash_barbarians",tolua_server_edit_unleash_barbarians00);
1322  tolua_function(tolua_S,"place_partisans",tolua_server_edit_place_partisans00);
1323  tolua_constant(tolua_S,"GLOBAL_WARMING",CLIMATE_CHANGE_GLOBAL_WARMING);
1324  tolua_constant(tolua_S,"NUCLEAR_WINTER",CLIMATE_CHANGE_NUCLEAR_WINTER);
1325  tolua_function(tolua_S,"climate_change",tolua_server_edit_climate_change00);
1326  tolua_function(tolua_S,"civil_war",tolua_server_edit_civil_war00);
1327  tolua_function(tolua_S,"unit_turn",tolua_server_edit_unit_turn00);
1328  tolua_function(tolua_S,"player_victory",tolua_server_edit_player_victory00);
1329  tolua_function(tolua_S,"unit_move",tolua_server_edit_unit_move00);
1330  tolua_function(tolua_S,"add_city_history",tolua_server_edit_add_city_history00);
1331  tolua_function(tolua_S,"add_player_history",tolua_server_edit_add_player_history00);
1332  tolua_endmodule(tolua_S);
1333 
1334  { /* begin embedded lua code */
1335  static unsigned char B[] = {
1336   10,102,117,110, 99,116,105,111,110, 32, 99,114,101, 97,116,
1337  101, 95,117,110,105,116, 40,112,108, 97,121,101,114, 44, 32,
1338  116,105,108,101, 44, 32,117,116,121,112,101, 44, 32,118,101,
1339  116,101,114, 97,110, 95,108,101,118,101,108, 44, 32,104,111,
1340  109,101, 99,105,116,121, 44, 32,109,111,118,101,115, 95,108,
1341  101,102,116, 41, 10,108,111,103, 46,100,101,112,114,101, 99,
1342   97,116,105,111,110, 95,119, 97,114,110,105,110,103, 40, 34,
1343   99,114,101, 97,116,101, 95,117,110,105,116, 40, 41, 34, 44,
1344   32, 34,101,100,105,116, 46, 99,114,101, 97,116,101, 95,117,
1345  110,105,116, 40, 41, 34, 44, 10, 34, 50, 46, 52, 34, 41, 59,
1346   10,114,101,116,117,114,110, 32,101,100,105,116, 46, 99,114,
1347  101, 97,116,101, 95,117,110,105,116, 40,112,108, 97,121,101,
1348  114, 44, 32,116,105,108,101, 44, 32,117,116,121,112,101, 44,
1349   32,118,101,116,101,114, 97,110, 95,108,101,118,101,108, 44,
1350   32,104,111,109,101, 99,105,116,121, 44, 10,109,111,118,101,
1351  115, 95,108,101,102,116, 41, 10,101,110,100, 10,102,117,110,
1352   99,116,105,111,110, 32, 99,114,101, 97,116,101, 95,117,110,
1353  105,116, 95,102,117,108,108, 40,112,108, 97,121,101,114, 44,
1354   32,116,105,108,101, 44, 32,117,116,121,112,101, 44, 32,118,
1355  101,116,101,114, 97,110, 95,108,101,118,101,108, 44, 32,104,
1356  111,109,101, 99,105,116,121, 44, 10,109,111,118,101,115, 95,
1357  108,101,102,116, 44, 32,104,112, 95,108,101,102,116, 44, 32,
1358  116,114, 97,110,115,112,111,114,116, 41, 10,108,111,103, 46,
1359  100,101,112,114,101, 99, 97,116,105,111,110, 95,119, 97,114,
1360  110,105,110,103, 40, 34, 99,114,101, 97,116,101, 95,117,110,
1361  105,116, 95,102,117,108,108, 40, 41, 34, 44, 32, 34,101,100,
1362  105,116, 46, 99,114,101, 97,116,101, 95,117,110,105,116, 95,
1363  102,117,108,108, 40, 41, 34, 44, 10, 34, 50, 46, 52, 34, 41,
1364   59, 10,114,101,116,117,114,110, 32,101,100,105,116, 46, 99,
1365  114,101, 97,116,101, 95,117,110,105,116, 95,102,117,108,108,
1366   40,112,108, 97,121,101,114, 44, 32,116,105,108,101, 44, 32,
1367  117,116,121,112,101, 44, 32,118,101,116,101,114, 97,110, 95,
1368  108,101,118,101,108, 44, 32,104,111,109,101, 99,105,116,121,
1369   44, 10,109,111,118,101,115, 95,108,101,102,116, 44, 32,104,
1370  112, 95,108,101,102,116, 44, 32,116,114, 97,110,115,112,111,
1371  114,116, 41, 10,101,110,100, 10,102,117,110, 99,116,105,111,
1372  110, 32, 99,114,101, 97,116,101, 95, 99,105,116,121, 40,112,
1373  108, 97,121,101,114, 44, 32,116,105,108,101, 44, 32,110, 97,
1374  109,101, 41, 10,108,111,103, 46,100,101,112,114,101, 99, 97,
1375  116,105,111,110, 95,119, 97,114,110,105,110,103, 40, 34, 99,
1376  114,101, 97,116,101, 95, 99,105,116,121, 40, 41, 34, 44, 32,
1377   34,101,100,105,116, 46, 99,114,101, 97,116,101, 95, 99,105,
1378  116,121, 40, 41, 34, 44, 10, 34, 50, 46, 52, 34, 41, 59, 10,
1379  101,100,105,116, 46, 99,114,101, 97,116,101, 95, 99,105,116,
1380  121, 32, 40,112,108, 97,121,101,114, 44, 32,116,105,108,101,
1381   44, 32,110, 97,109,101, 41, 10,101,110,100, 10,102,117,110,
1382   99,116,105,111,110, 32, 99,114,101, 97,116,101, 95, 98, 97,
1383  115,101, 40,116,105,108,101, 44, 32,110, 97,109,101, 44, 32,
1384  112,108, 97,121,101,114, 41, 10,108,111,103, 46,100,101,112,
1385  114,101, 99, 97,116,105,111,110, 95,119, 97,114,110,105,110,
1386  103, 40, 34, 99,114,101, 97,116,101, 95, 98, 97,115,101, 40,
1387   41, 34, 44, 32, 34,101,100,105,116, 46, 99,114,101, 97,116,
1388  101, 95, 98, 97,115,101, 40, 41, 34, 44, 10, 34, 50, 46, 52,
1389   34, 41, 59, 10,101,100,105,116, 46, 99,114,101, 97,116,101,
1390   95, 98, 97,115,101, 40,116,105,108,101, 44, 32,110, 97,109,
1391  101, 44, 32,112,108, 97,121,101,114, 41, 10,101,110,100, 10,
1392  102,117,110, 99,116,105,111,110, 32, 99,114,101, 97,116,101,
1393   95,112,108, 97,121,101,114, 40,117,115,101,114,110, 97,109,
1394  101, 44, 32,110, 97,116,105,111,110, 41, 10,108,111,103, 46,
1395  100,101,112,114,101, 99, 97,116,105,111,110, 95,119, 97,114,
1396  110,105,110,103, 40, 34, 99,114,101, 97,116,101, 95,112,108,
1397   97,121,101,114, 40, 41, 34, 44, 32, 34,101,100,105,116, 46,
1398   99,114,101, 97,116,101, 95,112,108, 97,121,101,114, 40, 41,
1399   34, 44, 10, 34, 50, 46, 52, 34, 41, 59, 10,114,101,116,117,
1400  114,110, 32,101,100,105,116, 46, 99,114,101, 97,116,101, 95,
1401  112,108, 97,121,101,114, 40,117,115,101,114,110, 97,109,101,
1402   44, 32,110, 97,116,105,111,110, 44, 32,110,105,108, 41, 10,
1403  101,110,100, 10,102,117,110, 99,116,105,111,110, 32, 99,104,
1404   97,110,103,101, 95,103,111,108,100, 40,112,112,108, 97,121,
1405  101,114, 44, 32, 97,109,111,117,110,116, 41, 10,108,111,103,
1406   46,100,101,112,114,101, 99, 97,116,105,111,110, 95,119, 97,
1407  114,110,105,110,103, 40, 34, 99,104, 97,110,103,101, 95,103,
1408  111,108,100, 40, 41, 34, 44, 32, 34,101,100,105,116, 46, 99,
1409  104, 97,110,103,101, 95,103,111,108,100, 40, 41, 34, 44, 10,
1410   34, 50, 46, 52, 34, 41, 59, 10,101,100,105,116, 46, 99,104,
1411   97,110,103,101, 95,103,111,108,100, 40,112,112,108, 97,121,
1412  101,114, 44, 32, 97,109,111,117,110,116, 41, 10,101,110,100,
1413   10,102,117,110, 99,116,105,111,110, 32,103,105,118,101, 95,
1414  116,101, 99,104,110,111,108,111,103,121, 40,112,108, 97,121,
1415  101,114, 44, 32,116,101, 99,104, 44, 32,114,101, 97,115,111,
1416  110, 41, 10,108,111,103, 46,100,101,112,114,101, 99, 97,116,
1417  105,111,110, 95,119, 97,114,110,105,110,103, 40, 34,103,105,
1418  118,101, 95,116,101, 99,104,110,111,108,111,103,121, 40, 41,
1419   34, 44, 32, 34,101,100,105,116, 46,103,105,118,101, 95,116,
1420  101, 99,104, 40, 41, 34, 44, 10, 34, 50, 46, 52, 34, 41, 59,
1421   10,114,101,116,117,114,110, 32,101,100,105,116, 46,103,105,
1422  118,101, 95,116,101, 99,104, 40,112,108, 97,121,101,114, 44,
1423   32,116,101, 99,104, 44, 32, 45, 49, 44, 32,102, 97,108,115,
1424  101, 44, 32,114,101, 97,115,111,110, 41, 10,101,110,100, 10,
1425  102,117,110, 99,116,105,111,110, 32,101,100,105,116, 46,103,
1426  105,118,101, 95,116,101, 99,104,110,111,108,111,103,121, 40,
1427  112,108, 97,121,101,114, 44, 32,116,101, 99,104, 44, 32,114,
1428  101, 97,115,111,110, 41, 10,108,111,103, 46,100,101,112,114,
1429  101, 99, 97,116,105,111,110, 95,119, 97,114,110,105,110,103,
1430   40, 34,101,100,105,116, 46,103,105,118,101, 95,116,101, 99,
1431  104,110,111,108,111,103,121, 40, 41, 34, 44, 32, 34,101,100,
1432  105,116, 46,103,105,118,101, 95,116,101, 99,104, 40, 41, 34,
1433   44, 10, 34, 50, 46, 54, 34, 41, 59, 10,114,101,116,117,114,
1434  110, 32,101,100,105,116, 46,103,105,118,101, 95,116,101, 99,
1435  104, 40,112,108, 97,121,101,114, 44, 32,116,101, 99,104, 44,
1436   32, 45, 49, 44, 32,102, 97,108,115,101, 44, 32,114,101, 97,
1437  115,111,110, 41, 10,101,110,100, 10,102,117,110, 99,116,105,
1438  111,110, 32,116,114, 97,105,116, 95,109,111,100, 40,112,108,
1439   97,121,101,114, 44, 32,116,114, 97,105,116, 44, 32,109,111,
1440  100, 41, 10,108,111,103, 46,100,101,112,114,101, 99, 97,116,
1441  105,111,110, 95,119, 97,114,110,105,110,103, 40, 34,116,114,
1442   97,105,116, 95,109,111,100, 40, 41, 34, 44, 32, 34,101,100,
1443  105,116, 46,116,114, 97,105,116, 95,109,111,100, 40, 41, 34,
1444   44, 10, 34, 50, 46, 52, 34, 41, 59, 10,114,101,116,117,114,
1445  110, 32,101,100,105,116, 46,116,114, 97,105,116, 95,109,111,
1446  100, 40,112,108, 97,121,101,114, 44, 32,116,114, 97,105,116,
1447   44, 32,109,111,100, 41, 10,101,110,100, 10,102,117,110, 99,
1448  116,105,111,110, 32,117,110,108,101, 97,115,104, 95, 98, 97,
1449  114, 98, 97,114,105, 97,110,115, 40,116,105,108,101, 41, 10,
1450  108,111,103, 46,100,101,112,114,101, 99, 97,116,105,111,110,
1451   95,119, 97,114,110,105,110,103, 40, 34,117,110,108,101, 97,
1452  115,104, 95, 98, 97,114, 98, 97,114,105, 97,110,115, 40, 41,
1453   34, 44, 32, 34,101,100,105,116, 46,117,110,108,101, 97,115,
1454  104, 95, 98, 97,114, 98, 97,114,105, 97,110,115, 40, 41, 34,
1455   44, 10, 34, 50, 46, 52, 34, 41, 59, 10,114,101,116,117,114,
1456  110, 32,101,100,105,116, 46,117,110,108,101, 97,115,104, 95,
1457   98, 97,114, 98, 97,114,105, 97,110,115, 40,116,105,108,101,
1458   41, 10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32,
1459  112,108, 97, 99,101, 95,112, 97,114,116,105,115, 97,110,115,
1460   40,116,105,108,101, 44, 32,112,108, 97,121,101,114, 44, 32,
1461   99,111,117,110,116, 44, 32,115,113, 95,114, 97,100,105,117,
1462  115, 41, 10,108,111,103, 46,100,101,112,114,101, 99, 97,116,
1463  105,111,110, 95,119, 97,114,110,105,110,103, 40, 34,112,108,
1464   97, 99,101, 95,112, 97,114,116,105,115, 97,110,115, 40, 41,
1465   34, 44, 32, 34,101,100,105,116, 46,112,108, 97, 99,101, 95,
1466  112, 97,114,116,105,115, 97,110,115, 40, 41, 34, 44, 10, 34,
1467   50, 46, 52, 34, 41, 59, 10,101,100,105,116, 46,112,108, 97,
1468   99,101, 95,112, 97,114,116,105,115, 97,110,115, 40,116,105,
1469  108,101, 44, 32,112,108, 97,121,101,114, 44, 32, 99,111,117,
1470  110,116, 44, 32,115,113, 95,114, 97,100,105,117,115, 41, 10,
1471  101,110,100, 10,102,117,110, 99,116,105,111,110, 32, 80,108,
1472   97,121,101,114, 58, 99,114,101, 97,116,101, 95,117,110,105,
1473  116, 40,116,105,108,101, 44, 32,117,116,121,112,101, 44, 32,
1474  118,101,116,101,114, 97,110, 95,108,101,118,101,108, 44, 32,
1475  104,111,109,101, 99,105,116,121, 44, 32,109,111,118,101,115,
1476   95,108,101,102,116, 41, 10,114,101,116,117,114,110, 32,101,
1477  100,105,116, 46, 99,114,101, 97,116,101, 95,117,110,105,116,
1478   40,115,101,108,102, 44, 32,116,105,108,101, 44, 32,117,116,
1479  121,112,101, 44, 32,118,101,116,101,114, 97,110, 95,108,101,
1480  118,101,108, 44, 32,104,111,109,101, 99,105,116,121, 44, 10,
1481  109,111,118,101,115, 95,108,101,102,116, 41, 10,101,110,100,
1482   10,102,117,110, 99,116,105,111,110, 32, 80,108, 97,121,101,
1483  114, 58, 99,114,101, 97,116,101, 95,117,110,105,116, 95,102,
1484  117,108,108, 40,116,105,108,101, 44, 32,117,116,121,112,101,
1485   44, 32,118,101,116,101,114, 97,110, 95,108,101,118,101,108,
1486   44, 32,104,111,109,101, 99,105,116,121, 44, 10,109,111,118,
1487  101,115, 95,108,101,102,116, 44, 32,104,112, 95,108,101,102,
1488  116, 44, 32,112,116,114, 97,110,115,112,111,114,116, 41, 10,
1489  114,101,116,117,114,110, 32,101,100,105,116, 46, 99,114,101,
1490   97,116,101, 95,117,110,105,116, 95,102,117,108,108, 40,115,
1491  101,108,102, 44, 32,116,105,108,101, 44, 32,117,116,121,112,
1492  101, 44, 32,118,101,116,101,114, 97,110, 95,108,101,118,101,
1493  108, 44, 32,104,111,109,101, 99,105,116,121, 44, 10,109,111,
1494  118,101,115, 95,108,101,102,116, 44, 32,104,112, 95,108,101,
1495  102,116, 44, 32,112,116,114, 97,110,115,112,111,114,116, 41,
1496   10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32, 80,
1497  108, 97,121,101,114, 58, 99,105,118,105,108,105,122, 97,116,
1498  105,111,110, 95,115, 99,111,114,101, 40, 41, 10,114,101,116,
1499  117,114,110, 32,115,101,114,118,101,114, 46, 99,105,118,105,
1500  108,105,122, 97,116,105,111,110, 95,115, 99,111,114,101, 40,
1501  115,101,108,102, 41, 10,101,110,100, 10,102,117,110, 99,116,
1502  105,111,110, 32, 80,108, 97,121,101,114, 58, 99,114,101, 97,
1503  116,101, 95, 99,105,116,121, 40,116,105,108,101, 44, 32,110,
1504   97,109,101, 41, 10,101,100,105,116, 46, 99,114,101, 97,116,
1505  101, 95, 99,105,116,121, 40,115,101,108,102, 44, 32,116,105,
1506  108,101, 44, 32,110, 97,109,101, 41, 10,101,110,100, 10,102,
1507  117,110, 99,116,105,111,110, 32, 80,108, 97,121,101,114, 58,
1508   99,104, 97,110,103,101, 95,103,111,108,100, 40, 97,109,111,
1509  117,110,116, 41, 10,101,100,105,116, 46, 99,104, 97,110,103,
1510  101, 95,103,111,108,100, 40,115,101,108,102, 44, 32, 97,109,
1511  111,117,110,116, 41, 10,101,110,100, 10,102,117,110, 99,116,
1512  105,111,110, 32, 80,108, 97,121,101,114, 58,103,105,118,101,
1513   95,116,101, 99,104, 40,116,101, 99,104, 44, 32, 99,111,115,
1514  116, 44, 32,110,111,116,105,102,121, 44, 32,114,101, 97,115,
1515  111,110, 41, 10,114,101,116,117,114,110, 32,101,100,105,116,
1516   46,103,105,118,101, 95,116,101, 99,104, 40,115,101,108,102,
1517   44, 32,116,101, 99,104, 44, 32, 99,111,115,116, 44, 32,110,
1518  111,116,105,102,121, 44, 32,114,101, 97,115,111,110, 41, 10,
1519  101,110,100, 10,102,117,110, 99,116,105,111,110, 32, 80,108,
1520   97,121,101,114, 58,103,105,118,101, 95,116,101, 99,104,110,
1521  111,108,111,103,121, 40,116,101, 99,104, 44, 32,114,101, 97,
1522  115,111,110, 41, 10,108,111,103, 46,100,101,112,114,101, 99,
1523   97,116,105,111,110, 95,119, 97,114,110,105,110,103, 40, 34,
1524   80,108, 97,121,101,114, 58,103,105,118,101, 95,116,101, 99,
1525  104,110,111,108,111,103,121, 40, 41, 34, 44, 32, 34, 80,108,
1526   97,121,101,114, 58,103,105,118,101, 95,116,101, 99,104, 40,
1527   41, 34, 44, 10, 34, 50, 46, 54, 34, 41, 59, 10,114,101,116,
1528  117,114,110, 32,101,100,105,116, 46,103,105,118,101, 95,116,
1529  101, 99,104, 40,115,101,108,102, 44, 32,116,101, 99,104, 44,
1530   32, 45, 49, 44, 32,102, 97,108,115,101, 44, 32,114,101, 97,
1531  115,111,110, 41, 10,101,110,100, 10,102,117,110, 99,116,105,
1532  111,110, 32, 80,108, 97,121,101,114, 58,116,114, 97,105,116,
1533   95,109,111,100, 40,116,114, 97,105,116, 44, 32,109,111,100,
1534   41, 10,114,101,116,117,114,110, 32,101,100,105,116, 46,116,
1535  114, 97,105,116, 95,109,111,100, 40,115,101,108,102, 44, 32,
1536  116,114, 97,105,116, 44, 32,109,111,100, 41, 10,101,110,100,
1537   10,102,117,110, 99,116,105,111,110, 32, 80,108, 97,121,101,
1538  114, 58, 99,105,118,105,108, 95,119, 97,114, 40,112,114,111,
1539   98, 97, 98,105,108,105,116,121, 41, 10,114,101,116,117,114,
1540  110, 32,101,100,105,116, 46, 99,105,118,105,108, 95,119, 97,
1541  114, 40,115,101,108,102, 44, 32,112,114,111, 98, 97, 98,105,
1542  108,105,116,121, 41, 10,101,110,100, 10,102,117,110, 99,116,
1543  105,111,110, 32, 80,108, 97,121,101,114, 58,118,105, 99,116,
1544  111,114,121, 40, 41, 10,101,100,105,116, 46,112,108, 97,121,
1545  101,114, 95,118,105, 99,116,111,114,121, 40,115,101,108,102,
1546   41, 10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32,
1547   80,108, 97,121,101,114, 58, 97,100,100, 95,104,105,115,116,
1548  111,114,121, 40, 97,109,111,117,110,116, 41, 10,101,100,105,
1549  116, 46, 97,100,100, 95,112,108, 97,121,101,114, 95,104,105,
1550  115,116,111,114,121, 40,115,101,108,102, 44, 32, 97,109,111,
1551  117,110,116, 41, 10,101,110,100, 10,102,117,110, 99,116,105,
1552  111,110, 32, 67,105,116,121, 58, 97,100,100, 95,104,105,115,
1553  116,111,114,121, 40, 97,109,111,117,110,116, 41, 10,101,100,
1554  105,116, 46, 97,100,100, 95, 99,105,116,121, 95,104,105,115,
1555  116,111,114,121, 40,115,101,108,102, 44, 32, 97,109,111,117,
1556  110,116, 41, 10,101,110,100, 10,102,117,110, 99,116,105,111,
1557  110, 32, 85,110,105,116, 58,116,101,108,101,112,111,114,116,
1558   40,100,101,115,116, 41, 10,114,101,116,117,114,110, 32,101,
1559  100,105,116, 46,117,110,105,116, 95,116,101,108,101,112,111,
1560  114,116, 40,115,101,108,102, 44, 32,100,101,115,116, 41, 10,
1561  101,110,100, 10,102,117,110, 99,116,105,111,110, 32, 85,110,
1562  105,116, 58,116,117,114,110, 40,100,105,114,101, 99,116,105,
1563  111,110, 41, 10,101,100,105,116, 46,117,110,105,116, 95,116,
1564  117,114,110, 40,115,101,108,102, 44, 32,100,105,114,101, 99,
1565  116,105,111,110, 41, 10,101,110,100, 10,102,117,110, 99,116,
1566  105,111,110, 32, 85,110,105,116, 58,107,105,108,108, 40,114,
1567  101, 97,115,111,110, 44, 32,107,105,108,108,101,114, 41, 10,
1568  101,100,105,116, 46,117,110,105,116, 95,107,105,108,108, 40,
1569  115,101,108,102, 44, 32,114,101, 97,115,111,110, 44, 32,107,
1570  105,108,108,101,114, 41, 10,101,110,100, 10,102,117,110, 99,
1571  116,105,111,110, 32, 85,110,105,116, 58,109,111,118,101, 40,
1572  109,111,118,101,116,111, 44, 32,109,111,118,101, 99,111,115,
1573  116, 41, 10,114,101,116,117,114,110, 32,101,100,105,116, 46,
1574  117,110,105,116, 95,109,111,118,101, 40,115,101,108,102, 44,
1575   32,109,111,118,101,116,111, 44, 32,109,111,118,101, 99,111,
1576  115,116, 41, 10,101,110,100, 10,102,117,110, 99,116,105,111,
1577  110, 32, 84,105,108,101, 58, 99,114,101, 97,116,101, 95,101,
1578  120,116,114, 97, 40,110, 97,109,101, 41, 10,101,100,105,116,
1579   46, 99,114,101, 97,116,101, 95,101,120,116,114, 97, 40,115,
1580  101,108,102, 44, 32,110, 97,109,101, 41, 10,101,110,100, 10,
1581  102,117,110, 99,116,105,111,110, 32, 84,105,108,101, 58, 99,
1582  114,101, 97,116,101, 95, 98, 97,115,101, 40,110, 97,109,101,
1583   44, 32,112,108, 97,121,101,114, 41, 10,101,100,105,116, 46,
1584   99,114,101, 97,116,101, 95, 98, 97,115,101, 40,115,101,108,
1585  102, 44, 32,110, 97,109,101, 44, 32,112,108, 97,121,101,114,
1586   41, 10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32,
1587   84,105,108,101, 58, 99,114,101, 97,116,101, 95,114,111, 97,
1588  100, 40,110, 97,109,101, 41, 10,108,111,103, 46,100,101,112,
1589  114,101, 99, 97,116,105,111,110, 95,119, 97,114,110,105,110,
1590  103, 40, 34, 84,105,108,101, 58, 99,114,101, 97,116,101, 95,
1591  114,111, 97,100, 40, 41, 34, 44, 32, 34, 84,105,108,101, 58,
1592   99,114,101, 97,116,101, 95,101,120,116,114, 97, 40, 41, 34,
1593   44, 10, 34, 50, 46, 54, 34, 41, 59, 10,101,100,105,116, 46,
1594   99,114,101, 97,116,101, 95,114,111, 97,100, 40,115,101,108,
1595  102, 44, 32,110, 97,109,101, 41, 10,101,110,100, 10,102,117,
1596  110, 99,116,105,111,110, 32, 84,105,108,101, 58,114,101,109,
1597  111,118,101, 95,101,120,116,114, 97, 40,110, 97,109,101, 41,
1598   10,101,100,105,116, 46,114,101,109,111,118,101, 95,101,120,
1599  116,114, 97, 40,115,101,108,102, 44, 32,110, 97,109,101, 41,
1600   10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32, 84,
1601  105,108,101, 58,117,110,108,101, 97,115,104, 95, 98, 97,114,
1602   98, 97,114,105, 97,110,115, 40, 41, 10,114,101,116,117,114,
1603  110, 32,101,100,105,116, 46,117,110,108,101, 97,115,104, 95,
1604   98, 97,114, 98, 97,114,105, 97,110,115, 40,115,101,108,102,
1605   41, 10,101,110,100, 10,102,117,110, 99,116,105,111,110, 32,
1606   84,105,108,101, 58,112,108, 97, 99,101, 95,112, 97,114,116,
1607  105,115, 97,110,115, 40,112,108, 97,121,101,114, 44, 32, 99,
1608  111,117,110,116, 44, 32,115,113, 95,114, 97,100,105,117,115,
1609   41, 10,101,100,105,116, 46,112,108, 97, 99,101, 95,112, 97,
1610  114,116,105,115, 97,110,115, 40,115,101,108,102, 44, 32,112,
1611  108, 97,121,101,114, 44, 32, 99,111,117,110,116, 44, 32,115,
1612  113, 95,114, 97,100,105,117,115, 41, 10,101,110,100, 10,102,
1613  117,110, 99,116,105,111,110, 32, 84,105,108,101, 58,115,101,
1614  116, 95,108, 97, 98,101,108, 40,108, 97, 98,101,108, 41, 10,
1615  101,100,105,116, 46,116,105,108,101, 95,115,101,116, 95,108,
1616   97, 98,101,108, 40,115,101,108,102, 44, 32,108, 97, 98,101,
1617  108, 41, 10,101,110,100,32
1618  };
1619  if (luaL_loadbuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code") == LUA_OK)
1620  lua_pcall(tolua_S,0,LUA_MULTRET,0);
1621  } /* end of embedded lua code */
1622 
1623  tolua_module(tolua_S,"Player",0);
1624  tolua_beginmodule(tolua_S,"Player");
1625  tolua_function(tolua_S,"trait",tolua_server_Player_trait00);
1626  tolua_function(tolua_S,"trait_base",tolua_server_Player_trait_base00);
1627  tolua_function(tolua_S,"trait_current_mod",tolua_server_Player_trait_current_mod00);
1628  tolua_endmodule(tolua_S);
1629  tolua_module(tolua_S,"Nation_Type",0);
1630  tolua_beginmodule(tolua_S,"Nation_Type");
1631  tolua_function(tolua_S,"trait_min",tolua_server_Nation_Type_trait_min00);
1632  tolua_function(tolua_S,"trait_max",tolua_server_Nation_Type_trait_max00);
1633  tolua_function(tolua_S,"trait_default",tolua_server_Nation_Type_trait_default00);
1634  tolua_endmodule(tolua_S);
1635  tolua_endmodule(tolua_S);
1636  return 1;
1637 }
1638 /* Open tolua function */
tolua_server_open(lua_State * tolua_S)1639 TOLUA_API int tolua_server_open (lua_State* tolua_S)
1640 {
1641  lua_pushcfunction(tolua_S, luaopen_server);
1642  lua_pushstring(tolua_S, "server");
1643  lua_call(tolua_S, 1, 0);
1644  return 1;
1645 }
1646