- Bugfix DEFAULT

- ALLIANCES define entfernt. Noch immer nicht gleicher Code für eressea wie wdw, wegen der Amulette
This commit is contained in:
Enno Rehling 2004-06-27 16:56:01 +00:00
parent 9d58776746
commit 65786fc059
36 changed files with 358 additions and 809 deletions

View File

@ -22,9 +22,6 @@
/* modules include */ /* modules include */
#include <modules/score.h> #include <modules/score.h>
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
/* attributes include */ /* attributes include */
#include <attributes/follow.h> #include <attributes/follow.h>
@ -39,6 +36,7 @@
/* kernel includes */ /* kernel includes */
#include <kernel/alchemy.h> #include <kernel/alchemy.h>
#include <kernel/alliance.h>
#include <kernel/border.h> #include <kernel/border.h>
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/faction.h> #include <kernel/faction.h>
@ -353,7 +351,6 @@ cr_race(const void * v, char * buffer, const void * userdata)
return 0; return 0;
} }
#ifdef ALLIANCES
static int static int
cr_alliance(const void * v, char * buffer, const void * userdata) cr_alliance(const void * v, char * buffer, const void * userdata)
{ {
@ -364,7 +361,6 @@ cr_alliance(const void * v, char * buffer, const void * userdata)
unused(userdata); unused(userdata);
return 0; return 0;
} }
#endif
static int static int
cr_skill(const void * v, char * buffer, const void * userdata) cr_skill(const void * v, char * buffer, const void * userdata)
@ -416,9 +412,7 @@ creport_init(void)
tsf_register("resource", &cr_resource); tsf_register("resource", &cr_resource);
tsf_register("race", &cr_race); tsf_register("race", &cr_race);
tsf_register("direction", &cr_int); tsf_register("direction", &cr_int);
#ifdef ALLIANCES
tsf_register("alliance", &cr_alliance); tsf_register("alliance", &cr_alliance);
#endif
} }
void void
@ -898,12 +892,10 @@ cr_find_address(FILE * F, const faction * uf, const faction_list * addresses)
fprintf(F, "\"%s\";Parteiname\n", f->name); fprintf(F, "\"%s\";Parteiname\n", f->name);
fprintf(F, "\"%s\";email\n", f->email); fprintf(F, "\"%s\";email\n", f->email);
fprintf(F, "\"%s\";banner\n", f->banner); fprintf(F, "\"%s\";banner\n", f->banner);
#ifdef ALLIANCES
if (f->alliance!=NULL && f->alliance==uf->alliance) { if (f->alliance!=NULL && f->alliance==uf->alliance) {
fprintf(F, "%d;alliance\n", f->alliance->id); fprintf(F, "%d;alliance\n", f->alliance->id);
fprintf(F, "\"%s\";alliancename\n", f->alliance->name); fprintf(F, "\"%s\";alliancename\n", f->alliance->name);
} }
#endif
#ifdef SHORTPWDS #ifdef SHORTPWDS
if (f->shortpwds) { if (f->shortpwds) {
shortpwd * spwd = f->shortpwds; shortpwd * spwd = f->shortpwds;

View File

@ -2559,12 +2559,10 @@ steal_cmd(unit * u, struct order * ord, request ** stealorders)
return; return;
} }
#ifdef ALLIANCES if (u->faction->alliance!=NULL && u->faction->alliance == u2->faction->alliance) {
if(u->faction->alliance == u2->faction->alliance) {
cmistake(u, ord, 47, MSG_INCOME); cmistake(u, ord, 47, MSG_INCOME);
return; return;
} }
#endif
assert(u->region==u2->region); assert(u->region==u2->region);
if (!can_contact(r, u, u2)) { if (!can_contact(r, u, u2)) {

View File

@ -36,30 +36,31 @@
#include "study.h" #include "study.h"
/* kernel includes */ /* kernel includes */
#include <alchemy.h> #include <kernel/alchemy.h>
#include <battle.h> #include <kernel/alliance.h>
#include <border.h> #include <kernel/battle.h>
#include <building.h> #include <kernel/border.h>
#include <faction.h> #include <kernel/building.h>
#include <group.h> #include <kernel/faction.h>
#include <item.h> #include <kernel/group.h>
#include <karma.h> #include <kernel/item.h>
#include <magic.h> #include <kernel/karma.h>
#include <message.h> #include <kernel/magic.h>
#include <movement.h> #include <kernel/message.h>
#include <order.h> #include <kernel/movement.h>
#include <plane.h> #include <kernel/order.h>
#include <pool.h> #include <kernel/plane.h>
#include <race.h> #include <kernel/pool.h>
#include <region.h> #include <kernel/race.h>
#include <resources.h> #include <kernel/region.h>
#include <save.h> #include <kernel/resources.h>
#include <ship.h> #include <kernel/save.h>
#include <skill.h> #include <kernel/ship.h>
#include <spy.h> #include <kernel/skill.h>
#include <unit.h> #include <kernel/spy.h>
#include <kernel/unit.h>
#ifdef USE_UGROUPS #ifdef USE_UGROUPS
# include <ugroup.h> # include <kernel/ugroup.h>
#endif #endif
/* attributes includes */ /* attributes includes */
@ -76,9 +77,6 @@
#include <util/message.h> #include <util/message.h>
#include <modules/xecmd.h> #include <modules/xecmd.h>
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
#ifdef AT_OPTION #ifdef AT_OPTION
/* attributes includes */ /* attributes includes */
@ -1049,7 +1047,6 @@ inactivefaction(faction * f)
fclose(inactiveFILE); fclose(inactiveFILE);
} }
#ifdef ENHANCED_QUIT
static void static void
transfer_faction(faction *f, faction *f2) transfer_faction(faction *f, faction *f2)
{ {
@ -1065,7 +1062,6 @@ transfer_faction(faction *f, faction *f2)
u = un; u = un;
} }
} }
#endif
static int static int
restart(unit * u, struct order * ord) restart(unit * u, struct order * ord)
@ -1112,6 +1108,17 @@ restart(unit * u, struct order * ord)
return 0; return 0;
} }
static boolean
EnhancedQuit()
{
static int value = -1;
if (value<0) {
const char * str = get_param(global.parameters, "alliance.transferquit");
value = (str!=0 && strcmp(str, "true")==0);
}
return value;
}
static int static int
quit(unit * u, struct order * ord) quit(unit * u, struct order * ord)
{ {
@ -1119,7 +1126,7 @@ quit(unit * u, struct order * ord)
skip_token(); /* skip keyword */ skip_token(); /* skip keyword */
if (checkpasswd(u->faction, getstrtoken(), false)) { if (checkpasswd(u->faction, getstrtoken(), false)) {
#ifdef ENHANCED_QUIT if (EnhancedQuit()) {
int f2_id = getid(); int f2_id = getid();
if (f2_id > 0) { if (f2_id > 0) {
@ -1130,12 +1137,8 @@ quit(unit * u, struct order * ord)
cmistake(u, ord, 66, MSG_EVENT); cmistake(u, ord, 66, MSG_EVENT);
} else if(f == f2) { } else if(f == f2) {
cmistake(u, ord, 8, MSG_EVENT); cmistake(u, ord, 8, MSG_EVENT);
#ifdef ALLIANCES } else if (!u->faction->alliance || u->faction->alliance != f2->alliance) {
} else if(u->faction->alliance != f2->alliance) {
cmistake(u, ord, 315, MSG_EVENT); cmistake(u, ord, 315, MSG_EVENT);
#else
#error ENHANCED_QUIT defined without ALLIANCES
#endif
} else if(!alliedfaction(NULL, f, f2, HELP_MONEY)) { } else if(!alliedfaction(NULL, f, f2, HELP_MONEY)) {
cmistake(u, ord, 316, MSG_EVENT); cmistake(u, ord, 316, MSG_EVENT);
} else { } else {
@ -1145,9 +1148,8 @@ quit(unit * u, struct order * ord)
} else { } else {
destroyfaction(u->faction); destroyfaction(u->faction);
} }
#else }
destroyfaction(u->faction); destroyfaction(u->faction);
#endif
return -1; return -1;
} else { } else {
cmistake(u, ord, 86, MSG_EVENT); cmistake(u, ord, 86, MSG_EVENT);
@ -1237,7 +1239,7 @@ parse_quit(void)
} }
} }
} }
#if defined(ALLIANCES) && !defined(ALLIANCEJOIN) #ifndef ALLIANCEJOIN
if (f->alliance==NULL) { if (f->alliance==NULL) {
/* destroyfaction(f); */ /* destroyfaction(f); */
continue; continue;
@ -3539,9 +3541,12 @@ defaultorders (void)
while (*ordp!=NULL) { while (*ordp!=NULL) {
order * ord = *ordp; order * ord = *ordp;
if (get_keyword(ord)==K_DEFAULT) { if (get_keyword(ord)==K_DEFAULT) {
char * cmd;
init_tokens(ord); init_tokens(ord);
skip_token(); /* skip the keyword */ skip_token(); /* skip the keyword */
set_order(&u->lastorder, parse_order(getstrtoken(), u->faction->locale)); cmd = strdup(getstrtoken());
set_order(&u->lastorder, parse_order(cmd, u->faction->locale));
free(cmd);
free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */ free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */
*ordp = ord->next; *ordp = ord->next;
ord->next = NULL; ord->next = NULL;
@ -3629,9 +3634,9 @@ processorders (void)
puts(" - Defaults und Instant-Befehle..."); puts(" - Defaults und Instant-Befehle...");
setdefaults(); setdefaults();
instant_orders(); instant_orders();
#ifdef ALLIANCES
alliancekick(); if (alliances!=NULL) alliancekick();
#endif
parse(K_MAIL, mail_cmd, false); parse(K_MAIL, mail_cmd, false);
puts(" - Altern"); puts(" - Altern");
age_factions(); age_factions();
@ -3642,10 +3647,10 @@ processorders (void)
puts(" - Kontaktieren, Betreten von Schiffen und Gebäuden (1.Versuch)"); puts(" - Kontaktieren, Betreten von Schiffen und Gebäuden (1.Versuch)");
do_misc(false); do_misc(false);
#ifdef ALLIANCES if (alliances!=NULL) {
puts(" - Testen der Allianzbedingungen"); puts(" - Testen der Allianzbedingungen");
alliancevictory(); alliancevictory();
#endif }
puts(" - GM Kommandos"); puts(" - GM Kommandos");
#ifdef INFOCMD_MODULE #ifdef INFOCMD_MODULE

View File

@ -19,9 +19,6 @@
/* modules includes */ /* modules includes */
#include <modules/score.h> #include <modules/score.h>
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
/* attributes includes */ /* attributes includes */
#include <attributes/overrideroads.h> #include <attributes/overrideroads.h>
@ -39,6 +36,7 @@
/* kernel includes */ /* kernel includes */
#include <kernel/alchemy.h> #include <kernel/alchemy.h>
#include <kernel/alliance.h>
#include <kernel/border.h> #include <kernel/border.h>
#include <kernel/build.h> #include <kernel/build.h>
#include <kernel/building.h> #include <kernel/building.h>
@ -1675,17 +1673,11 @@ show_allies(const faction * f, const ally * allies)
const ally * sf; const ally * sf;
for (sf = allies; sf; sf = sf->next) { for (sf = allies; sf; sf = sf->next) {
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL); int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
#ifdef ALLIANCES
if (f->alliance!=sf->faction->alliance) continue;
#endif
if (mode > 0) ++allierte; if (mode > 0) ++allierte;
} }
for (sf = allies; sf; sf = sf->next) { for (sf = allies; sf; sf = sf->next) {
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL); int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
#ifdef ALLIANCES
if (f->alliance!=sf->faction->alliance) continue;
#endif
if (mode <= 0) continue; if (mode <= 0) continue;
i++; i++;
if (dh) { if (dh) {
@ -2001,11 +1993,9 @@ report(FILE *F, faction * f, const faction_list * addresses,
LOC(f->locale, rc_name(f->race, 1)), neue_gebiete[f->magiegebiet], LOC(f->locale, rc_name(f->race, 1)), neue_gebiete[f->magiegebiet],
f->email); f->email);
centre(F, buf, true); centre(F, buf, true);
#ifdef ALLIANCES
if (f->alliance!=NULL) { if (f->alliance!=NULL) {
centre(F, alliancename(f->alliance), true); centre(F, alliancename(f->alliance), true);
} }
#endif
buf[0] = 0; buf[0] = 0;
dh = 0; dh = 0;
@ -3267,18 +3257,18 @@ writeturn(void)
static void static void
out_faction(FILE *file, faction *f) out_faction(FILE *file, faction *f)
{ {
#ifdef ALLIANCES if (alliances!=NULL) {
fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n", fprintf(file, "%s (%s/%d) (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n",
f->name, itoa36(f->no), f->alliance?f->alliance->id:0, f->name, itoa36(f->no), f->alliance?f->alliance->id:0,
LOC(default_locale, rc_name(f->race, 0)), neue_gebiete[f->magiegebiet], LOC(default_locale, rc_name(f->race, 0)), neue_gebiete[f->magiegebiet],
f->no_units, f->number, f->money, turn - f->lastorders, f->no_units, f->number, f->money, turn - f->lastorders,
turn - f->lastorders != 1 ? "NMRs" : "NMR "); turn - f->lastorders != 1 ? "NMRs" : "NMR ");
#else } else {
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n", fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n",
factionname(f), LOC(default_locale, rc_name(f->race, 0)), factionname(f), LOC(default_locale, rc_name(f->race, 0)),
neue_gebiete[f->magiegebiet], f->no_units, f->number, f->money, neue_gebiete[f->magiegebiet], f->no_units, f->number, f->money,
turn - f->lastorders, turn - f->lastorders != 1 ? "NMRs" : "NMR "); turn - f->lastorders, turn - f->lastorders != 1 ? "NMRs" : "NMR ");
#endif }
} }
void void
@ -3505,7 +3495,6 @@ eval_faction(struct opstack ** stack, const void * userdata) /* faction -> strin
opush(stack, strcpy(balloc(len+1), c)); opush(stack, strcpy(balloc(len+1), c));
} }
#ifdef ALLIANCES
static void static void
eval_alliance(struct opstack ** stack, const void * userdata) /* faction -> string */ eval_alliance(struct opstack ** stack, const void * userdata) /* faction -> string */
{ {
@ -3517,7 +3506,6 @@ eval_alliance(struct opstack ** stack, const void * userdata) /* faction -> stri
} }
else opush(stack, NULL); else opush(stack, NULL);
} }
#endif
static void static void
eval_region(struct opstack ** stack, const void * userdata) /* region -> string */ eval_region(struct opstack ** stack, const void * userdata) /* region -> string */
@ -3614,9 +3602,7 @@ eval_int36(struct opstack ** stack, const void * userdata)
void void
report_init(void) report_init(void)
{ {
#ifdef ALLIANCES
add_function("alliance", &eval_alliance); add_function("alliance", &eval_alliance);
#endif
add_function("region", &eval_region); add_function("region", &eval_region);
add_function("resource", &eval_resource); add_function("resource", &eval_resource);
add_function("race", &eval_race); add_function("race", &eval_race);

View File

@ -55,17 +55,6 @@
#define TEACHNUMBER 10 #define TEACHNUMBER 10
static boolean
ExpensiveMigrants(void)
{
int value = -1;
if (value<0) {
const char * str = get_param(global.parameters, "study.expensivemigrants");
value = str?atoi(str):0;
}
return value;
}
static skill_t static skill_t
getskill(const struct locale * lang) getskill(const struct locale * lang)
{ {

View File

@ -8,6 +8,7 @@ SubDirHdrs $(XMLHDRS) ;
SOURCES = SOURCES =
alchemy.c alchemy.c
alliance.c
battle.c battle.c
border.c border.c
build.c build.c

View File

@ -11,11 +11,8 @@
*/ */
#include <config.h> #include <config.h>
#include <eressea.h> #include "eressea.h"
#ifdef ALLIANCES
#include "alliance.h" #include "alliance.h"
#include "command.h"
#include <attributes/key.h> #include <attributes/key.h>
@ -29,8 +26,9 @@
#include <kernel/item.h> #include <kernel/item.h>
/* util includes */ /* util includes */
#include <umlaut.h> #include <util/command.h>
#include <base36.h> #include <util/umlaut.h>
#include <util/base36.h>
/* libc includes */ /* libc includes */
#include <assert.h> #include <assert.h>
@ -329,6 +327,3 @@ victorycondition(const alliance * al, const char * name)
} }
return -1; return -1;
} }
#endif

View File

@ -11,15 +11,12 @@
* This program may not be used, modified or distributed without * This program may not be used, modified or distributed without
* prior permission by the authors of Eressea. * prior permission by the authors of Eressea.
*/ */
#ifndef H_MOD_ALLIANCE #ifndef H_KRNL_ALLIANCE
#define H_MOD_ALLIANCE #define H_KRNL_ALLIANCE
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
#ifndef ALLIANCES
#error "must define ALLIANCES to use this module"
#endif
struct plane; struct plane;
struct attrib; struct attrib;
struct unit; struct unit;

View File

@ -33,13 +33,15 @@ typedef enum combatmagic {
#include "eressea.h" #include "eressea.h"
#include "battle.h" #include "battle.h"
#include "item.h"
#include "alchemy.h" #include "alchemy.h"
#include "alliance.h"
#include "build.h" #include "build.h"
#include "building.h" #include "building.h"
#include "curse.h" #include "curse.h"
#include "faction.h" #include "faction.h"
#include "goodies.h" #include "goodies.h"
#include "group.h"
#include "item.h"
#include "karma.h" #include "karma.h"
#include "magic.h" #include "magic.h"
#include "message.h" #include "message.h"
@ -54,7 +56,6 @@ typedef enum combatmagic {
#include "skill.h" #include "skill.h"
#include "spell.h" #include "spell.h"
#include "unit.h" #include "unit.h"
#include "group.h"
/* attributes includes */ /* attributes includes */
#include <attributes/key.h> #include <attributes/key.h>
@ -66,11 +67,6 @@ typedef enum combatmagic {
/* items includes */ /* items includes */
#include <items/demonseye.h> #include <items/demonseye.h>
/* modules includes */
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
/* util includes */ /* util includes */
#include <base36.h> #include <base36.h>
#include <cvector.h> #include <cvector.h>
@ -354,14 +350,6 @@ set_enemy(side * as, side * ds, boolean attacking)
if (attacking) as->enemy[ds->index] |= E_ATTACKING; if (attacking) as->enemy[ds->index] |= E_ATTACKING;
} }
#ifdef ALLIANCES
static int
allysfm(const side * s, const faction * f, int mode)
{
if (s->bf->faction==f) return true;
return alliedfaction(s->battle->plane, s->bf->faction, f, mode);
}
#else
static int static int
allysfm(const side * s, const faction * f, int mode) allysfm(const side * s, const faction * f, int mode)
{ {
@ -371,7 +359,6 @@ allysfm(const side * s, const faction * f, int mode)
} }
return alliedfaction(s->battle->plane, s->bf->faction, f, mode); return alliedfaction(s->battle->plane, s->bf->faction, f, mode);
} }
#endif
static int static int
allysf(const side * s, const faction * f) allysf(const side * s, const faction * f)
@ -2756,12 +2743,12 @@ print_stats(battle * b)
for (k = buf; *k; ++k) *k = '-'; for (k = buf; *k; ++k) *k = '-';
battlerecord(b, buf); battlerecord(b, buf);
if (side->bf->faction) { if (side->bf->faction) {
#ifdef ALLIANCES if (side->bf->faction->alliance) {
sprintf(buf, "##### %s (%s/%d)", side->bf->faction->name, itoa36(side->bf->faction->no), sprintf(buf, "##### %s (%s/%d)", side->bf->faction->name, itoa36(side->bf->faction->no),
side->bf->faction->alliance?side->bf->faction->alliance->id:0); side->bf->faction->alliance?side->bf->faction->alliance->id:0);
#else } else {
sprintf(buf, "##### %s (%s)", side->bf->faction->name, itoa36(side->bf->faction->no)); sprintf(buf, "##### %s (%s)", side->bf->faction->name, itoa36(side->bf->faction->no));
#endif }
battledebug(buf); battledebug(buf);
} }
print_fighters(b, &side->fighters); print_fighters(b, &side->fighters);

View File

@ -23,9 +23,6 @@
/* modules includes */ /* modules includes */
#include <modules/xecmd.h> #include <modules/xecmd.h>
#ifdef ALLIANCES
# include <modules/alliance.h>
#endif
/* attributes includes */ /* attributes includes */
#include <attributes/reduceproduction.h> #include <attributes/reduceproduction.h>
@ -34,6 +31,7 @@
#include <attributes/gm.h> #include <attributes/gm.h>
/* kernel includes */ /* kernel includes */
#include "alliance.h"
#include "alchemy.h" #include "alchemy.h"
#include "battle.h" #include "battle.h"
#include "border.h" #include "border.h"
@ -118,6 +116,69 @@ MaxAge(void) {
return value; return value;
} }
static int
ally_flag(const char * s)
{
if (strcmp(s, "money")==0) return HELP_MONEY;
if (strcmp(s, "fight")==0) return HELP_FIGHT;
if (strcmp(s, "observe")==0) return HELP_OBSERVE;
if (strcmp(s, "give")==0) return HELP_GIVE;
if (strcmp(s, "guard")==0) return HELP_GUARD;
if (strcmp(s, "stealth")==0) return HELP_FSTEALTH;
if (strcmp(s, "travel")==0) return HELP_TRAVEL;
return 0;
}
boolean
ExpensiveMigrants(void)
{
int value = -1;
if (value<0) {
const char * str = get_param(global.parameters, "study.expensivemigrants");
value = str?atoi(str):0;
}
return value;
}
int
AllianceAuto(void)
{
static int value = -1;
if (value<0) {
char * str = strdup(get_param(global.parameters, "alliance.auto"));
value = 0;
if (str!=NULL) {
char * tok = strtok(str, " ");
while (tok) {
value |= ally_flag(tok);
tok = strtok(NULL, " ");
}
free(str);
}
}
return value;
}
int
AllianceRestricted(void)
{
static int value = -1;
if (value<0) {
char * str = strdup(get_param(global.parameters, "alliance.restricted"));
value = 0;
if (str!=NULL) {
char * tok = strtok(str, " ");
while (tok) {
value |= ally_flag(tok);
tok = strtok(NULL, " ");
}
free(str);
}
}
return value;
}
int int
FirstTurn(void) FirstTurn(void)
{ {
@ -378,8 +439,7 @@ const char *options[MAXOPTIONS] =
"SHOWSKCHANGE" "SHOWSKCHANGE"
}; };
#ifdef ALLIANCE_LIMITS static int
int
allied_skillcount(const faction * f, skill_t sk) allied_skillcount(const faction * f, skill_t sk)
{ {
int num = 0; int num = 0;
@ -392,19 +452,23 @@ allied_skillcount(const faction * f, skill_t sk)
return num; return num;
} }
int static int
allied_skilllimit(const faction * f, skill_t sk) allied_skilllimit(const faction * f, skill_t sk)
{ {
const char * str = get_param(global.parameters, "allied.skilllimit"); static int value = -1;
return str?atoi(str):0; if (value<0) {
const char * str = get_param(global.parameters, "alliance.skilllimit");
value = str?atoi(str):0;
}
return value;
} }
#endif
int int
max_skill(faction * f, skill_t sk) max_skill(faction * f, skill_t sk)
{ {
int m = INT_MAX; int m = INT_MAX;
#ifdef ALLIANCE_LIMITS
if (allied_skilllimit(f, sk)) {
if (sk!=SK_ALCHEMY && sk!=SK_MAGIC) return INT_MAX; if (sk!=SK_ALCHEMY && sk!=SK_MAGIC) return INT_MAX;
if (f->alliance!=NULL) { if (f->alliance!=NULL) {
int ac = listlen(f->alliance->members); /* number of factions */ int ac = listlen(f->alliance->members); /* number of factions */
@ -414,7 +478,7 @@ max_skill(faction * f, skill_t sk)
if (sc==0) return count_skill(f, sk); if (sc==0) return count_skill(f, sk);
return fl; return fl;
} }
#endif }
switch (sk) { switch (sk) {
case SK_MAGIC: case SK_MAGIC:
m = MAXMAGICIANS; m = MAXMAGICIANS;
@ -855,9 +919,10 @@ autoalliance(const plane * pl, const faction * sf, const faction * f2)
a=a->next; a=a->next;
} }
} }
#ifdef AUTOALLIANCE
if (sf->alliance==f2->alliance) return AUTOALLIANCE; if (sf->alliance && AllianceAuto()) {
#endif if (sf->alliance==f2->alliance) return AllianceAuto();
}
return 0; return 0;
} }
@ -878,15 +943,9 @@ alliedgroup(const struct plane * pl, const struct faction * f,
mode = mode & autoalliance(pl, f, f2); mode = mode & autoalliance(pl, f, f2);
} }
mode = ally_mode(sf, mode) | (mode & autoalliance(pl, f, f2)); mode = ally_mode(sf, mode) | (mode & autoalliance(pl, f, f2));
#ifdef ALLIANCES if (AllianceRestricted() && f->alliance!=f2->alliance) {
if (f->alliance!=f2->alliance) { mode &= ~AllianceRestricted();
# ifdef ALLIES_ONLY
mode &= ~ALLIES_ONLY;
# else
mode = 0;
# endif
} }
#endif
return mode; return mode;
} }

View File

@ -88,11 +88,7 @@ struct building_type;
#include <util/vset.h> #include <util/vset.h>
#define AT_PERSISTENT #define AT_PERSISTENT
#ifdef ALLIANCES #define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
# define ALLIED(f1, f2) (f1->alliance && f1->alliance==f2->alliance)
#else
# define ALLIED(f1, f2) (f1==f2)
#endif
/* eressea-defined attribute-type flags */ /* eressea-defined attribute-type flags */
#define ATF_CURSE ATF_USER_DEFINED #define ATF_CURSE ATF_USER_DEFINED
@ -167,16 +163,16 @@ struct building_type;
#define DBLINK_VERSION 314 #define DBLINK_VERSION 314
#define CURSEVIGOURISFLOAT_VERSION 315 #define CURSEVIGOURISFLOAT_VERSION 315
#define SAVEXMLNAME_VERSION 316 #define SAVEXMLNAME_VERSION 316
#define SAVEALLIANCE_VERSION 317
#define REGIONOWNERS_VERSION 317
#define MIN_VERSION ALLIANCES_VERSION #define MIN_VERSION ALLIANCES_VERSION
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */ #define REGIONOWNERS_VERSION 400
#define UGROUPS_VERSION 500 /* nicht aktivieren, nicht fertig */
#ifdef REGIONOWNERS #ifdef REGIONOWNERS
# define RELEASE_VERSION REGIONOWNERS_VERSION # define RELEASE_VERSION REGIONOWNERS_VERSION
#else #else
# define RELEASE_VERSION SAVEXMLNAME_VERSION # define RELEASE_VERSION SAVEALLIANCE_VERSION
#endif #endif
#if RESOURCE_CONVERSION #if RESOURCE_CONVERSION
@ -1173,12 +1169,14 @@ extern const char * dbrace(const struct race * rc);
extern void set_param(struct param ** p, const char * name, const char * data); extern void set_param(struct param ** p, const char * name, const char * data);
extern const char* get_param(const struct param * p, const char * name); extern const char* get_param(const struct param * p, const char * name);
extern boolean ExpensiveMigrants(void);
extern int FirstTurn(void); extern int FirstTurn(void);
extern int NMRTimeout(void); extern int NMRTimeout(void);
extern int LongHunger(void); extern int LongHunger(void);
extern boolean TradeDisabled(void); extern boolean TradeDisabled(void);
extern int SkillCap(skill_t sk); extern int SkillCap(skill_t sk);
extern int AllianceAuto(void); /* flags that allied factions get automatically */
extern int AllianceRestricted(void); /* flags restricted to allied factions */
extern struct order * default_order(const struct locale * lang); extern struct order * default_order(const struct locale * lang);
extern int entertainmoney(const struct region * r); extern int entertainmoney(const struct region * r);

