forked from github/server
some more bugs reading objects that are conditional on save-data
This commit is contained in:
parent
0a9705809b
commit
8ebd4c2066
|
@ -7,6 +7,7 @@
|
||||||
#include "region.h"
|
#include "region.h"
|
||||||
#include "group.h"
|
#include "group.h"
|
||||||
#include "faction.h"
|
#include "faction.h"
|
||||||
|
#include "objtypes.h"
|
||||||
#include "plane.h"
|
#include "plane.h"
|
||||||
|
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
|
@ -23,10 +24,13 @@ void read_allies(gamedata * data, faction *f)
|
||||||
ally **sfp = &f->allies;
|
ally **sfp = &f->allies;
|
||||||
for (;;) {
|
for (;;) {
|
||||||
int aid;
|
int aid;
|
||||||
ally * al = ally_add(sfp, NULL);
|
READ_INT(data->store, &aid);
|
||||||
aid = read_faction_reference(data, &al->faction, NULL);
|
|
||||||
if (aid > 0) {
|
if (aid > 0) {
|
||||||
|
ally * al = ally_add(sfp, NULL);
|
||||||
int state;
|
int state;
|
||||||
|
if ((al->faction = findfaction(aid)) == NULL) {
|
||||||
|
ur_add(RESOLVE_FACTION | aid, &al->faction, NULL);
|
||||||
|
}
|
||||||
READ_INT(data->store, &state);
|
READ_INT(data->store, &state);
|
||||||
al->status = state & HELP_ALL;
|
al->status = state & HELP_ALL;
|
||||||
sfp = &al->next;
|
sfp = &al->next;
|
||||||
|
|
|
@ -60,7 +60,7 @@ static void killunit_write(const trigger * t, struct storage *store)
|
||||||
|
|
||||||
static int killunit_read(trigger * t, gamedata *data)
|
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_FAIL;
|
||||||
}
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
|
|
Loading…
Reference in New Issue