forked from github/server
"Watchers", Parteien die eine komplette Plane einsehen können.
This commit is contained in:
parent
472254020c
commit
fa8c86084b
|
@ -2606,12 +2606,23 @@ prepare_report(faction * f)
|
||||||
for (r = firstregion(f); r != end; r = r->next) {
|
for (r = firstregion(f); r != end; r = r->next) {
|
||||||
attrib *ru;
|
attrib *ru;
|
||||||
unit * u;
|
unit * u;
|
||||||
|
plane * p = rplane(r);
|
||||||
unsigned char mode = see_none;
|
unsigned char mode = see_none;
|
||||||
boolean dis = false;
|
boolean dis = false;
|
||||||
#if DBG_CACHE
|
#if DBG_CACHE
|
||||||
++ctries;
|
++ctries;
|
||||||
#endif
|
#endif
|
||||||
for (u = r->units; u; u = u->next) {
|
if (p) {
|
||||||
|
watcher * w = p->watchers;
|
||||||
|
while (w) {
|
||||||
|
if (f==w->faction) {
|
||||||
|
mode = w->mode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
w = w->next;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (mode<see_unit) for (u = r->units; u; u = u->next) {
|
||||||
if (u->faction == f) {
|
if (u->faction == f) {
|
||||||
if (u->race != new_race[RC_SPELL] || u->number == RS_FARVISION) {
|
if (u->race != new_race[RC_SPELL] || u->number == RS_FARVISION) {
|
||||||
mode = see_unit;
|
mode = see_unit;
|
||||||
|
@ -2623,7 +2634,7 @@ prepare_report(faction * f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode==see_none) for (ru = a_find(r->attribs, &at_travelunit); ru; ru = ru->nexttype) {
|
if (mode<see_travel) for (ru = a_find(r->attribs, &at_travelunit); ru; ru = ru->nexttype) {
|
||||||
unit * u = (unit*)ru->data.v;
|
unit * u = (unit*)ru->data.v;
|
||||||
if (u->faction == f) {
|
if (u->faction == f) {
|
||||||
mode = see_travel;
|
mode = see_travel;
|
||||||
|
@ -2631,7 +2642,7 @@ prepare_report(faction * f)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode==see_none && rterrain(r) == T_OCEAN) {
|
if (mode<see_lighthouse && rterrain(r) == T_OCEAN) {
|
||||||
if (check_leuchtturm(r, f)) mode = see_lighthouse;
|
if (check_leuchtturm(r, f)) mode = see_lighthouse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,12 +150,14 @@ struct xml_stack;
|
||||||
#define GROWTREE_VERSION 305
|
#define GROWTREE_VERSION 305
|
||||||
#define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */
|
#define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */
|
||||||
#define NEWRACE_VERSION 307
|
#define NEWRACE_VERSION 307
|
||||||
#define NEWSKILL_VERSION 308
|
#define INTERIM_VERSION 309
|
||||||
|
#define NEWSKILL_VERSION 309
|
||||||
|
#define WATCHERS_VERSION 310
|
||||||
|
|
||||||
#if SKILLPOINTS
|
#if SKILLPOINTS
|
||||||
# define RELEASE_VERSION NEWRACE_VERSION
|
# define RELEASE_VERSION INTERIM_VERSION
|
||||||
#else
|
#else
|
||||||
# define RELEASE_VERSION NEWSKILL_VERSION
|
# define RELEASE_VERSION WATCHERS_VERSION
|
||||||
#endif
|
#endif
|
||||||
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
||||||
|
|
||||||
|
|
|
@ -38,8 +38,15 @@
|
||||||
|
|
||||||
#define PFL_MUSEUM PFL_NOCOORDS | PFL_NORECRUITS | PFL_NOGIVE | PFL_NOATTACK | PFL_NOTERRAIN | PFL_NOMAGIC | PFL_NOSTEALTH | PFL_NOTEACH | PFL_NOBUILD | PFL_NOFEED
|
#define PFL_MUSEUM PFL_NOCOORDS | PFL_NORECRUITS | PFL_NOGIVE | PFL_NOATTACK | PFL_NOTERRAIN | PFL_NOMAGIC | PFL_NOSTEALTH | PFL_NOTEACH | PFL_NOBUILD | PFL_NOFEED
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
|
@ -863,6 +863,19 @@ readgame(boolean backup)
|
||||||
pl->miny = ri(F);
|
pl->miny = ri(F);
|
||||||
pl->maxy = ri(F);
|
pl->maxy = ri(F);
|
||||||
pl->flags = ri(F);
|
pl->flags = ri(F);
|
||||||
|
if (global.data_version>WATCHERS_VERSION) {
|
||||||
|
char * s = NULL;
|
||||||
|
rds(F, &s);
|
||||||
|
while (strcmp(s, "end")!=0) {
|
||||||
|
watcher * w = calloc(sizeof(watcher),1);
|
||||||
|
int fno = ri36(F);
|
||||||
|
w->mode = (unsigned char)ri(F);
|
||||||
|
w->next = pl->watchers;
|
||||||
|
pl->watchers = w;
|
||||||
|
ur_add((void*)fno, &w->faction, resolve_faction);
|
||||||
|
}
|
||||||
|
free(s);
|
||||||
|
}
|
||||||
a_read(F, &pl->attribs);
|
a_read(F, &pl->attribs);
|
||||||
addlist(&planes, pl);
|
addlist(&planes, pl);
|
||||||
}
|
}
|
||||||
|
@ -1796,6 +1809,9 @@ writegame(char *path, char quiet)
|
||||||
wnl(F);
|
wnl(F);
|
||||||
|
|
||||||
for(pl = planes; pl; pl=pl->next) {
|
for(pl = planes; pl; pl=pl->next) {
|
||||||
|
#if RELEASE_VERSION >= WATCHERS_VERSION
|
||||||
|
watcher * w;
|
||||||
|
#endif
|
||||||
wi(F, pl->id);
|
wi(F, pl->id);
|
||||||
ws(F, pl->name);
|
ws(F, pl->name);
|
||||||
wi(F, pl->minx);
|
wi(F, pl->minx);
|
||||||
|
@ -1803,6 +1819,17 @@ writegame(char *path, char quiet)
|
||||||
wi(F, pl->miny);
|
wi(F, pl->miny);
|
||||||
wi(F, pl->maxy);
|
wi(F, pl->maxy);
|
||||||
wi(F, pl->flags);
|
wi(F, pl->flags);
|
||||||
|
#if RELEASE_VERSION >= WATCHERS_VERSION
|
||||||
|
w = pl->watchers;
|
||||||
|
while (w) {
|
||||||
|
if (w->faction) {
|
||||||
|
wi36(F, w->faction->no);
|
||||||
|
wi(F, w->mode);
|
||||||
|
}
|
||||||
|
w = w->next;
|
||||||
|
}
|
||||||
|
ws(F, "end");
|
||||||
|
#endif
|
||||||
a_write(F, pl->attribs);
|
a_write(F, pl->attribs);
|
||||||
wnl(F);
|
wnl(F);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2470,7 +2470,7 @@ peasant_adjustment(void)
|
||||||
terrain_t ter;
|
terrain_t ter;
|
||||||
int sum, avg, c;
|
int sum, avg, c;
|
||||||
double freeall, pool; /* long long is illegal */
|
double freeall, pool; /* long long is illegal */
|
||||||
long long s;
|
double s;
|
||||||
region *r;
|
region *r;
|
||||||
|
|
||||||
s = 0;
|
s = 0;
|
||||||
|
@ -2601,8 +2601,34 @@ static int
|
||||||
fix_astralplane(void)
|
fix_astralplane(void)
|
||||||
{
|
{
|
||||||
plane * astralplane = getplanebyname("Astralraum");
|
plane * astralplane = getplanebyname("Astralraum");
|
||||||
|
if (astralplane) {
|
||||||
freset(astralplane, PFL_NOCOORDS);
|
freset(astralplane, PFL_NOCOORDS);
|
||||||
set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0);
|
set_ursprung(findfaction(MONSTER_FACTION), astralplane->id, 0, 0);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
fix_watchers(void)
|
||||||
|
{
|
||||||
|
plane * p = getplanebyid (59034966);
|
||||||
|
if (p) {
|
||||||
|
faction * f = findfaction(atoi36("gm04"));
|
||||||
|
watcher * w = calloc(sizeof(watcher), 1);
|
||||||
|
w->faction = f;
|
||||||
|
w->mode = see_unit;
|
||||||
|
w->next = p->watchers;
|
||||||
|
p->watchers = w;
|
||||||
|
}
|
||||||
|
p = getplanebyid(1137);
|
||||||
|
if (p) {
|
||||||
|
faction * f = findfaction(atoi36("rr"));
|
||||||
|
watcher * w = calloc(sizeof(watcher), 1);
|
||||||
|
w->faction = f;
|
||||||
|
w->mode = see_unit;
|
||||||
|
w->next = p->watchers;
|
||||||
|
p->watchers = w;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2654,6 +2680,7 @@ korrektur(void)
|
||||||
/* fix_unitrefs(); */
|
/* fix_unitrefs(); */
|
||||||
stats();
|
stats();
|
||||||
do_once("sql2", dump_sql());
|
do_once("sql2", dump_sql());
|
||||||
|
do_once("fw01", fix_watchers());
|
||||||
#if NEW_RESOURCEGROWTH
|
#if NEW_RESOURCEGROWTH
|
||||||
/* do not remove do_once calls - old datafiles need them! */
|
/* do not remove do_once calls - old datafiles need them! */
|
||||||
do_once("rgrw", convert_resources());
|
do_once("rgrw", convert_resources());
|
||||||
|
|
Loading…
Reference in New Issue