View File

@ -82,9 +82,7 @@ typedef struct faction {
int number; /* enno: unterschied zu num_people ? */ int number; /* enno: unterschied zu num_people ? */
int money; int money;
int score; int score;
#ifdef ALLIANCES
struct alliance * alliance; struct alliance * alliance;
#endif
#ifdef VICTORY_DELAY #ifdef VICTORY_DELAY
unsigned char victory_delay; unsigned char victory_delay;
#endif #endif

View File

@ -297,6 +297,12 @@
<File <File
RelativePath=".\alchemy.c"> RelativePath=".\alchemy.c">
</File> </File>
<File
RelativePath=".\alliance.c">
</File>
<File
RelativePath=".\alliance.h">
</File>
<File <File
RelativePath=".\battle.c"> RelativePath=".\battle.c">
</File> </File>

View File

@ -887,7 +887,7 @@ get_addresses(faction * f)
u = u->next; u = u->next;
} }
} }
#ifdef ALLIANCES
if (f->alliance != NULL) { if (f->alliance != NULL) {
faction *f2; faction *f2;
for(f2 = factions; f2; f2 = f2->next) { for(f2 = factions; f2; f2 = f2->next) {
@ -905,7 +905,6 @@ get_addresses(faction * f)
} }
} }
} }
#endif
return flist; return flist;
} }

