some more bugs reading objects that are conditional on save-data

This commit is contained in:
Enno Rehling 2017-09-22 17:58:10 +02:00
parent 0a9705809b
commit 8ebd4c2066
2 changed files with 7 additions and 3 deletions

View File

@ -7,6 +7,7 @@
#include "region.h"
#include "group.h"
#include "faction.h"
#include "objtypes.h"
#include "plane.h"
#include <util/attrib.h>
@ -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;

View File

@ -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;