heroes lose their status when gifted.

This commit is contained in:
Enno Rehling 2019-05-04 11:11:30 +02:00
parent 2cb4287268
commit cd28f3aee4
2 changed files with 4 additions and 2 deletions

View File

@ -965,6 +965,7 @@ void transfer_faction(faction *fsrc, faction *fdst) {
for (u = fsrc->units; u != NULL; u = u->nextF) {
if (u_race(u) == fdst->race) {
u->flags &= ~UFL_HERO;
if (give_unit_allowed(u) == 0) {
if (u->skills) {
int i;

View File

@ -1984,7 +1984,7 @@ static void test_quit_transfer_migrants(CuTest *tc) {
}
/**
* Heroes cannot be gifted to another faction.
* A hero that is gifted to another faction loses their status.
*/
static void test_quit_transfer_hero(CuTest *tc) {
faction *f1, *f2;
@ -2006,7 +2006,8 @@ static void test_quit_transfer_hero(CuTest *tc) {
quit_cmd(u1, u1->thisorder);
CuAssertIntEquals(tc, FFL_QUIT, f1->flags & FFL_QUIT);
CuAssertPtrEquals(tc, f1, u1->faction);
CuAssertPtrEquals(tc, f2, u1->faction);
CuAssertIntEquals(tc, 0, u1->flags & UFL_HERO);
test_teardown();
}