forked from github/server
added promote, renumber, restack to eressea.process interface
fixed a test that relied on no random skill progress
This commit is contained in:
parent
a662f88868
commit
9124fe2c6d
|
@ -33,6 +33,9 @@ function test_process()
|
|||
assert_equal("function", _G.type(eressea.process.battle))
|
||||
assert_equal("function", _G.type(eressea.process.siege))
|
||||
assert_equal("function", _G.type(eressea.process.leave))
|
||||
assert_equal("function", _G.type(eressea.process.promote))
|
||||
assert_equal("function", _G.type(eressea.process.renumber))
|
||||
assert_equal("function", _G.type(eressea.process.restack))
|
||||
end
|
||||
|
||||
function test_settings()
|
||||
|
|
|
@ -116,7 +116,7 @@ function test_process_make()
|
|||
assert_equal(1, u:get_item('log'))
|
||||
end
|
||||
|
||||
function test_process_teach()
|
||||
function test_process_study()
|
||||
u:add_order("LERNEN Holzfaellen")
|
||||
eressea.process.update_long_order()
|
||||
eressea.process.study()
|
||||
|
@ -124,7 +124,8 @@ function test_process_teach()
|
|||
assert_equal(1, u:get_skill('forestry'))
|
||||
end
|
||||
|
||||
function test_process_study()
|
||||
function test_process_teach()
|
||||
eressea.settings.set("study.random_progress", "0")
|
||||
u:set_skill('forestry', 3)
|
||||
u2 = _G.unit.create(f, r, 10)
|
||||
u2:clear_orders()
|
||||
|
@ -183,3 +184,9 @@ function test_process_name_ship()
|
|||
assert_equal('Herpderp', u.ship.name)
|
||||
end
|
||||
|
||||
function test_process_renumber()
|
||||
u:add_order("NUMMER EINHEIT 'ii'")
|
||||
eressea.process.renumber()
|
||||
assert_equal(666, u.id)
|
||||
end
|
||||
|
||||
|
|
|
@ -177,6 +177,19 @@ void process_leave(void) {
|
|||
process_cmd(K_LEAVE, leave_cmd, 0);
|
||||
}
|
||||
|
||||
void process_promote(void) {
|
||||
process_cmd(K_PROMOTION, promotion_cmd, 0);
|
||||
}
|
||||
|
||||
void process_renumber(void) {
|
||||
process_cmd(K_NUMBER, renumber_cmd, 0);
|
||||
renumber_factions();
|
||||
}
|
||||
|
||||
void process_restack(void) {
|
||||
restack_units();
|
||||
}
|
||||
|
||||
void process_maintenance(void) {
|
||||
region * r;
|
||||
for (r=regions; r; r=r->next) {
|
||||
|
|
|
@ -25,6 +25,9 @@ void process_battle(void);
|
|||
void process_siege(void);
|
||||
void process_leave(void);
|
||||
void process_maintenance(void);
|
||||
void process_promotion(void);
|
||||
void process_renumber(void);
|
||||
void process_restack(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -22,5 +22,8 @@ module eressea {
|
|||
void process_siege @ siege(void); /* SIEGE */
|
||||
void process_leave @ leave(void); /* LEAVE */
|
||||
void process_maintenance @ maintenance(void); /* PAY */
|
||||
void process_promote @ promote(void); /* PROMOTE */
|
||||
void process_renumber @ renumber(void); /* RENUMBER */
|
||||
void process_restack @ restack(void); /* SORT */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2703,7 +2703,7 @@ static void reshow(unit * u, struct order *ord, const char *s, param_t p)
|
|||
}
|
||||
}
|
||||
|
||||
static int promotion_cmd(unit * u, struct order *ord)
|
||||
int promotion_cmd(unit * u, struct order *ord)
|
||||
{
|
||||
int money, people;
|
||||
|
||||
|
@ -3005,7 +3005,7 @@ static attrib_type at_number = {
|
|||
ATF_UNIQUE
|
||||
};
|
||||
|
||||
static void renumber_factions(void)
|
||||
void renumber_factions(void)
|
||||
/* gibt parteien neue nummern */
|
||||
{
|
||||
struct renum {
|
||||
|
@ -3066,7 +3066,7 @@ static void renumber_factions(void)
|
|||
}
|
||||
}
|
||||
|
||||
static void reorder(void)
|
||||
void restack_units(void)
|
||||
{
|
||||
region *r;
|
||||
for (r = regions; r; r = r->next) {
|
||||
|
@ -3146,7 +3146,7 @@ static void reorder(void)
|
|||
}
|
||||
}
|
||||
|
||||
static int renumber_cmd(unit * u, order * ord)
|
||||
int renumber_cmd(unit * u, order * ord)
|
||||
{
|
||||
const char *s;
|
||||
int i;
|
||||
|
@ -4605,7 +4605,7 @@ void init_processor(void)
|
|||
|
||||
if (!global.disabled[K_SORT]) {
|
||||
p += 10;
|
||||
add_proc_global(p, &reorder, "Einheiten sortieren");
|
||||
add_proc_global(p, restack_units, "Einheiten sortieren");
|
||||
}
|
||||
add_proc_order(p, K_PROMOTION, &promotion_cmd, 0, "Heldenbefoerderung");
|
||||
if (!global.disabled[K_NUMBER]) {
|
||||
|
|
|
@ -52,6 +52,8 @@ extern "C" {
|
|||
|
||||
extern void new_units(void);
|
||||
extern void quit(void);
|
||||
extern void renumber_factions(void);
|
||||
extern void restack_units(void);
|
||||
extern void update_long_order(struct unit *u);
|
||||
extern void sinkships(struct region * r);
|
||||
extern int password_cmd(struct unit *u, struct order *ord);
|
||||
|
@ -71,6 +73,8 @@ extern "C" {
|
|||
extern int siege_cmd(struct unit *u, struct order *ord);
|
||||
extern int leave_cmd(struct unit *u, struct order *ord);
|
||||
extern int pay_cmd(struct unit *u, struct order *ord);
|
||||
extern int promotion_cmd(struct unit *u, struct order *ord);
|
||||
extern int renumber_cmd(struct unit *u, struct order *ord);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue