forked from github/server
fix gcc compilation
This commit is contained in:
parent
0c16727d41
commit
3aed0b1ee5
|
@ -36,7 +36,7 @@ write_targetregion(const attrib * a, const void *owner, struct storage *store)
|
||||||
|
|
||||||
static int read_targetregion(attrib * a, void *owner, gamedata *data)
|
static int read_targetregion(attrib * a, void *owner, gamedata *data)
|
||||||
{
|
{
|
||||||
if (read_region_reference(data, &a->data.v, NULL) <= 0) {
|
if (read_region_reference(data, (region **)&a->data.v, NULL) <= 0) {
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
|
|
|
@ -329,7 +329,7 @@ void resolve_building(building *b)
|
||||||
resolve(RESOLVE_BUILDING | b->no, b);
|
resolve(RESOLVE_BUILDING | b->no, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_building_reference(gamedata * data, void **bp, resolve_fun fun)
|
int read_building_reference(gamedata * data, building **bp, resolve_fun fun)
|
||||||
{
|
{
|
||||||
int id;
|
int id;
|
||||||
READ_INT(data->store, &id);
|
READ_INT(data->store, &id);
|
||||||
|
@ -337,7 +337,7 @@ int read_building_reference(gamedata * data, void **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, bp, fun);
|
ur_add(RESOLVE_BUILDING | id, (void**)bp, fun);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -155,7 +155,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, void **bp, resolve_fun fun);
|
int read_building_reference(struct gamedata * data, struct building **bp, resolve_fun fun);
|
||||||
|
|
||||||
struct building *findbuilding(int n);
|
struct building *findbuilding(int n);
|
||||||
|
|
||||||
|
|
|
@ -226,7 +226,7 @@ int curse_read(attrib * a, void *owner, gamedata *data)
|
||||||
READ_INT(store, &c->data.i);
|
READ_INT(store, &c->data.i);
|
||||||
}
|
}
|
||||||
if (c->type->typ == CURSETYP_REGION) {
|
if (c->type->typ == CURSETYP_REGION) {
|
||||||
int rr = read_region_reference(data, &c->data.v, NULL);
|
int rr = read_region_reference(data, (region **)&c->data.v, NULL);
|
||||||
if (ur == 0 && rr == 0 && !c->data.v) {
|
if (ur == 0 && rr == 0 && !c->data.v) {
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,7 +332,7 @@ int read_faction_reference(gamedata * data, faction **fp, resolve_fun fun)
|
||||||
*fp = findfaction(id);
|
*fp = findfaction(id);
|
||||||
if (*fp == NULL) {
|
if (*fp == NULL) {
|
||||||
*fp = NULL;
|
*fp = NULL;
|
||||||
ur_add(RESOLVE_FACTION | id, fp, fun);
|
ur_add(RESOLVE_FACTION | id, (void **)fp, fun);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -1262,7 +1262,7 @@ void resolve_region(region *r)
|
||||||
resolve(RESOLVE_REGION | r->uid, r);
|
resolve(RESOLVE_REGION | r->uid, r);
|
||||||
}
|
}
|
||||||
|
|
||||||
int read_region_reference(gamedata * data, void **rp, resolve_fun fun)
|
int read_region_reference(gamedata * data, region **rp, resolve_fun fun)
|
||||||
{
|
{
|
||||||
struct storage * store = data->store;
|
struct storage * store = data->store;
|
||||||
int id = 0;
|
int id = 0;
|
||||||
|
@ -1270,7 +1270,7 @@ int read_region_reference(gamedata * data, void **rp, resolve_fun fun)
|
||||||
READ_INT(store, &id);
|
READ_INT(store, &id);
|
||||||
*rp = findregionbyid(id);
|
*rp = findregionbyid(id);
|
||||||
if (*rp == NULL) {
|
if (*rp == NULL) {
|
||||||
ur_add(RESOLVE_REGION | id, rp, fun);
|
ur_add(RESOLVE_REGION | id, (void **)rp, fun);
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -260,7 +260,7 @@ extern "C" {
|
||||||
void region_set_morale(region * r, int morale, int turn);
|
void region_set_morale(region * r, int morale, int turn);
|
||||||
|
|
||||||
void write_region_reference(const struct region *r, struct storage *store);
|
void write_region_reference(const struct region *r, struct storage *store);
|
||||||
int read_region_reference(struct gamedata *data, void **rp, resolve_fun fun);
|
int read_region_reference(struct gamedata *data, region **rp, resolve_fun fun);
|
||||||
void resolve_region(region *r);
|
void resolve_region(region *r);
|
||||||
|
|
||||||
const char *regionname(const struct region *r, const struct faction *f);
|
const char *regionname(const struct region *r, const struct faction *f);
|
||||||
|
|
|
@ -508,21 +508,6 @@ void write_alliances(gamedata *data)
|
||||||
WRITE_SECTION(data->store);
|
WRITE_SECTION(data->store);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int resolve_owner(int id, void *address)
|
|
||||||
{
|
|
||||||
region_owner *owner = (region_owner *)address;
|
|
||||||
int result = 0;
|
|
||||||
faction *f = NULL;
|
|
||||||
if (id != 0) {
|
|
||||||
f = findfaction(id);
|
|
||||||
if (f == NULL) {
|
|
||||||
log_error("region has an invalid owner (%s)", itoa36(id));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
owner->owner = f;
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void read_owner(gamedata *data, region_owner ** powner)
|
static void read_owner(gamedata *data, region_owner ** powner)
|
||||||
{
|
{
|
||||||
int since_turn;
|
int since_turn;
|
||||||
|
@ -1230,7 +1215,6 @@ void _test_write_password(gamedata *data, const faction *f) {
|
||||||
|
|
||||||
faction *read_faction(gamedata * data)
|
faction *read_faction(gamedata * data)
|
||||||
{
|
{
|
||||||
ally **sfp;
|
|
||||||
int planes, n;
|
int planes, n;
|
||||||
faction *f;
|
faction *f;
|
||||||
char name[DISPLAYSIZE];
|
char name[DISPLAYSIZE];
|
||||||
|
@ -1359,7 +1343,6 @@ faction *read_faction(gamedata * data)
|
||||||
/* mistakes were made in the past*/
|
/* mistakes were made in the past*/
|
||||||
f->options &= ~want(O_JSON);
|
f->options &= ~want(O_JSON);
|
||||||
}
|
}
|
||||||
sfp = &f->allies;
|
|
||||||
read_allies(data, f);
|
read_allies(data, f);
|
||||||
read_groups(data, f);
|
read_groups(data, f);
|
||||||
f->spellbook = 0;
|
f->spellbook = 0;
|
||||||
|
|
|
@ -648,7 +648,7 @@ void a_writesiege(const attrib * a, const void *owner, struct storage *store)
|
||||||
|
|
||||||
int a_readsiege(attrib * a, void *owner, gamedata *data)
|
int a_readsiege(attrib * a, void *owner, gamedata *data)
|
||||||
{
|
{
|
||||||
if (read_building_reference(data, &a->data.v, NULL) <= 0) {
|
if (read_building_reference(data, (building **)&a->data.v, NULL) <= 0) {
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
|
@ -764,7 +764,7 @@ int read_unit_reference(gamedata * data, unit **up, resolve_fun fun)
|
||||||
*up = findunit(id);
|
*up = findunit(id);
|
||||||
if (*up == NULL) {
|
if (*up == NULL) {
|
||||||
*up = NULL;
|
*up = NULL;
|
||||||
ur_add(RESOLVE_UNIT | id, up, fun);
|
ur_add(RESOLVE_UNIT | id, (void **)up, fun);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -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, &t->data.v, NULL) <= 0) {
|
if (read_building_reference(data, (building **)&t->data.v, NULL) <= 0) {
|
||||||
return AT_READ_FAIL;
|
return AT_READ_FAIL;
|
||||||
}
|
}
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static int wormhole_read(struct attrib *a, void *owner, struct gamedata *data)
|
||||||
if (data->version < ATTRIBOWNER_VERSION) {
|
if (data->version < ATTRIBOWNER_VERSION) {
|
||||||
READ_INT(data->store, NULL);
|
READ_INT(data->store, NULL);
|
||||||
}
|
}
|
||||||
id = read_region_reference(data, &a->data.v, NULL);
|
id = read_region_reference(data, (region **)&a->data.v, NULL);
|
||||||
return (id <= 0) ? AT_READ_FAIL : AT_READ_OK;
|
return (id <= 0) ? AT_READ_FAIL : AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue