fix some niggles, delete invalid test.

This commit is contained in:
Enno Rehling 2017-09-16 07:37:33 +02:00
parent 860afe855f
commit 8c6362002e
4 changed files with 10 additions and 24 deletions

View File

@ -418,10 +418,12 @@ message * give_men(int n, unit * u, unit * u2, struct order *ord)
set_racename(&u2->attribs, get_racename(u->attribs)); set_racename(&u2->attribs, get_racename(u->attribs));
u_setrace(u2, u_race(u)); u_setrace(u2, u_race(u));
u2->irace = u->irace; u2->irace = u->irace;
if (fval(u, UFL_HERO)) if (fval(u, UFL_HERO)) {
fset(u2, UFL_HERO); fset(u2, UFL_HERO);
else }
else {
freset(u2, UFL_HERO); freset(u2, UFL_HERO);
}
} }
/* Einheiten von Schiffen können nicht NACH in von /* Einheiten von Schiffen können nicht NACH in von

View File

@ -648,10 +648,15 @@ static void read_skills(gamedata *data, unit *u)
static void write_skills(gamedata *data, const unit *u) { static void write_skills(gamedata *data, const unit *u) {
int i; int i;
skill_t sk = NOSKILL;
WRITE_INT(data->store, u->skill_size); WRITE_INT(data->store, u->skill_size);
for (i = 0; i != u->skill_size; ++i) { for (i = 0; i != u->skill_size; ++i) {
skill *sv = u->skills + i; skill *sv = u->skills + i;
#ifndef NDEBUG
assert(sv->id > sk);
sk = sv->id;
assert(sv->weeks <= sv->level * 2 + 1); assert(sv->weeks <= sv->level * 2 + 1);
#endif
WRITE_INT(data->store, sv->id); WRITE_INT(data->store, sv->id);
WRITE_INT(data->store, sv->level); WRITE_INT(data->store, sv->level);
WRITE_INT(data->store, sv->weeks); WRITE_INT(data->store, sv->weeks);

View File

@ -356,9 +356,7 @@ static int read_seenspell(attrib * a, void *owner, struct gamedata *data)
} }
sp = find_spell(token); sp = find_spell(token);
if (!sp) { if (!sp) {
log_warning("read_seenspell: could not find spell '%s'\n", token); log_info("read_seenspell: could not find spell '%s'\n", token);
}
if (!sp) {
return AT_READ_FAIL; return AT_READ_FAIL;
} }
a->data.v = sp; a->data.v = sp;

View File

@ -445,24 +445,6 @@ static void test_max_spellpoints(CuTest *tc) {
test_cleanup(); test_cleanup();
} }
static void test_familiar_mage(CuTest *tc) {
unit *um, *uf, *ut;
test_setup();
um = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0));
uf = test_create_unit(um->faction, um->region);
ut = test_create_unit(um->faction, um->region);
set_number(ut, 0);
CuAssertTrue(tc, create_newfamiliar(um, uf));
CuAssertTrue(tc, is_familiar(uf));
CuAssertTrue(tc, !is_familiar(um));
CuAssertPtrEquals(tc, um, get_familiar_mage(uf));
CuAssertPtrEquals(tc, uf, get_familiar(um));
CuAssertPtrEquals(tc, NULL, give_men(1, um, ut, NULL));
CuAssertPtrEquals(tc, ut, get_familiar_mage(uf));
test_cleanup();
}
static void test_illusioncastle(CuTest *tc) static void test_illusioncastle(CuTest *tc)
{ {
building *b; building *b;
@ -502,6 +484,5 @@ CuSuite *get_magic_suite(void)
SUITE_ADD_TEST(suite, test_magic_resistance); SUITE_ADD_TEST(suite, test_magic_resistance);
SUITE_ADD_TEST(suite, test_max_spellpoints); SUITE_ADD_TEST(suite, test_max_spellpoints);
SUITE_ADD_TEST(suite, test_illusioncastle); SUITE_ADD_TEST(suite, test_illusioncastle);
DISABLE_TEST(suite, test_familiar_mage);
return suite; return suite;
} }