forked from github/server
Fixes an fix_otherfaction (null-pointer)
This commit is contained in:
parent
05f6eec60d
commit
d221ca4db7
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
/* misc includes */
|
/* misc includes */
|
||||||
#include <attributes/key.h>
|
#include <attributes/key.h>
|
||||||
|
#include <attributes/otherfaction.h>
|
||||||
#include <modules/xecmd.h>
|
#include <modules/xecmd.h>
|
||||||
|
|
||||||
/* gamecode includes */
|
/* gamecode includes */
|
||||||
|
@ -491,15 +492,16 @@ fix_otherfaction(void)
|
||||||
unit * u;
|
unit * u;
|
||||||
for (u=r->units;u;u=u->next) {
|
for (u=r->units;u;u=u->next) {
|
||||||
attrib * a = a_find(u->attribs, &at_otherfaction);
|
attrib * a = a_find(u->attribs, &at_otherfaction);
|
||||||
|
if (a!=NULL) {
|
||||||
faction * f = (faction*)a->data.v;
|
faction * f = (faction*)a->data.v;
|
||||||
if (f==u->faction) {
|
if (f==u->faction) {
|
||||||
a_remove(&u->attribs, a);
|
a_remove(&u->attribs, a);
|
||||||
++ncount;
|
++count;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
r = r->next;
|
|
||||||
}
|
}
|
||||||
if (count) log_warning(("%u units had otherfaction=own faction.\n"));
|
}
|
||||||
|
if (count) log_warning(("%u units had otherfaction=own faction.\n", count));
|
||||||
}
|
}
|
||||||
|
|
||||||
extern attrib * make_atgmcreate(const struct item_type * itype);
|
extern attrib * make_atgmcreate(const struct item_type * itype);
|
||||||
|
|
Loading…
Reference in New Issue