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)
|
||||
{
|
||||
bfaction *bf;
|
||||
plane *p = rplane(b->region);
|
||||
watcher *w;
|
||||
|
||||
for (bf = b->factions; bf; bf = bf->next) {
|
||||
assert(bf->faction);
|
||||
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)
|
||||
|
|
|
@ -290,14 +290,3 @@ int read_plane_reference(plane ** pp, struct storage *store)
|
|||
ur_add(id, pp, resolve_plane);
|
||||
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_SEESPECIAL 32768 /* far seeing */
|
||||
|
||||
typedef struct watcher {
|
||||
struct watcher *next;
|
||||
struct faction *faction;
|
||||
unsigned char mode;
|
||||
} watcher;
|
||||
|
||||
typedef struct plane {
|
||||
struct plane *next;
|
||||
struct watcher *watchers;
|
||||
int id;
|
||||
char *name;
|
||||
int minx, maxx, miny, maxy;
|
||||
|
@ -76,7 +69,6 @@ extern "C" {
|
|||
struct plane *get_homeplane(void);
|
||||
extern int rel_to_abs(const struct plane *pl, const struct faction *f,
|
||||
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 int read_plane_reference(plane ** pp, struct storage *store);
|
||||
extern int plane_width(const plane * pl);
|
||||
|
|
|
@ -1502,17 +1502,14 @@ int readgame(const char *filename, bool backup)
|
|||
}
|
||||
}
|
||||
else {
|
||||
/* WATCHERS - eliminated in February 2016, ca. turn 966 */
|
||||
if (gdata.version < CRYPT_VERSION) {
|
||||
fno = read_faction_reference(&store);
|
||||
while (fno.i) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
a_read(&store, &pl->attribs, pl);
|
||||
if (pl->id != 1094969858) { // Regatta
|
||||
addlist(&planes, pl);
|
||||
|
@ -1791,7 +1788,6 @@ int writegame(const char *filename)
|
|||
WRITE_SECTION(&store);
|
||||
|
||||
for (pl = planes; pl; pl = pl->next) {
|
||||
watcher *w;
|
||||
WRITE_INT(&store, pl->id);
|
||||
WRITE_STR(&store, pl->name);
|
||||
WRITE_INT(&store, pl->minx);
|
||||
|
@ -1799,15 +1795,9 @@ int writegame(const char *filename)
|
|||
WRITE_INT(&store, pl->miny);
|
||||
WRITE_INT(&store, pl->maxy);
|
||||
WRITE_INT(&store, pl->flags);
|
||||
w = pl->watchers;
|
||||
while (w) {
|
||||
if (w->faction) {
|
||||
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 */
|
||||
#if RELEASE_VERSION < CRYPT_VERSION
|
||||
write_faction_reference(NULL, &store); /* mark the end of pl->watchers (gone since T966) */
|
||||
#endif
|
||||
a_write(&store, pl->attribs, pl);
|
||||
WRITE_SECTION(&store);
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
#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 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 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 */
|
||||
|
|
|
@ -1385,17 +1385,9 @@ static void prepare_reports(void)
|
|||
|
||||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
plane *p = rplane(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 */
|
||||
if (bt_lighthouse && config_token("rules.region_owner_pay_building", bt_lighthouse->_name)) {
|
||||
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. */
|
||||
for (r = f->last->next; r; r = r->next) {
|
||||
plane *p = rplane(r);
|
||||
|
||||
/* search the region for travelthru-attributes: */
|
||||
if (fval(r, RF_TRAVELUNIT)) {
|
||||
travelthru_map(r, cb_set_last, f);
|
||||
|
@ -1474,9 +1464,6 @@ static region *lastregion(faction * f)
|
|||
continue;
|
||||
if (check_leuchtturm(r, f))
|
||||
f->last = r;
|
||||
if (p && is_watcher(p, f)) {
|
||||
f->last = r;
|
||||
}
|
||||
}
|
||||
return f->last->next;
|
||||
#else
|
||||
|
|
Loading…
Reference in New Issue