2001-01-25 10:37:55 +01:00
|
|
|
/* vi: set ts=2:
|
|
|
|
*
|
2003-07-29 11:48:03 +02:00
|
|
|
* Eressea PB(E)M host Copyright (C) 1998-2003
|
2001-01-25 10:37:55 +01:00
|
|
|
* 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.
|
|
|
|
*/
|
2003-07-29 11:48:03 +02:00
|
|
|
#ifndef H_KRNL_FACTION
|
|
|
|
#define H_KRNL_FACTION
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
2001-01-25 10:37:55 +01:00
|
|
|
|
2001-04-26 19:41:06 +02:00
|
|
|
struct player;
|
2002-08-26 16:16:16 +02:00
|
|
|
struct alliance;
|
2001-04-26 19:41:06 +02:00
|
|
|
|
2005-04-27 23:03:08 +02:00
|
|
|
/* SMART_INTERVALS: define to speed up finding the interval of regions that a
|
|
|
|
faction is in. defining this speeds up the turn by 30-40% */
|
|
|
|
#define SMART_INTERVALS
|
2005-04-27 15:30:12 +02:00
|
|
|
|
2003-06-22 10:38:55 +02:00
|
|
|
#ifdef SHORTPWDS
|
|
|
|
typedef struct shortpwd {
|
|
|
|
struct shortpwd * next;
|
|
|
|
char * email;
|
|
|
|
char * pwd;
|
|
|
|
boolean used;
|
|
|
|
} shortpwd;
|
|
|
|
#endif
|
|
|
|
|
2003-07-29 11:48:03 +02:00
|
|
|
/* faction flags */
|
|
|
|
#define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
|
|
|
#define FFL_NOAID (1<<21) /* Hilfsflag Kampf */
|
|
|
|
#define FFL_RESTART (1<<2)
|
|
|
|
#define FFL_OVERRIDE (1<<27) /* Override-Passwort wurde benutzt */
|
|
|
|
#define FFL_DBENTRY (1<<28) /* Partei ist in Datenbank eingetragen */
|
|
|
|
#define FFL_NOTIMEOUT (1<<29) /* ignore MaxAge() */
|
2004-02-22 01:59:49 +01:00
|
|
|
#define FFL_GM (1<<30) /* eine Partei mit Sonderrechten */
|
2003-07-29 11:48:03 +02:00
|
|
|
|
2001-01-25 10:37:55 +01:00
|
|
|
typedef struct faction {
|
|
|
|
struct faction *next;
|
|
|
|
struct faction *nexthash;
|
2001-04-26 19:41:06 +02:00
|
|
|
|
|
|
|
struct player *owner;
|
2005-04-27 15:30:12 +02:00
|
|
|
#ifdef SMART_INTERVALS
|
2001-01-25 10:37:55 +01:00
|
|
|
struct region *first;
|
|
|
|
struct region *last;
|
2005-04-27 15:30:12 +02:00
|
|
|
#endif
|
2001-01-25 10:37:55 +01:00
|
|
|
int no;
|
2002-11-02 15:10:52 +01:00
|
|
|
int subscription;
|
2001-01-25 10:37:55 +01:00
|
|
|
unsigned int flags;
|
|
|
|
char *name;
|
|
|
|
char *banner;
|
|
|
|
char *email;
|
|
|
|
char *passw;
|
2002-03-03 13:53:05 +01:00
|
|
|
char *override;
|
2003-06-22 10:38:55 +02:00
|
|
|
#ifdef SHORTPWDS
|
|
|
|
struct shortpwd * shortpwds;
|
|
|
|
#endif
|
2002-03-09 16:16:35 +01:00
|
|
|
const struct locale * locale;
|
2001-01-25 10:37:55 +01:00
|
|
|
int lastorders; /* enno: short? */
|
|
|
|
int age; /* enno: short? */
|
2003-07-29 11:48:03 +02:00
|
|
|
struct ursprung *ursprung;
|
2001-12-10 01:13:39 +01:00
|
|
|
const struct race * race;
|
2001-01-25 10:37:55 +01:00
|
|
|
magic_t magiegebiet;
|
|
|
|
int newbies;
|
2005-03-06 14:47:23 +01:00
|
|
|
int num_people; /* Anzahl Personen ohne Monster */
|
|
|
|
int num_total; /* Anzahl Personen mit Monstern */
|
2001-01-25 10:37:55 +01:00
|
|
|
int options;
|
|
|
|
int no_units;
|
|
|
|
int karma;
|
2001-04-29 21:27:42 +02:00
|
|
|
#ifdef USE_UGROUPS
|
2001-04-28 14:01:17 +02:00
|
|
|
struct ugroup *ugroups;
|
2001-04-29 21:27:42 +02:00
|
|
|
#endif
|
2004-03-28 22:53:47 +02:00
|
|
|
#ifdef MSG_LEVELS
|
2005-05-08 02:03:31 +02:00
|
|
|
struct msglevel * msglevels;
|
2001-01-25 10:37:55 +01:00
|
|
|
struct warning * warnings;
|
2004-03-28 22:53:47 +02:00
|
|
|
#endif
|
2001-01-25 10:37:55 +01:00
|
|
|
struct ally *allies;
|
|
|
|
struct group *groups;
|
|
|
|
boolean alive; /* enno: sollte ein flag werden */
|
|
|
|
int nregions;
|
|
|
|
int money;
|
2005-07-31 18:07:02 +02:00
|
|
|
#ifdef SCORE_MODULE
|
|
|
|
int score;
|
|
|
|
#endif
|
2002-08-26 16:16:16 +02:00
|
|
|
struct alliance * alliance;
|
2002-03-31 11:42:39 +02:00
|
|
|
#ifdef VICTORY_DELAY
|
|
|
|
unsigned char victory_delay;
|
2001-01-25 10:37:55 +01:00
|
|
|
#endif
|
|
|
|
struct unit * units;
|
|
|
|
struct attrib *attribs;
|
2001-02-24 13:50:51 +01:00
|
|
|
struct message_list * msgs;
|
2002-12-18 01:34:19 +01:00
|
|
|
#ifdef REGIONOWNERS
|
|
|
|
struct faction_list * enemies;
|
|
|
|
#endif
|
2001-01-25 10:37:55 +01:00
|
|
|
struct bmsg {
|
|
|
|
struct bmsg * next;
|
|
|
|
struct region * r;
|
2001-02-24 13:50:51 +01:00
|
|
|
struct message_list * msgs;
|
2001-01-25 10:37:55 +01:00
|
|
|
} * battles;
|
2004-12-22 01:53:12 +01:00
|
|
|
struct item * items; /* items this faction can claim */
|
2001-01-25 10:37:55 +01:00
|
|
|
} faction;
|
|
|
|
|
2001-12-10 01:13:39 +01:00
|
|
|
typedef struct faction_list {
|
|
|
|
struct faction_list * next;
|
|
|
|
struct faction * data;
|
|
|
|
} faction_list;
|
|
|
|
|
|
|
|
extern const struct unit * random_unit_in_faction(const struct faction *f);
|
- Neue Messages fertig
Messages werden jetzt in einem anderen Meta-Format (message* of
message_type*) gespeichert, das man in beliebige Formate (CR oder NR)
rendern kann. crmessage.c und nrmessage.c sind die render-engines dafür.
Die Messagetypen werden in res/{de,en}/messages.xml gesammelt, ultimativ
kann das aber durchaus eine einzelne Datei sein. Die ist derzeit nicht
wirklich xml (Umlaute drin, keine Definitionsdatei), aber gut lesbar.
- make_message
Diese Funktion ersetzt new_message, und ist etwas einfacher in der Syntax:
make_message("dumb_mistake", "unit region command", u, r, cmd) erzeugt
eine neue Nachricht, die dann einfach mit add_message wie bisher an die
Nachrichtenliste gehängt werden kann.
TODO: Messages könnte man durchaus reference-counten, und in mehrere Listen
einfügen, solang sie a) mehrfachverwendet (Kampf!) und b) vom Betrachter
unabhängig sind. Das spart einigen Speicher.
- CR Version erhöht.
Weil die MESSAGETYPES Blocks anders sind als früher
- OFFENSIVE_DELAY
Verbietet Einheiten, deren Partei eine Reigon niht bewachen, den
Angriff in der Region, wenn sie sich in der Runde zuvor bewegt haben.
Status der letzten Runde wird in neuem Attribut at_moved gespeichert.
- SHORT_ATTACKS
ein define, das angibt ob Kämpfen grundsätzlich keine lange Aktion ist.
- XML Parser
xml.[hc] enthält einen XML-Parser, dem man ein plugin mit callbacks
übergibt, die nach dem Parsen eines tokens aufgerufen werden.
2001-04-12 19:21:57 +02:00
|
|
|
extern const char * factionname(const struct faction * f);
|
2005-06-10 00:10:35 +02:00
|
|
|
extern void * resolve_faction(variant data);
|
2003-12-14 11:02:29 +01:00
|
|
|
extern struct unit * addplayer(struct region *r, faction * f);
|
|
|
|
extern struct faction * addfaction(const char *email, const char* password,
|
|
|
|
const struct race * frace,
|
|
|
|
const struct locale *loc, int subscription);
|
2003-06-22 10:38:55 +02:00
|
|
|
extern boolean checkpasswd(const faction * f, const char * passwd, boolean shortp);
|
2002-09-26 12:57:55 +02:00
|
|
|
extern void destroyfaction(faction * f);
|
2001-01-25 10:37:55 +01:00
|
|
|
|
2004-05-30 01:50:39 +02:00
|
|
|
extern void set_alliance(struct faction * a, struct faction * b, int status);
|
|
|
|
extern int get_alliance(const struct faction * a, const struct faction * b);
|
|
|
|
|
2002-12-18 01:34:19 +01:00
|
|
|
#ifdef REGIONOWNERS
|
|
|
|
extern boolean is_enemy(const struct faction * f, const struct faction * enemy);
|
|
|
|
extern void add_enemy(struct faction * f, struct faction * enemy);
|
2002-12-18 18:40:21 +01:00
|
|
|
extern void remove_enemy(struct faction * f, struct faction * enemy);
|
2002-12-18 01:34:19 +01:00
|
|
|
#endif
|
|
|
|
|
2005-04-27 23:03:08 +02:00
|
|
|
#ifdef SMART_INTERVALS
|
|
|
|
extern void update_interval(struct faction * f, struct region * r);
|
|
|
|
#endif
|
|
|
|
|
2003-07-29 11:48:03 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
2001-01-25 10:37:55 +01:00
|
|
|
#endif
|