Beispiel #1
0
static void test_resourcename_with_appearance(CuTest *tc) {
    item_type *itype;

    test_cleanup();
    itype = it_get_or_create(rt_get_or_create("foo"));
    assert(itype && itype->rtype);
    it_set_appearance(itype, "bar");
    CuAssertStrEquals(tc, "foo", resourcename(itype->rtype, 0));
    CuAssertStrEquals(tc, "foo_p", resourcename(itype->rtype, NMF_PLURAL));
    CuAssertStrEquals(tc, "bar", resourcename(itype->rtype, NMF_APPEARANCE));
    CuAssertStrEquals(tc, "bar_p", resourcename(itype->rtype, NMF_APPEARANCE | NMF_PLURAL));
    test_cleanup();
}
Beispiel #2
0
static void test_resourcename_no_appearance(CuTest *tc) {
    const resource_type *rtype;

    test_cleanup();
    init_resources(); // creates R_SILVER
    rtype = get_resourcetype(R_SILVER);
    assert(rtype && rtype->itype);
    assert(rtype->itype->_appearance[0] == 0);
    assert(rtype->itype->_appearance[1] == 0);
    CuAssertStrEquals(tc, "money", resourcename(rtype, 0));
    CuAssertStrEquals(tc, "money_p", resourcename(rtype, NMF_PLURAL));
    CuAssertStrEquals(tc, "money", resourcename(rtype, NMF_APPEARANCE));
    CuAssertStrEquals(tc, "money_p", resourcename(rtype, NMF_APPEARANCE | NMF_PLURAL));
    test_cleanup();
}
Beispiel #3
0
static void
a_writeeffect(const attrib * a, const void *owner, struct storage *store)
{
  effect_data *edata = (effect_data *) a->data.v;
  WRITE_TOK(store, resourcename(edata->type->itype->rtype, 0));
  WRITE_INT(store, edata->value);
}
Beispiel #4
0
static void
write_gmcreate(const attrib * a, const void *owner, struct storage *store)
{
  const item_type *itype = (const item_type *)a->data.v;
  assert(itype);
  WRITE_TOK(store, resourcename(itype->rtype, 0));
}