View File

@ -22,6 +22,7 @@
#include "eressea.h" #include "eressea.h"
#include "save.h" #include "save.h"
#include "alliance.h"
#include "alchemy.h" #include "alchemy.h"
#include "attrib.h" #include "attrib.h"
#include "border.h" #include "border.h"
@ -50,11 +51,6 @@
#include <attributes/ugroup.h> #include <attributes/ugroup.h>
#endif #endif
/* modules include */
#ifdef ALLIANCES
# include <modules/alliance.h>
#endif
/* attributes includes */ /* attributes includes */
#include <attributes/key.h> #include <attributes/key.h>
@ -792,11 +788,15 @@ read_ugroups(FILE *file)
} }
#endif #endif
#ifdef ALLIANCES static void
void
read_alliances(FILE * F) read_alliances(FILE * F)
{ {
char pbuf[32]; char pbuf[32];
if (global.data_version<SAVEALLIANCE_VERSION) {
if (!AllianceRestricted() && !AllianceAuto()) return;
}
rs(F, pbuf); rs(F, pbuf);
while (strcmp(pbuf, "end")!=0) { while (strcmp(pbuf, "end")!=0) {
rs(F, buf); rs(F, buf);
@ -804,7 +804,6 @@ read_alliances(FILE * F)
rs(F, pbuf); rs(F, pbuf);
} }
} }
#endif
#define wc(F, c) putc(c, F); #define wc(F, c) putc(c, F);
#define wnl(F) putc('\n', F); #define wnl(F) putc('\n', F);
@ -839,7 +838,6 @@ wi36(FILE * F, int n)
fprintf(F, "%s ", itoa36(n)); fprintf(F, "%s ", itoa36(n));
} }
#ifdef ALLIANCES
void void
write_alliances(FILE * F) write_alliances(FILE * F)
{ {
@ -853,7 +851,6 @@ write_alliances(FILE * F)
fprintf(F, "end "); fprintf(F, "end ");
wnl(F); wnl(F);
} }
#endif
void void
write_items(FILE *F, item *ilist) write_items(FILE *F, item *ilist)
@ -1472,13 +1469,10 @@ addally(const faction * f, ally ** sfp, int aid, int state)
#ifndef REGIONOWNERS #ifndef REGIONOWNERS
state &= ~HELP_TRAVEL; state &= ~HELP_TRAVEL;
#endif #endif
#ifdef ALLIANCES
# ifdef ALLIES_ONLY if (af==NULL) return sfp;
if (af!=NULL && af->alliance!=f->alliance) state &= ~ALLIES_ONLY;; if (f->alliance==NULL || f->alliance!=af->alliance) state &= ~AllianceRestricted();
# else if (f->alliance==NULL || f->alliance==af->alliance) state |= AllianceAuto();
# endif
if (af!=NULL && af->alliance!=f->alliance) return sfp;
#endif
if (state==0) return sfp; if (state==0) return sfp;
sf = calloc(1, sizeof(ally)); sf = calloc(1, sizeof(ally));
@ -1513,8 +1507,8 @@ readfaction(FILE * F)
while (f->attribs) a_remove(&f->attribs, f->attribs); while (f->attribs) a_remove(&f->attribs, f->attribs);
} }
f->subscription = ri(F); f->subscription = ri(F);
#ifdef ALLIANCES
if (global.data_version>=ALLIANCES_VERSION) { if (alliances!=NULL) {
int allianceid = rid(F); int allianceid = rid(F);
if (allianceid!=0) f->alliance = findalliance(allianceid); if (allianceid!=0) f->alliance = findalliance(allianceid);
if (f->alliance) { if (f->alliance) {
@ -1524,7 +1518,6 @@ readfaction(FILE * F)
f->alliance->members = flist; f->alliance->members = flist;
} }
} }
#endif
rds(F, &f->name); rds(F, &f->name);
@ -1641,10 +1634,10 @@ writefaction(FILE * F, const faction * f)
wi36(F, f->no); wi36(F, f->no);
wi(F, f->subscription); wi(F, f->subscription);
#if defined(ALLIANCES) && RELEASE_VERSION>=ALLIANCES_VERSION if (alliances!=NULL) {
if (f->alliance) wi36(F, f->alliance->id); if (f->alliance) wi36(F, f->alliance->id);
else wi36(F, 0); else wi36(F, 0);
#endif }
ws(F, f->name); ws(F, f->name);
ws(F, f->banner); ws(F, f->banner);
@ -1782,11 +1775,9 @@ readgame(const char * filename, int backup)
} }
/* Read factions */ /* Read factions */
#ifdef ALLIANCES
if (global.data_version>=ALLIANCES_VERSION) { if (global.data_version>=ALLIANCES_VERSION) {
read_alliances(F); read_alliances(F);
} }
#endif
n = ri(F); n = ri(F);
printf(" - Einzulesende Parteien: %d\n", n); printf(" - Einzulesende Parteien: %d\n", n);
fp = &factions; fp = &factions;
@ -2076,7 +2067,7 @@ writegame(const char *filename, char quiet)
/* Write factions */ /* Write factions */
#if defined(ALLIANCES) && RELEASE_VERSION>=ALLIANCES_VERSION #if RELEASE_VERSION>=ALLIANCES_VERSION
write_alliances(F); write_alliances(F);
#endif #endif
n = listlen(factions); n = listlen(factions);

View File

@ -15,6 +15,5 @@
void teaching(void); void teaching(void);
void learn(void); void learn(void);
magic_t getmagicskill(void); extern magic_t getmagicskill(void);
extern boolean is_migrant(struct unit *u); extern boolean is_migrant(struct unit *u);

View File

@ -1,334 +0,0 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <config.h>
#include <eressea.h>
#ifdef ALLIANCES
#include "alliance.h"
#include "command.h"
#include <attributes/key.h>
/* kernel includes */
#include <kernel/building.h>
#include <kernel/faction.h>
#include <kernel/message.h>
#include <kernel/order.h>
#include <kernel/region.h>
#include <kernel/unit.h>
#include <kernel/item.h>
/* util includes */
#include <umlaut.h>
#include <base36.h>
/* libc includes */
#include <assert.h>
#include <stdlib.h>
#include <string.h>
alliance * alliances = NULL;
alliance *
makealliance(int id, const char * name)
{
alliance * al = calloc(1, sizeof(alliance));
al->id=id;
al->name=strdup(name);
al->next=alliances;
return alliances=al;
}
alliance *
findalliance(int id)
{
alliance * al;
for (al=alliances;al;al=al->next) {
if (al->id==id) return al;
}
return NULL;
}
void destroy_kick(struct attrib * a)
{
faction_list * flist = (faction_list*)a->data.v;
freelist(flist);
}
const attrib_type at_kick = { "kick",
DEFAULT_INIT, destroy_kick
};
static attrib *
make_kick(void)
{
return a_new(&at_kick);
}
void
add_kick(attrib * a, const faction * f)
{
faction_list * flist = (faction_list*)a->data.v;
while (flist && flist->data!=f) flist = flist->next;
if (flist) return;
flist = calloc(1, sizeof(faction_list));
flist->data = (void*)f;
flist->next = (faction_list*)a->data.v;
a->data.v = flist;
}
static void
alliance_kick(const tnode * tnext, const char * str, void * data, struct order * ord)
{
unit * u = (unit*)data;
faction * f = findfaction(atoi36(igetstrtoken(str)));
attrib * a;
unused(tnext);
if (f==NULL || f->alliance!=u->faction->alliance) {
/* does not belong to our alliance */
return;
}
a = a_find(f->attribs, &at_kick);
if (a==NULL) a = a_add(&f->attribs, make_kick());
add_kick(a, f);
}
static void
alliance_join(const tnode * tnext, const char * str, void * data, struct order * ord)
{
unit * u = (unit*)data;
alliance * al = findalliance(atoi36(igetstrtoken(str)));
unused(tnext);
if (u->faction->alliance!=NULL || al==NULL) {
/* not found */
return;
}
u->faction->alliance = al;
/* inform the rest? */
}
static void
execute(const struct syntaxtree * syntax)
{
region ** rp = &regions;
while (*rp) {
region * r = *rp;
unit **up = &r->units;
while (*up) {
unit * u = *up;
const struct locale * lang = u->faction->locale;
tnode * root = stree_find(syntax, lang);
order * ord;
for (ord = u->orders; ord; ord = ord->next) {
if (get_keyword(ord) == K_ALLIANCE) {
do_command(root, u, ord);
}
}
if (u==*up) up = &u->next;
}
if (*rp==r) rp = &r->next;
}
}
void
alliancekick(void)
{
static syntaxtree * stree = NULL;
faction * f = factions;
if (stree==NULL) {
syntaxtree * slang = stree = stree_create();
while (slang) {
struct tnode * root = calloc(sizeof(tnode), 1);
struct tnode * leaf = calloc(sizeof(tnode), 1);
add_command(root, leaf, LOC(slang->lang, "alliance"), NULL);
add_command(leaf, NULL, LOC(slang->lang, "kick"), &alliance_kick);
slang = slang->next;
}
}
execute(stree);
while (f) {
attrib * a = a_find(f->attribs, &at_kick);
if (a!=NULL) {
faction_list * flist = (faction_list*)a->data.v;
if (flist!=NULL) {
unsigned int votes = listlen(flist);
unsigned int size = listlen(f->alliance->members);
if (size<=votes*2) {
f->alliance = NULL;
/* tell him he's been kicked */
for (flist=f->alliance->members;flist;flist=flist->next) {
ADDMSG(&flist->data->msgs, msg_message("alliance::kickedout",
"member alliance votes", f, f->alliance, votes));
}
} else {
/* warn that he's been attempted to kick */
for (flist=f->alliance->members;flist;flist=flist->next) {
ADDMSG(&flist->data->msgs, msg_message("alliance::kickattempt",
"member alliance votes", f, f->alliance, votes));
}
}
}
}
f = f->next;
}
/* some may have been kicked, must remove f->alliance==NULL */
}
void
alliancejoin(void)
{
static syntaxtree * stree = NULL;
if (stree==NULL) {
syntaxtree * slang = stree = stree_create();
while (slang) {
struct tnode * root = calloc(sizeof(tnode), 1);
struct tnode * leaf = calloc(sizeof(tnode), 1);
add_command(root, leaf, LOC(slang->lang, "alliance"), NULL);
add_command(leaf, NULL, LOC(slang->lang, "join"), &alliance_join);
slang = slang->next;
}
}
execute(stree);
}
void
setalliance(struct faction * f, alliance * al)
{
if (f->alliance==al) return;
if (f->alliance!=NULL) {
faction_list ** flistp = &f->alliance->members;
while (*flistp) {
if ((*flistp)->data==f) {
*flistp = (*flistp)->next;
break;
}
flistp = &(*flistp)->next;
}
}
f->alliance = al;
if (al!=NULL) {
faction_list * flist = calloc(sizeof(faction_list), 1);
flist->next = al->members;
flist->data = f;
al->members = flist;
}
}
const char *
alliancename(const alliance * al)
{
typedef char name[OBJECTIDSIZE + 1];
static name idbuf[8];
static int nextbuf = 0;
char *buf = idbuf[(++nextbuf) % 8];
if (al && al->name) {
sprintf(buf, "%s (%s)", strcheck(al->name, NAMESIZE), itoa36(al->id));
} else {
return NULL;
}
return buf;
}
void
alliancevictory(void)
{
const struct building_type * btype = bt_find("stronghold");
region * r = regions;
alliance * al = alliances;
if (btype==NULL) return;
while (r!=NULL) {
building * b = r->buildings;
while (b!=NULL) {
if (b->type==btype) {
unit * u = buildingowner(r, b);
if (u) {
fset(u->faction->alliance, FL_MARK);
}
}
b = b->next;
}
r=r->next;
}
while (al!=NULL) {
if (!fval(al, FL_MARK)) {
faction_list * flist = al->members;
while (flist!=0) {
faction * f = flist->data;
if (f->alliance==al) {
ADDMSG(&f->msgs, msg_message("alliance::lost",
"alliance", al));
destroyfaction(f);
}
flist = flist->next;
}
} else {
freset(al, FL_MARK);
}
al = al->next;
}
}
int
victorycondition(const alliance * al, const char * name)
{
const char * gems[] = { "opal", "diamond", "zaphire", "topaz", "beryl", "agate", "garnet", "emerald", NULL };
if (strcmp(name, "gems")==0) {
const char ** igem = gems;
for (;*igem;++igem) {
const struct item_type * itype = it_find(*igem);
faction_list * flist = al->members;
boolean found = false;
assert(itype!=NULL);
for (;flist && !found;flist=flist->next) {
unit * u = flist->data->units;
for (;u;u=u->nextF) {
if (i_get(u->items, itype)>0) {
found = true;
break;
}
}
}
if (!found) return 0;
}
return 1;
} else if (strcmp(name, "phoenix")==0) {
faction_list * flist = al->members;
for (;flist;flist=flist->next) {
faction * f = flist->data;
if (find_key(f->attribs, atoi36("phnx"))) {
return 1;
}
}
return 0;
} else if (strcmp(name, "pyramid")==0) {
faction_list * flist = al->members;
for (;flist;flist=flist->next) {
faction * f = flist->data;
if (find_key(f->attribs, atoi36("pyra"))) {
return 1;
}
}
return 0;
}
return -1;
}
#endif

View File

@ -1,54 +0,0 @@
/* vi: set ts=2:
*
*
* Eressea PB(E)M host Copyright (C) 1998-2003
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#ifndef H_MOD_ALLIANCE
#define H_MOD_ALLIANCE
#ifdef __cplusplus
extern "C" {
#endif
#ifndef ALLIANCES
#error "must define ALLIANCES to use this module"
#endif
struct plane;
struct attrib;
struct unit;
struct faction;
struct region;
struct faction_list;
typedef struct alliance {
struct alliance * next;
struct faction_list * members;
unsigned int flags;
int id;
char * name;
} alliance;
extern alliance * alliances;
extern alliance * findalliance(int id);
extern alliance * makealliance(int id, const char * name);
extern const char * alliancename(const struct alliance * al);
extern void setalliance(struct faction * f, alliance * al);
extern void alliancejoin(void);
extern void alliancekick(void);
extern void alliancevictory(void);
extern int victorycondition(const alliance * al, const char * name);
/* execute commands */
#ifdef __cplusplus
}
#endif
#endif

