forked from github/server
fix some bugs created during conversions (thanks, tests!)
This commit is contained in:
parent
3aed0b1ee5
commit
0a9705809b
10 changed files with 14 additions and 13 deletions
|
@ -322,8 +322,6 @@ void write_building_reference(const struct building *b, struct storage *store)
|
|||
WRITE_INT(store, (b && b->region) ? b->no : 0);
|
||||
}
|
||||
|
||||
#define RESOLVE_BUILDING (TYP_BUILDING << 24)
|
||||
|
||||
void resolve_building(building *b)
|
||||
{
|
||||
resolve(RESOLVE_BUILDING | b->no, b);
|
||||
|
|
|
@ -152,6 +152,7 @@ extern "C" {
|
|||
#include "build.h"
|
||||
#define NOBUILDING NULL
|
||||
|
||||
#define RESOLVE_BUILDING (TYP_BUILDING << 24)
|
||||
void resolve_building(building *b);
|
||||
void write_building_reference(const struct building *b,
|
||||
struct storage *store);
|
||||
|
|
|
@ -317,8 +317,6 @@ bool checkpasswd(const faction * f, const char *passwd)
|
|||
return true;
|
||||
}
|
||||
|
||||
#define RESOLVE_FACTION (TYP_FACTION << 24)
|
||||
|
||||
void resolve_faction(faction *f)
|
||||
{
|
||||
resolve(RESOLVE_FACTION | f->no, f);
|
||||
|
|
|
@ -130,6 +130,8 @@ extern "C" {
|
|||
void write_faction_reference(const struct faction *f,
|
||||
struct storage *store);
|
||||
int read_faction_reference(struct gamedata *data, struct faction **fp, resolve_fun fun);
|
||||
|
||||
#define RESOLVE_FACTION (TYP_FACTION << 24)
|
||||
void resolve_faction(struct faction *f);
|
||||
|
||||
void renumber_faction(faction * f, int no);
|
||||
|
|
|
@ -24,6 +24,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "ally.h"
|
||||
#include "faction.h"
|
||||
#include "unit.h"
|
||||
#include "objtypes.h"
|
||||
|
||||
/* attrib includes */
|
||||
#include <attributes/raceprefix.h>
|
||||
|
@ -239,9 +240,13 @@ void read_groups(gamedata *data, faction * f)
|
|||
pa = &g->allies;
|
||||
for (;;) {
|
||||
ally *al;
|
||||
int id;
|
||||
READ_INT(store, &id);
|
||||
if (id == 0) break;
|
||||
al = ally_add(pa, NULL);
|
||||
if (read_faction_reference(data, &al->faction, NULL) <= 0) {
|
||||
break;
|
||||
al->faction = findfaction(id);
|
||||
if (!al->faction) {
|
||||
ur_add(RESOLVE_FACTION | id, (void **)&al->faction, NULL);
|
||||
}
|
||||
READ_INT(store, &al->status);
|
||||
}
|
||||
|
|
|
@ -1255,8 +1255,6 @@ int production(const region * r)
|
|||
return p;
|
||||
}
|
||||
|
||||
#define RESOLVE_REGION (TYP_REGION << 24)
|
||||
|
||||
void resolve_region(region *r)
|
||||
{
|
||||
resolve(RESOLVE_REGION | r->uid, r);
|
||||
|
|
|
@ -259,9 +259,10 @@ extern "C" {
|
|||
int region_get_morale(const region * r);
|
||||
void region_set_morale(region * r, int morale, int turn);
|
||||
|
||||
#define RESOLVE_REGION (TYP_REGION << 24)
|
||||
void resolve_region(region *r);
|
||||
void write_region_reference(const struct region *r, struct storage *store);
|
||||
int read_region_reference(struct gamedata *data, region **rp, resolve_fun fun);
|
||||
void resolve_region(region *r);
|
||||
|
||||
const char *regionname(const struct region *r, const struct faction *f);
|
||||
|
||||
|
|
|
@ -749,8 +749,6 @@ void write_unit_reference(const unit * u, struct storage *store)
|
|||
WRITE_INT(store, (u && u->region) ? u->no : 0);
|
||||
}
|
||||
|
||||
#define RESOLVE_UNIT (TYP_UNIT << 24)
|
||||
|
||||
void resolve_unit(unit *u)
|
||||
{
|
||||
resolve(RESOLVE_UNIT | u->no, u);
|
||||
|
|
|
@ -185,6 +185,7 @@ extern "C" {
|
|||
void make_zombie(struct unit * u);
|
||||
|
||||
/* see resolve.h */
|
||||
#define RESOLVE_UNIT (TYP_UNIT << 24)
|
||||
void resolve_unit(struct unit *u);
|
||||
void write_unit_reference(const struct unit *u, struct storage *store);
|
||||
int read_unit_reference(struct gamedata * data, struct unit **up, resolve_fun fun);
|
||||
|
|
|
@ -86,8 +86,7 @@ static int changefaction_read(trigger * t, gamedata *data)
|
|||
changefaction_data *td = (changefaction_data *)t->data.v;
|
||||
|
||||
read_unit_reference(data, &td->unit, NULL);
|
||||
read_faction_reference(data, &td->faction, NULL);
|
||||
return AT_READ_OK;
|
||||
return read_faction_reference(data, &td->faction, NULL) > 0 ? AT_READ_OK : AT_READ_FAIL;
|
||||
}
|
||||
|
||||
trigger_type tt_changefaction = {
|
||||
|
|
Loading…
Reference in a new issue