forked from github/server
REGIONOWNERS (per makro enabled)
Implementiert: - HELFE DURCHREISE - NACH-Restriktionen - Feindlisten, laden&speichern Es fehlt noch: - Schiffe - Kontaktiere - Parteitarnung - Kriegserklärung - Reportanzeigen
This commit is contained in:
parent
8c8f36f64c
commit
c184a888a9
|
@ -31,6 +31,5 @@ void listnames(void);
|
|||
void writemap(FILE * F, int mode);
|
||||
|
||||
void regionspells(void);
|
||||
void moveunit(void);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1182,7 +1182,14 @@ set_ally(unit * u, strlist * S)
|
|||
sf->status = HELP_ALL;
|
||||
break;
|
||||
|
||||
case P_GIB:
|
||||
case P_TRAVEL:
|
||||
if (not_kw == P_NOT)
|
||||
sf->status = sf->status & (HELP_ALL - HELP_TRAVEL);
|
||||
else
|
||||
sf->status = sf->status | HELP_TRAVEL;
|
||||
break;
|
||||
|
||||
case P_GIB:
|
||||
if (not_kw == P_NOT)
|
||||
sf->status = sf->status & (HELP_ALL - HELP_GIVE);
|
||||
else
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#define FAST_SEEN 0
|
||||
#define INDENT 0
|
||||
|
||||
#include <config.h>
|
||||
|
@ -1672,6 +1671,10 @@ show_allies(const faction * f, const ally * allies)
|
|||
for (h = 1; h < HELP_ALL; h *= 2) {
|
||||
if ((mode & h) == h)
|
||||
switch (h) {
|
||||
case HELP_TRAVEL:
|
||||
scat("Durchreise");
|
||||
hh = 1;
|
||||
break;
|
||||
case HELP_MONEY:
|
||||
scat("Silber");
|
||||
hh = 1;
|
||||
|
@ -2574,52 +2577,6 @@ seen_done(void)
|
|||
}
|
||||
}
|
||||
|
||||
#if FAST_SEEN
|
||||
static void
|
||||
init_intervals()
|
||||
{
|
||||
region * r;
|
||||
for (r=regions;r;r=r->next) {
|
||||
unit * u;
|
||||
attrib * a;
|
||||
for (a=a_find(r->attribs, &at_travelunit);a;a=a->nexttype) {
|
||||
unit * v = (unit*)a->data.v;
|
||||
faction * f = v->faction;
|
||||
if (!f) continue;
|
||||
if (!f->first)
|
||||
{
|
||||
assert(!f->last);
|
||||
f->first = r;
|
||||
}
|
||||
f->last = r->next;
|
||||
}
|
||||
for (a=a_find(r->attribs, &at_lighthouse);a;a=a->nexttype) {
|
||||
building * b = (building*)a->data.v;
|
||||
region * br = b->region;
|
||||
if (!b->region) continue;
|
||||
for (u=br->units;u;u=u->next) {
|
||||
faction * f = u->faction;
|
||||
if (!f->first)
|
||||
{
|
||||
assert(!f->last);
|
||||
f->first = r;
|
||||
}
|
||||
f->last = r->next;
|
||||
}
|
||||
}
|
||||
for (u=r->units;u;u=u->next) {
|
||||
faction * f = u->faction;
|
||||
if (!f->first)
|
||||
{
|
||||
assert(!f->last);
|
||||
f->first = r;
|
||||
}
|
||||
f->last = r->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
seen_region *
|
||||
find_seen(const region * r)
|
||||
{
|
||||
|
@ -2919,9 +2876,6 @@ reports(void)
|
|||
printf("\n");
|
||||
|
||||
report_donations();
|
||||
#if FAST_SEEN
|
||||
init_intervals();
|
||||
#endif
|
||||
remove_empty_units();
|
||||
log_printf("Report timestamp - %s\n", pzTime);
|
||||
for (f = factions; f; f = f->next) {
|
||||
|
|
|
@ -151,6 +151,7 @@ const char *parameters[MAXPARAMS] =
|
|||
"GEBÄUDE",
|
||||
"GIB", /* Für HELFE */
|
||||
"KÄMPFE",
|
||||
"DURCHREISE",
|
||||
"BEWACHE",
|
||||
"ZAUBER",
|
||||
"PAUSE",
|
||||
|
@ -478,9 +479,6 @@ stripfaction (faction * f)
|
|||
free(f->passw);
|
||||
free(f->override);
|
||||
free(f->name);
|
||||
#ifndef FAST_REGION
|
||||
vset_destroy(&f->regions);
|
||||
#endif
|
||||
while (f->attribs) a_remove (&f->attribs, f->attribs);
|
||||
freelist(f->ursprung);
|
||||
funhash(f);
|
||||
|
|
|
@ -163,10 +163,16 @@ struct xml_stack;
|
|||
#define CURSETYPE_VERSION 312
|
||||
#define ALLIANCES_VERSION 313
|
||||
#define DBLINK_VERSION 314
|
||||
#define REGIONOWNERS_VERSION 315
|
||||
|
||||
#define MIN_VERSION TYPES_VERSION
|
||||
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
|
||||
#define RELEASE_VERSION ALLIANCES_VERSION
|
||||
|
||||
#ifdef REGIONOWNERS
|
||||
# define RELEASE_VERSION REGIONOWNERS_VERSION
|
||||
#else
|
||||
# define RELEASE_VERSION DBLINK_VERSION
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if RELEASE_VERSION >= UGROUPS_VERSION
|
||||
|
@ -495,6 +501,7 @@ enum {
|
|||
P_GEBAEUDE,
|
||||
P_GIB,
|
||||
P_KAEMPFE,
|
||||
P_TRAVEL,
|
||||
P_GUARD,
|
||||
P_ZAUBER,
|
||||
P_PAUSE,
|
||||
|
@ -828,8 +835,9 @@ enum {
|
|||
#define HELP_OBSERVE 4 /* Bei Wahrnehmung mithelfen */
|
||||
#define HELP_GIVE 8 /* Dinge annehmen ohne KONTAKTIERE */
|
||||
#define HELP_GUARD 16 /* Laesst Steuern eintreiben etc. */
|
||||
#define HELP_FSTEALTH 32 /* Laesst Steuern eintreiben etc. */
|
||||
#define HELP_ALL (63-HELP_OBSERVE) /* Alle "positiven" HELPs zusammen */
|
||||
#define HELP_FSTEALTH 32 /* Parteitarnung anzeigen. */
|
||||
#define HELP_TRAVEL 64 /* Laesst Regionen betreten. */
|
||||
#define HELP_ALL (127-HELP_OBSERVE) /* Alle "positiven" HELPs zusammen */
|
||||
/* HELP_OBSERVE deaktiviert */
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Prototypen */
|
||||
|
|
|
@ -289,3 +289,40 @@ destroyfaction(faction * f)
|
|||
}
|
||||
}
|
||||
|
||||
#ifdef REGIONOWNERS
|
||||
boolean
|
||||
is_enemy(const struct faction * f, const struct faction * enemy)
|
||||
{
|
||||
struct faction_list * flist = f->enemies;
|
||||
for (;flist!=NULL;flist=flist->next) {
|
||||
if (flist->data==enemy) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
add_enemy(struct faction * f, struct faction * enemy)
|
||||
{
|
||||
if (!is_enemy(f, enemy)) {
|
||||
struct faction_list * flist = malloc(sizeof(faction_list));
|
||||
flist->next = f->enemies;
|
||||
flist->data = enemy;
|
||||
f->enemies = flist;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
remove_enemy(struct faction * f, const struct faction * enemy)
|
||||
{
|
||||
struct faction_list **pflist = &f->enemies;
|
||||
while (*pflist!=NULL) {
|
||||
struct faction_list * flist = *pflist;
|
||||
if (flist->data==enemy) {
|
||||
*pflist = flist->next;
|
||||
free(flist);
|
||||
} else {
|
||||
pflist = &flist->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -61,13 +61,13 @@ typedef struct faction {
|
|||
#endif
|
||||
#ifdef VICTORY_DELAY
|
||||
unsigned char victory_delay;
|
||||
#endif
|
||||
#ifndef FAST_REGION
|
||||
vset regions;
|
||||
#endif
|
||||
struct unit * units;
|
||||
struct attrib *attribs;
|
||||
struct message_list * msgs;
|
||||
#ifdef REGIONOWNERS
|
||||
struct faction_list * enemies;
|
||||
#endif
|
||||
struct bmsg {
|
||||
struct bmsg * next;
|
||||
struct region * r;
|
||||
|
@ -89,4 +89,10 @@ extern struct unit * addplayer(struct region *r, const char *email,
|
|||
extern boolean checkpasswd(const faction * f, const char * passwd);
|
||||
extern void destroyfaction(faction * f);
|
||||
|
||||
#ifdef REGIONOWNERS
|
||||
extern boolean is_enemy(const struct faction * f, const struct faction * enemy);
|
||||
extern void add_enemy(struct faction * f, struct faction * enemy);
|
||||
extern void remove_enemy(struct faction * f, const struct faction * enemy);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
@ -143,6 +143,19 @@ static attrib_type at_driveweight = {
|
|||
"driveweight", NULL, NULL, NULL, NULL, NULL
|
||||
};
|
||||
|
||||
static boolean
|
||||
entrance_allowed(const struct unit * u, const struct region * r)
|
||||
{
|
||||
#ifdef REGIONOWNERS
|
||||
unit * owner = region_owner(r);
|
||||
if (owner==NULL || u->faction==owner->faction) return true;
|
||||
if (alliedunit(owner, u->faction, HELP_TRAVEL)) return true;
|
||||
if (is_enemy(u->faction, owner->faction)) return true;
|
||||
return false;
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
int
|
||||
personcapacity(const unit *u)
|
||||
{
|
||||
|
@ -1073,6 +1086,11 @@ travel(region * first, unit * u, region * next, int flucht)
|
|||
ADDMSG(&u->faction->msgs, msg_message("leavefail",
|
||||
"unit region", u, next));
|
||||
}
|
||||
if (!entrance_allowed(u, next)) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("regionowned",
|
||||
"unit region target", u, current, next));
|
||||
break;
|
||||
}
|
||||
if ((wache = bewegung_blockiert_von(u, current)) != (unit *) NULL
|
||||
&& gereist != 0)
|
||||
{
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
/* kernel includes */
|
||||
#include "border.h"
|
||||
#include "building.h"
|
||||
#include "curse.h"
|
||||
#include "faction.h"
|
||||
#include "item.h"
|
||||
|
@ -32,6 +33,7 @@
|
|||
#include "plane.h"
|
||||
#include "region.h"
|
||||
#include "resources.h"
|
||||
#include "unit.h"
|
||||
|
||||
/* util includes */
|
||||
#include <resolve.h>
|
||||
|
@ -1090,4 +1092,24 @@ r_addmessage(struct region * r, const struct faction * viewer, struct message *
|
|||
return add_message(&imsg->msgs, msg);
|
||||
}
|
||||
|
||||
|
||||
struct unit *
|
||||
region_owner(const struct region * r)
|
||||
{
|
||||
#ifdef REGIONOWNERS
|
||||
struct unit * owner = NULL;
|
||||
int maxsize = 0;
|
||||
building * b = r->buildings;
|
||||
for (;b!=NULL;b=b->next) {
|
||||
if (b->size>maxsize) {
|
||||
unit * u = buildingowner(r, b);
|
||||
if (u) {
|
||||
owner = u;
|
||||
maxsize=b->size;
|
||||
}
|
||||
}
|
||||
}
|
||||
return owner;
|
||||
#else
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -218,4 +218,6 @@ extern int production(const struct region *r);
|
|||
extern int read_region_reference(struct region ** r, FILE * F);
|
||||
extern void write_region_reference(const struct region * r, FILE * F);
|
||||
|
||||
extern struct unit * region_owner(const struct region * r);
|
||||
|
||||
#endif /* _REGION_H */
|
||||
|
|
|
@ -56,14 +56,6 @@ char *translate_regions(const char *st, const struct faction * f);
|
|||
|
||||
char *replace_global_coords(const char *s, const struct faction * f);
|
||||
|
||||
#ifdef USE_MERIAN
|
||||
#ifdef FAST_REGION
|
||||
void merian(FILE * out, struct faction *f);
|
||||
#else
|
||||
void merian(FILE * out, vset* regs, struct faction *f);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
char *f_regionid(const struct region *r, const struct faction *f);
|
||||
|
||||
/* für fast_region und neuen CR: */
|
||||
|
|
|
@ -434,6 +434,38 @@ getbuf(FILE * F)
|
|||
return buf;
|
||||
}
|
||||
|
||||
#ifdef REGIONOWNERS
|
||||
static void
|
||||
read_enemies(FILE * F, faction * f)
|
||||
{
|
||||
if (global.data_version<REGIONOWNERS_VERSION) return;
|
||||
f->enemies = NULL;
|
||||
for (;;) {
|
||||
char zText[32];
|
||||
fscanf(F, "%s", zText);
|
||||
if (strcmp(zText, "end")==0) break;
|
||||
else {
|
||||
int fno = atoi36(zText);
|
||||
faction_list * flist = malloc(sizeof(faction_list));
|
||||
flist->next = f->enemies;
|
||||
f->enemies = flist;
|
||||
ur_add((void*)fno, (void**)&flist->data, resolve_faction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
write_enemies(FILE * F, const faction_list * flist)
|
||||
{
|
||||
#if RELEASE_VERSION>=REGIONOWNERS_VERSION
|
||||
while (flist) {
|
||||
fprintf(F, "%s ", itoa36(flist->data->no));
|
||||
}
|
||||
fputs("end\n", F);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
static unit *
|
||||
unitorders(FILE * F, struct faction * f)
|
||||
{
|
||||
|
@ -2188,6 +2220,9 @@ readfaction(FILE * F)
|
|||
}
|
||||
}
|
||||
read_groups(F, f);
|
||||
#ifdef REGIONOWNERS
|
||||
read_enemies(F, f);
|
||||
#endif
|
||||
return f;
|
||||
}
|
||||
|
||||
|
@ -2242,4 +2277,7 @@ writefaction(FILE * F, const faction * f)
|
|||
fprintf(F, "end");
|
||||
wnl(F);
|
||||
write_groups(F, f->groups);
|
||||
#ifdef REGIONOWNERS
|
||||
write_enemies(F, f->enemies);
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -43,6 +43,7 @@
|
|||
#define NEWATSROI 0
|
||||
|
||||
#define CHECK_OVERLOAD_ON_ENTER
|
||||
#undef REGIONOWNERS
|
||||
|
||||
#define MUSEUM_MODULE
|
||||
#define ARENA_MODULE
|
||||
|
|
|
@ -5393,17 +5393,22 @@
|
|||
</locale>
|
||||
</message>
|
||||
|
||||
<message name="moveblockedbyguard">
|
||||
<message name="regionowned" section="movement">
|
||||
<type>
|
||||
<arg name="unit" type="unit"></arg>
|
||||
<arg name="region" type="region"></arg>
|
||||
<arg name="target" type="region"></arg>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) konnte nicht von $region($region) nach $region($target) reisen, da der Besitzer der Region es verhinderte."</text>
|
||||
</message>
|
||||
|
||||
<message name="moveblockedbyguard" section="movement">
|
||||
<type>
|
||||
<arg name="unit" type="unit"></arg>
|
||||
<arg name="region" type="region"></arg>
|
||||
<arg name="guard" type="unit"></arg>
|
||||
</type>
|
||||
<locale name="de">
|
||||
<nr section="movement">
|
||||
<text>"$unit($unit) wurde in $region($region) von $unit($guard) aufgehalten."</text>
|
||||
</nr>
|
||||
</locale>
|
||||
<text locale="de">"$unit($unit) wurde in $region($region) von $unit($guard) aufgehalten."</text>
|
||||
</message>
|
||||
|
||||
<message name="sailfail">
|
||||
|
@ -7730,20 +7735,12 @@
|
|||
<text locale="en">"($int36($id))"</text>
|
||||
</message>
|
||||
|
||||
<message name="mallorn_effect">
|
||||
<message name="mallorn_effect" section="magic">
|
||||
<type>
|
||||
<arg name="mage" type="unit"></arg>
|
||||
</type>
|
||||
<locale name="de">
|
||||
<nr section="magic">
|
||||
<text>"$unit($mage) läßt einen Teil seiner selbst in die Erde fliessen. Die Bäume, die Transformation überlebt haben, erscheinen nun viel kräftiger."</text>
|
||||
</nr>
|
||||
</locale>
|
||||
<locale name="en">
|
||||
<nr section="magic">
|
||||
<text>"The power of $unit($mage) flows into the region and the trees which survived the spell appear stronger now."</text>
|
||||
</nr>
|
||||
</locale>
|
||||
<text locale="de">"$unit($mage) läßt einen Teil seiner selbst in die Erde fliessen. Die Bäume, die Transformation überlebt haben, erscheinen nun viel kräftiger."</text>
|
||||
<text locale="en">"The power of $unit($mage) flows into the region and the trees which survived the spell appear stronger now."</text>
|
||||
</message>
|
||||
|
||||
</messages>
|
||||
|
|
|
@ -1626,6 +1626,10 @@
|
|||
<string name="KRÄUTER">
|
||||
<text locale="de">KRÄUTER</text>
|
||||
</string>
|
||||
<string name="DURCHREISE">
|
||||
<text locale="de">DURCHREISE</text>
|
||||
<text locale="en">TRAVEL</text>
|
||||
</string>
|
||||
<string name="KÄMPFE">
|
||||
<text locale="de">KÄMPFE</text>
|
||||
</string>
|
||||
|
|
Loading…
Reference in New Issue