forked from github/server
Merge branch 'master' into develop
This commit is contained in:
commit
6b1baec2de
10
src/laws.c
10
src/laws.c
|
@ -951,24 +951,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;
|
||||
|
|
|
@ -2107,7 +2107,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;
|
||||
|
@ -2130,28 +2130,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();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue