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' u1.name = 'Xolgrim'
process_orders() process_orders()
-- Intermittent Failure: expected 0 but was 2
assert_equal(0, u1:get_item("log")) assert_equal(0, u1:get_item("log"))
assert_equal(2, u2: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; int err;
region *r; region *r;
cJSON *json, *attr, *result, *regs; cJSON *json, *attr, *result, *regs;
size_t sz;
r = test_create_region(0, 0, terrain); 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); err = json_export(&out, EXPORT_REGIONS);
CuAssertIntEquals(tc, 0, err); CuAssertIntEquals(tc, 0, err);
out.api->rewind(out.handle); 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); mstream_done(&out);
json = cJSON_Parse(buf); json = cJSON_Parse(buf);

View file

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

View file

@ -8,7 +8,7 @@
#ifndef ERESSEA_VERSION #ifndef ERESSEA_VERSION
/* the version number, if it was not passed to make with -D */ /* 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 #endif
const char *eressea_version(void) { 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) { for (u = f->units; u; u = u->nextF) {
if (u->number > 0) { if (u->number > 0) {
struct sc_mage * mage = get_mage(u); struct sc_mage * mage = get_mage(u);
if (mage && mage_get_spellbook(mage)) { if (mage) {
int level = effskill(u, SK_MAGIC, NULL); int level = effskill(u, SK_MAGIC, NULL);
if (level > maxlevel) { if (level > maxlevel) {
maxlevel = level; maxlevel = level;

View file

@ -144,8 +144,6 @@ bool omniscient(const faction *f)
return (f->race == rc_template); return (f->race == rc_template);
} }
static char *groupid(const struct group *g, const struct faction *f) static char *groupid(const struct group *g, const struct faction *f)
{ {
typedef char name[OBJECTIDSIZE + 1]; typedef char name[OBJECTIDSIZE + 1];
@ -1603,7 +1601,9 @@ int write_reports(faction * f)
if (noreports) { if (noreports) {
return false; 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); password = faction_genpassword(f, buffer);
} }
prepare_report(&ctx, f, password); prepare_report(&ctx, f, password);

View file

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