diff --git a/conf/e4/config.xml b/conf/e4/config.xml index 95bcde300..a6439db21 100644 --- a/conf/e4/config.xml +++ b/conf/e4/config.xml @@ -58,6 +58,7 @@ + diff --git a/res/core/common/items.xml b/res/core/common/items.xml index d867a3126..9508653e7 100644 --- a/res/core/common/items.xml +++ b/res/core/common/items.xml @@ -1,6 +1,10 @@ + + + + diff --git a/scripts/tests/e3/rules.lua b/scripts/tests/e3/rules.lua index 07fbb1a60..193551ea9 100644 --- a/scripts/tests/e3/rules.lua +++ b/scripts/tests/e3/rules.lua @@ -712,6 +712,42 @@ function test_golem_use_four_iron() assert_equal(4, u1:get_item("towershield")) end +function skip_test_silver_weight_stops_movement() + local r1 = region.create(1, 1, "plain") + local r2 = region.create(2, 1, "plain") + region.create(3, 1, "plain") + local f1 = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f1, r1, 1) + u1:clear_orders() + u1:add_order("NACH OST") + u1:add_item("money", 540) + assert_equal(1540, u1.weight) + process_orders() + assert_equal(r2, u1.region) + u1:add_item("money", 1) + process_orders() + assert_equal(r2, u1.region) +end + +function skip_test_silver_weight_stops_ship() + local r1 = region.create(1, 1, "ocean") + local r2 = region.create(2, 1, "ocean") + region.create(3, 1, "ocean") + local f1 = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f1, r1, 1) + u1:set_skill("sailing", 3) + local s1 = ship.create(r1, "canoe") + u1.ship = s1 + u1:clear_orders() + u1:add_order("NACH OST") + u1:add_item("money", 2000) + process_orders() + assert_equal(r2, u1.region) + u1:add_item("money", 1) + process_orders() + assert_equal(r2, u1.region) +end + function test_building_owner_can_enter_ship() local r1 = region.create(1, 2, "plain") local f1 = faction.create("noreply@eressea.de", "human", "de") @@ -734,3 +770,12 @@ function test_building_owner_can_enter_ship() assert_equal(s1, u1.ship) assert_equal(null, u1.building, "owner of the building can not go into a ship") end + +function test_weightless_silver() + local r1 = region.create(1, 2, "plain") + local f1 = faction.create("noreply@eressea.de", "human", "de") + local u1 = unit.create(f1, r1, 1) + assert_equal(1000, u1.weight) + u1:add_item("money", 540) + assert_equal(1000, u1.weight) +end diff --git a/src/kernel/item.test.c b/src/kernel/item.test.c index dcb7ca878..981edf641 100644 --- a/src/kernel/item.test.c +++ b/src/kernel/item.test.c @@ -143,6 +143,27 @@ static void test_fix_demand(CuTest *tc) { test_cleanup(); } +static void test_core_resources(CuTest *tc) { + resource_type * rtype; + test_cleanup(); + init_resources(); + CuAssertPtrNotNull(tc, rtype = rt_find("money")); + CuAssertPtrNotNull(tc, rtype->itype); + CuAssertPtrNotNull(tc, rtype->uchange); + CuAssertPtrNotNull(tc, rtype->itype->give); + CuAssertPtrNotNull(tc, rtype = rt_find("peasant")); + CuAssertPtrEquals(tc, 0, rtype->itype); + CuAssertPtrNotNull(tc, rtype = rt_find("person")); + CuAssertPtrEquals(tc, 0, rtype->itype); + CuAssertPtrNotNull(tc, rtype = rt_find("permaura")); + CuAssertPtrEquals(tc, 0, rtype->itype); + CuAssertPtrNotNull(tc, rtype = rt_find("hp")); + CuAssertPtrEquals(tc, 0, rtype->itype); + CuAssertPtrNotNull(tc, rtype = rt_find("aura")); + CuAssertPtrEquals(tc, 0, rtype->itype); + test_cleanup(); +} + CuSuite *get_item_suite(void) { CuSuite *suite = CuSuiteNew(); @@ -153,5 +174,6 @@ CuSuite *get_item_suite(void) SUITE_ADD_TEST(suite, test_finditemtype); SUITE_ADD_TEST(suite, test_findresourcetype); SUITE_ADD_TEST(suite, test_fix_demand); + SUITE_ADD_TEST(suite, test_core_resources); return suite; } diff --git a/src/laws.c b/src/laws.c index 761ddab00..693df8f5c 100755 --- a/src/laws.c +++ b/src/laws.c @@ -4347,17 +4347,17 @@ void init_processor(void) add_proc_order(p, K_GROUP, group_cmd, 0, NULL); p += 10; - add_proc_order(p, K_QUIT, quit_cmd, 0, NULL); - add_proc_order(p, K_URSPRUNG, origin_cmd, 0, NULL); - add_proc_order(p, K_ALLY, ally_cmd, 0, NULL); - add_proc_order(p, K_PREFIX, prefix_cmd, 0, NULL); - add_proc_order(p, K_SETSTEALTH, setstealth_cmd, 0, NULL); - add_proc_order(p, K_STATUS, status_cmd, 0, NULL); - add_proc_order(p, K_COMBATSPELL, combatspell_cmd, 0, NULL); - add_proc_order(p, K_DISPLAY, display_cmd, 0, NULL); - add_proc_order(p, K_NAME, name_cmd, 0, NULL); - add_proc_order(p, K_GUARD, guard_off_cmd, 0, NULL); - add_proc_order(p, K_RESHOW, reshow_cmd, 0, NULL); + add_proc_order(p, K_QUIT, &quit_cmd, 0, NULL); + add_proc_order(p, K_URSPRUNG, &origin_cmd, 0, NULL); + add_proc_order(p, K_ALLY, &ally_cmd, 0, NULL); + add_proc_order(p, K_PREFIX, &prefix_cmd, 0, NULL); + add_proc_order(p, K_SETSTEALTH, &setstealth_cmd, 0, NULL); + add_proc_order(p, K_STATUS, &status_cmd, 0, NULL); + add_proc_order(p, K_COMBATSPELL, &combatspell_cmd, 0, NULL); + add_proc_order(p, K_DISPLAY, &display_cmd, 0, NULL); + add_proc_order(p, K_NAME, &name_cmd, 0, NULL); + add_proc_order(p, K_GUARD, &guard_off_cmd, 0, NULL); + add_proc_order(p, K_RESHOW, &reshow_cmd, 0, NULL); if (get_param_int(global.parameters, "rules.alliances", 0) == 1) { p += 10;