From 396705f492fc9ced86759535e57f8229b9545cdb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 7 Nov 2017 19:42:00 +0100 Subject: [PATCH 1/2] BUG 2383: Delete an invalid assertion. https://bugs.eressea.de/view.php?id=2383 --- src/creport.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/creport.c b/src/creport.c index 15e1791f6..30f045b3f 100644 --- a/src/creport.c +++ b/src/creport.c @@ -853,8 +853,6 @@ void cr_output_unit(stream *out, const region * r, const faction * f, stream_printf(out, "\"%s\";Typ\n", translate(zRace, LOC(f->locale, zRace))); if (u->faction == f && irace != u_race(u)) { - assert(skill_enabled(SK_STEALTH) - || !"we're resetting this on load, so.. ircase should never be used"); zRace = rc_name_s(u_race(u), NAME_PLURAL); stream_printf(out, "\"%s\";wahrerTyp\n", translate(zRace, LOC(f->locale, zRace))); From 6e53f15a1c95e49bb8cbc9c7068f1debd1e75741 Mon Sep 17 00:00:00 2001 From: Steffen Mecke Date: Sat, 18 Nov 2017 17:57:30 +0100 Subject: [PATCH 2/2] addendum to BUG 2383 (5a0a1f): read irace correctly --- src/kernel/save.c | 2 +- src/kernel/save.test.c | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/kernel/save.c b/src/kernel/save.c index aa09a27be..926de1bb1 100644 --- a/src/kernel/save.c +++ b/src/kernel/save.c @@ -509,7 +509,7 @@ unit *read_unit(gamedata *data) u_setrace(u, rc); READ_TOK(data->store, rname, sizeof(rname)); - if (rname[0] && skill_enabled(SK_STEALTH)) + if (rname[0]) u->irace = rc_find(rname); else u->irace = NULL; diff --git a/src/kernel/save.test.c b/src/kernel/save.test.c index 81d5a507d..82cd8662c 100644 --- a/src/kernel/save.test.c +++ b/src/kernel/save.test.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -51,6 +52,7 @@ static void test_readwrite_unit(CuTest * tc) struct unit *u; struct region *r; struct faction *f; + struct race *irace; int fno; test_setup(); @@ -60,6 +62,12 @@ static void test_readwrite_unit(CuTest * tc) u = test_create_unit(f, r); unit_setname(u, " Hodor "); CuAssertStrEquals(tc, " Hodor ", u->_name); + enable_skill(SK_STEALTH, false); + irace = test_create_race("halfling"); + CuAssertTrue(tc, playerrace(irace)); + u->irace = irace; + CuAssertTrue(tc, irace == u_irace(u)); + mstream_init(&data.strm); gamedata_init(&data, &store, RELEASE_VERSION); write_unit(&data, u); @@ -74,6 +82,7 @@ static void test_readwrite_unit(CuTest * tc) CuAssertPtrNotNull(tc, u); CuAssertPtrEquals(tc, f, u->faction); CuAssertStrEquals(tc, "Hodor", u->_name); + CuAssertTrue(tc, irace == u_irace(u)); CuAssertPtrEquals(tc, 0, u->region); mstream_done(&data.strm);