Magier dürfen bei STIRB nicht übergeben werden.

This commit is contained in:
Enno Rehling 2019-11-18 19:44:24 +01:00
parent 1bff7801ff
commit cd165d94ec
2 changed files with 4 additions and 27 deletions

View File

@ -969,24 +969,16 @@ void transfer_faction(faction *fsrc, faction *fdst) {
if (u_race(u) == fdst->race) {
u->flags &= ~UFL_HERO;
if (give_unit_allowed(u) == 0) {
if (give_unit_allowed(u) == 0 && !get_mage(u)) {
if (u->skills) {
int i;
for (i = 0; i != u->skill_size; ++i) {
const skill *sv = u->skills + i;
skill_t sk = (skill_t)sv->id;
struct sc_mage *mage;
if (skill_count[sk] + u->number > skill_limit[sk]) {
break;
}
mage = get_mage(u);
if (mage) {
if (fdst->magiegebiet != mage_get_type(mage)) {
break;
}
}
}
if (i != u->skill_size) {
u = u->nextF;

View File

@ -2084,7 +2084,7 @@ static void test_quit_transfer_limited(CuTest *tc) {
}
/**
* Gifting units with same magic schools.
* Mages cannot be transfered. At all.
*/
static void test_quit_transfer_mages(CuTest *tc) {
faction *f1, *f2;
@ -2107,28 +2107,13 @@ static void test_quit_transfer_mages(CuTest *tc) {
set_level(u1, SK_MAGIC, 1);
create_mage(u1, M_GWYRRD);
f2->magiegebiet = M_CERDDOR;
f2->magiegebiet = M_GWYRRD;
set_level(u2, SK_MAGIC, 1);
create_mage(u2, M_CERDDOR);
create_mage(u2, M_GWYRRD);
quit_cmd(u1, u1->thisorder);
CuAssertPtrEquals(tc, f1, u1->faction);
CuAssertIntEquals(tc, FFL_QUIT, f1->flags & FFL_QUIT);
f1->flags -= FFL_QUIT;
unit_set_magic(u1, M_CERDDOR);
scale_number(u1, 2);
f1->magiegebiet = M_CERDDOR;
quit_cmd(u1, u1->thisorder);
CuAssertPtrEquals(tc, f1, u1->faction);
CuAssertIntEquals(tc, FFL_QUIT, f1->flags & FFL_QUIT);
f1->flags -= FFL_QUIT;
unit_set_magic(u1, M_CERDDOR);
scale_number(u1, 1);
f1->magiegebiet = M_CERDDOR;
quit_cmd(u1, u1->thisorder);
CuAssertPtrEquals(tc, f2, u1->faction);
test_teardown();
}