View File

@ -120,9 +120,6 @@
<Filter <Filter
Name="Header" Name="Header"
Filter="*.h"> Filter="*.h">
<File
RelativePath=".\alliance.h">
</File>
<File <File
RelativePath=".\arena.h"> RelativePath=".\arena.h">
</File> </File>
@ -154,9 +151,6 @@
RelativePath=".\xmas.h"> RelativePath=".\xmas.h">
</File> </File>
</Filter> </Filter>
<File
RelativePath=".\alliance.c">
</File>
<File <File
RelativePath=".\arena.c"> RelativePath=".\arena.c">
</File> </File>

View File

@ -22,11 +22,8 @@
#include <config.h> #include <config.h>
#include "eressea.h" #include "eressea.h"
#ifdef ALLIANCES
#include "alliance.h"
#endif
/* kernel includes */ /* kernel includes */
#include <kernel/alliance.h>
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
@ -255,8 +252,7 @@ score(void)
} }
fclose(scoreFP); fclose(scoreFP);
#ifdef ALLIANCES if (alliances!=NULL) {
{
alliance *a; alliance *a;
const item_type * token = it_find("conquesttoken"); const item_type * token = it_find("conquesttoken");
@ -292,7 +288,6 @@ score(void)
} }
fclose(scoreFP); fclose(scoreFP);
} }
#endif
} }

View File

@ -30,16 +30,13 @@
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */ #define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */ #define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
#define CHANGED_CROSSBOWS 1 #define CHANGED_CROSSBOWS 1
#define NEWATSROI 0
#define COMBAT_TURNS 5 #define COMBAT_TURNS 5
#define PEASANTS_DO_NOT_STARVE 0 #define PEASANTS_DO_NOT_STARVE 0
#define NEW_MIGRATION 1 #define NEW_MIGRATION 1
#define ASTRAL_HUNGER #define ASTRAL_HUNGER
#undef SHORTPWDS
#define ZEROFOKS_QUESTMASTER "eressea@zerofoks.net" #define NEWATSROI 0
#undef DUNGEON_MODULE
#define MUSEUM_MODULE #define MUSEUM_MODULE
#define ARENA_MODULE #define ARENA_MODULE
#define WORMHOLE_MODULE #define WORMHOLE_MODULE

View File

@ -40,9 +40,4 @@
#define ROIBONUS 4 #define ROIBONUS 4
#endif #endif
#define ENHANCED_QUIT
#define ALLIANCES
#undef ALLIANCEJOIN
#define AUTOALLIANCE (HELP_FIGHT)
#define MAILITPATH "/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin" #define MAILITPATH "/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin"

View File

@ -11,7 +11,7 @@
*/ */
/* /*
* Contains defines for the "alliance" vinyambar game (V3). * Contains defines for the "alliance" vinyambar game (wdw).
* Include this file from settings.h to make eressea work. * Include this file from settings.h to make eressea work.
*/ */
#define ENTERTAINFRACTION 20 #define ENTERTAINFRACTION 20
@ -30,24 +30,24 @@
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */ #define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */ #define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
#define CHANGED_CROSSBOWS 1 #define CHANGED_CROSSBOWS 1
#define NEWATSROI 1
#define COMBAT_TURNS 5 #define COMBAT_TURNS 5
#define PEASANTS_DO_NOT_STARVE 0 #define PEASANTS_DO_NOT_STARVE 0
#define NEW_MIGRATION 1 #define NEW_MIGRATION 1
#define ASTRAL_HUNGER #define ASTRAL_HUNGER
#define NEWATSROI 1
#if NEWATSROI == 1 #if NEWATSROI == 1
#define ATSBONUS 2 #define ATSBONUS 2
#define ROIBONUS 4 #define ROIBONUS 4
#endif #endif
#define ENHANCED_QUIT
#define ALLIANCES
#define ALLIES_ONLY (HELP_FIGHT|HELP_GUARD|HELP_FSTEALTH|HELP_MONEY)
#undef ALLIANCEJOIN #undef ALLIANCEJOIN
#define ALLIANCE_LIMITS
#define AUTOALLIANCE (HELP_FIGHT)
#undef DUNGEON_MODULE
#undef MUSEUM_MODULE
#undef ARENA_MODULE
#undef WORMHOLE_MODULE
#undef XECMD_MODULE
#define WDW_PHOENIX #define WDW_PHOENIX
#define WDW_PYRAMIDSPELL #define WDW_PYRAMIDSPELL
#define NEW_STARTEQUIPMENT #define NEW_STARTEQUIPMENT

View File

@ -26,37 +26,35 @@
#include <items/questkeys.h> #include <items/questkeys.h>
#include <items/catapultammo.h> #include <items/catapultammo.h>
#include <modules/xecmd.h> #include <modules/xecmd.h>
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
/* gamecode includes */ /* gamecode includes */
#include <economy.h> #include <gamecode/economy.h>
#include <gamecode/monster.h>
/* kernel includes */ /* kernel includes */
#include <border.h> #include <kernel/alchemy.h>
#include <building.h> #include <kernel/alliance.h>
#include <ship.h> #include <kernel/border.h>
#include <faction.h> #include <kernel/building.h>
#include <item.h> #include <kernel/faction.h>
#include <magic.h> #include <kernel/item.h>
#include <message.h> #include <kernel/magic.h>
#include <monster.h> #include <kernel/message.h>
#include <movement.h> #include <kernel/movement.h>
#include <names.h> #include <kernel/names.h>
#include <pathfinder.h> #include <kernel/pathfinder.h>
#include <plane.h> #include <kernel/plane.h>
#include <pool.h> #include <kernel/pool.h>
#include <race.h> #include <kernel/race.h>
#include <region.h> #include <kernel/region.h>
#include <reports.h> #include <kernel/reports.h>
#include <resources.h> #include <kernel/resources.h>
#include <skill.h> #include <kernel/ship.h>
#include <teleport.h> #include <kernel/skill.h>
#include <unit.h> #include <kernel/spell.h>
#include <spell.h> #include <kernel/study.h>
#include <alchemy.h> #include <kernel/teleport.h>
#include <study.h> #include <kernel/unit.h>
/* util includes */ /* util includes */
#include <attrib.h> #include <attrib.h>
@ -225,17 +223,17 @@ static void
no_teurefremde(boolean convert) no_teurefremde(boolean convert)
{ {
region *r; region *r;
unit *u;
for(r=regions;r;r=r->next) { for(r=regions;r;r=r->next) {
unit *u;
for(u=r->units;u;u=u->next) { for(u=r->units;u;u=u->next) {
if (u->faction->no != MONSTER_FACTION if (u->faction->no != MONSTER_FACTION
&& playerrace(u->faction->race) && playerrace(u->faction->race)
&& is_migrant(u) && is_migrant(u) && kor_teure_talente(u))
&& kor_teure_talente(u))
{ {
log_printf("* Warnung, teurer Migrant: %s %s\n", log_warning(("Teurer Migrant: %s, Partei %s\n",
unitname(u), factionname(u->faction)); unitname(u), factionname(u->faction)));
if (convert) { if (convert) {
u->race = u->faction->race; u->race = u->faction->race;
u->irace = u->faction->race; u->irace = u->faction->race;
@ -1166,12 +1164,10 @@ korrektur(void)
update_gms(); update_gms();
verify_owners(false); verify_owners(false);
/* fix_herbtypes(); */ /* fix_herbtypes(); */
/* In Vin3 können Parteien komplett übergeben werden. */ /* In Vin 3+ können Parteien komplett übergeben werden. */
#ifdef ENHANCED_QUIT if (!ExpensiveMigrants()) {
no_teurefremde(0); no_teurefremde(true);
#else }
no_teurefremde(1);
#endif
fix_allies(); fix_allies();
update_gmquests(); /* test gm quests */ update_gmquests(); /* test gm quests */
/* fix_unitrefs(); */ /* fix_unitrefs(); */
@ -1179,9 +1175,6 @@ korrektur(void)
warn_password(); warn_password();
fix_road_borders(); fix_road_borders();
if (turn>1000) curse_emptiness(); /*** disabled ***/ if (turn>1000) curse_emptiness(); /*** disabled ***/
#ifdef ALLIANCES
/* init_alliances(); */
#endif
/* seems something fishy is going on, do this just /* seems something fishy is going on, do this just
* to be on the safe side: * to be on the safe side:
*/ */

View File

@ -1,13 +1,12 @@
#include <config.h> #include <config.h>
#include <eressea.h> #include <eressea.h>
#ifdef ALLIANCES
#include "list.h" #include "list.h"
// kernel includes // kernel includes
#include <kernel/region.h> #include <kernel/region.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <modules/alliance.h> #include <kernel/alliance.h>
// lua includes // lua includes
#include <lua.hpp> #include <lua.hpp>
@ -53,4 +52,3 @@ bind_alliance(lua_State * L)
.property("factions", &alliance_factions, return_stl_iterator) .property("factions", &alliance_factions, return_stl_iterator)
]; ];
} }
#endif

View File

@ -3,9 +3,6 @@
#include "script.h" #include "script.h"
#ifdef ALLIANCES
# include <modules/alliance.h>
#endif
#include <attributes/key.h> #include <attributes/key.h>
// gamecode includes // gamecode includes
@ -13,6 +10,7 @@
#include <gamecode/monster.h> #include <gamecode/monster.h>
// kernel includes // kernel includes
#include <kernel/alliance.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/plane.h> #include <kernel/plane.h>

View File

@ -3,11 +3,9 @@
#include "list.h" #include "list.h"
// kernel includes // kernel includes
#include <kernel/alliance.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/unit.h> #include <kernel/unit.h>
#ifdef ALLIANCES
# include <modules/alliance.h>
#endif
// util includes // util includes
#include <util/base36.h> #include <util/base36.h>
@ -49,7 +47,6 @@ faction_units(const faction& f)
return eressea::list<unit *, unit *, factionunit>(f.units); return eressea::list<unit *, unit *, factionunit>(f.units);
} }
#ifdef ALLIANCES
static void static void
faction_setalliance(faction& f, alliance * team) faction_setalliance(faction& f, alliance * team)
{ {
@ -61,7 +58,6 @@ faction_getalliance(const faction& f)
{ {
return f.alliance; return f.alliance;
} }
#endif
const char * const char *
faction_locale(const faction& f) faction_locale(const faction& f)
@ -146,8 +142,6 @@ bind_faction(lua_State * L)
.def_readwrite("lastturn", &faction::lastorders) .def_readwrite("lastturn", &faction::lastorders)
.property("locale", &faction_locale) .property("locale", &faction_locale)
.property("units", &faction_units, return_stl_iterator) .property("units", &faction_units, return_stl_iterator)
#ifdef ALLIANCES
.property("alliance", &faction_getalliance, &faction_setalliance) .property("alliance", &faction_getalliance, &faction_setalliance)
#endif
]; ];
} }

View File

@ -277,9 +277,7 @@ lua_init(void)
luabind::open(luaState); luabind::open(luaState);
bind_eressea(luaState); bind_eressea(luaState);
bind_spell(luaState); bind_spell(luaState);
#ifdef ALLIANCES
bind_alliance(luaState); bind_alliance(luaState);
#endif
bind_region(luaState); bind_region(luaState);
bind_item(luaState); bind_item(luaState);
bind_faction(luaState); bind_faction(luaState);

View File

@ -259,9 +259,7 @@ autoseed(struct region_list * rlist)
while (*nfp!=nf) nfp=&(*nfp)->next; while (*nfp!=nf) nfp=&(*nfp)->next;
u = addplayer(seeds[i].region, addfaction(nf->email, nf->password, nf->race, u = addplayer(seeds[i].region, addfaction(nf->email, nf->password, nf->race,
nf->lang, nf->subscription)); nf->lang, nf->subscription));
#ifdef ALLIANCES
u->faction->alliance = nf->allies; u->faction->alliance = nf->allies;
#endif
++numnewbies; ++numnewbies;
*nfp = nf->next; *nfp = nf->next;
free(nf); free(nf);
@ -360,9 +358,7 @@ mkisland(int nsize)
++isize; ++isize;
u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, nextf->lang, u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, nextf->lang,
nextf->subscription)); nextf->subscription));
#ifdef ALLIANCES
u->faction->alliance = nextf->allies; u->faction->alliance = nextf->allies;
#endif
/* remove duplicate email addresses */ /* remove duplicate email addresses */
nfp=&newfactions; nfp=&newfactions;

