DELTA
SVN   ĶzĶzĶz/**********************************************************************
 Freeciv - Copyright (C) 1996-2015 - Freeciv Development Team
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
***********************************************************************/

#ifdef HAVE_CONFIG_H
#include <fc_config.h>
#endif

/* common/scriptcore */
#include "luascript.h"

/* ai */
#include "aitraits.h" /* ai_trait_get_value() */

/* server/scripting */
#include "script_server.h"

#include "api_server_game_methods.h"

/*****************************************************************************
  Return the current value of an AI trait in force (base+mod)
*****************************************************************************/
int api_methods_player_trait(lua_State *L, Player *pplayer,
                             const char *trait_name)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_SELF(L, pplayer, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, 0);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);

  return ai_trait_get_value(tr, pplayer);
}

/*****************************************************************************
  Return the current base value of an AI trait (not including Lua mod)
*****************************************************************************/
int api_methods_player_trait_base(lua_State *L, Player *pplayer,
                                  const char *trait_name)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_SELF(L, pplayer, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, 0);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);

  return pplayer->ai_common.traits[tr].val;
}

/*****************************************************************************
  Return the current Lua increment to an AI trait
  (can be changed with api_edit_trait_mod_set())
*****************************************************************************/
int api_methods_player_trait_current_mod(lua_State *L, Player *pplayer,
                                         const char *trait_name)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_SELF(L, pplayer, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, 0);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);

  return pplayer->ai_common.traits[tr].mod;
}

/*****************************************************************************
  Return the minimum random trait value that will be allocated for a nation
*****************************************************************************/
int api_methods_nation_trait_min(lua_State *L, Nation_Type *pnation,
                                 const char *trait_name)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_SELF(L, pnation, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, 0);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);

  return pnation->server.traits[tr].min;
}

/*****************************************************************************
  Return the maximum random trait value that will be allocated for a nation
*****************************************************************************/
int api_methods_nation_trait_max(lua_State *L, Nation_Type *pnation,
                                 const char *trait_name)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_SELF(L, pnation, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, 0);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);

  return pnation->server.traits[tr].max;
}

/*****************************************************************************
  Return the default trait value that will be allocated for a nation
*****************************************************************************/
int api_methods_nation_trait_default(lua_State *L, Nation_Type *pnation,
                                     const char *trait_name)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_SELF(L, pnation, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, 0);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);

  return pnation->server.traits[tr].fixed;
}
ENDREP
DELTA
SVN   ooo/**********************************************************************
 Freeciv - Copyright (C) 1996-2015 - Freeciv Development Team
   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2, or (at your option)
   any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
***********************************************************************/

#ifndef FC__API_SERVER_GAME_METHODS_H
#define FC__API_SERVER_GAME_METHODS_H

/* common/scriptcore */
#include "luascript_types.h"

/* server/scripting */
#include "api_server_edit.h"

/* Server-only methods added to the modules defined in
 * the common tolua_game.pkg. */

int api_methods_player_trait(lua_State *L, Player *pplayer,
                             const char *trait_name);
int api_methods_player_trait_base(lua_State *L, Player *pplayer,
                                  const char *trait_name);
int api_methods_player_trait_current_mod(lua_State *L, Player *pplayer,
                                         const char *trait_name);

int api_methods_nation_trait_min(lua_State *L, Nation_Type *pnation,
                                 const char *trait_name);
int api_methods_nation_trait_max(lua_State *L, Nation_Type *pnation,
                                 const char *trait_name);
int api_methods_nation_trait_default(lua_State *L, Nation_Type *pnation,
                                     const char *trait_name);

#endif /* FC__API_SERVER_GAME_METHODS_H */
ENDREP
DELTA 27705 35882 61
SVN  
Z+   Đ aigame_methods.c	\
	api_server_game_methodsENDREP
DELTA 30060 4261 27
SVN  K Ũ;  Đ	Ų_set(lua_State *L, Player *pplayer,
                            const char *trait_name, const int mod)
{
  enum trait tr;

  LUASCRIPT_CHECK_STATE(L, -1);
  LUASCRIPT_CHECK_ARG_NIL(L, pplayer, 2, Player, FALSE);
  LUASCRIPT_CHECK_ARG_NIL(L, trait_name, 3, string, FALSE);

  tr = trait_by_name(trait_name, fc_strcasecmp);

  LUASCRIPT_CHECK_ARG(L, trait_is_valid(tr), 3, "no such trait", 0);ENDREP
DELTA 29563 676 66
SVN  08W [ W *_set(lua_State *L, Player *pplayer,
                            const char *trait_name,ENDREP
DELTA 30525 0 174
SVN  Ė2Ó[    Mq Īt§>@api_server_game_methods_set
/* Additions to common Player module. */
module Player {
  int api_methods_player_trait
    @ trait (lua_State *L, Player *pplayer, const char *trait_name);
  int api_methods_player_trait_base
    @ trait_base (lua_State *L, Player *pplayer, const char *trait_name);
  int api_methods_player_trait_current_mod
    @ trait_current_mod (lua_State *L, Player *pplayer, const char *trait_name);
}

/* Additions to common Nation_Type module. */
module Nation_Type {
  int api_methods_nation_trait_min
    @ trait_min (lua_State *L, Nation_Type *pnation, const char *trait_name);
  int api_methods_nation_trait_max
    @ trait_max (lua_State *L, Nation_Type *pnation, const char *trait_name);
  int api_methods_nation_trait_default
    @ trait_default (lua_State *L, Nation_Type *pnation,
                     const char *trait_name);
}
ENDREP
id: 31z.5ck.r30526/8407
type: file
pred: 31z.5ck.r27705/61680
count: 24
text: 30526 6815 70 2010 561a3c5240ca5e61263f14fa3cf4c934
props: 10655 62 110 0 fdfdab56f53d2388a66f6a5ce0985f95
cpath: /trunk/server/scripting/Makefile.am
copyroot: 15280 /trunk

id: 32c.5ic.r30526/8659
type: file
pred: 32c.5ic.r30060/163377
count: 68
text: 30526 6913 417 16843 a3842442788ae9cf82f36d8ee30ec190
props: 10755 32706 110 0 fdfdab56f53d2388a66f6a5ce0985f95
cpath: /trunk/server/scripting/api_server_edit.c
copyroot: 20274 /trunk/server/scripting/api_server_edit.c

id: 32d.5id.r30526/8958
type: file
pred: 32d.5id.r29563/7395
count: 22
text: 30526 7357 109 3384 f508dfa40f83b83c2fba7f6d5cb02b59
props: 10395 6390 110 0 94a2a96823d3c54fff31bdd51de17982
cpath: /trunk/server/scripting/api_server_edit.h
copyroot: 20274 /trunk/server/scripting/api_server_edit.h

id: 22zw.5ck.r30526/9253
type: file
count: 0
text: 30526 0 5000 4986 95f98115c8787f255006cb20e4c05ce1
cpath: /trunk/server/scripting/api_server_game_methods.c
copyroot: 15280 /trunk

id: 22zz.5ck.r30526/9436
type: file
count: 0
text: 30526 5013 1789 1775 846a63d09a12297045a8d6461b1e07f5
cpath: /trunk/server/scripting/api_server_game_methods.h
copyroot: 15280 /trunk

id: 74d.5ck.r30526/9622
type: file
pred: 74d.5ck.r30525/201
count: 22
text: 30526 7492 890 10652 0c96dc135f44f5fde417059f8ccdd6fe
cpath: /trunk/server/scripting/tolua_server.pkg
copyroot: 15280 /trunk

PLAIN
K 11
Makefile.am
V 24
file 31z.5ck.r30526/8407
K 15
api_fcdb_auth.c
V 25
file 6la.5i8.r26905/61144
K 15
api_fcdb_auth.h
V 25
file 6lb.5i9.r26905/61484
K 15
api_fcdb_base.c
V 25
file 6l5.5ia.r26905/59261
K 15
api_fcdb_base.h
V 25
file 6l6.5ib.r26905/59900
K 17
api_server_base.c
V 24
file 75j.5ck.r27127/4851
K 17
api_server_base.h
V 24
file 75k.5ck.r27127/5110
K 17
api_server_edit.c
V 24
file 32c.5ic.r30526/8659
K 17
api_server_edit.h
V 24
file 32d.5id.r30526/8958
K 25
api_server_game_methods.c
V 25
file 22zw.5ck.r30526/9253
K 25
api_server_game_methods.h
V 25
file 22zz.5ck.r30526/9436
K 19
api_server_notify.c
V 24
file 325.5ie.r30484/1002
K 19
api_server_notify.h
V 24
file 326.5if.r30484/1299
K 13
script_fcdb.c
V 25
file 6l7.5ck.r26905/59601
K 13
script_fcdb.h
V 25
file 6l8.5ck.r26905/60238
K 15
script_server.c
V 25
file 328.5ig.r30156/45508
K 15
script_server.h
V 24
file 329.5ih.r27543/2384
K 14
tolua_fcdb.pkg
V 25
file 6l9.5ck.r24496/13807
K 16
tolua_server.pkg
V 24
file 74d.5ck.r30526/9622
END
ENDREP
id: 31x.5ck.r30526/10848
type: dir
pred: 31x.5ck.r30525/1301
count: 268
text: 30526 9824 1011 0 87f6186b427a2dbf49bb2c028d4db10c
props: 20297 0 141 0 0e1185e28fae1bc27fafb1dc5525bf7c
cpath: /trunk/server/scripting
copyroot: 15280 /trunk

PLAIN
K 11
Makefile.am
V 24
file 5q.5ck.r28427/16272
K 13
actiontools.c
V 25
file 1p83.5ck.r30416/4277
K 13
actiontools.h
V 25
file 1p86.5ck.r30416/4466
K 8
advisors
V 24
dir 4n2.5ck.r30513/31122
K 9
aiiface.c
V 25
file 4gm.5ck.r26905/55786
K 9
aiiface.h
V 25
file 4gn.5ck.r26905/56374
K 9
animals.c
V 25
file vnk.5ck.r30328/88390
K 9
animals.h
V 25
file vnm.5ck.r26905/63257
K 6
auth.c
V 25
file 39c.5ck.r20274/32101
K 6
auth.h
V 25
file 39d.5ck.r18977/19170
K 11
barbarian.c
V 24
file lw.5ck.r30328/88634
K 11
barbarian.h
V 23
file lx.5ck.r28605/1460
K 14
citizenshand.c
V 25
file 6mz.5ck.r29645/54068
K 14
citizenshand.h
V 25
file 6n0.5ck.r26905/56662
K 10
cityhand.c
V 23
file 10.5ck.r29621/7077
K 10
cityhand.h
V 23
file 4f.0.r13297/423686
K 11
citytools.c
V 22
file 4g.5ck.r30385/297
K 11
citytools.h
V 24
file 4h.5ck.r29273/23520
K 10
cityturn.c
V 22
file 4i.5ck.r30521/713
K 10
cityturn.h
V 24
file 4j.5ck.r24742/16670
K 11
civserver.c
V 24
file 4k.5ck.r30359/19184
K 10
commands.c
V 26
file 2ly.5ck.r27912/171920
K 10
commands.h
V 25
file 2lz.5ck.r28012/47664
K 13
connecthand.c
V 25
file 2dw.5ck.r30328/89126
K 13
connecthand.h
V 24
file 2dx.5ck.r23606/2057
K 9
console.c
V 24
file dd.5ck.r24895/15492
K 9
console.h
V 23
file de.5ck.r19183/7918
K 10
diplhand.c
V 24
file 4m.5ck.r30328/89376
K 10
diplhand.h
V 23
file 4n.5ck.r27517/8916
K 11
diplomats.c
V 23
file vz.5ck.r30201/4473
K 11
diplomats.h
V 23
file w0.5ck.r29361/9281
K 10
edithand.c
V 26
file 3bk.5ck.r30060/162112
K 10
edithand.h
V 25
file 4ez.5ck.r26905/64705
K 6
fcdb.c
V 25
file 6l3.5ck.r26905/56956
K 6
fcdb.h
V 25
file 6l4.5ck.r26905/57239
K 10
gamehand.c
V 24
file 4o.5ck.r30221/69653
K 10
gamehand.h
V 24
file 4p.5ck.r26564/23149
K 9
generator
V 24
dir 2me.5ck.r30513/32273
K 10
handchat.c
V 23
file 4q.5ck.r25915/6654
K 10
handchat.h
V 24
file dj.5ck.r18270/28229
K 9
maphand.c
V 24
file 13.5ck.r30221/72608
K 9
maphand.h
V 24
file 14.5ck.r29829/22202
K 6
meta.c
V 24
file 4s.5ck.r30393/42652
K 6
meta.h
V 23
file 4t.5ck.r27204/3095
K 6
mood.c
V 26
file 112c.5ck.r26905/63547
K 6
mood.h
V 26
file 112e.5ck.r26905/64129
K 8
notify.c
V 25
file 4i2.5ck.r26905/57814
K 8
notify.h
V 25
file 4i3.5ck.r26905/58681
K 9
plrhand.c
V 22
file 4u.5ck.r30400/605
K 9
plrhand.h
V 22
file 4v.5ck.r29629/440
K 8
report.c
V 24
file vi.5ck.r30328/90100
K 8
report.h
V 23
file vj.5ck.r29899/8035
K 10
rscompat.c
V 27
file 1kte.5ck.r30051/102453
K 10
rscompat.h
V 26
file 1ktg.5ck.r28753/34226
K 10
rssanity.c
V 25
file hew.5ck.r30513/32514
K 10
rssanity.h
V 25
file hey.5ck.r26905/55500
K 9
ruleset.c
V 24
file 8w.5ck.r30330/29870
K 9
ruleset.h
V 24
file 8x.5ck.r30102/20190
K 13
sanitycheck.c
V 22
file wi.5ck.r30486/101
K 13
sanitycheck.h
V 24
file wj.5ck.r28075/17176
K 12
savecompat.c
V 22
file qva.5ck.r30241/61
K 12
savecompat.h
V 24
file qvc.5ck.r30202/8414
K 10
savegame.c
V 23
file vl.5ck.r30475/1568
K 10
savegame.h
V 24
file vm.5ck.r20758/19233
K 11
savegame2.c
V 24
file 4m0.5ck.r30366/6203
K 11
savegame2.h
V 25
file 4m1.5ck.r27478/65017
K 11
savegame3.c
V 24
file 4m0.5ql.r30366/6449
K 11
savegame3.h
V 25
file 4m1.5qm.r27478/64506
K 7
score.c
V 25
file 2eg.5ck.r29645/57467
K 7
score.h
V 24
file 2eh.5ck.r21929/6179
K 9
scripting
V 24
dir 31x.5ck.r30526/10848
K 8
sernet.c
V 24
file 15.5ck.r30393/42892
K 8
sernet.h
V 23
file 4y.5ck.r23685/5129
K 10
settings.c
V 25
file 2m0.5ck.r30330/30114
K 10
settings.h
V 23
file 2m1.5ck.r29779/937
K 11
spacerace.c
V 24
file 9a.5ck.r25063/30975
K 11
spacerace.h
V 21
file 9b.0.r11338/1129
K 9
srv_log.c
V 25
file 15t.5el.r28853/27603
K 9
srv_log.h
V 25
file 15u.5em.r28012/47157
K 10
srv_main.c
V 21
file vg.5ck.r30487/67
K 10
srv_main.h
V 24
file vh.5ck.r29281/23933
K 11
stdinhand.c
V 24
file 4z.5ck.r30328/91844
K 11
stdinhand.h
V 24
file 50.5ck.r26100/15471
K 11
techtools.c
V 23
file 33n.5ck.r30453/546
K 11
techtools.h
V 24
file 33o.5ck.r27058/2134
K 10
unithand.c
V 23
file 18.5ck.r30416/4657
K 10
unithand.h
V 23
file 19.5ck.r30154/1851
K 11
unittools.c
V 24
file 1a.5ck.r30513/32760
K 11
unittools.h
V 24
file 1b.5ck.r29998/15685
K 8
voting.c
V 25
file 4ex.5ck.r26905/57525
K 8
voting.h
V 25
file 4ey.5ck.r26905/58399
END
ENDREP
id: z.5ck.r30526/15238
type: dir
pred: z.5ck.r30525/5687
count: 6282
text: 30526 11086 4139 0 6255a97c2cd062396a138e10e597cdd2
props: 23990 448 166 0 e5026e1cb18fe57b41417951bfac7b19
cpath: /trunk/server
copyroot: 15280 /trunk

PLAIN
K 9
ABOUT-NLS
V 24
file fu.5ck.r27270/69307
K 7
AUTHORS
V 24
file 5u.5ck.r22143/14016
K 7
COPYING
V 22
file 1h.5ck.r29454/952
K 9
ChangeLog
V 26
file 6l.5ck.r27473/7455495
K 7
INSTALL
V 21
file 6.5ck.r30188/957
K 11
Makefile.am
V 23
file 59.5ck.r30425/6590
K 4
NEWS
V 24
file 6m.5ck.r25634/30702
K 6
README
V 20
file 7.0.r4421/96382
K 2
ai
V 21
dir 8.5ck.r30417/4267
K 10
autogen.sh
V 24
file 12o.5ck.r30108/3341
K 9
bootstrap
V 23
dir 2p5.5ck.r30188/3443
K 6
client
V 21
dir d.5ck.r30524/4876
K 6
common
V 22
dir p.5ck.r30513/29632
K 12
configure.ac
V 23
file 149.5ck.r30403/257
K 4
data
V 21
dir w.5ck.r30518/6649
K 12
dependencies
V 24
dir 2yu.5ck.r30393/41914
K 3
doc
V 23
dir k7.5ck.r30310/25841
K 10
fc_version
V 23
file 2lo.5en.r30446/150
K 11
gen_headers
V 25
dir 1hsw.5ck.r30393/42473
K 2
m4
V 23
dir 12p.5ck.r30492/2378
K 7
scripts
V 23
dir 2yo.5ck.r28716/5421
K 6
server
V 22
dir z.5ck.r30526/15238
K 5
tests
V 23
dir 2g9.5ck.r27783/1363
K 5
tools
V 23
dir 4pj.5js.r30468/2741
K 12
translations
V 24
dir t0a.5ck.r30188/21451
K 7
utility
V 23
dir 1c.5ck.r30393/51329
K 5
win32
V 23
dir 2eu.5ck.r30465/1964
END
ENDREP
id: 3.5ck.r30526/16599
type: dir
pred: 3.5ck.r30525/7045
count: 20281
text: 30526 15466 1120 0 2043d2380f71f35906058bd62dc3a59c
props: 28036 14655 292 0 9e1d5de0253c723466868990c52c129f
cpath: /trunk
copyroot: 15280 /trunk

PLAIN
K 8
branches
V 19
dir 1.0.r30523/6604
K 4
tags
V 19
dir 2.0.r29519/6475
K 5
trunk
V 22
dir 3.5ck.r30526/16599
K 7
website
V 21
dir 3ge.0.r30021/1531
END
ENDREP
id: 0.0.r30526/16989
type: dir
pred: 0.0.r30525/7432
count: 30526
text: 30526 16823 153 0 2540ea4bb94955766ea865730c3953c4
cpath: /
copyroot: 0 /

31z.5ck.t30525-1 modify true false /trunk/server/scripting/Makefile.am

32c.5ic.t30525-1 modify true false /trunk/server/scripting/api_server_edit.c

32d.5id.t30525-1 modify true false /trunk/server/scripting/api_server_edit.h

_3.5ck.t30525-1 add true false /trunk/server/scripting/api_server_game_methods.c

_6.5ck.t30525-1 add true false /trunk/server/scripting/api_server_game_methods.h

74d.5ck.t30525-1 modify true false /trunk/server/scripting/tolua_server.pkg


16989 17136
