crashbug dying clone-mages

This commit is contained in:
Enno Rehling 2006-05-21 10:35:08 +00:00
parent 4ea7779932
commit d57e05fcd7
3 changed files with 95 additions and 92 deletions

View File

@ -246,9 +246,9 @@ destroy_unit(unit * u)
set_number(u, 1); set_number(u, 1);
set_spellpoints(u, 0); set_spellpoints(u, 0);
a = a_find(u->attribs, &at_clone); a = a_find(u->attribs, &at_clone);
a_remove(&u->attribs, a); if (a!=NULL) a_remove(&u->attribs, a);
a = a_find(clone->attribs, &at_clonemage); a = a_find(clone->attribs, &at_clonemage);
a_remove(&clone->attribs, a); if (a!=NULL) a_remove(&clone->attribs, a);
fset(u, UFL_LONGACTION); fset(u, UFL_LONGACTION);
set_number(clone, 0); set_number(clone, 0);
u = clone; u = clone;
@ -262,8 +262,9 @@ destroy_unit(unit * u)
} else { } else {
if (u->number) set_number(u, 0); if (u->number) set_number(u, 0);
handle_event(&u->attribs, "destroy", u); handle_event(&u->attribs, "destroy", u);
if (r && !fval(r->terrain, SEA_REGION)) if (r && !fval(r->terrain, SEA_REGION)) {
rsetmoney(r, rmoney(r) + get_money(u)); rsetmoney(r, rmoney(r) + get_money(u));
}
dhash(u->no, u->faction); dhash(u->no, u->faction);
u_setfaction(u, NULL); u_setfaction(u, NULL);
if (r) leave(r, u); if (r) leave(r, u);

View File

@ -156,6 +156,7 @@ a_unlink(attrib ** pa, attrib * a)
attrib ** pnexttype = pa; attrib ** pnexttype = pa;
attrib ** pnext = NULL; attrib ** pnext = NULL;
assert(a!=NULL);
while (*pnexttype) { while (*pnexttype) {
attrib * next = *pnexttype; attrib * next = *pnexttype;
if (next->type==a->type) break; if (next->type==a->type) break;
@ -188,6 +189,7 @@ int
a_remove(attrib ** pa, attrib * a) a_remove(attrib ** pa, attrib * a)
{ {
int ok; int ok;
assert(a!=NULL);
ok = a_unlink(pa, a); ok = a_unlink(pa, a);
if (ok) a_free(a); if (ok) a_free(a);
return ok; return ok;

View File

@ -776,7 +776,7 @@
<arg name="ship" type="ship"/> <arg name="ship" type="ship"/>
<arg name="dir" type="direction"/> <arg name="dir" type="direction"/>
</type> </type>
<text locale="de">"Die $region($ship) treibt nach $direction($dir)."</text> <text locale="de">"Die $ship($ship) treibt nach $direction($dir)."</text>
<text locale="fr">"The ship $ship($ship) drifts to the $direction($dir)."</text> <text locale="fr">"The ship $ship($ship) drifts to the $direction($dir)."</text>
<text locale="en">"The ship $ship($ship) drifts to the $direction($dir)."</text> <text locale="en">"The ship $ship($ship) drifts to the $direction($dir)."</text>
</message> </message>