forked from github/server
Merge pull request #72 from badgerman/master
fix two crashes, and undead heroes
This commit is contained in:
commit
968304db96
|
@ -2719,7 +2719,7 @@ static void aftermath(battle * b)
|
||||||
fset(sh, SF_DAMAGED);
|
fset(sh, SF_DAMAGED);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (df->alive == du->number) {
|
if (df->alive && df->alive == du->number) {
|
||||||
du->hp = sum_hp;
|
du->hp = sum_hp;
|
||||||
continue; /* nichts passiert */
|
continue; /* nichts passiert */
|
||||||
}
|
}
|
||||||
|
|
|
@ -634,7 +634,7 @@ int give_control_cmd(unit * u, order * ord)
|
||||||
getunit(r, u->faction, &u2);
|
getunit(r, u->faction, &u2);
|
||||||
|
|
||||||
s = getstrtoken();
|
s = getstrtoken();
|
||||||
if (isparam(s, u->faction->locale, P_CONTROL)) {
|
if (s && isparam(s, u->faction->locale, P_CONTROL)) {
|
||||||
message *msg = 0;
|
message *msg = 0;
|
||||||
|
|
||||||
if (!can_give_to(u, u2)) {
|
if (!can_give_to(u, u2)) {
|
||||||
|
|
|
@ -459,7 +459,7 @@ damage_unit(unit * u, const char *dam, bool physical, bool magic)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert(u->number > u->hp);
|
assert(u->number <= u->hp);
|
||||||
h = u->hp / u->number;
|
h = u->hp / u->number;
|
||||||
/* HP verteilen */
|
/* HP verteilen */
|
||||||
for (i = 0; i < u->number; i++)
|
for (i = 0; i < u->number; i++)
|
||||||
|
|
|
@ -1737,6 +1737,7 @@ int sp_undeadhero(struct castorder * co)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (j > 0) {
|
if (j > 0) {
|
||||||
|
item **ilist;
|
||||||
unit *u =
|
unit *u =
|
||||||
create_unit(r, mage->faction, 0, get_race(RC_UNDEAD), 0, du->name,
|
create_unit(r, mage->faction, 0, get_race(RC_UNDEAD), 0, du->name,
|
||||||
du);
|
du);
|
||||||
|
@ -1750,6 +1751,21 @@ int sp_undeadhero(struct castorder * co)
|
||||||
}
|
}
|
||||||
setstatus(u, du->status);
|
setstatus(u, du->status);
|
||||||
setguard(u, GUARD_NONE);
|
setguard(u, GUARD_NONE);
|
||||||
|
for (ilist = &du->items; *ilist;) {
|
||||||
|
item *itm = *ilist;
|
||||||
|
int loot = itm->number * j / du->number;
|
||||||
|
if (loot != itm->number) {
|
||||||
|
int split = itm->number * j % du->number;
|
||||||
|
if (split > 0 && (rng_int() % du->number) < split) {
|
||||||
|
++loot;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
i_change(&u->items, itm->type, loot);
|
||||||
|
i_change(ilist, itm->type, -loot);
|
||||||
|
if (*ilist == itm) {
|
||||||
|
ilist = &itm->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* inherit stealth from magician */
|
/* inherit stealth from magician */
|
||||||
if (fval(mage, UFL_ANON_FACTION)) {
|
if (fval(mage, UFL_ANON_FACTION)) {
|
||||||
|
|
Loading…
Reference in New Issue