forked from github/server
more process-related bindings and tests
This commit is contained in:
parent
e23016f0f0
commit
6aa08b60fd
|
@ -13,10 +13,17 @@ function test_eressea()
|
||||||
end
|
end
|
||||||
|
|
||||||
function test_process()
|
function test_process()
|
||||||
|
assert_equal("function", _G.type(eressea.process.update_long_order))
|
||||||
assert_equal("function", _G.type(eressea.process.markets))
|
assert_equal("function", _G.type(eressea.process.markets))
|
||||||
assert_equal("function", _G.type(eressea.process.produce))
|
assert_equal("function", _G.type(eressea.process.produce))
|
||||||
|
|
||||||
assert_equal("function", _G.type(eressea.process.make_temp))
|
assert_equal("function", _G.type(eressea.process.make_temp))
|
||||||
assert_equal("function", _G.type(eressea.process.settings))
|
assert_equal("function", _G.type(eressea.process.settings))
|
||||||
|
assert_equal("function", _G.type(eressea.process.set_allies))
|
||||||
|
assert_equal("function", _G.type(eressea.process.set_prefix))
|
||||||
|
assert_equal("function", _G.type(eressea.process.set_stealth))
|
||||||
|
assert_equal("function", _G.type(eressea.process.set_status))
|
||||||
|
assert_equal("function", _G.type(eressea.process.set_description))
|
||||||
assert_equal("function", _G.type(eressea.process.set_group))
|
assert_equal("function", _G.type(eressea.process.set_group))
|
||||||
assert_equal("function", _G.type(eressea.process.set_origin))
|
assert_equal("function", _G.type(eressea.process.set_origin))
|
||||||
assert_equal("function", _G.type(eressea.process.quit))
|
assert_equal("function", _G.type(eressea.process.quit))
|
||||||
|
|
|
@ -16,6 +16,16 @@ void process_produce(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void process_update_long_order(void) {
|
||||||
|
region * r;
|
||||||
|
for (r=regions; r; r=r->next) {
|
||||||
|
unit * u;
|
||||||
|
for (u=r->units; u; u=u->next) {
|
||||||
|
update_long_order(u);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void process_markets(void) {
|
void process_markets(void) {
|
||||||
do_markets();
|
do_markets();
|
||||||
}
|
}
|
||||||
|
@ -65,6 +75,26 @@ static void process_cmd(keyword_t kwd, int (*callback)(unit *, order *))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void process_ally(void) {
|
||||||
|
process_cmd(K_ALLY, ally_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_prefix(void) {
|
||||||
|
process_cmd(K_PREFIX, prefix_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_setstealth(void) {
|
||||||
|
process_cmd(K_SETSTEALTH, setstealth_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_status(void) {
|
||||||
|
process_cmd(K_STATUS, status_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void process_display(void) {
|
||||||
|
process_cmd(K_DISPLAY, display_cmd);
|
||||||
|
}
|
||||||
|
|
||||||
void process_group(void) {
|
void process_group(void) {
|
||||||
process_cmd(K_GROUP, group_cmd);
|
process_cmd(K_GROUP, group_cmd);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,8 +6,15 @@ extern "C" {
|
||||||
|
|
||||||
void process_produce(void);
|
void process_produce(void);
|
||||||
void process_markets(void);
|
void process_markets(void);
|
||||||
|
void process_update_long_order(void);
|
||||||
|
|
||||||
void process_make_temp(void);
|
void process_make_temp(void);
|
||||||
void process_settings(void);
|
void process_settings(void);
|
||||||
|
void process_ally(void);
|
||||||
|
void process_prefix(void);
|
||||||
|
void process_setstealth(void);
|
||||||
|
void process_status(void);
|
||||||
|
void process_display(void);
|
||||||
void process_group(void);
|
void process_group(void);
|
||||||
void process_origin(void);
|
void process_origin(void);
|
||||||
void process_quit(void);
|
void process_quit(void);
|
||||||
|
|
|
@ -1,13 +1,19 @@
|
||||||
$#include <bindings/bind_process.h>
|
$#include <bindings/bind_process.h>
|
||||||
|
|
||||||
module eressea {
|
module eressea {
|
||||||
module process {
|
module process {
|
||||||
void process_markets @ markets(void);
|
void process_update_long_order @ update_long_order(void);
|
||||||
void process_produce @ produce(void);
|
void process_markets @ markets(void); /* operate the e3 markets */
|
||||||
void process_make_temp @ make_temp(void);
|
void process_produce @ produce(void); /* BUY/SELL/ENTERTAIN/WORK/TAX/STEAL/SPY/SABOTAGE/PLANT/BREED/RESEARCH */
|
||||||
void process_settings @ settings(void);
|
void process_make_temp @ make_temp(void); /* MAKE TEMP */
|
||||||
void process_group @ set_group(void);
|
void process_settings @ settings(void); /* EMAIL/PASSWORD/BANNER/OPTION */
|
||||||
void process_origin @ set_origin(void);
|
void process_ally @ set_allies(void); /* HELP */
|
||||||
void process_quit @ quit(void);
|
void process_prefix @ set_prefix(void); /* PREFIX */
|
||||||
}
|
void process_setstealth @ set_stealth(void); /* STEALTH */
|
||||||
|
void process_status @ set_status(void); /* STATUS */
|
||||||
|
void process_display @ set_description(void); /* DESCRIBE */
|
||||||
|
void process_group @ set_group(void); /* GROUP */
|
||||||
|
void process_origin @ set_origin(void); /* ORIGIN */
|
||||||
|
void process_quit @ quit(void); /* QUIT */
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1306,7 +1306,7 @@ static void parse_restart(void)
|
||||||
|
|
||||||
/* HELFE partei [<ALLES | SILBER | GIB | KAEMPFE | WAHRNEHMUNG>] [NICHT] */
|
/* HELFE partei [<ALLES | SILBER | GIB | KAEMPFE | WAHRNEHMUNG>] [NICHT] */
|
||||||
|
|
||||||
static int ally_cmd(unit * u, struct order *ord)
|
int ally_cmd(unit * u, struct order *ord)
|
||||||
{
|
{
|
||||||
ally *sf, **sfp;
|
ally *sf, **sfp;
|
||||||
faction *f;
|
faction *f;
|
||||||
|
@ -1461,7 +1461,7 @@ static void init_prefixnames(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int prefix_cmd(unit * u, struct order *ord)
|
int prefix_cmd(unit * u, struct order *ord)
|
||||||
{
|
{
|
||||||
attrib **ap;
|
attrib **ap;
|
||||||
const char *s;
|
const char *s;
|
||||||
|
@ -1523,7 +1523,7 @@ static cmp_building_cb get_cmp_region_owner(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int display_cmd(unit * u, struct order *ord)
|
int display_cmd(unit * u, struct order *ord)
|
||||||
{
|
{
|
||||||
char **s = NULL;
|
char **s = NULL;
|
||||||
const char *str;
|
const char *str;
|
||||||
|
@ -1689,7 +1689,7 @@ rename_building(unit * u, order * ord, building * b, const char *name)
|
||||||
return rename_cmd(u, ord, &b->name, name);
|
return rename_cmd(u, ord, &b->name, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int name_cmd(unit * u, struct order *ord)
|
int name_cmd(struct unit *u, struct order *ord)
|
||||||
{
|
{
|
||||||
building *b = u->building;
|
building *b = u->building;
|
||||||
region *r = u->region;
|
region *r = u->region;
|
||||||
|
@ -2572,7 +2572,7 @@ static int reshow_cmd(unit * u, struct order *ord)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int status_cmd(unit * u, struct order *ord)
|
int status_cmd(unit * u, struct order *ord)
|
||||||
{
|
{
|
||||||
const char *param;
|
const char *param;
|
||||||
|
|
||||||
|
@ -3429,7 +3429,7 @@ void check_long_orders(unit * u)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void setdefaults(unit * u)
|
void update_long_order(unit * u)
|
||||||
{
|
{
|
||||||
order *ord;
|
order *ord;
|
||||||
boolean trade = false;
|
boolean trade = false;
|
||||||
|
@ -4043,7 +4043,7 @@ void process(void)
|
||||||
cmistake(u, ord, 224, MSG_MAGIC);
|
cmistake(u, ord, 224, MSG_MAGIC);
|
||||||
ord = NULL;
|
ord = NULL;
|
||||||
} else if (fval(u, UFL_LONGACTION)) {
|
} else if (fval(u, UFL_LONGACTION)) {
|
||||||
/* this message was already given in laws.setdefaults
|
/* this message was already given in laws.update_long_order
|
||||||
cmistake(u, ord, 52, MSG_PRODUCE);
|
cmistake(u, ord, 52, MSG_PRODUCE);
|
||||||
*/
|
*/
|
||||||
ord = NULL;
|
ord = NULL;
|
||||||
|
@ -4153,7 +4153,7 @@ void init_processor(void)
|
||||||
add_proc_global(p, &new_units, "Neue Einheiten erschaffen");
|
add_proc_global(p, &new_units, "Neue Einheiten erschaffen");
|
||||||
|
|
||||||
p += 10;
|
p += 10;
|
||||||
add_proc_unit(p, &setdefaults, "Default-Befehle");
|
add_proc_unit(p, update_long_order, "Langen Befehl aktualisieren");
|
||||||
add_proc_order(p, K_BANNER, banner_cmd, 0, NULL);
|
add_proc_order(p, K_BANNER, banner_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_EMAIL, &email_cmd, 0, NULL);
|
add_proc_order(p, K_EMAIL, &email_cmd, 0, NULL);
|
||||||
add_proc_order(p, K_PASSWORD, &password_cmd, 0, NULL);
|
add_proc_order(p, K_PASSWORD, &password_cmd, 0, NULL);
|
||||||
|
|
|
@ -47,14 +47,21 @@ extern "C" {
|
||||||
|
|
||||||
extern void new_units(void);
|
extern void new_units(void);
|
||||||
extern void quit(void);
|
extern void quit(void);
|
||||||
|
extern void update_long_order(struct unit * u);
|
||||||
extern int password_cmd(struct unit *u, struct order *ord);
|
extern int password_cmd(struct unit *u, struct order *ord);
|
||||||
extern int banner_cmd(struct unit *u, struct order *ord);
|
extern int banner_cmd(struct unit *u, struct order *ord);
|
||||||
extern int email_cmd(struct unit *u, struct order *ord);
|
extern int email_cmd(struct unit *u, struct order *ord);
|
||||||
extern int send_cmd(struct unit *u, struct order *ord);
|
extern int send_cmd(struct unit *u, struct order *ord);
|
||||||
extern int origin_cmd(struct unit *u, struct order *ord);
|
extern int ally_cmd(struct unit* u, struct order *ord);
|
||||||
|
extern int prefix_cmd(struct unit *u, struct order *ord);
|
||||||
|
extern int setstealth_cmd(struct unit *u, struct order *ord);
|
||||||
|
extern int status_cmd(struct unit *u, struct order *ord);
|
||||||
|
extern int display_cmd(struct unit *u, struct order *ord);
|
||||||
extern int group_cmd(struct unit *u, struct order *ord);
|
extern int group_cmd(struct unit *u, struct order *ord);
|
||||||
|
extern int origin_cmd(struct unit *u, struct order *ord);
|
||||||
extern int quit_cmd(struct unit *u, struct order *ord);
|
extern int quit_cmd(struct unit *u, struct order *ord);
|
||||||
|
extern int name_cmd(struct unit *u, struct order *ord);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue