- El heroi es independent de la recarrega

This commit is contained in:
2023-06-06 19:36:45 +02:00
parent 33d9573d8a
commit e75eae0c7e
2 changed files with 30 additions and 6 deletions

View File

@@ -640,13 +640,34 @@ namespace actor
void clear()
{
actor_t *hero = nullptr;
actor_t *act = first;
while (act)
{
actor_t *tmp = act->next;
free(act);
if (act->flags & FLAG_HERO) {
hero = act;
} else {
free(act);
}
act = tmp;
}
act = dirty;
while (act)
{
actor_t *tmp = act->next;
if (act->flags & FLAG_HERO) {
hero = act;
} else {
free(act);
}
act = tmp;
}
first = dirty = nullptr;
if (hero) {
hero->above = hero->below = hero->next = hero->prev = nullptr;
dirty = hero;
}
}
}