forked from github/server
read_building_reference does not need a callback
This commit is contained in:
parent
ba9af6d765
commit
fc4f32f8e0
4 changed files with 5 additions and 5 deletions
|
@ -359,7 +359,7 @@ void resolve_building(building *b)
|
||||||
resolve(RESOLVE_BUILDING | b->no, b);
|
resolve(RESOLVE_BUILDING | b->no, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_building_reference(gamedata * data, building **bp, resolve_fun fun)
|
int read_building_reference(gamedata * data, building **bp)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
READ_INT(data->store, &id);
|
READ_INT(data->store, &id);
|
||||||
|
@ -367,7 +367,7 @@ int read_building_reference(gamedata * data, building **bp, resolve_fun fun)
|
||||||
*bp = findbuilding(id);
|
*bp = findbuilding(id);
|
||||||
if (*bp == NULL) {
|
if (*bp == NULL) {
|
||||||
*bp = NULL;
|
*bp = NULL;
|
||||||
ur_add(RESOLVE_BUILDING | id, (void**)bp, fun);
|
ur_add(RESOLVE_BUILDING | id, (void**)bp, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -166,7 +166,7 @@ extern "C" {
|
||||||
void resolve_building(building *b);
|
void resolve_building(building *b);
|
||||||
void write_building_reference(const struct building *b,
|
void write_building_reference(const struct building *b,
|
||||||
struct storage *store);
|
struct storage *store);
|
||||||
int read_building_reference(struct gamedata * data, struct building **bp, resolve_fun fun);
|
int read_building_reference(struct gamedata * data, struct building **bp);
|
||||||
|
|
||||||
struct building *findbuilding(int n);
|
struct building *findbuilding(int n);
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ static void xmasgate_write(const trigger * t, struct storage *store)
|
||||||
|
|
||||||
static int xmasgate_read(trigger * t, struct gamedata *data)
|
static int xmasgate_read(trigger * t, struct gamedata *data)
|
||||||
{
|
{
|
||||||
if (read_building_reference(data, (building **)&t->data.v, NULL) <= 0) {
|
if (read_building_reference(data, (building **)&t->data.v) <= 0) {
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
|
|
|
@ -75,7 +75,7 @@ static void gate_write(const trigger * t, struct storage *store)
|
||||||
static int gate_read(trigger * t, gamedata *data)
|
static int gate_read(trigger * t, gamedata *data)
|
||||||
{
|
{
|
||||||
gate_data *gd = (gate_data *)t->data.v;
|
gate_data *gd = (gate_data *)t->data.v;
|
||||||
int bc = read_building_reference(data, &gd->gate, NULL);
|
int bc = read_building_reference(data, &gd->gate);
|
||||||
int rc = read_region_reference(data, &gd->target);
|
int rc = read_region_reference(data, &gd->target);
|
||||||
|
|
||||||
if (bc <= 0 && rc <= 0) {
|
if (bc <= 0 && rc <= 0) {
|
||||||
|
|
Loading…
Reference in a new issue