forked from github/server
parent
0379a17350
commit
8d7f966391
|
@ -1097,9 +1097,11 @@ static void cr_reportspell(FILE * F, spell * sp, int level, const struct locale
|
||||||
static char *cr_output_resource(char *buf, const resource_type *rtype,
|
static char *cr_output_resource(char *buf, const resource_type *rtype,
|
||||||
const struct locale *loc, int amount, int level)
|
const struct locale *loc, int amount, int level)
|
||||||
{
|
{
|
||||||
|
const char * name;
|
||||||
assert(rtype);
|
assert(rtype);
|
||||||
|
name = resourcename(rtype, 1);
|
||||||
buf += sprintf(buf, "RESOURCE %u\n", hashstring(rtype->_name));
|
buf += sprintf(buf, "RESOURCE %u\n", hashstring(rtype->_name));
|
||||||
buf += sprintf(buf, "\"%s\";type\n", translate(rtype->_name, LOC(loc, rtype->_name)));
|
buf += sprintf(buf, "\"%s\";type\n", translate(name, LOC(loc, rtype->_name)));
|
||||||
if (amount >= 0) {
|
if (amount >= 0) {
|
||||||
if (level >= 0)
|
if (level >= 0)
|
||||||
buf += sprintf(buf, "%d;skill\n", level);
|
buf += sprintf(buf, "%d;skill\n", level);
|
||||||
|
@ -1180,7 +1182,8 @@ void cr_output_resources(stream *out, const faction * f, const region *r, bool s
|
||||||
}
|
}
|
||||||
for (n = 0; n < size; ++n) {
|
for (n = 0; n < size; ++n) {
|
||||||
if (result[n].level >= 0 && result[n].number >= 0) {
|
if (result[n].level >= 0 && result[n].number >= 0) {
|
||||||
/* stream_printf(out, "%d;%s\n", result[n].number, crtag(result[n].name)); */
|
const char * name = resourcename(result[n].rtype, result[n].number != 1);
|
||||||
|
stream_printf(out, "%d;%s\n", result[n].number, crtag(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -73,7 +73,7 @@ static void test_cr_resources(CuTest *tc) {
|
||||||
|
|
||||||
f = test_create_faction(0);
|
f = test_create_faction(0);
|
||||||
r = test_create_region(0, 0, 0);
|
r = test_create_region(0, 0, 0);
|
||||||
r->land->horses = 100;
|
r->land->horses = 1;
|
||||||
r->land->peasants = 200;
|
r->land->peasants = 200;
|
||||||
r->land->money = 300;
|
r->land->money = 300;
|
||||||
rsettrees(r, 0, 1);
|
rsettrees(r, 0, 1);
|
||||||
|
@ -107,7 +107,7 @@ static void test_cr_resources(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
|
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
|
||||||
CuAssertStrEquals(tc, "\"Pferde\";type", line);
|
CuAssertStrEquals(tc, "\"Pferde\";type", line);
|
||||||
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
|
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
|
||||||
CuAssertStrEquals(tc, "300;number", line);
|
CuAssertStrEquals(tc, "1;number", line);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
|
CuAssertIntEquals(tc, 0, strm.api->readln(strm.handle, line, sizeof(line)));
|
||||||
CuAssertIntEquals(tc, 0, memcmp(line, "RESOURCE ", 9));
|
CuAssertIntEquals(tc, 0, memcmp(line, "RESOURCE ", 9));
|
||||||
|
|
Loading…
Reference in New Issue