remove the R_UNIT resource.

https://bugs.eressea.de/view.php?id=1945
assert that only items can be reserved.
This commit is contained in:
Enno Rehling 2014-12-11 23:24:00 +01:00
parent 20c0dfbb47
commit d7c2fc2b04
6 changed files with 3 additions and 27 deletions

View File

@ -516,7 +516,7 @@ void give_unit(unit * u, unit * u2, order * ord)
cmistake(u, ord, 156, MSG_COMMERCE); cmistake(u, ord, 156, MSG_COMMERCE);
return; return;
} }
add_give(u, u2, 1, 1, get_resourcetype(R_UNIT), ord, 0); // TODO: add_give(u, u2, 1, 1, get_resourcetype(R_UNIT), ord, 0);
u_setfaction(u, u2->faction); u_setfaction(u, u2->faction);
u2->faction->newbies += n; u2->faction->newbies += n;
} }

View File

@ -604,7 +604,7 @@ static const char *resourcenames[MAX_RESOURCES] = {
"aurafocus", "sphereofinv", "magicbag", "aurafocus", "sphereofinv", "magicbag",
"magicherbbag", "dreameye", "p2", "seed", "mallornseed", "magicherbbag", "dreameye", "p2", "seed", "mallornseed",
"money", "aura", "permaura", "money", "aura", "permaura",
"hp", "unit", "peasant" "hp", "peasant"
}; };
const resource_type *get_resourcetype(resource_t type) { const resource_type *get_resourcetype(resource_t type) {
@ -971,10 +971,6 @@ void init_resources(void)
rtype = rt_get_or_create(resourcenames[R_AURA]); rtype = rt_get_or_create(resourcenames[R_AURA]);
rtype->uchange = res_changeaura; rtype->uchange = res_changeaura;
// R_UNIT
rtype = rt_get_or_create(resourcenames[R_UNIT]);
rtype->uchange = res_changeperson;
/* alte typen registrieren: */ /* alte typen registrieren: */
init_oldpotions(); init_oldpotions();
} }

View File

@ -297,7 +297,6 @@ extern "C" {
R_AURA, /* Aura */ R_AURA, /* Aura */
R_PERMAURA, /* Permanente Aura */ R_PERMAURA, /* Permanente Aura */
R_LIFE, R_LIFE,
R_UNIT,
R_PEASANT, R_PEASANT,
MAX_RESOURCES, /* do not use outside item.c ! */ MAX_RESOURCES, /* do not use outside item.c ! */

View File

@ -64,20 +64,6 @@ void test_change_item(CuTest * tc)
test_uchange(tc, u, get_resourcetype(R_IRON)); test_uchange(tc, u, get_resourcetype(R_IRON));
} }
void test_change_person(CuTest * tc)
{
unit * u;
test_cleanup();
register_resources();
init_resources();
test_create_world();
u = test_create_unit(0, 0);
test_uchange(tc, u, get_resourcetype(R_UNIT));
}
void test_resource_type(CuTest * tc) void test_resource_type(CuTest * tc)
{ {
struct item_type *itype; struct item_type *itype;
@ -136,7 +122,6 @@ CuSuite *get_item_suite(void)
SUITE_ADD_TEST(suite, test_resourcename_no_appearance); SUITE_ADD_TEST(suite, test_resourcename_no_appearance);
SUITE_ADD_TEST(suite, test_resourcename_with_appearance); SUITE_ADD_TEST(suite, test_resourcename_with_appearance);
SUITE_ADD_TEST(suite, test_change_item); SUITE_ADD_TEST(suite, test_change_item);
SUITE_ADD_TEST(suite, test_change_person);
SUITE_ADD_TEST(suite, test_resource_type); SUITE_ADD_TEST(suite, test_resource_type);
SUITE_ADD_TEST(suite, test_finditemtype); SUITE_ADD_TEST(suite, test_finditemtype);
SUITE_ADD_TEST(suite, test_findresourcetype); SUITE_ADD_TEST(suite, test_findresourcetype);

View File

@ -128,7 +128,7 @@ int change_reservation(unit * u, const resource_type * rtype, int value)
int set_resvalue(unit * u, const resource_type * rtype, int value) int set_resvalue(unit * u, const resource_type * rtype, int value)
{ {
reservation *res, **rp = &u->reservations; reservation *res, **rp = &u->reservations;
assert(rtype->itype);
while (*rp && (*rp)->type != rtype) while (*rp && (*rp)->type != rtype)
rp = &(*rp)->next; rp = &(*rp)->next;
res = *rp; res = *rp;

View File

@ -20,8 +20,6 @@ static void test_resources(CuTest *tc) {
CuAssertPtrEquals(tc, rt_find("aura"), (void *)get_resourcetype(R_AURA)); CuAssertPtrEquals(tc, rt_find("aura"), (void *)get_resourcetype(R_AURA));
CuAssertPtrNotNull(tc, rt_find("permaura")); CuAssertPtrNotNull(tc, rt_find("permaura"));
CuAssertPtrEquals(tc, rt_find("permaura"), (void *)get_resourcetype(R_PERMAURA)); CuAssertPtrEquals(tc, rt_find("permaura"), (void *)get_resourcetype(R_PERMAURA));
CuAssertPtrNotNull(tc, rt_find("unit"));
CuAssertPtrEquals(tc, rt_find("unit"), (void *)get_resourcetype(R_UNIT));
CuAssertPtrEquals(tc, 0, rt_find("stone")); CuAssertPtrEquals(tc, 0, rt_find("stone"));
rtype = rt_get_or_create("stone"); rtype = rt_get_or_create("stone");
@ -55,7 +53,6 @@ static void test_recreate_world(CuTest * tc)
CuAssertPtrNotNull(tc, get_resourcetype(R_AURA)); CuAssertPtrNotNull(tc, get_resourcetype(R_AURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA)); CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT)); CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT));
CuAssertPtrNotNull(tc, get_resourcetype(R_UNIT));
test_cleanup(); test_cleanup();
CuAssertPtrEquals(tc, 0, get_locale("de")); CuAssertPtrEquals(tc, 0, get_locale("de"));
@ -67,7 +64,6 @@ static void test_recreate_world(CuTest * tc)
CuAssertPtrNotNull(tc, get_resourcetype(R_AURA)); CuAssertPtrNotNull(tc, get_resourcetype(R_AURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA)); CuAssertPtrNotNull(tc, get_resourcetype(R_PERMAURA));
CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT)); CuAssertPtrNotNull(tc, get_resourcetype(R_PEASANT));
CuAssertPtrNotNull(tc, get_resourcetype(R_UNIT));
CuAssertPtrEquals(tc, 0, findregion(0, 0)); CuAssertPtrEquals(tc, 0, findregion(0, 0));
} }