Merge remote-tracking branch 'upstream/develop' into develop

This commit is contained in:
Enno Rehling 2019-03-18 10:37:13 +01:00
commit 2a702cbabc
7 changed files with 10 additions and 8 deletions

View File

@ -31,7 +31,6 @@ function test_undead_reserve_other()
u1.name = 'Xolgrim'
process_orders()
-- Intermittent Failure: expected 0 but was 2
assert_equal(0, u1:get_item("log"))
assert_equal(2, u2:get_item("log"))

View File

@ -58,6 +58,7 @@ static cJSON *export_a_region(CuTest * tc, const struct terrain_type *terrain, r
int err;
region *r;
cJSON *json, *attr, *result, *regs;
size_t sz;
r = test_create_region(0, 0, terrain);
@ -65,7 +66,8 @@ static cJSON *export_a_region(CuTest * tc, const struct terrain_type *terrain, r
err = json_export(&out, EXPORT_REGIONS);
CuAssertIntEquals(tc, 0, err);
out.api->rewind(out.handle);
out.api->read(out.handle, buf, sizeof(buf));
sz = out.api->read(out.handle, buf, sizeof(buf));
buf[sz] = '\0';
mstream_done(&out);
json = cJSON_Parse(buf);

View File

@ -299,7 +299,7 @@ unit *addplayer(region * r, faction * f)
} while (rc == NULL || urc == RC_DAEMON || !playerrace(rc));
u->irace = rc;
}
f->lastorders = 0;
return u;
}

View File

@ -8,7 +8,7 @@
#ifndef ERESSEA_VERSION
/* the version number, if it was not passed to make with -D */
#define ERESSEA_VERSION "3.19.0"
#define ERESSEA_VERSION "3.20.0"
#endif
const char *eressea_version(void) {

View File

@ -3205,7 +3205,7 @@ static int faction_getmages(faction * f, unit ** results, int numresults)
for (u = f->units; u; u = u->nextF) {
if (u->number > 0) {
struct sc_mage * mage = get_mage(u);
if (mage && mage_get_spellbook(mage)) {
if (mage) {
int level = effskill(u, SK_MAGIC, NULL);
if (level > maxlevel) {
maxlevel = level;

View File

@ -144,8 +144,6 @@ bool omniscient(const faction *f)
return (f->race == rc_template);
}
static char *groupid(const struct group *g, const struct faction *f)
{
typedef char name[OBJECTIDSIZE + 1];
@ -1603,7 +1601,9 @@ int write_reports(faction * f)
if (noreports) {
return false;
}
if (f->lastorders == 0) {
if (f->lastorders == 0 || f->age <= 1) {
/* neue Parteien, oder solche die noch NIE einen Zug gemacht haben,
* kriegen ein neues Passwort: */
password = faction_genpassword(f, buffer);
}
prepare_report(&ctx, f, password);

View File

@ -963,6 +963,7 @@ static void test_reports_genpassword(CuTest *tc) {
CuAssertTrue(tc, f->password_id != 0);
test_clear_messagelist(&f->msgs);
f->lastorders = 1;
f->age = 2;
pwid = f->password_id;
write_reports(f);
CuAssertIntEquals(tc, pwid, f->password_id);