diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c index e204a6b68..d69f75663 100644 --- a/src/common/gamecode/laws.c +++ b/src/common/gamecode/laws.c @@ -3665,7 +3665,7 @@ claim_cmd(unit * u, struct order * ord) if (itype!=NULL) { item ** iclaim = i_find(&u->faction->items, itype); - if (iclaim!=NULL) { + if (iclaim!=NULL && *iclaim!=NULL) { n = min(n, (*iclaim)->number); i_change(iclaim, itype, -n); i_change(&u->items, itype, n); diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 654c1a757..512246388 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -880,8 +880,11 @@ rmtroop(troop dt) rmfighter(df, 1); assert(dt.index >= 0 && dt.index < df->unit->number); - df->person[dt.index] = df->person[df->alive - df->removed]; - df->person[df->alive - df->removed].hp = 0; + df->person[dt.index] = df->person[df->alive - df->removed]; + if (df->removed) { + df->person[df->alive - df->removed] = df->person[df->alive]; + } + df->person[df->alive].hp = 0; } void @@ -2559,8 +2562,8 @@ aftermath(battle * b) } if (du->hp < du->number) { log_error(("%s has less hitpoints (%u) than people (%u)\n", - itoa36(du->no), du->hp, du->number)); - du->hp=du->no; + itoa36(du->no), du->hp, du->number)); + du->hp = du->number; } } cv_next(df); s->alive+=s->healed; diff --git a/src/common/kernel/battle.h b/src/common/kernel/battle.h index 5f3c8b991..8f6029f96 100644 --- a/src/common/kernel/battle.h +++ b/src/common/kernel/battle.h @@ -158,11 +158,11 @@ extern "C" { struct item * loot; int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */ struct person { + int hp; /* Trefferpunkte der Personen */ int attack : 8; /* (Magie) Attackenbonus der Personen */ int defence : 8; /* (Magie) Paradenbonus der Personen */ int damage : 8; /* (Magie) Schadensbonus der Personen im Nahkampf */ int damage_rear : 8; /* (Magie) Schadensbonus der Personen im Fernkampf */ - int hp : 16; /* Trefferpunkte der Personen */ int flags : 8; /* (Magie) Diverse Flags auf Kämpfern */ int speed : 8; /* (Magie) Geschwindigkeitsmultiplkator. */ int reload : 4; /* Anzahl Runden, die die Waffe x noch laden muss.