functional test for GROW/BREED horses (Bug 1886)

This commit is contained in:
Enno Rehling 2015-01-04 15:42:36 +01:00
parent 90dd700487
commit 3db403d7fd
2 changed files with 25 additions and 2 deletions

View File

@ -32,3 +32,26 @@ function test_set_status_de()
assert_equal(u.status, 0) assert_equal(u.status, 0)
end 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

View File

@ -168,8 +168,9 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
if (s[0]) { if (s[0]) {
if (s[0] != '@') { if (s[0] != '@') {
char token[128];
const char *stok = s; const char *stok = s;
stok = parse_token_depr(&stok); stok = parse_token(&stok, token, sizeof(token));
if (stok) { if (stok) {
bool quit = false; bool quit = false;
@ -192,7 +193,6 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
} }
break; break;
default: default:
/* TODO: syntax error message */
break; break;
} }
if (quit) { if (quit) {