forked from github/server
- Bugfix DEFAULT
- ALLIANCES define entfernt. Noch immer nicht gleicher Code für eressea wie wdw, wegen der Amulette
This commit is contained in:
parent
9d58776746
commit
65786fc059
|
@ -22,9 +22,6 @@
|
|||
|
||||
/* modules include */
|
||||
#include <modules/score.h>
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* attributes include */
|
||||
#include <attributes/follow.h>
|
||||
|
@ -39,6 +36,7 @@
|
|||
|
||||
/* kernel includes */
|
||||
#include <kernel/alchemy.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/border.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
|
@ -353,7 +351,6 @@ cr_race(const void * v, char * buffer, const void * userdata)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifdef ALLIANCES
|
||||
static int
|
||||
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);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
cr_skill(const void * v, char * buffer, const void * userdata)
|
||||
|
@ -416,9 +412,7 @@ creport_init(void)
|
|||
tsf_register("resource", &cr_resource);
|
||||
tsf_register("race", &cr_race);
|
||||
tsf_register("direction", &cr_int);
|
||||
#ifdef ALLIANCES
|
||||
tsf_register("alliance", &cr_alliance);
|
||||
#endif
|
||||
}
|
||||
|
||||
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\";email\n", f->email);
|
||||
fprintf(F, "\"%s\";banner\n", f->banner);
|
||||
#ifdef ALLIANCES
|
||||
if (f->alliance!=NULL && f->alliance==uf->alliance) {
|
||||
fprintf(F, "%d;alliance\n", f->alliance->id);
|
||||
fprintf(F, "\"%s\";alliancename\n", f->alliance->name);
|
||||
}
|
||||
#endif
|
||||
#ifdef SHORTPWDS
|
||||
if (f->shortpwds) {
|
||||
shortpwd * spwd = f->shortpwds;
|
||||
|
|
|
@ -2559,12 +2559,10 @@ steal_cmd(unit * u, struct order * ord, request ** stealorders)
|
|||
return;
|
||||
}
|
||||
|
||||
#ifdef ALLIANCES
|
||||
if(u->faction->alliance == u2->faction->alliance) {
|
||||
if (u->faction->alliance!=NULL && u->faction->alliance == u2->faction->alliance) {
|
||||
cmistake(u, ord, 47, MSG_INCOME);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(u->region==u2->region);
|
||||
if (!can_contact(r, u, u2)) {
|
||||
|
|
|
@ -36,30 +36,31 @@
|
|||
#include "study.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <alchemy.h>
|
||||
#include <battle.h>
|
||||
#include <border.h>
|
||||
#include <building.h>
|
||||
#include <faction.h>
|
||||
#include <group.h>
|
||||
#include <item.h>
|
||||
#include <karma.h>
|
||||
#include <magic.h>
|
||||
#include <message.h>
|
||||
#include <movement.h>
|
||||
#include <order.h>
|
||||
#include <plane.h>
|
||||
#include <pool.h>
|
||||
#include <race.h>
|
||||
#include <region.h>
|
||||
#include <resources.h>
|
||||
#include <save.h>
|
||||
#include <ship.h>
|
||||
#include <skill.h>
|
||||
#include <spy.h>
|
||||
#include <unit.h>
|
||||
#include <kernel/alchemy.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/battle.h>
|
||||
#include <kernel/border.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/group.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/karma.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/movement.h>
|
||||
#include <kernel/order.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/pool.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/resources.h>
|
||||
#include <kernel/save.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/skill.h>
|
||||
#include <kernel/spy.h>
|
||||
#include <kernel/unit.h>
|
||||
#ifdef USE_UGROUPS
|
||||
# include <ugroup.h>
|
||||
# include <kernel/ugroup.h>
|
||||
#endif
|
||||
|
||||
/* attributes includes */
|
||||
|
@ -76,9 +77,6 @@
|
|||
#include <util/message.h>
|
||||
|
||||
#include <modules/xecmd.h>
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
#ifdef AT_OPTION
|
||||
/* attributes includes */
|
||||
|
@ -1049,7 +1047,6 @@ inactivefaction(faction * f)
|
|||
fclose(inactiveFILE);
|
||||
}
|
||||
|
||||
#ifdef ENHANCED_QUIT
|
||||
static void
|
||||
transfer_faction(faction *f, faction *f2)
|
||||
{
|
||||
|
@ -1065,7 +1062,6 @@ transfer_faction(faction *f, faction *f2)
|
|||
u = un;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
restart(unit * u, struct order * ord)
|
||||
|
@ -1112,6 +1108,17 @@ restart(unit * u, struct order * ord)
|
|||
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
|
||||
quit(unit * u, struct order * ord)
|
||||
{
|
||||
|
@ -1119,35 +1126,30 @@ quit(unit * u, struct order * ord)
|
|||
skip_token(); /* skip keyword */
|
||||
|
||||
if (checkpasswd(u->faction, getstrtoken(), false)) {
|
||||
#ifdef ENHANCED_QUIT
|
||||
int f2_id = getid();
|
||||
if (EnhancedQuit()) {
|
||||
int f2_id = getid();
|
||||
|
||||
if(f2_id > 0) {
|
||||
faction *f2 = findfaction(f2_id);
|
||||
faction * f = u->faction;
|
||||
if (f2_id > 0) {
|
||||
faction *f2 = findfaction(f2_id);
|
||||
faction * f = u->faction;
|
||||
|
||||
if(f2 == NULL) {
|
||||
cmistake(u, ord, 66, MSG_EVENT);
|
||||
} else if(f == f2) {
|
||||
cmistake(u, ord, 8, MSG_EVENT);
|
||||
#ifdef ALLIANCES
|
||||
} else if(u->faction->alliance != f2->alliance) {
|
||||
cmistake(u, ord, 315, MSG_EVENT);
|
||||
#else
|
||||
#error ENHANCED_QUIT defined without ALLIANCES
|
||||
#endif
|
||||
} else if(!alliedfaction(NULL, f, f2, HELP_MONEY)) {
|
||||
cmistake(u, ord, 316, MSG_EVENT);
|
||||
if(f2 == NULL) {
|
||||
cmistake(u, ord, 66, MSG_EVENT);
|
||||
} else if(f == f2) {
|
||||
cmistake(u, ord, 8, MSG_EVENT);
|
||||
} else if (!u->faction->alliance || u->faction->alliance != f2->alliance) {
|
||||
cmistake(u, ord, 315, MSG_EVENT);
|
||||
} else if(!alliedfaction(NULL, f, f2, HELP_MONEY)) {
|
||||
cmistake(u, ord, 316, MSG_EVENT);
|
||||
} else {
|
||||
transfer_faction(f,f2);
|
||||
destroyfaction(f);
|
||||
}
|
||||
} else {
|
||||
transfer_faction(f,f2);
|
||||
destroyfaction(f);
|
||||
destroyfaction(u->faction);
|
||||
}
|
||||
} else {
|
||||
destroyfaction(u->faction);
|
||||
}
|
||||
#else
|
||||
destroyfaction(u->faction);
|
||||
#endif
|
||||
return -1;
|
||||
} else {
|
||||
cmistake(u, ord, 86, MSG_EVENT);
|
||||
|
@ -1237,7 +1239,7 @@ parse_quit(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#if defined(ALLIANCES) && !defined(ALLIANCEJOIN)
|
||||
#ifndef ALLIANCEJOIN
|
||||
if (f->alliance==NULL) {
|
||||
/* destroyfaction(f); */
|
||||
continue;
|
||||
|
@ -3539,9 +3541,12 @@ defaultorders (void)
|
|||
while (*ordp!=NULL) {
|
||||
order * ord = *ordp;
|
||||
if (get_keyword(ord)==K_DEFAULT) {
|
||||
char * cmd;
|
||||
init_tokens(ord);
|
||||
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 */
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
|
@ -3629,10 +3634,10 @@ processorders (void)
|
|||
puts(" - Defaults und Instant-Befehle...");
|
||||
setdefaults();
|
||||
instant_orders();
|
||||
#ifdef ALLIANCES
|
||||
alliancekick();
|
||||
#endif
|
||||
parse(K_MAIL, mail_cmd, false);
|
||||
|
||||
if (alliances!=NULL) alliancekick();
|
||||
|
||||
parse(K_MAIL, mail_cmd, false);
|
||||
puts(" - Altern");
|
||||
age_factions();
|
||||
|
||||
|
@ -3642,10 +3647,10 @@ processorders (void)
|
|||
puts(" - Kontaktieren, Betreten von Schiffen und Gebäuden (1.Versuch)");
|
||||
do_misc(false);
|
||||
|
||||
#ifdef ALLIANCES
|
||||
puts(" - Testen der Allianzbedingungen");
|
||||
alliancevictory();
|
||||
#endif
|
||||
if (alliances!=NULL) {
|
||||
puts(" - Testen der Allianzbedingungen");
|
||||
alliancevictory();
|
||||
}
|
||||
|
||||
puts(" - GM Kommandos");
|
||||
#ifdef INFOCMD_MODULE
|
||||
|
|
|
@ -19,9 +19,6 @@
|
|||
|
||||
/* modules includes */
|
||||
#include <modules/score.h>
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/overrideroads.h>
|
||||
|
@ -39,6 +36,7 @@
|
|||
|
||||
/* kernel includes */
|
||||
#include <kernel/alchemy.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/border.h>
|
||||
#include <kernel/build.h>
|
||||
#include <kernel/building.h>
|
||||
|
@ -1675,17 +1673,11 @@ show_allies(const faction * f, const ally * allies)
|
|||
const ally * sf;
|
||||
for (sf = allies; sf; sf = sf->next) {
|
||||
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
|
||||
#ifdef ALLIANCES
|
||||
if (f->alliance!=sf->faction->alliance) continue;
|
||||
#endif
|
||||
if (mode > 0) ++allierte;
|
||||
}
|
||||
|
||||
for (sf = allies; sf; sf = sf->next) {
|
||||
int mode = alliedgroup(NULL, f, sf->faction, sf, HELP_ALL);
|
||||
#ifdef ALLIANCES
|
||||
if (f->alliance!=sf->faction->alliance) continue;
|
||||
#endif
|
||||
if (mode <= 0) continue;
|
||||
i++;
|
||||
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],
|
||||
f->email);
|
||||
centre(F, buf, true);
|
||||
#ifdef ALLIANCES
|
||||
if (f->alliance!=NULL) {
|
||||
centre(F, alliancename(f->alliance), true);
|
||||
}
|
||||
#endif
|
||||
|
||||
buf[0] = 0;
|
||||
dh = 0;
|
||||
|
@ -3267,18 +3257,18 @@ writeturn(void)
|
|||
static void
|
||||
out_faction(FILE *file, faction *f)
|
||||
{
|
||||
#ifdef ALLIANCES
|
||||
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,
|
||||
LOC(default_locale, rc_name(f->race, 0)), neue_gebiete[f->magiegebiet],
|
||||
f->no_units, f->number, f->money, turn - f->lastorders,
|
||||
turn - f->lastorders != 1 ? "NMRs" : "NMR ");
|
||||
#else
|
||||
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n",
|
||||
factionname(f), LOC(default_locale, rc_name(f->race, 0)),
|
||||
neue_gebiete[f->magiegebiet], f->no_units, f->number, f->money,
|
||||
turn - f->lastorders, turn - f->lastorders != 1 ? "NMRs" : "NMR ");
|
||||
#endif
|
||||
if (alliances!=NULL) {
|
||||
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,
|
||||
LOC(default_locale, rc_name(f->race, 0)), neue_gebiete[f->magiegebiet],
|
||||
f->no_units, f->number, f->money, turn - f->lastorders,
|
||||
turn - f->lastorders != 1 ? "NMRs" : "NMR ");
|
||||
} else {
|
||||
fprintf(file, "%s (%.3s/%.3s), %d Einh., %d Pers., $%d, %d %s\n",
|
||||
factionname(f), LOC(default_locale, rc_name(f->race, 0)),
|
||||
neue_gebiete[f->magiegebiet], f->no_units, f->number, f->money,
|
||||
turn - f->lastorders, turn - f->lastorders != 1 ? "NMRs" : "NMR ");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3505,7 +3495,6 @@ eval_faction(struct opstack ** stack, const void * userdata) /* faction -> strin
|
|||
opush(stack, strcpy(balloc(len+1), c));
|
||||
}
|
||||
|
||||
#ifdef ALLIANCES
|
||||
static void
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
eval_region(struct opstack ** stack, const void * userdata) /* region -> string */
|
||||
|
@ -3614,9 +3602,7 @@ eval_int36(struct opstack ** stack, const void * userdata)
|
|||
void
|
||||
report_init(void)
|
||||
{
|
||||
#ifdef ALLIANCES
|
||||
add_function("alliance", &eval_alliance);
|
||||
#endif
|
||||
add_function("region", &eval_region);
|
||||
add_function("resource", &eval_resource);
|
||||
add_function("race", &eval_race);
|
||||
|
|
|
@ -55,17 +55,6 @@
|
|||
|
||||
#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
|
||||
getskill(const struct locale * lang)
|
||||
{
|
||||
|
|
|
@ -8,6 +8,7 @@ SubDirHdrs $(XMLHDRS) ;
|
|||
|
||||
SOURCES =
|
||||
alchemy.c
|
||||
alliance.c
|
||||
battle.c
|
||||
border.c
|
||||
build.c
|
||||
|
|
|
@ -11,11 +11,8 @@
|
|||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <eressea.h>
|
||||
|
||||
#ifdef ALLIANCES
|
||||
#include "eressea.h"
|
||||
#include "alliance.h"
|
||||
#include "command.h"
|
||||
|
||||
#include <attributes/key.h>
|
||||
|
||||
|
@ -29,8 +26,9 @@
|
|||
#include <kernel/item.h>
|
||||
|
||||
/* util includes */
|
||||
#include <umlaut.h>
|
||||
#include <base36.h>
|
||||
#include <util/command.h>
|
||||
#include <util/umlaut.h>
|
||||
#include <util/base36.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <assert.h>
|
||||
|
@ -329,6 +327,3 @@ victorycondition(const alliance * al, const char * name)
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,15 +11,12 @@
|
|||
* 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
|
||||
#ifndef H_KRNL_ALLIANCE
|
||||
#define H_KRNL_ALLIANCE
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifndef ALLIANCES
|
||||
#error "must define ALLIANCES to use this module"
|
||||
#endif
|
||||
struct plane;
|
||||
struct attrib;
|
||||
struct unit;
|
||||
|
|
|
@ -33,13 +33,15 @@ typedef enum combatmagic {
|
|||
#include "eressea.h"
|
||||
#include "battle.h"
|
||||
|
||||
#include "item.h"
|
||||
#include "alchemy.h"
|
||||
#include "alliance.h"
|
||||
#include "build.h"
|
||||
#include "building.h"
|
||||
#include "curse.h"
|
||||
#include "faction.h"
|
||||
#include "goodies.h"
|
||||
#include "group.h"
|
||||
#include "item.h"
|
||||
#include "karma.h"
|
||||
#include "magic.h"
|
||||
#include "message.h"
|
||||
|
@ -54,7 +56,6 @@ typedef enum combatmagic {
|
|||
#include "skill.h"
|
||||
#include "spell.h"
|
||||
#include "unit.h"
|
||||
#include "group.h"
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/key.h>
|
||||
|
@ -66,11 +67,6 @@ typedef enum combatmagic {
|
|||
/* items includes */
|
||||
#include <items/demonseye.h>
|
||||
|
||||
/* modules includes */
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* util includes */
|
||||
#include <base36.h>
|
||||
#include <cvector.h>
|
||||
|
@ -354,14 +350,6 @@ set_enemy(side * as, side * ds, boolean 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
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
allysf(const side * s, const faction * f)
|
||||
|
@ -2755,13 +2742,13 @@ print_stats(battle * b)
|
|||
buf[77] = (char)0;
|
||||
for (k = buf; *k; ++k) *k = '-';
|
||||
battlerecord(b, buf);
|
||||
if(side->bf->faction) {
|
||||
#ifdef ALLIANCES
|
||||
sprintf(buf, "##### %s (%s/%d)", side->bf->faction->name, itoa36(side->bf->faction->no),
|
||||
side->bf->faction->alliance?side->bf->faction->alliance->id:0);
|
||||
#else
|
||||
sprintf(buf, "##### %s (%s)", side->bf->faction->name, itoa36(side->bf->faction->no));
|
||||
#endif
|
||||
if (side->bf->faction) {
|
||||
if (side->bf->faction->alliance) {
|
||||
sprintf(buf, "##### %s (%s/%d)", side->bf->faction->name, itoa36(side->bf->faction->no),
|
||||
side->bf->faction->alliance?side->bf->faction->alliance->id:0);
|
||||
} else {
|
||||
sprintf(buf, "##### %s (%s)", side->bf->faction->name, itoa36(side->bf->faction->no));
|
||||
}
|
||||
battledebug(buf);
|
||||
}
|
||||
print_fighters(b, &side->fighters);
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
|
||||
/* modules includes */
|
||||
#include <modules/xecmd.h>
|
||||
#ifdef ALLIANCES
|
||||
# include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/reduceproduction.h>
|
||||
|
@ -34,6 +31,7 @@
|
|||
#include <attributes/gm.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include "alliance.h"
|
||||
#include "alchemy.h"
|
||||
#include "battle.h"
|
||||
#include "border.h"
|
||||
|
@ -118,6 +116,69 @@ MaxAge(void) {
|
|||
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
|
||||
FirstTurn(void)
|
||||
{
|
||||
|
@ -378,8 +439,7 @@ const char *options[MAXOPTIONS] =
|
|||
"SHOWSKCHANGE"
|
||||
};
|
||||
|
||||
#ifdef ALLIANCE_LIMITS
|
||||
int
|
||||
static int
|
||||
allied_skillcount(const faction * f, skill_t sk)
|
||||
{
|
||||
int num = 0;
|
||||
|
@ -392,29 +452,33 @@ allied_skillcount(const faction * f, skill_t sk)
|
|||
return num;
|
||||
}
|
||||
|
||||
int
|
||||
static int
|
||||
allied_skilllimit(const faction * f, skill_t sk)
|
||||
{
|
||||
const char * str = get_param(global.parameters, "allied.skilllimit");
|
||||
return str?atoi(str):0;
|
||||
static int value = -1;
|
||||
if (value<0) {
|
||||
const char * str = get_param(global.parameters, "alliance.skilllimit");
|
||||
value = str?atoi(str):0;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
#endif
|
||||
|
||||
int
|
||||
max_skill(faction * f, skill_t sk)
|
||||
{
|
||||
int m = INT_MAX;
|
||||
#ifdef ALLIANCE_LIMITS
|
||||
if (sk!=SK_ALCHEMY && sk!=SK_MAGIC) return INT_MAX;
|
||||
if (f->alliance!=NULL) {
|
||||
int ac = listlen(f->alliance->members); /* number of factions */
|
||||
int al = allied_skilllimit(f, sk); /* limit per alliance */
|
||||
int fl = (al+ac-1)/ac; /* faction limit */
|
||||
int sc = al - allied_skillcount(f, sk);
|
||||
if (sc==0) return count_skill(f, sk);
|
||||
return fl;
|
||||
|
||||
if (allied_skilllimit(f, sk)) {
|
||||
if (sk!=SK_ALCHEMY && sk!=SK_MAGIC) return INT_MAX;
|
||||
if (f->alliance!=NULL) {
|
||||
int ac = listlen(f->alliance->members); /* number of factions */
|
||||
int al = allied_skilllimit(f, sk); /* limit per alliance */
|
||||
int fl = (al+ac-1)/ac; /* faction limit */
|
||||
int sc = al - allied_skillcount(f, sk);
|
||||
if (sc==0) return count_skill(f, sk);
|
||||
return fl;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
switch (sk) {
|
||||
case SK_MAGIC:
|
||||
m = MAXMAGICIANS;
|
||||
|
@ -855,9 +919,10 @@ autoalliance(const plane * pl, const faction * sf, const faction * f2)
|
|||
a=a->next;
|
||||
}
|
||||
}
|
||||
#ifdef AUTOALLIANCE
|
||||
if (sf->alliance==f2->alliance) return AUTOALLIANCE;
|
||||
#endif
|
||||
|
||||
if (sf->alliance && AllianceAuto()) {
|
||||
if (sf->alliance==f2->alliance) return AllianceAuto();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -878,15 +943,9 @@ alliedgroup(const struct plane * pl, const struct faction * f,
|
|||
mode = mode & autoalliance(pl, f, f2);
|
||||
}
|
||||
mode = ally_mode(sf, mode) | (mode & autoalliance(pl, f, f2));
|
||||
#ifdef ALLIANCES
|
||||
if (f->alliance!=f2->alliance) {
|
||||
# ifdef ALLIES_ONLY
|
||||
mode &= ~ALLIES_ONLY;
|
||||
# else
|
||||
mode = 0;
|
||||
# endif
|
||||
if (AllianceRestricted() && f->alliance!=f2->alliance) {
|
||||
mode &= ~AllianceRestricted();
|
||||
}
|
||||
#endif
|
||||
return mode;
|
||||
}
|
||||
|
||||
|
|
|
@ -88,11 +88,7 @@ struct building_type;
|
|||
#include <util/vset.h>
|
||||
|
||||
#define AT_PERSISTENT
|
||||
#ifdef ALLIANCES
|
||||
# define ALLIED(f1, f2) (f1->alliance && f1->alliance==f2->alliance)
|
||||
#else
|
||||
# define ALLIED(f1, f2) (f1==f2)
|
||||
#endif
|
||||
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
|
||||
|
||||
/* eressea-defined attribute-type flags */
|
||||
#define ATF_CURSE ATF_USER_DEFINED
|
||||
|
@ -167,16 +163,16 @@ struct building_type;
|
|||
#define DBLINK_VERSION 314
|
||||
#define CURSEVIGOURISFLOAT_VERSION 315
|
||||
#define SAVEXMLNAME_VERSION 316
|
||||
|
||||
#define REGIONOWNERS_VERSION 317
|
||||
#define SAVEALLIANCE_VERSION 317
|
||||
|
||||
#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
|
||||
# define RELEASE_VERSION REGIONOWNERS_VERSION
|
||||
#else
|
||||
# define RELEASE_VERSION SAVEXMLNAME_VERSION
|
||||
# define RELEASE_VERSION SAVEALLIANCE_VERSION
|
||||
#endif
|
||||
|
||||
#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 const char* get_param(const struct param * p, const char * name);
|
||||
|
||||
extern boolean ExpensiveMigrants(void);
|
||||
extern int FirstTurn(void);
|
||||
extern int NMRTimeout(void);
|
||||
extern int LongHunger(void);
|
||||
extern boolean TradeDisabled(void);
|
||||
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 int entertainmoney(const struct region * r);
|
||||
|
||||
|
|
|
@ -82,9 +82,7 @@ typedef struct faction {
|
|||
int number; /* enno: unterschied zu num_people ? */
|
||||
int money;
|
||||
int score;
|
||||
#ifdef ALLIANCES
|
||||
struct alliance * alliance;
|
||||
#endif
|
||||
#ifdef VICTORY_DELAY
|
||||
unsigned char victory_delay;
|
||||
#endif
|
||||
|
|
|
@ -297,6 +297,12 @@
|
|||
<File
|
||||
RelativePath=".\alchemy.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\alliance.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\alliance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\battle.c">
|
||||
</File>
|
||||
|
|
|
@ -887,8 +887,8 @@ get_addresses(faction * f)
|
|||
u = u->next;
|
||||
}
|
||||
}
|
||||
#ifdef ALLIANCES
|
||||
if(f->alliance != NULL) {
|
||||
|
||||
if (f->alliance != NULL) {
|
||||
faction *f2;
|
||||
for(f2 = factions; f2; f2 = f2->next) {
|
||||
if(f2->alliance != NULL && f2->alliance == f->alliance) {
|
||||
|
@ -905,7 +905,6 @@ get_addresses(faction * f)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return flist;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include "eressea.h"
|
||||
#include "save.h"
|
||||
|
||||
#include "alliance.h"
|
||||
#include "alchemy.h"
|
||||
#include "attrib.h"
|
||||
#include "border.h"
|
||||
|
@ -50,11 +51,6 @@
|
|||
#include <attributes/ugroup.h>
|
||||
#endif
|
||||
|
||||
/* modules include */
|
||||
#ifdef ALLIANCES
|
||||
# include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/key.h>
|
||||
|
||||
|
@ -792,19 +788,22 @@ read_ugroups(FILE *file)
|
|||
}
|
||||
#endif
|
||||
|
||||
#ifdef ALLIANCES
|
||||
void
|
||||
static void
|
||||
read_alliances(FILE * F)
|
||||
{
|
||||
char pbuf[32];
|
||||
rs(F, pbuf);
|
||||
char pbuf[32];
|
||||
|
||||
if (global.data_version<SAVEALLIANCE_VERSION) {
|
||||
if (!AllianceRestricted() && !AllianceAuto()) return;
|
||||
}
|
||||
|
||||
rs(F, pbuf);
|
||||
while (strcmp(pbuf, "end")!=0) {
|
||||
rs(F, buf);
|
||||
makealliance(atoi36(pbuf), buf);
|
||||
rs(F, pbuf);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#define wc(F, c) putc(c, F);
|
||||
#define wnl(F) putc('\n', F);
|
||||
|
@ -839,7 +838,6 @@ wi36(FILE * F, int n)
|
|||
fprintf(F, "%s ", itoa36(n));
|
||||
}
|
||||
|
||||
#ifdef ALLIANCES
|
||||
void
|
||||
write_alliances(FILE * F)
|
||||
{
|
||||
|
@ -853,7 +851,6 @@ write_alliances(FILE * F)
|
|||
fprintf(F, "end ");
|
||||
wnl(F);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
write_items(FILE *F, item *ilist)
|
||||
|
@ -1472,13 +1469,10 @@ addally(const faction * f, ally ** sfp, int aid, int state)
|
|||
#ifndef REGIONOWNERS
|
||||
state &= ~HELP_TRAVEL;
|
||||
#endif
|
||||
#ifdef ALLIANCES
|
||||
# ifdef ALLIES_ONLY
|
||||
if (af!=NULL && af->alliance!=f->alliance) state &= ~ALLIES_ONLY;;
|
||||
# else
|
||||
# endif
|
||||
if (af!=NULL && af->alliance!=f->alliance) return sfp;
|
||||
#endif
|
||||
|
||||
if (af==NULL) return sfp;
|
||||
if (f->alliance==NULL || f->alliance!=af->alliance) state &= ~AllianceRestricted();
|
||||
if (f->alliance==NULL || f->alliance==af->alliance) state |= AllianceAuto();
|
||||
if (state==0) return sfp;
|
||||
|
||||
sf = calloc(1, sizeof(ally));
|
||||
|
@ -1513,8 +1507,8 @@ readfaction(FILE * F)
|
|||
while (f->attribs) a_remove(&f->attribs, f->attribs);
|
||||
}
|
||||
f->subscription = ri(F);
|
||||
#ifdef ALLIANCES
|
||||
if (global.data_version>=ALLIANCES_VERSION) {
|
||||
|
||||
if (alliances!=NULL) {
|
||||
int allianceid = rid(F);
|
||||
if (allianceid!=0) f->alliance = findalliance(allianceid);
|
||||
if (f->alliance) {
|
||||
|
@ -1524,7 +1518,6 @@ readfaction(FILE * F)
|
|||
f->alliance->members = flist;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
rds(F, &f->name);
|
||||
|
||||
|
@ -1641,10 +1634,10 @@ writefaction(FILE * F, const faction * f)
|
|||
|
||||
wi36(F, f->no);
|
||||
wi(F, f->subscription);
|
||||
#if defined(ALLIANCES) && RELEASE_VERSION>=ALLIANCES_VERSION
|
||||
if (f->alliance) wi36(F, f->alliance->id);
|
||||
else wi36(F, 0);
|
||||
#endif
|
||||
if (alliances!=NULL) {
|
||||
if (f->alliance) wi36(F, f->alliance->id);
|
||||
else wi36(F, 0);
|
||||
}
|
||||
|
||||
ws(F, f->name);
|
||||
ws(F, f->banner);
|
||||
|
@ -1782,11 +1775,9 @@ readgame(const char * filename, int backup)
|
|||
}
|
||||
|
||||
/* Read factions */
|
||||
#ifdef ALLIANCES
|
||||
if (global.data_version>=ALLIANCES_VERSION) {
|
||||
read_alliances(F);
|
||||
}
|
||||
#endif
|
||||
n = ri(F);
|
||||
printf(" - Einzulesende Parteien: %d\n", n);
|
||||
fp = &factions;
|
||||
|
@ -2076,10 +2067,10 @@ writegame(const char *filename, char quiet)
|
|||
|
||||
|
||||
/* Write factions */
|
||||
#if defined(ALLIANCES) && RELEASE_VERSION>=ALLIANCES_VERSION
|
||||
#if RELEASE_VERSION>=ALLIANCES_VERSION
|
||||
write_alliances(F);
|
||||
#endif
|
||||
n=listlen(factions);
|
||||
n = listlen(factions);
|
||||
wi(F, n);
|
||||
wnl(F);
|
||||
|
||||
|
|
|
@ -15,6 +15,5 @@
|
|||
void teaching(void);
|
||||
void learn(void);
|
||||
|
||||
magic_t getmagicskill(void);
|
||||
extern magic_t getmagicskill(void);
|
||||
extern boolean is_migrant(struct unit *u);
|
||||
|
||||
|
|
|
@ -943,7 +943,7 @@ item_modification(const unit *u, skill_t sk, int val)
|
|||
val = val * 2;
|
||||
} else if(sk == SK_STEALTH) {
|
||||
#if NEWATSROI == 1
|
||||
if(get_item(u, I_RING_OF_INVISIBILITY)
|
||||
if (get_item(u, I_RING_OF_INVISIBILITY)
|
||||
+ 100 * get_item(u, I_SPHERE_OF_INVISIBILITY) >= u->number) {
|
||||
val += ROIBONUS;
|
||||
}
|
||||
|
|
|
@ -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 = ®ions;
|
||||
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
|
|
@ -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
|
|
@ -120,9 +120,6 @@
|
|||
<Filter
|
||||
Name="Header"
|
||||
Filter="*.h">
|
||||
<File
|
||||
RelativePath=".\alliance.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\arena.h">
|
||||
</File>
|
||||
|
@ -154,9 +151,6 @@
|
|||
RelativePath=".\xmas.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath=".\alliance.c">
|
||||
</File>
|
||||
<File
|
||||
RelativePath=".\arena.c">
|
||||
</File>
|
||||
|
|
|
@ -22,11 +22,8 @@
|
|||
#include <config.h>
|
||||
#include "eressea.h"
|
||||
|
||||
#ifdef ALLIANCES
|
||||
#include "alliance.h"
|
||||
#endif
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
|
@ -255,8 +252,7 @@ score(void)
|
|||
}
|
||||
fclose(scoreFP);
|
||||
|
||||
#ifdef ALLIANCES
|
||||
{
|
||||
if (alliances!=NULL) {
|
||||
alliance *a;
|
||||
const item_type * token = it_find("conquesttoken");
|
||||
|
||||
|
@ -292,7 +288,6 @@ score(void)
|
|||
}
|
||||
fclose(scoreFP);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -30,16 +30,13 @@
|
|||
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
|
||||
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
|
||||
#define CHANGED_CROSSBOWS 1
|
||||
#define NEWATSROI 0
|
||||
#define COMBAT_TURNS 5
|
||||
#define PEASANTS_DO_NOT_STARVE 0
|
||||
#define NEW_MIGRATION 1
|
||||
#define ASTRAL_HUNGER
|
||||
#undef SHORTPWDS
|
||||
|
||||
#define ZEROFOKS_QUESTMASTER "eressea@zerofoks.net"
|
||||
#define NEWATSROI 0
|
||||
|
||||
#undef DUNGEON_MODULE
|
||||
#define MUSEUM_MODULE
|
||||
#define ARENA_MODULE
|
||||
#define WORMHOLE_MODULE
|
||||
|
|
|
@ -40,9 +40,4 @@
|
|||
#define ROIBONUS 4
|
||||
#endif
|
||||
|
||||
#define ENHANCED_QUIT
|
||||
#define ALLIANCES
|
||||
#undef ALLIANCEJOIN
|
||||
#define AUTOALLIANCE (HELP_FIGHT)
|
||||
|
||||
#define MAILITPATH "/usr/sbin:$HOME/bin:/bin:/usr/bin:/usr/local/bin"
|
||||
|
|
|
@ -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.
|
||||
*/
|
||||
#define ENTERTAINFRACTION 20
|
||||
|
@ -30,24 +30,24 @@
|
|||
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
|
||||
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
|
||||
#define CHANGED_CROSSBOWS 1
|
||||
#define NEWATSROI 1
|
||||
#define COMBAT_TURNS 5
|
||||
#define PEASANTS_DO_NOT_STARVE 0
|
||||
#define NEW_MIGRATION 1
|
||||
#define ASTRAL_HUNGER
|
||||
|
||||
#define NEWATSROI 1
|
||||
#if NEWATSROI == 1
|
||||
#define ATSBONUS 2
|
||||
#define ROIBONUS 4
|
||||
#endif
|
||||
|
||||
#define ENHANCED_QUIT
|
||||
#define ALLIANCES
|
||||
#define ALLIES_ONLY (HELP_FIGHT|HELP_GUARD|HELP_FSTEALTH|HELP_MONEY)
|
||||
#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_PYRAMIDSPELL
|
||||
#define NEW_STARTEQUIPMENT
|
||||
|
|
|
@ -26,37 +26,35 @@
|
|||
#include <items/questkeys.h>
|
||||
#include <items/catapultammo.h>
|
||||
#include <modules/xecmd.h>
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* gamecode includes */
|
||||
#include <economy.h>
|
||||
#include <gamecode/economy.h>
|
||||
#include <gamecode/monster.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <border.h>
|
||||
#include <building.h>
|
||||
#include <ship.h>
|
||||
#include <faction.h>
|
||||
#include <item.h>
|
||||
#include <magic.h>
|
||||
#include <message.h>
|
||||
#include <monster.h>
|
||||
#include <movement.h>
|
||||
#include <names.h>
|
||||
#include <pathfinder.h>
|
||||
#include <plane.h>
|
||||
#include <pool.h>
|
||||
#include <race.h>
|
||||
#include <region.h>
|
||||
#include <reports.h>
|
||||
#include <resources.h>
|
||||
#include <skill.h>
|
||||
#include <teleport.h>
|
||||
#include <unit.h>
|
||||
#include <spell.h>
|
||||
#include <alchemy.h>
|
||||
#include <study.h>
|
||||
#include <kernel/alchemy.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/border.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/magic.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/movement.h>
|
||||
#include <kernel/names.h>
|
||||
#include <kernel/pathfinder.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/pool.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/reports.h>
|
||||
#include <kernel/resources.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/skill.h>
|
||||
#include <kernel/spell.h>
|
||||
#include <kernel/study.h>
|
||||
#include <kernel/teleport.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <attrib.h>
|
||||
|
@ -224,29 +222,29 @@ kor_teure_talente(unit *u)
|
|||
static void
|
||||
no_teurefremde(boolean convert)
|
||||
{
|
||||
region *r;
|
||||
unit *u;
|
||||
region *r;
|
||||
|
||||
for(r=regions;r;r=r->next) {
|
||||
for(u=r->units;u;u=u->next) {
|
||||
if (u->faction->no != MONSTER_FACTION
|
||||
&& playerrace(u->faction->race)
|
||||
&& is_migrant(u)
|
||||
&& kor_teure_talente(u))
|
||||
{
|
||||
log_printf("* Warnung, teurer Migrant: %s %s\n",
|
||||
unitname(u), factionname(u->faction));
|
||||
if(convert) {
|
||||
u->race = u->faction->race;
|
||||
u->irace = u->faction->race;
|
||||
u->faction->num_migrants -= u->number;
|
||||
sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse",
|
||||
unitname(u));
|
||||
addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for(r=regions;r;r=r->next) {
|
||||
unit *u;
|
||||
|
||||
for(u=r->units;u;u=u->next) {
|
||||
if (u->faction->no != MONSTER_FACTION
|
||||
&& playerrace(u->faction->race)
|
||||
&& is_migrant(u) && kor_teure_talente(u))
|
||||
{
|
||||
log_warning(("Teurer Migrant: %s, Partei %s\n",
|
||||
unitname(u), factionname(u->faction)));
|
||||
if (convert) {
|
||||
u->race = u->faction->race;
|
||||
u->irace = u->faction->race;
|
||||
u->faction->num_migrants -= u->number;
|
||||
sprintf(buf, "Die Götter segnen %s mit der richtigen Rasse",
|
||||
unitname(u));
|
||||
addmessage(0, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
attrib_type at_roadfix = {
|
||||
|
@ -1166,12 +1164,10 @@ korrektur(void)
|
|||
update_gms();
|
||||
verify_owners(false);
|
||||
/* fix_herbtypes(); */
|
||||
/* In Vin3 können Parteien komplett übergeben werden. */
|
||||
#ifdef ENHANCED_QUIT
|
||||
no_teurefremde(0);
|
||||
#else
|
||||
no_teurefremde(1);
|
||||
#endif
|
||||
/* In Vin 3+ können Parteien komplett übergeben werden. */
|
||||
if (!ExpensiveMigrants()) {
|
||||
no_teurefremde(true);
|
||||
}
|
||||
fix_allies();
|
||||
update_gmquests(); /* test gm quests */
|
||||
/* fix_unitrefs(); */
|
||||
|
@ -1179,9 +1175,6 @@ korrektur(void)
|
|||
warn_password();
|
||||
fix_road_borders();
|
||||
if (turn>1000) curse_emptiness(); /*** disabled ***/
|
||||
#ifdef ALLIANCES
|
||||
/* init_alliances(); */
|
||||
#endif
|
||||
/* seems something fishy is going on, do this just
|
||||
* to be on the safe side:
|
||||
*/
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
#include <config.h>
|
||||
#include <eressea.h>
|
||||
|
||||
#ifdef ALLIANCES
|
||||
#include "list.h"
|
||||
|
||||
// kernel includes
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <modules/alliance.h>
|
||||
#include <kernel/alliance.h>
|
||||
|
||||
// lua includes
|
||||
#include <lua.hpp>
|
||||
|
@ -53,4 +52,3 @@ bind_alliance(lua_State * L)
|
|||
.property("factions", &alliance_factions, return_stl_iterator)
|
||||
];
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -3,9 +3,6 @@
|
|||
|
||||
#include "script.h"
|
||||
|
||||
#ifdef ALLIANCES
|
||||
# include <modules/alliance.h>
|
||||
#endif
|
||||
#include <attributes/key.h>
|
||||
|
||||
// gamecode includes
|
||||
|
@ -13,6 +10,7 @@
|
|||
#include <gamecode/monster.h>
|
||||
|
||||
// kernel includes
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/plane.h>
|
||||
|
|
|
@ -3,11 +3,9 @@
|
|||
#include "list.h"
|
||||
|
||||
// kernel includes
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/unit.h>
|
||||
#ifdef ALLIANCES
|
||||
# include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
// util includes
|
||||
#include <util/base36.h>
|
||||
|
@ -49,7 +47,6 @@ faction_units(const faction& f)
|
|||
return eressea::list<unit *, unit *, factionunit>(f.units);
|
||||
}
|
||||
|
||||
#ifdef ALLIANCES
|
||||
static void
|
||||
faction_setalliance(faction& f, alliance * team)
|
||||
{
|
||||
|
@ -61,7 +58,6 @@ faction_getalliance(const faction& f)
|
|||
{
|
||||
return f.alliance;
|
||||
}
|
||||
#endif
|
||||
|
||||
const char *
|
||||
faction_locale(const faction& f)
|
||||
|
@ -146,8 +142,6 @@ bind_faction(lua_State * L)
|
|||
.def_readwrite("lastturn", &faction::lastorders)
|
||||
.property("locale", &faction_locale)
|
||||
.property("units", &faction_units, return_stl_iterator)
|
||||
#ifdef ALLIANCES
|
||||
.property("alliance", &faction_getalliance, &faction_setalliance)
|
||||
#endif
|
||||
];
|
||||
}
|
||||
|
|
|
@ -277,9 +277,7 @@ lua_init(void)
|
|||
luabind::open(luaState);
|
||||
bind_eressea(luaState);
|
||||
bind_spell(luaState);
|
||||
#ifdef ALLIANCES
|
||||
bind_alliance(luaState);
|
||||
#endif
|
||||
bind_region(luaState);
|
||||
bind_item(luaState);
|
||||
bind_faction(luaState);
|
||||
|
|
|
@ -259,9 +259,7 @@ autoseed(struct region_list * rlist)
|
|||
while (*nfp!=nf) nfp=&(*nfp)->next;
|
||||
u = addplayer(seeds[i].region, addfaction(nf->email, nf->password, nf->race,
|
||||
nf->lang, nf->subscription));
|
||||
#ifdef ALLIANCES
|
||||
u->faction->alliance = nf->allies;
|
||||
#endif
|
||||
++numnewbies;
|
||||
*nfp = nf->next;
|
||||
free(nf);
|
||||
|
@ -360,9 +358,7 @@ mkisland(int nsize)
|
|||
++isize;
|
||||
u = addplayer(r, addfaction(nextf->email, nextf->password, nextf->race, nextf->lang,
|
||||
nextf->subscription));
|
||||
#ifdef ALLIANCES
|
||||
u->faction->alliance = nextf->allies;
|
||||
#endif
|
||||
|
||||
/* remove duplicate email addresses */
|
||||
nfp=&newfactions;
|
||||
|
|
|
@ -25,9 +25,7 @@ typedef struct newfaction {
|
|||
int bonus;
|
||||
int subscription;
|
||||
boolean oldregions;
|
||||
#ifdef ALLIANCES
|
||||
struct alliance * allies;
|
||||
#endif
|
||||
} newfaction;
|
||||
|
||||
extern newfaction * newfactions;
|
||||
|
|
|
@ -20,21 +20,17 @@
|
|||
#include "autoseed.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <faction.h>
|
||||
#include <item.h>
|
||||
#include <plane.h>
|
||||
#include <race.h>
|
||||
#include <region.h>
|
||||
#include <reports.h>
|
||||
#include <save.h>
|
||||
#include <study.h>
|
||||
#include <skill.h>
|
||||
#include <unit.h>
|
||||
|
||||
/* modules */
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
#include <kernel/alliance.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/save.h>
|
||||
#include <kernel/skill.h>
|
||||
#include <kernel/study.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <base36.h>
|
||||
|
@ -211,9 +207,7 @@ seed_dropouts(void)
|
|||
if (nf->race==drop->race && !nf->bonus) {
|
||||
unit * u = addplayer(r, addfaction(nf->email, nf->password, nf->race, nf->lang,
|
||||
nf->subscription));
|
||||
#ifdef ALLIANCES
|
||||
u->faction->alliance = nf->allies;
|
||||
#endif
|
||||
++numnewbies;
|
||||
if (nf->bonus) give_latestart_bonus(r, u, nf->bonus);
|
||||
found=true;
|
||||
|
@ -241,14 +235,15 @@ read_newfactions(const char * filename)
|
|||
char race[20], email[64], lang[8], password[16];
|
||||
newfaction *nf;
|
||||
int bonus, subscription;
|
||||
#ifdef ALLIANCES
|
||||
int 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;
|
||||
#else
|
||||
/* email;race;locale;startbonus;subscription */
|
||||
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break;
|
||||
#endif
|
||||
|
||||
if (alliances!=NULL) {
|
||||
int 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;
|
||||
} else {
|
||||
/* email;race;locale;startbonus;subscription */
|
||||
if (fscanf(F, "%s %s %s %d %d %s", email, race, lang, &bonus, &subscription, password)<=0) break;
|
||||
}
|
||||
while (f) {
|
||||
if (strcmp(f->email, email)==0 && f->subscription) {
|
||||
break;
|
||||
|
@ -265,8 +260,7 @@ read_newfactions(const char * filename)
|
|||
nf->password = strdup(password);
|
||||
nf->race = rc_find(race);
|
||||
nf->subscription = subscription;
|
||||
#ifdef ALLIANCES
|
||||
{
|
||||
if (alliances!=NULL) {
|
||||
struct alliance * al = findalliance(alliance);
|
||||
if (al==NULL) {
|
||||
char zText[64];
|
||||
|
@ -274,8 +268,9 @@ read_newfactions(const char * filename)
|
|||
al = makealliance(alliance, zText);
|
||||
}
|
||||
nf->allies = al;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
nf->allies = NULL;
|
||||
}
|
||||
if (nf->race==NULL) nf->race = findrace(race, default_locale);
|
||||
nf->lang = find_locale(lang);
|
||||
nf->bonus = bonus;
|
||||
|
@ -301,11 +296,11 @@ select_newfaction(const struct race * rc)
|
|||
while (player) {
|
||||
if (rc==NULL || player->race==rc) {
|
||||
char str[80];
|
||||
#ifdef ALLIANCES
|
||||
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
|
||||
snprintf(str, 70, "%s %s %s", player->bonus?"!":" ", locale_string(default_locale, rc_name(player->race, 0)), player->email);
|
||||
#endif
|
||||
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);
|
||||
} else {
|
||||
snprintf(str, 70, "%s %s %s", player->bonus?"!":" ", locale_string(default_locale, rc_name(player->race, 0)), player->email);
|
||||
}
|
||||
insert_selection(iinsert, prev, strdup(str), (void*)player);
|
||||
prev = *iinsert;
|
||||
iinsert = &prev->next;
|
||||
|
|
|
@ -19,21 +19,19 @@
|
|||
#include "mapper.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <building.h>
|
||||
#include <faction.h>
|
||||
#include <plane.h>
|
||||
#include <race.h>
|
||||
#include <region.h>
|
||||
#include <ship.h>
|
||||
#include <unit.h>
|
||||
#include <curse.h>
|
||||
#include <resources.h>
|
||||
#include <item.h>
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/resources.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* modules includes */
|
||||
#ifdef ALLIANCES
|
||||
# include <modules/alliance.h>
|
||||
#endif
|
||||
|
||||
/* util includes */
|
||||
#include <base36.h>
|
||||
|
@ -370,15 +368,13 @@ showregion(region * r, char full)
|
|||
}
|
||||
for (f = factions; f; f = f->next)
|
||||
if (f->no_units) {
|
||||
#ifdef ALLIANCES
|
||||
if(f->alliance != NULL) {
|
||||
sprintf(buf, " %-26.26s (%s/%d)", f->name, factionid(f), f->alliance->id);
|
||||
} else {
|
||||
sprintf(buf, " %-26.26s (%s/-)", f->name, factionid(f));
|
||||
}
|
||||
#else
|
||||
sprintf(buf, " %-29.29s (%s)", f->name, factionid(f));
|
||||
#endif
|
||||
if (alliances==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);
|
||||
} else {
|
||||
sprintf(buf, " %-26.26s (%s/-)", f->name, factionid(f));
|
||||
}
|
||||
adddbllist(®list, buf);
|
||||
sprintf(buf, " Einheiten: %d; Leute: %d %c",
|
||||
f->no_units, f->num_people, Tchar[old_race(f->race)]);
|
||||
|
|
|
@ -32,9 +32,6 @@
|
|||
|
||||
#include <modules/gmcmd.h>
|
||||
#include <modules/xmas.h>
|
||||
#ifdef ALLIANCES
|
||||
#include <modules/alliance.h>
|
||||
#endif
|
||||
#ifdef MUSEUM_MODULE
|
||||
#include <modules/museum.h>
|
||||
#endif
|
||||
|
@ -46,20 +43,21 @@
|
|||
#endif
|
||||
|
||||
/* 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 <item.h>
|
||||
#include <faction.h>
|
||||
#include <race.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>
|
||||
#include <kernel/teleport.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/xmlreader.h>
|
||||
|
||||
/* util includes */
|
||||
#include <base36.h>
|
||||
|
@ -189,9 +187,7 @@ init_win(int x, int y) {
|
|||
/* --------------------------------------------------------------------- */
|
||||
|
||||
static int hl;
|
||||
#ifdef ALLIANCES
|
||||
static int hl_alliance;
|
||||
#endif
|
||||
|
||||
int politkarte = 0;
|
||||
|
||||
|
@ -316,7 +312,6 @@ factionhere(region * r, int f)
|
|||
return false;
|
||||
}
|
||||
|
||||
#ifdef ALLIANCES
|
||||
static boolean
|
||||
alliancehere(region * r, int allied)
|
||||
{
|
||||
|
@ -326,7 +321,6 @@ alliancehere(region * r, int allied)
|
|||
return true;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NEW_RESOURCEGROWTH
|
||||
static boolean
|
||||
|
@ -397,9 +391,7 @@ highlight_region(region *r)
|
|||
(hl == -8 && get_curse(r->attribs, ct_find("godcursezone"))) ||
|
||||
(hl == -9 && newbie_region(r)) ||
|
||||
(hl == -10 && dropout_region(r)) ||
|
||||
#ifdef ALLIANCES
|
||||
(hl == -11 && alliancehere(r, hl_alliance)) ||
|
||||
#endif
|
||||
(hl >= 0 && factionhere(r, hl))) {
|
||||
return true;
|
||||
}
|
||||
|
@ -453,11 +445,9 @@ drawmap(boolean maponly) {
|
|||
case -10:
|
||||
addstr("Dropouts ");
|
||||
break;
|
||||
#ifdef ALLIANCES
|
||||
case -11:
|
||||
printw((NCURSES_CONST char*)"Allianz %d ", hl_alliance);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
printw((NCURSES_CONST char*)"Partei %d ", hl);
|
||||
}
|
||||
|
@ -773,11 +763,7 @@ SetHighlight(void)
|
|||
wmove(win, 2, 2);
|
||||
wAddstr(" A)nfängern, L)aen, C)haos, G)odcurse");
|
||||
wmove(win, 3, 2);
|
||||
#ifdef ALLIANCES
|
||||
wAddstr(" D)ropouts, Allian(Z) oder N)ichts?");
|
||||
#else
|
||||
wAddstr(" D)ropouts oder N)ichts?");
|
||||
#endif
|
||||
wrefresh(win);
|
||||
c = tolower(getch());
|
||||
switch (c) {
|
||||
|
@ -785,12 +771,10 @@ SetHighlight(void)
|
|||
fac_nr36 = my_input(win, 2, 2, "Partei-Nummer: ", NULL);
|
||||
hl = atoi36(fac_nr36);
|
||||
break;
|
||||
#ifdef ALLIANCES
|
||||
case 'z':
|
||||
hl_alliance = map_input(win, 2, 2, "Allianz-Nummer: ", 0, 999, 0);
|
||||
hl = -11;
|
||||
break;
|
||||
#endif
|
||||
case 'e':
|
||||
hl = -2;
|
||||
break;
|
||||
|
|
|
@ -24,6 +24,9 @@
|
|||
<param name="hunger.long" value="0"></param>
|
||||
<param name="study.expensivemigrants" value="1"/>
|
||||
<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>
|
||||
<include file="vinyambar/de/strings.xml"></include>
|
||||
<include file="vinyambar/stronghold.xml"></include>
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
<param name="GiveRestriction" value="0"/>
|
||||
<param name="database.gameid" value="3"/>
|
||||
<param name="hunger.long" value="0"/>
|
||||
<param name="allied.skilllimit" value="15"/>
|
||||
<param name="atsroi.ats" value="2"/>
|
||||
<param name="atsroi.roi" value="4"/>
|
||||
<param name="magic.regeneration" value="0.5"/>
|
||||
|
@ -33,6 +32,10 @@
|
|||
<param name="resource.factor" value="0.25"/>
|
||||
<param name="study.expensivemigrants" value="1"/>
|
||||
<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>
|
||||
|
||||
<xi:include href="vinyambar/wdw-strings.xml"/>
|
||||
|
|
Loading…
Reference in New Issue