forked from github/server
functional test for GROW/BREED horses (Bug 1886)
This commit is contained in:
parent
90dd700487
commit
3db403d7fd
|
@ -32,3 +32,26 @@ function test_set_status_de()
|
|||
assert_equal(u.status, 0)
|
||||
end
|
||||
|
||||
function test_breed_horses()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f = faction.create("bug_1886@eressea.de", "human", "en")
|
||||
local u = unit.create(f, r, 1)
|
||||
local b = building.create(r, "stables")
|
||||
b.size = 10
|
||||
u.building = b
|
||||
u:add_item("horse", 2)
|
||||
u:add_item("money", 2000)
|
||||
u:set_skill("training", 100) -- 100% chance to duplicate each horse
|
||||
u:clear_orders()
|
||||
u:add_order("GROW horses")
|
||||
process_orders()
|
||||
assert_equal(4, u:get_item("horse"))
|
||||
u:clear_orders()
|
||||
u:add_order("BREED horses")
|
||||
process_orders()
|
||||
assert_equal(8, u:get_item("horse"))
|
||||
u:clear_orders()
|
||||
u:add_order("PLANT horses")
|
||||
process_orders()
|
||||
assert_equal(16, u:get_item("horse"))
|
||||
end
|
||||
|
|
|
@ -168,8 +168,9 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
|
|||
|
||||
if (s[0]) {
|
||||
if (s[0] != '@') {
|
||||
char token[128];
|
||||
const char *stok = s;
|
||||
stok = parse_token_depr(&stok);
|
||||
stok = parse_token(&stok, token, sizeof(token));
|
||||
|
||||
if (stok) {
|
||||
bool quit = false;
|
||||
|
@ -192,7 +193,6 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
/* TODO: syntax error message */
|
||||
break;
|
||||
}
|
||||
if (quit) {
|
||||
|
|
Loading…
Reference in New Issue