diff --git a/src/kernel/ally.c b/src/kernel/ally.c index b4385088a..534b9ff8e 100644 --- a/src/kernel/ally.c +++ b/src/kernel/ally.c @@ -7,6 +7,7 @@ #include "region.h" #include "group.h" #include "faction.h" +#include "objtypes.h" #include "plane.h" #include @@ -23,10 +24,13 @@ void read_allies(gamedata * data, faction *f) ally **sfp = &f->allies; for (;;) { int aid; - ally * al = ally_add(sfp, NULL); - aid = read_faction_reference(data, &al->faction, NULL); + READ_INT(data->store, &aid); if (aid > 0) { + ally * al = ally_add(sfp, NULL); int state; + if ((al->faction = findfaction(aid)) == NULL) { + ur_add(RESOLVE_FACTION | aid, &al->faction, NULL); + } READ_INT(data->store, &state); al->status = state & HELP_ALL; sfp = &al->next; diff --git a/src/triggers/killunit.c b/src/triggers/killunit.c index f6613dcb7..230efa7dc 100644 --- a/src/triggers/killunit.c +++ b/src/triggers/killunit.c @@ -60,7 +60,7 @@ static void killunit_write(const trigger * t, struct storage *store) static int killunit_read(trigger * t, gamedata *data) { - if (read_unit_reference(data, (unit **)&t->data.v, NULL)) { + if (read_unit_reference(data, (unit **)&t->data.v, NULL) == 0) { return AT_READ_FAIL; } return AT_READ_OK;