forked from github/server
eliminate plane.watchers feature
. we don't use them anywhere . they have no tests . they crash readgame when watchers have died
This commit is contained in:
parent
57085ea47b
commit
29c9e719da
10
src/battle.c
10
src/battle.c
|
@ -228,21 +228,11 @@ static void message_faction(battle * b, faction * f, struct message *m)
|
||||||
void message_all(battle * b, message * m)
|
void message_all(battle * b, message * m)
|
||||||
{
|
{
|
||||||
bfaction *bf;
|
bfaction *bf;
|
||||||
plane *p = rplane(b->region);
|
|
||||||
watcher *w;
|
|
||||||
|
|
||||||
for (bf = b->factions; bf; bf = bf->next) {
|
for (bf = b->factions; bf; bf = bf->next) {
|
||||||
assert(bf->faction);
|
assert(bf->faction);
|
||||||
message_faction(b, bf->faction, m);
|
message_faction(b, bf->faction, m);
|
||||||
}
|
}
|
||||||
if (p)
|
|
||||||
for (w = p->watchers; w; w = w->next) {
|
|
||||||
for (bf = b->factions; bf; bf = bf->next)
|
|
||||||
if (bf->faction == w->faction)
|
|
||||||
break;
|
|
||||||
if (bf == NULL)
|
|
||||||
message_faction(b, w->faction, m);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void fbattlerecord(battle * b, faction * f, const char *s)
|
static void fbattlerecord(battle * b, faction * f, const char *s)
|
||||||
|
|
|
@ -290,14 +290,3 @@ int read_plane_reference(plane ** pp, struct storage *store)
|
||||||
ur_add(id, pp, resolve_plane);
|
ur_add(id, pp, resolve_plane);
|
||||||
return AT_READ_OK;
|
return AT_READ_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_watcher(const struct plane * p, const struct faction * f)
|
|
||||||
{
|
|
||||||
struct watcher *w;
|
|
||||||
if (!p)
|
|
||||||
return false;
|
|
||||||
w = p->watchers;
|
|
||||||
while (w && w->faction != f)
|
|
||||||
w = w->next;
|
|
||||||
return (w != NULL);
|
|
||||||
}
|
|
||||||
|
|
|
@ -43,15 +43,8 @@ extern "C" {
|
||||||
#define PFL_NOMONSTERS 16384 /* no monster randenc */
|
#define PFL_NOMONSTERS 16384 /* no monster randenc */
|
||||||
#define PFL_SEESPECIAL 32768 /* far seeing */
|
#define PFL_SEESPECIAL 32768 /* far seeing */
|
||||||
|
|
||||||
typedef struct watcher {
|
|
||||||
struct watcher *next;
|
|
||||||
struct faction *faction;
|
|
||||||
unsigned char mode;
|
|
||||||
} watcher;
|
|
||||||
|
|
||||||
typedef struct plane {
|
typedef struct plane {
|
||||||
struct plane *next;
|
struct plane *next;
|
||||||
struct watcher *watchers;
|
|
||||||
int id;
|
int id;
|
||||||
char *name;
|
char *name;
|
||||||
int minx, maxx, miny, maxy;
|
int minx, maxx, miny, maxy;
|
||||||
|
@ -76,7 +69,6 @@ extern "C" {
|
||||||
struct plane *get_homeplane(void);
|
struct plane *get_homeplane(void);
|
||||||
extern int rel_to_abs(const struct plane *pl, const struct faction *f,
|
extern int rel_to_abs(const struct plane *pl, const struct faction *f,
|
||||||
int rel, unsigned char index);
|
int rel, unsigned char index);
|
||||||
extern bool is_watcher(const struct plane *p, const struct faction *f);
|
|
||||||
extern void write_plane_reference(const plane * p, struct storage *store);
|
extern void write_plane_reference(const plane * p, struct storage *store);
|
||||||
extern int read_plane_reference(plane ** pp, struct storage *store);
|
extern int read_plane_reference(plane ** pp, struct storage *store);
|
||||||
extern int plane_width(const plane * pl);
|
extern int plane_width(const plane * pl);
|
||||||
|
|
|
@ -1502,15 +1502,12 @@ int readgame(const char *filename, bool backup)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fno = read_faction_reference(&store);
|
/* WATCHERS - eliminated in February 2016, ca. turn 966 */
|
||||||
while (fno.i) {
|
if (gdata.version < CRYPT_VERSION) {
|
||||||
watcher *w = (watcher *)malloc(sizeof(watcher));
|
|
||||||
ur_add(fno, &w->faction, resolve_faction);
|
|
||||||
READ_INT(&store, &n);
|
|
||||||
w->mode = (unsigned char)n;
|
|
||||||
w->next = pl->watchers;
|
|
||||||
pl->watchers = w;
|
|
||||||
fno = read_faction_reference(&store);
|
fno = read_faction_reference(&store);
|
||||||
|
while (fno.i) {
|
||||||
|
fno = read_faction_reference(&store);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
a_read(&store, &pl->attribs, pl);
|
a_read(&store, &pl->attribs, pl);
|
||||||
|
@ -1791,7 +1788,6 @@ int writegame(const char *filename)
|
||||||
WRITE_SECTION(&store);
|
WRITE_SECTION(&store);
|
||||||
|
|
||||||
for (pl = planes; pl; pl = pl->next) {
|
for (pl = planes; pl; pl = pl->next) {
|
||||||
watcher *w;
|
|
||||||
WRITE_INT(&store, pl->id);
|
WRITE_INT(&store, pl->id);
|
||||||
WRITE_STR(&store, pl->name);
|
WRITE_STR(&store, pl->name);
|
||||||
WRITE_INT(&store, pl->minx);
|
WRITE_INT(&store, pl->minx);
|
||||||
|
@ -1799,15 +1795,9 @@ int writegame(const char *filename)
|
||||||
WRITE_INT(&store, pl->miny);
|
WRITE_INT(&store, pl->miny);
|
||||||
WRITE_INT(&store, pl->maxy);
|
WRITE_INT(&store, pl->maxy);
|
||||||
WRITE_INT(&store, pl->flags);
|
WRITE_INT(&store, pl->flags);
|
||||||
w = pl->watchers;
|
#if RELEASE_VERSION < CRYPT_VERSION
|
||||||
while (w) {
|
write_faction_reference(NULL, &store); /* mark the end of pl->watchers (gone since T966) */
|
||||||
if (w->faction) {
|
#endif
|
||||||
write_faction_reference(w->faction, &store);
|
|
||||||
WRITE_INT(&store, w->mode);
|
|
||||||
}
|
|
||||||
w = w->next;
|
|
||||||
}
|
|
||||||
write_faction_reference(NULL, &store); /* mark the end of the list */
|
|
||||||
a_write(&store, pl->attribs, pl);
|
a_write(&store, pl->attribs, pl);
|
||||||
WRITE_SECTION(&store);
|
WRITE_SECTION(&store);
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
#define SPELL_LEVEL_VERSION 348 /* f->max_spelllevel gets stored, not calculated */
|
#define SPELL_LEVEL_VERSION 348 /* f->max_spelllevel gets stored, not calculated */
|
||||||
#define OWNER_3_VERSION 349 /* regions store last owner, not last alliance */
|
#define OWNER_3_VERSION 349 /* regions store last owner, not last alliance */
|
||||||
#define ATTRIBOWNER_VERSION 350 /* all attrib_type functions know who owns the attribute */
|
#define ATTRIBOWNER_VERSION 350 /* all attrib_type functions know who owns the attribute */
|
||||||
#define CRYPT_VERSION 351 /* passwords are encrypted */
|
#define CRYPT_VERSION 351 /* passwords are encrypted (3.8.2), plane.watchers are gone (3.8.3) */
|
||||||
#define RELEASE_VERSION CRYPT_VERSION /* current datafile */
|
#define RELEASE_VERSION CRYPT_VERSION /* current datafile */
|
||||||
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
||||||
#define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */
|
#define MAX_VERSION RELEASE_VERSION /* change this if we can need to read the future datafile, and we can do so */
|
||||||
|
|
|
@ -1385,17 +1385,9 @@ static void prepare_reports(void)
|
||||||
|
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
unit *u;
|
unit *u;
|
||||||
plane *p = rplane(r);
|
|
||||||
|
|
||||||
reorder_units(r);
|
reorder_units(r);
|
||||||
|
|
||||||
if (p) {
|
|
||||||
watcher *w = p->watchers;
|
|
||||||
for (; w; w = w->next) {
|
|
||||||
faction_add_seen(w->faction, r, w->mode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Region owner get always the Lighthouse report */
|
/* Region owner get always the Lighthouse report */
|
||||||
if (bt_lighthouse && config_token("rules.region_owner_pay_building", bt_lighthouse->_name)) {
|
if (bt_lighthouse && config_token("rules.region_owner_pay_building", bt_lighthouse->_name)) {
|
||||||
for (b = rbuildings(r); b; b = b->next) {
|
for (b = rbuildings(r); b; b = b->next) {
|
||||||
|
@ -1464,8 +1456,6 @@ static region *lastregion(faction * f)
|
||||||
|
|
||||||
/* we continue from the best region and look for travelthru etc. */
|
/* we continue from the best region and look for travelthru etc. */
|
||||||
for (r = f->last->next; r; r = r->next) {
|
for (r = f->last->next; r; r = r->next) {
|
||||||
plane *p = rplane(r);
|
|
||||||
|
|
||||||
/* search the region for travelthru-attributes: */
|
/* search the region for travelthru-attributes: */
|
||||||
if (fval(r, RF_TRAVELUNIT)) {
|
if (fval(r, RF_TRAVELUNIT)) {
|
||||||
travelthru_map(r, cb_set_last, f);
|
travelthru_map(r, cb_set_last, f);
|
||||||
|
@ -1474,9 +1464,6 @@ static region *lastregion(faction * f)
|
||||||
continue;
|
continue;
|
||||||
if (check_leuchtturm(r, f))
|
if (check_leuchtturm(r, f))
|
||||||
f->last = r;
|
f->last = r;
|
||||||
if (p && is_watcher(p, f)) {
|
|
||||||
f->last = r;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return f->last->next;
|
return f->last->next;
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue