neue lua-exporte:

- int get_plane_id(string)

unit.number setzt auch auf 0 (killen)
This commit is contained in:
Enno Rehling 2004-04-10 23:59:03 +00:00
parent 5f0ba5c2a0
commit a53cc0a25c
3 changed files with 43 additions and 30 deletions

View File

@ -5,6 +5,7 @@
// kernel includes // kernel includes
#include <gamecode/laws.h> #include <gamecode/laws.h>
#include <kernel/race.h> #include <kernel/race.h>
#include <kernel/plane.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/reports.h> #include <kernel/reports.h>
#include <kernel/save.h> #include <kernel/save.h>
@ -63,6 +64,13 @@ write_reports()
extern int process_orders(void); extern int process_orders(void);
static int
find_plane_id(const char * name)
{
plane * pl = getplanebyname(name);
return pl?pl->id:0;
}
void void
bind_eressea(lua_State * L) bind_eressea(lua_State * L)
{ {
@ -76,6 +84,9 @@ bind_eressea(lua_State * L)
def("read_orders", &readorders), def("read_orders", &readorders),
def("process_orders", &process_orders), def("process_orders", &process_orders),
def("add_equipment", &lua_addequipment), def("add_equipment", &lua_addequipment),
def("get_turn", &get_turn) def("get_turn", &get_turn),
/* planes not really implemented */
def("find_plane_id", &find_plane_id)
]; ];
} }

View File

@ -61,6 +61,8 @@ unit_setnumber(unit& u, int number)
if (u.number==0) { if (u.number==0) {
set_number(&u, number); set_number(&u, number);
u.hp = unit_max_hp(&u) * number; u.hp = unit_max_hp(&u) * number;
} else {
scale_number(&u, number);
} }
} }