forked from github/server
Magier dürfen bei STIRB nicht übergeben werden.
This commit is contained in:
parent
1bff7801ff
commit
cd165d94ec
10
src/laws.c
10
src/laws.c
|
@ -969,24 +969,16 @@ void transfer_faction(faction *fsrc, faction *fdst) {
|
||||||
|
|
||||||
if (u_race(u) == fdst->race) {
|
if (u_race(u) == fdst->race) {
|
||||||
u->flags &= ~UFL_HERO;
|
u->flags &= ~UFL_HERO;
|
||||||
if (give_unit_allowed(u) == 0) {
|
if (give_unit_allowed(u) == 0 && !get_mage(u)) {
|
||||||
if (u->skills) {
|
if (u->skills) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i != u->skill_size; ++i) {
|
for (i = 0; i != u->skill_size; ++i) {
|
||||||
const skill *sv = u->skills + i;
|
const skill *sv = u->skills + i;
|
||||||
skill_t sk = (skill_t)sv->id;
|
skill_t sk = (skill_t)sv->id;
|
||||||
struct sc_mage *mage;
|
|
||||||
|
|
||||||
if (skill_count[sk] + u->number > skill_limit[sk]) {
|
if (skill_count[sk] + u->number > skill_limit[sk]) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mage = get_mage(u);
|
|
||||||
if (mage) {
|
|
||||||
if (fdst->magiegebiet != mage_get_type(mage)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (i != u->skill_size) {
|
if (i != u->skill_size) {
|
||||||
u = u->nextF;
|
u = u->nextF;
|
||||||
|
|
|
@ -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) {
|
static void test_quit_transfer_mages(CuTest *tc) {
|
||||||
faction *f1, *f2;
|
faction *f1, *f2;
|
||||||
|
@ -2107,28 +2107,13 @@ static void test_quit_transfer_mages(CuTest *tc) {
|
||||||
set_level(u1, SK_MAGIC, 1);
|
set_level(u1, SK_MAGIC, 1);
|
||||||
create_mage(u1, M_GWYRRD);
|
create_mage(u1, M_GWYRRD);
|
||||||
|
|
||||||
f2->magiegebiet = M_CERDDOR;
|
f2->magiegebiet = M_GWYRRD;
|
||||||
set_level(u2, SK_MAGIC, 1);
|
set_level(u2, SK_MAGIC, 1);
|
||||||
create_mage(u2, M_CERDDOR);
|
create_mage(u2, M_GWYRRD);
|
||||||
|
|
||||||
quit_cmd(u1, u1->thisorder);
|
quit_cmd(u1, u1->thisorder);
|
||||||
CuAssertPtrEquals(tc, f1, u1->faction);
|
CuAssertPtrEquals(tc, f1, u1->faction);
|
||||||
CuAssertIntEquals(tc, FFL_QUIT, f1->flags & FFL_QUIT);
|
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();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue