BUG 2313: proper accounting in remove_unit.

https://bugs.eressea.de/view.php?id=2313
This commit is contained in:
Enno Rehling 2017-03-12 13:02:55 +01:00
parent 720c41c1bf
commit decc38a056
1 changed files with 5 additions and 2 deletions

View File

@ -438,9 +438,12 @@ int remove_unit(unit ** ulist, unit * u)
*ulist = u->next;
}
if (u->faction && u->faction->units == u) {
if (u->faction) {
--u->faction->num_units;
if (u->faction->units == u) {
u->faction->units = u->nextF;
}
}
if (u->prevF) {
u->prevF->nextF = u->nextF;
}