Merge pull request #14 from CTD1/master

Bug 1755 Beschworene Skelette mit Ausdauerproblemen
This commit is contained in:
Enno Rehling 2014-07-24 07:58:50 +02:00
commit 10e08ab306
3 changed files with 24 additions and 8 deletions

View File

@ -1164,17 +1164,10 @@ void economics(region * r)
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
order *ord; order *ord;
bool destroyed = false;
if (u->number > 0) { if (u->number > 0) {
for (ord = u->orders; ord; ord = ord->next) { for (ord = u->orders; ord; ord = ord->next) {
keyword_t kwd = getkeyword(ord); keyword_t kwd = getkeyword(ord);
if (kwd == K_DESTROY) { if (kwd == K_GIVE) {
if (!destroyed) {
if (destroy_cmd(u, ord) != 0)
ord = NULL;
destroyed = true;
}
} else if (kwd == K_GIVE) {
give_cmd(u, ord); give_cmd(u, ord);
} else if (kwd == K_FORGET) { } else if (kwd == K_FORGET) {
forget_cmd(u, ord); forget_cmd(u, ord);
@ -1207,6 +1200,27 @@ void economics(region * r)
if (recruitorders) if (recruitorders)
expandrecruit(r, recruitorders); expandrecruit(r, recruitorders);
remove_empty_units_in_region(r); remove_empty_units_in_region(r);
for (u = r->units; u; u = u->next) {
order *ord;
bool destroyed = false;
if (u->number > 0) {
for (ord = u->orders; ord; ord = ord->next) {
keyword_t kwd = getkeyword(ord);
if (kwd == K_DESTROY) {
if (!destroyed) {
if (destroy_cmd(u, ord) != 0)
ord = NULL;
destroyed = true;
}
}
if (u->orders == NULL) {
break;
}
}
}
}
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */

View File

@ -139,6 +139,7 @@ void equip_unit_mask(struct unit *u, const struct equipment *eq, int mask)
set_level(u, (skill_t)sk, i); set_level(u, (skill_t)sk, i);
} }
} }
u->hp = unit_max_hp(u) * u->number; // Bring the unit to max HitPoints just for the case stamina was changed
} }
if (mask & EQUIP_SPELLS) { if (mask & EQUIP_SPELLS) {

View File

@ -3235,6 +3235,7 @@ static void skill_summoned(unit * u, int level)
} }
} }
} }
u->hp = unit_max_hp(u) * u->number; // Bring the unit to max HitPoints just for the case stamina was changed
} }
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */