STIRB PARTEI: Versuche, Helden zu übernehmen.

This commit is contained in:
Enno Rehling 2019-11-30 16:29:23 +01:00
parent 1a8b94da59
commit 633866c814
1 changed files with 11 additions and 1 deletions

View File

@ -924,6 +924,7 @@ int leave_cmd(unit * u, struct order *ord)
void transfer_faction(faction *fsrc, faction *fdst) { void transfer_faction(faction *fsrc, faction *fdst) {
unit *u; unit *u;
skill_t sk; skill_t sk;
int hmax, hnow;
int skill_count[MAXSKILLS]; int skill_count[MAXSKILLS];
int skill_limit[MAXSKILLS]; int skill_limit[MAXSKILLS];
@ -945,12 +946,21 @@ void transfer_faction(faction *fsrc, faction *fdst) {
} }
} }
hnow = countheroes(fdst);
hmax = maxheroes(fdst);
u = fsrc->units; u = fsrc->units;
while (u) { while (u) {
unit *unext = u->nextF; unit *unext = u->nextF;
if (u_race(u) == fdst->race) { if (u_race(u) == fdst->race) {
if (u->flags & UFL_HERO) {
if (u->number + hnow > hmax) {
u->flags &= ~UFL_HERO; u->flags &= ~UFL_HERO;
}
else {
hnow += u->number;
}
}
if (give_unit_allowed(u) == 0 && !get_mage(u)) { if (give_unit_allowed(u) == 0 && !get_mage(u)) {
if (u->skills) { if (u->skills) {
int i; int i;