forked from github/server
clean the quipment interface for lua a little bit.
This commit is contained in:
parent
0270b3fb8a
commit
4cbeb03590
|
@ -29,7 +29,7 @@
|
|||
<xi:include href="config://game/strings.xml"/>
|
||||
<xi:include href="config://default/adamantium.xml"/>
|
||||
<equipment>
|
||||
<set name="first_unit">
|
||||
<set name="autoseed_unit">
|
||||
<item name="log" amount="50"/>
|
||||
<item name="stone" amount="50"/>
|
||||
<item name="iron" amount="50"/>
|
||||
|
|
|
@ -319,23 +319,6 @@ static int tolua_dice_rand(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_addequipment(lua_State * L)
|
||||
{
|
||||
const char *eqname = tolua_tostring(L, 1, 0);
|
||||
const char *iname = tolua_tostring(L, 2, 0);
|
||||
const char *value = tolua_tostring(L, 3, 0);
|
||||
int result = -1;
|
||||
if (iname != NULL) {
|
||||
const struct item_type *itype = it_find(iname);
|
||||
if (itype != NULL) {
|
||||
equipment_setitem(get_or_create_equipment(eqname), itype, value);
|
||||
result = 0;
|
||||
}
|
||||
}
|
||||
lua_pushinteger(L, result);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_get_season(lua_State * L)
|
||||
{
|
||||
int turnno = (int)tolua_tonumber(L, 1, 0);
|
||||
|
@ -1112,7 +1095,6 @@ int tolua_bindings_open(lua_State * L, const dictionary *inifile)
|
|||
tolua_function(L, TOLUA_CAST "get_season", tolua_get_season);
|
||||
tolua_function(L, TOLUA_CAST "equipment_setitem", tolua_equipment_setitem);
|
||||
tolua_function(L, TOLUA_CAST "equip_unit", tolua_equipunit);
|
||||
tolua_function(L, TOLUA_CAST "add_equipment", tolua_addequipment);
|
||||
tolua_function(L, TOLUA_CAST "atoi36", tolua_atoi36);
|
||||
tolua_function(L, TOLUA_CAST "itoa36", tolua_itoa36);
|
||||
tolua_function(L, TOLUA_CAST "dice_roll", tolua_dice_rand);
|
||||
|
|
|
@ -22,6 +22,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "alliance.h"
|
||||
#include "ally.h"
|
||||
#include "curse.h"
|
||||
#include "equipment.h"
|
||||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "messages.h"
|
||||
|
@ -286,10 +287,15 @@ faction *addfaction(const char *email, const char *password,
|
|||
unit *addplayer(region * r, faction * f)
|
||||
{
|
||||
unit *u;
|
||||
const struct equipment* eq;
|
||||
|
||||
assert(f->units == NULL);
|
||||
faction_setorigin(f, 0, r->x, r->y);
|
||||
u = create_unit(r, f, 1, f->race, 0, NULL, NULL);
|
||||
eq = get_equipment("first_unit");
|
||||
if (eq) {
|
||||
equip_items(&u->items, eq);
|
||||
}
|
||||
u->hp = unit_max_hp(u) * u->number;
|
||||
fset(u, UFL_ISNEW);
|
||||
if (f->race == get_race(RC_DAEMON)) {
|
||||
|
|
Loading…
Reference in New Issue