View File

@ -25,9 +25,7 @@ typedef struct newfaction {
int bonus; int bonus;
int subscription; int subscription;
boolean oldregions; boolean oldregions;
#ifdef ALLIANCES
struct alliance * allies; struct alliance * allies;
#endif
} newfaction; } newfaction;
extern newfaction * newfactions; extern newfaction * newfactions;

View File

@ -20,21 +20,17 @@
#include "autoseed.h" #include "autoseed.h"
/* kernel includes */ /* kernel includes */
#include <faction.h> #include <kernel/alliance.h>
#include <item.h> #include <kernel/faction.h>
#include <plane.h> #include <kernel/item.h>
#include <race.h> #include <kernel/plane.h>
#include <region.h> #include <kernel/race.h>
#include <reports.h> #include <kernel/region.h>
#include <save.h> #include <kernel/reports.h>
#include <study.h> #include <kernel/save.h>
#include <skill.h> #include <kernel/skill.h>
#include <unit.h> #include <kernel/study.h>
#include <kernel/unit.h>
/* modules */
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
/* util includes */ /* util includes */
#include <base36.h> #include <base36.h>
@ -211,9 +207,7 @@ seed_dropouts(void)
if (nf->race==drop->race && !nf->bonus) { if (nf->race==drop->race && !nf->bonus) {
unit * u = addplayer(r, addfaction(nf->email, nf->password, nf->race, nf->lang, unit * u = addplayer(r, addfaction(nf->email, nf->password, nf->race, nf->lang,
nf->subscription)); nf->subscription));
#ifdef ALLIANCES
u->faction->alliance = nf->allies; u->faction->alliance = nf->allies;
#endif
++numnewbies; ++numnewbies;
if (nf->bonus) give_latestart_bonus(r, u, nf->bonus); if (nf->bonus) give_latestart_bonus(r, u, nf->bonus);
found=true; found=true;
@ -241,14 +235,15 @@ read_newfactions(const char * filename)
char race[20], email[64], lang[8], password[16]; char race[20], email[64], lang[8], password[16];
newfaction *nf; newfaction *nf;
int bonus, subscription; int bonus, subscription;
#ifdef ALLIANCES
if (alliances!=NULL) {
int alliance; int alliance;
/* email;race;locale;startbonus;subscription;alliance */ /* email;race;locale;startbonus;subscription;alliance */
if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break; if (fscanf(F, "%s %s %s %d %d %s %d", email, race, lang, &bonus, &subscription, password, &alliance)<=0) break;
#else } else {
/* email;race;locale;startbonus;subscription */ /* email;race;locale;startbonus;subscription */
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break; if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break;
#endif }
while (f) { while (f) {
if (strcmp(f->email, email)==0 && f->subscription) { if (strcmp(f->email, email)==0 && f->subscription) {
break; break;
@ -265,8 +260,7 @@ read_newfactions(const char * filename)
nf->password = strdup(password); nf->password = strdup(password);
nf->race = rc_find(race); nf->race = rc_find(race);
nf->subscription = subscription; nf->subscription = subscription;
#ifdef ALLIANCES if (alliances!=NULL) {
{
struct alliance * al = findalliance(alliance); struct alliance * al = findalliance(alliance);
if (al==NULL) { if (al==NULL) {
char zText[64]; char zText[64];
@ -274,8 +268,9 @@ read_newfactions(const char * filename)
al = makealliance(alliance, zText); al = makealliance(alliance, zText);
} }
nf->allies = al; nf->allies = al;
} else {
nf->allies = NULL;
} }
#endif
if (nf->race==NULL) nf->race = findrace(race, default_locale); if (nf->race==NULL) nf->race = findrace(race, default_locale);
nf->lang = find_locale(lang); nf->lang = find_locale(lang);
nf->bonus = bonus; nf->bonus = bonus;
@ -301,11 +296,11 @@ select_newfaction(const struct race * rc)
while (player) { while (player) {
if (rc==NULL || player->race==rc) { if (rc==NULL || player->race==rc) {
char str[80]; char str[80];
#ifdef ALLIANCES if (alliances!=NULL) {
snprintf(str, 70, "%s %d %s %s", player->bonus?"!":" ", player->allies?player->allies->id:0, locale_string(default_locale, rc_name(player->race, 0)), player->email); snprintf(str, 70, "%s %d %s %s", player->bonus?"!":" ", player->allies?player->allies->id:0, locale_string(default_locale, rc_name(player->race, 0)), player->email);
#else } else {
snprintf(str, 70, "%s %s %s", player->bonus?"!":" ", locale_string(default_locale, rc_name(player->race, 0)), player->email); snprintf(str, 70, "%s %s %s", player->bonus?"!":" ", locale_string(default_locale, rc_name(player->race, 0)), player->email);
#endif }
insert_selection(iinsert, prev, strdup(str), (void*)player); insert_selection(iinsert, prev, strdup(str), (void*)player);
prev = *iinsert; prev = *iinsert;
iinsert = &prev->next; iinsert = &prev->next;

View File

@ -19,21 +19,19 @@
#include "mapper.h" #include "mapper.h"
/* kernel includes */ /* kernel includes */
#include <building.h> #include <kernel/alliance.h>
#include <faction.h> #include <kernel/building.h>
#include <plane.h> #include <kernel/curse.h>
#include <race.h> #include <kernel/faction.h>
#include <region.h> #include <kernel/item.h>
#include <ship.h> #include <kernel/plane.h>
#include <unit.h> #include <kernel/race.h>
#include <curse.h> #include <kernel/region.h>
#include <resources.h> #include <kernel/resources.h>
#include <item.h> #include <kernel/ship.h>
#include <kernel/unit.h>
/* modules includes */ /* modules includes */
#ifdef ALLIANCES
# include <modules/alliance.h>
#endif
/* util includes */ /* util includes */
#include <base36.h> #include <base36.h>
@ -370,15 +368,13 @@ showregion(region * r, char full)
} }
for (f = factions; f; f = f->next) for (f = factions; f; f = f->next)
if (f->no_units) { if (f->no_units) {
#ifdef ALLIANCES if (alliances==NULL) {
if(f->alliance != NULL) { sprintf(buf, " %-29.29s (%s)", f->name, factionid(f));
} else if (f->alliance != NULL) {
sprintf(buf, " %-26.26s (%s/%d)", f->name, factionid(f), f->alliance->id); sprintf(buf, " %-26.26s (%s/%d)", f->name, factionid(f), f->alliance->id);
} else { } else {
sprintf(buf, " %-26.26s (%s/-)", f->name, factionid(f)); sprintf(buf, " %-26.26s (%s/-)", f->name, factionid(f));
} }
#else
sprintf(buf, " %-29.29s (%s)", f->name, factionid(f));
#endif
adddbllist(&reglist, buf); adddbllist(&reglist, buf);
sprintf(buf, " Einheiten: %d; Leute: %d %c", sprintf(buf, " Einheiten: %d; Leute: %d %c",
f->no_units, f->num_people, Tchar[old_race(f->race)]); f->no_units, f->num_people, Tchar[old_race(f->race)]);

View File

@ -32,9 +32,6 @@
#include <modules/gmcmd.h> #include <modules/gmcmd.h>
#include <modules/xmas.h> #include <modules/xmas.h>
#ifdef ALLIANCES
#include <modules/alliance.h>
#endif
#ifdef MUSEUM_MODULE #ifdef MUSEUM_MODULE
#include <modules/museum.h> #include <modules/museum.h>
#endif #endif
@ -46,20 +43,21 @@
#endif #endif
/* kernel includes */ /* kernel includes */
#include <kernel/xmlreader.h> #include <kernel/alliance.h>
#include <kernel/building.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/plane.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/reports.h>
#include <kernel/resources.h>
#include <kernel/save.h>
#include <kernel/ship.h>
#include <kernel/spell.h> #include <kernel/spell.h>
#include <item.h> #include <kernel/teleport.h>
#include <faction.h> #include <kernel/unit.h>
#include <race.h> #include <kernel/xmlreader.h>
#include <region.h>
#include <reports.h>
#include <save.h>
#include <ship.h>
#include <unit.h>
#include <plane.h>
#include <teleport.h>
#include <resources.h>
#include <building.h>
/* util includes */ /* util includes */
#include <base36.h> #include <base36.h>
@ -189,9 +187,7 @@ init_win(int x, int y) {
/* --------------------------------------------------------------------- */ /* --------------------------------------------------------------------- */
static int hl; static int hl;
#ifdef ALLIANCES
static int hl_alliance; static int hl_alliance;
#endif
int politkarte = 0; int politkarte = 0;
@ -316,7 +312,6 @@ factionhere(region * r, int f)
return false; return false;
} }
#ifdef ALLIANCES
static boolean static boolean
alliancehere(region * r, int allied) alliancehere(region * r, int allied)
{ {
@ -326,7 +321,6 @@ alliancehere(region * r, int allied)
return true; return true;
return false; return false;
} }
#endif
#if NEW_RESOURCEGROWTH #if NEW_RESOURCEGROWTH
static boolean static boolean
@ -397,9 +391,7 @@ highlight_region(region *r)
(hl == -8 && get_curse(r->attribs, ct_find("godcursezone"))) || (hl == -8 && get_curse(r->attribs, ct_find("godcursezone"))) ||
(hl == -9 && newbie_region(r)) || (hl == -9 && newbie_region(r)) ||
(hl == -10 && dropout_region(r)) || (hl == -10 && dropout_region(r)) ||
#ifdef ALLIANCES
(hl == -11 && alliancehere(r, hl_alliance)) || (hl == -11 && alliancehere(r, hl_alliance)) ||
#endif
(hl >= 0 && factionhere(r, hl))) { (hl >= 0 && factionhere(r, hl))) {
return true; return true;
} }
@ -453,11 +445,9 @@ drawmap(boolean maponly) {
case -10: case -10:
addstr("Dropouts "); addstr("Dropouts ");
break; break;
#ifdef ALLIANCES
case -11: case -11:
printw((NCURSES_CONST char*)"Allianz %d ", hl_alliance); printw((NCURSES_CONST char*)"Allianz %d ", hl_alliance);
break; break;
#endif
default: default:
printw((NCURSES_CONST char*)"Partei %d ", hl); printw((NCURSES_CONST char*)"Partei %d ", hl);
} }
@ -773,11 +763,7 @@ SetHighlight(void)
wmove(win, 2, 2); wmove(win, 2, 2);
wAddstr(" A)nfängern, L)aen, C)haos, G)odcurse"); wAddstr(" A)nfängern, L)aen, C)haos, G)odcurse");
wmove(win, 3, 2); wmove(win, 3, 2);
#ifdef ALLIANCES
wAddstr(" D)ropouts, Allian(Z) oder N)ichts?"); wAddstr(" D)ropouts, Allian(Z) oder N)ichts?");
#else
wAddstr(" D)ropouts oder N)ichts?");
#endif
wrefresh(win); wrefresh(win);
c = tolower(getch()); c = tolower(getch());
switch (c) { switch (c) {
@ -785,12 +771,10 @@ SetHighlight(void)
fac_nr36 = my_input(win, 2, 2, "Partei-Nummer: ", NULL); fac_nr36 = my_input(win, 2, 2, "Partei-Nummer: ", NULL);
hl = atoi36(fac_nr36); hl = atoi36(fac_nr36);
break; break;
#ifdef ALLIANCES
case 'z': case 'z':
hl_alliance = map_input(win, 2, 2, "Allianz-Nummer: ", 0, 999, 0); hl_alliance = map_input(win, 2, 2, "Allianz-Nummer: ", 0, 999, 0);
hl = -11; hl = -11;
break; break;
#endif
case 'e': case 'e':
hl = -2; hl = -2;
break; break;

View File

@ -24,6 +24,9 @@
<param name="hunger.long" value="0"></param> <param name="hunger.long" value="0"></param>
<param name="study.expensivemigrants" value="1"/> <param name="study.expensivemigrants" value="1"/>
<param name="report.mailit" value="/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin"/> <param name="report.mailit" value="/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin"/>
<param name="alliance.restricted" value="fight guard stealth money"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.transferquit" value="true"/>
</game> </game>
<include file="vinyambar/de/strings.xml"></include> <include file="vinyambar/de/strings.xml"></include>
<include file="vinyambar/stronghold.xml"></include> <include file="vinyambar/stronghold.xml"></include>

View File

@ -25,7 +25,6 @@
<param name="GiveRestriction" value="0"/> <param name="GiveRestriction" value="0"/>
<param name="database.gameid" value="3"/> <param name="database.gameid" value="3"/>
<param name="hunger.long" value="0"/> <param name="hunger.long" value="0"/>
<param name="allied.skilllimit" value="15"/>
<param name="atsroi.ats" value="2"/> <param name="atsroi.ats" value="2"/>
<param name="atsroi.roi" value="4"/> <param name="atsroi.roi" value="4"/>
<param name="magic.regeneration" value="0.5"/> <param name="magic.regeneration" value="0.5"/>
@ -33,6 +32,10 @@
<param name="resource.factor" value="0.25"/> <param name="resource.factor" value="0.25"/>
<param name="study.expensivemigrants" value="1"/> <param name="study.expensivemigrants" value="1"/>
<param name="report.mailit" value="/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin"/> <param name="report.mailit" value="/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin"/>
<param name="alliance.skilllimit" value="15"/>
<param name="alliance.restricted" value="fight guard stealth money"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.transferquit" value="true"/>
</game> </game>
<xi:include href="vinyambar/wdw-strings.xml"/> <xi:include href="vinyambar/wdw-strings.xml"/>