- herbalism disabled, better

This commit is contained in:
Enno Rehling 2009-06-12 15:02:44 +00:00
parent 301b9519f0
commit 8480886f14
3 changed files with 24 additions and 4 deletions

View File

@ -182,7 +182,11 @@ xml_readconstruction(xmlXPathContextPtr xpath, xmlNodeSetPtr nodeSet, constructi
propValue = xmlGetProp(node, BAD_CAST "skill");
if (propValue!=NULL) {
sk = sk_find((const char*)propValue);
assert(sk!=NOSKILL);
if (sk==NOSKILL) {
log_error(("construction requires skill '%s' that does not exist.", (const char *)propValue));
xmlFree(propValue);
continue;
}
xmlFree(propValue);
}

View File

@ -96,7 +96,8 @@
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<skill name="herbalism" enable="true"/>
<skill name="herbalism" enable="false"/>
<skill name="alchemy" enable="false"/>
<skill name="entertainment" enable="false"/>

View File

@ -371,6 +371,19 @@ function test_market()
assert(len>1)
end
function test_herbalism()
free_game()
local r = region.create(0, 0, "plain")
local f = faction.create("enno@eressea.de", "human", "de")
f.id = 42
local u = unit.create(f, r, 1)
u:add_item("money", u.number * 100)
u:set_skill("herbalism", 5)
u:clear_orders()
u:add_order("MACHE Samen")
process_orders()
end
function test_storage()
free_game()
local r = region.create(0, 0, "plain")
@ -412,10 +425,12 @@ tests = {
["rename"] = test_rename,
["recruit"] = test_recruit,
["spells"] = test_spells,
["storage"] = test_storage
["herbalism"] = test_herbalism,
["storage"] = test_storage,
["market"] = test_market
}
mytests = {
["market"] = test_market
["herbalism"] = test_herbalism
}
fail = 0
for k, v in pairs(mytests) do