CR is missing saplings?

This commit is contained in:
Enno Rehling 2017-03-05 18:47:49 +01:00
parent f699c32f0e
commit dbe5980577
3 changed files with 17 additions and 6 deletions

View File

@ -417,6 +417,7 @@ static int cr_resources(variant var, char *buffer, const void *userdata)
char *wp = buffer;
if (rlist != NULL) {
const char *name = resourcename(rlist->type, rlist->number != 1);
assert(name);
wp +=
sprintf(wp, "\"%d %s", rlist->number, translate(name, LOC(f->locale,
name)));
@ -425,6 +426,7 @@ static int cr_resources(variant var, char *buffer, const void *userdata)
if (rlist == NULL)
break;
name = resourcename(rlist->type, rlist->number != 1);
assert(name);
wp +=
sprintf(wp, ", %d %s", rlist->number, translate(name,
LOC(f->locale, name)));
@ -1100,6 +1102,7 @@ static char *cr_output_resource(char *buf, const resource_type *rtype,
const char * name;
assert(rtype);
name = resourcename(rtype, 1);
assert(name);
buf += sprintf(buf, "RESOURCE %u\n", hashstring(rtype->_name));
buf += sprintf(buf, "\"%s\";type\n", translate(name, LOC(loc, rtype->_name)));
if (amount >= 0) {
@ -1183,6 +1186,7 @@ void cr_output_resources(stream *out, const faction * f, const region *r, bool s
for (n = 0; n < size; ++n) {
if (result[n].level >= 0 && result[n].number >= 0) {
const char * name = resourcename(result[n].rtype, result[n].number != 1);
assert(name);
stream_printf(out, "%d;%s\n", result[n].number, crtag(name));
}
}

View File

@ -53,10 +53,13 @@ assert_grep_count reports/$CRFILE '^BURG' 1
assert_grep_count reports/$CRFILE '^EINHEIT' 2
assert_grep_count reports/$CRFILE '^GEGENSTAENDE' 2
assert_grep_count reports/185-heg.cr ';Baeume' 4
assert_grep_count reports/185-heg.cr '"B.ume";type' 4
assert_grep_count reports/185-heg.cr '"Pferde";type' 6
assert_grep_count reports/185-heg.nr 'erblickt' 6
assert_grep_count reports/185-heg.cr '"lighthouse";visibility' 6
assert_grep_count reports/185-heg.cr '"neighbour";visibility' 11
assert_grep_count reports/185-6rLo.cr '^EINHEIT' 2
assert_grep_count reports/185-6rLo.cr '^REGION' 13
echo "integration tests: PASS"
cleanup
#cleanup

View File

@ -34,14 +34,18 @@ $VALGRIND $SERVER -t 184 ../scripts/reports.lua
[ -d reports ] || quit 4 "no reports directory created"
CRFILE=184-zvto.cr
grep -q PARTEI reports/$CRFILE || quit 1 "CR did not contain any factions"
grep -q -E '"B.ume";type"' reports/$CRFILE || \
quit 1 "CR did not contain trees"
grep -q '"Bauern";type"' reports/$CRFILE || \
quit 1 "CR did not contain peasants"
grep -q -E '"B.ume";type' reports/$CRFILE || \
quit 1 "regions did not contain trees"
grep -q -E '"Silber";type' reports/$CRFILE || \
quit 1 "regions did not contain silver"
grep -q '"Bauern";type' reports/$CRFILE || \
quit 1 "regions did not contain peasants"
grep -q '"Sch..linge";type' reports/$CRFILE || \
quit 1 "regions did not contain saplings"
grep -q REGION reports/$CRFILE || quit 2 "CR did not contain any regions"
grep -q SCHIFF reports/$CRFILE || quit 3 "CR did not contain any ships"
grep -q BURG reports/$CRFILE || quit 4 "CR did not contain any buildings"
grep -q EINHEIT reports/$CRFILE || quit 5 "CR did not contain any units"
grep -q GEGENSTAENDE reports/$CRFILE || quit 6 "CR did not contain any items"
echo "integration tests: PASS"
#cleanup
cleanup