server/src/common/kernel/eressea.h

1194 lines
28 KiB
C
Raw Normal View History

2001-01-25 10:37:55 +01:00
/* vi: set ts=2:
*
* 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)
*
* based on:
*
* Atlantis v1.0 13 September 1993 Copyright 1993 by Russell Wallace
* Atlantis v1.7 Copyright 1996 by Alex Schr<EFBFBD>der
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
* This program may not be sold or used commercially without prior written
* permission from the authors.
*/
#ifndef ERESSEA_H
#define ERESSEA_H
#ifdef __cplusplus
extern "C" {
#endif
2001-01-25 10:37:55 +01:00
/*
* Features enabled:
* If you are lacking the settings.h, create a new file common/settings.h,
* and write #include <settings-eressea.h> (or whatever settings you want
* your game to use) in there.
* !!! DO NOT COMMIT THE SETTINGS.H FILE TO CVS !!!
*/
#include <settings.h>
/* Features currently in development (change makefile please): */
/* #define MSG_LEVELS -- msg-levels active */
2001-01-25 10:37:55 +01:00
/* basic types used in the eressea "kernel" */
2004-01-19 00:52:57 +01:00
typedef short order_t;
typedef short terrain_t;
typedef short direction_t;
typedef short race_t;
typedef short magic_t;
2002-02-22 20:41:20 +01:00
typedef short skill_t;
typedef short typ_t;
2004-01-19 00:52:57 +01:00
typedef short herb_t;
typedef short potion_t;
typedef short luxury_t;
typedef short weapon_t;
typedef short item_t;
typedef short resource_t;
typedef short spellid_t;
2001-01-25 10:37:55 +01:00
struct plane;
struct spell;
2001-01-25 10:37:55 +01:00
struct region;
struct race;
2001-01-25 10:37:55 +01:00
struct ship;
struct building;
struct faction;
struct party;
struct unit;
struct item;
/* item */
struct strlist;
struct resource_type;
struct item_type;
struct potion_type;
struct luxury_type;
struct herb_type;
struct weapon_type;
/* types */
struct ship_type;
struct building_type;
2001-01-25 10:37:55 +01:00
/* util includes */
struct xml_stack;
2001-01-25 10:37:55 +01:00
#include <cvector.h>
#include <umlaut.h>
#include <language.h>
#include <lists.h>
#include <vmap.h>
#include <vset.h>
#include <attrib.h>
2001-02-04 11:04:36 +01:00
#define AT_PERSISTENT
#ifdef ALLIANCES
# define ALLIED(f1, f2) (f1->alliance && f1->alliance==f2->alliance)
#else
# define ALLIED(f1, f2) (f1==f2)
#endif
2001-02-04 11:04:36 +01:00
2001-01-25 10:37:55 +01:00
/* eressea-defined attribute-type flags */
#define ATF_CURSE ATF_USER_DEFINED
#define OLD_FAMILIAR_MOD /* conversion required */
/* feature-dis/en-able */
#undef WEATHER /* Kein Wetter-Modul */
#define NEW_DRIVE /* Neuer Algorithmus Transportiere/Fahre */
#define PARTIAL_STUDY /* Wenn nicht genug Silber vorhanden, wird ein Talent anteilig gelernt */
#define HUNGER_REDUCES_SKILL /* Hunger reduziert den Talentwert auf die H<>lfte */
#define NEW_RECEIPIES /* Vereinfachte, besser verteilte Kr<4B>uterzutaten f<>r Tr<54>nke */
#define NEW_TAVERN
#define GOBLINKILL
#define USE_FIREWALL 1
#undef COMPATIBILITY
#define MONSTER_FACTION 0 /* Die Partei, in der die Monster sind. */
#define FULL_BASE36
/**
2002-09-02 22:36:12 +02:00
* heaps and heaps of unsupported versions:
#define RACES_VERSION 91
#define MAGIEGEBIET_VERSION 92
#define FATTRIBS_VERSION 94
#define ATNORD_VERSION 95
#define NEWMAGIC 100
#define MEMSAVE_VERSION 101
#define BORDER_VERSION 102
#define ATNAME_VERSION 103
#define ATTRIBFIX_VERSION 104
#define BORDERID_VERSION 105
#define NEWROAD_VERSION 106
#define GUARD_VERSION 107
#define TIMEOUT_VERSION 108
#define GUARDFIX_VERSION 109
#define NEW_FACTIONID_VERSION 110
#define ACTIONFIX1_VERSION 111
#define SHIPTYPE_VERSION 112
#define GROUPS_VERSION 113
#define MSGLEVEL_VERSION 114
#define DISABLE_ROADFIX 114
#define FACTIONFLAGS_VERSION 114
#define KARMA_VERSION 114
#define FULL_BASE36_VERSION 115
**/
2001-01-25 10:37:55 +01:00
#define TYPES_VERSION 117
#define ITEMTYPE_VERSION 190
#define NOFOREST_VERSION 191
#define REGIONAGE_VERSION 192
#define CURSE_NO_VERSION 193
#define EFFSTEALTH_VERSION 194
#define MAGE_ATTRIB_VERSION 195
#define GLOBAL_ATTRIB_VERSION 196
#define BASE36IDS_VERSION 197
#define NEWSOURCE_VERSION 197
#define NEWSTATUS_VERSION 198
#define NEWNAMES_VERSION 199
#define LOCALE_VERSION 300
#define GROUPATTRIB_VERSION 301
#define NEWRESOURCE_VERSION 303
#define GROWTREE_VERSION 305
#define RANDOMIZED_RESOURCES_VERSION 306 /* should be the same, but doesn't work */
#define NEWRACE_VERSION 307
#define INTERIM_VERSION 309
#define NEWSKILL_VERSION 309
#define WATCHERS_VERSION 310
#define OVERRIDE_VERSION 311
#define CURSETYPE_VERSION 312
#define ALLIANCES_VERSION 313
#define DBLINK_VERSION 314
#define CURSEVIGOURISFLOAT_VERSION 315
2004-01-11 11:05:03 +01:00
#define SAVEXMLNAME_VERSION 316
#define REGIONOWNERS_VERSION 317
#define MIN_VERSION ALLIANCES_VERSION
#define UGROUPS_VERSION 400 /* nicht aktivieren, nicht fertig */
#ifdef REGIONOWNERS
# define RELEASE_VERSION REGIONOWNERS_VERSION
#else
2004-01-11 11:05:03 +01:00
# define RELEASE_VERSION SAVEXMLNAME_VERSION
#endif
#if RESOURCE_CONVERSION
extern void init_resourcefix(void);
extern void read_iron(struct region * r, int iron);
extern void read_laen(struct region * r, int laen);
#endif
#define ECHECK_VERSION "4.01"
2001-01-25 10:37:55 +01:00
/* changes from->to: 72->73: struct unit::lock entfernt.
* 73->74: struct unit::flags eingef<EFBFBD>hrt.
* 74->75: parteitarnung als flag.
* 75->76: #ifdef NEW_HP: hp
* 76->77: ship->damage
* 77->78: neue Message-Option "Orkvermehrung" (MAX_MSG +1)
* 78->79: showdata nicht mehr speichern
* 79->HEX_VERSION: hex
* 80->82: ATTRIB_VERSION
* 90: Ebenen
* 92: Magiegebiet-Auswahl f->magiegebiet
* 94: f->attribs wird gespeichert
* 100: NEWMAGIC, neue Message-Option "Zauber" (MAX_MSG +1)
* 108: Speichern von Timeouts
* 193: curse bekommen id aus struct unit-nummernraum
*/
/* NEWMAIL benutzt ein spezielles Skript zum Erstellen der Reportmails */
#define MAIL "eresseamail"
#define DEFAULT_LOCALE "de"
#define MAXPEASANTS_PER_AREA 10
#if !defined(NEW_ITEMS)
# define NEW_ITEMS
#endif
/* So lange kann die Partei nicht angegriffen werden */
#undef STUDY_IF_NOT_WORKING
/** Attackierende Einheiten k<>nnen keine langen Befehle ausf<73>hren */
#define DISALLOW_ATTACK_AND_WORK
/** Ausbreitung und Vermehrung */
#define MAXDEMAND 25
#define DMRISE 10
#define DMRISEHAFEN 20
/* Vermehrungsrate Bauern in 1/10000.
* Evt. Berechnungsfehler, reale Vermehrungsraten scheinen h<EFBFBD>her. */
#if REDUCED_PEASANTGROWTH == 1
#define PEASANTGROWTH 10
#define BATTLE_KILLS_PEASANTS 20
#define PEASANTLUCK 10
#else
#define PEASANTGROWTH 100
#define BATTLE_KILLS_PEASANTS 100
#define PEASANTLUCK 1
#endif
2001-01-25 10:37:55 +01:00
/* Vermehrung trotz 90% Auslastung */
#define PEASANTFORCE 75
#define PEASANTSWANDER_WEIGHT 5
#define PEASANTSGREED_WEIGHT 5
#define STARVATION_SURVIVAL 10
/* Pferdevermehrung */
#define HORSEGROWTH 4
2001-01-25 10:37:55 +01:00
/* Wanderungschance pro Pferd */
#define HORSEMOVE 3
2001-01-25 10:37:55 +01:00
/* Vermehrungschance pro Baum */
#define FORESTGROWTH 10000 /* In Millionstel */
2001-01-25 10:37:55 +01:00
#define TREESIZE (MAXPEASANTS_PER_AREA-2)
/* Eisen in Bergregionen bei Erschaffung */
#define IRONSTART 250
/* Zuwachs Eisen in Bergregionen */
#define IRONPERTURN 25
#define MAXLAENPERTURN 6
#define NEW_LAEN 0
/* Eisen in Gletschern */
#define GLIRONSTART 20
/* Zuwachs Eisen in Gletschern */
#define GLIRONPERTURN 3
/* Maximales Eisen in Gletschern */
#define MAXGLIRON 80
/* Verrottchance f<>r Kr<4B>uter */
#define HERBROTCHANCE 5
#define HERBS_ROT
#define STUDYCOST 200
/* Geb<65>udegr<67><72>e = Minimalbelagerer */
#define SIEGEFACTOR 2
/** Magic */
#define MAXMAGICIANS 3
#define MAXALCHEMISTS 3
/** Plagues **/
/* Seuchenwahrscheinlichkeit (siehe plagues()) */
#define SEUCHE 10
/* % Betroffene */
#define SEUCHENOPFER 20
2001-01-25 10:37:55 +01:00
extern void plagues(struct region * r, boolean ismagic);
/** Healing **/
/* Wahrscheinlichkeit Heilung */
#define HEILCHANCE 25
/* Heilkosten */
#define HEILKOSTEN 30
/** Monster */
/* Chance f<>r Monsterangriff */
#define MONSTERATTACK 0.4
2001-01-25 10:37:55 +01:00
/** Geb<65>ude */
/* Chance f<>r Einsturz bei unversorgtem Gebaeude */
#define EINSTURZCHANCE 40
/* Soviele % <20>berleben den Einsturz */
#define EINSTURZUEBERLEBEN 50
/** Geographie. Nicht im laufenden Spiel <20>ndern!!! */
#define BLOCKSIZE 9
/* Nur Bewaffnete bewachen */
#define WACH_WAFF
#undef TROLLSAVE
/* Spezialtrank f<>r Insekten */
#define INSECT_POTION
/* Schiffsbesch<63>digungen */
#define SHIPDAMAGE
/* regionen im Report der Parteien werden nur einmal berechnet: */
#define FAST_REGION
/* Magiesystem */
#define NIGHT_EYE_TALENT 5
/* gibt es ein attribut at_salary */
#undef AFFECT_SALARY
/* ist noch nicht fertig! */
#define ARENA_PLANE
#undef UNDERWORLD_PLANE
#define ORCIFICATION
/* Bewegungsweiten: */
#define BP_WALKING 4
#define BP_RIDING 6
#define BP_UNICORN 9
#define BP_DRAGON 4
#define BP_NORMAL 3
#define BP_ROAD 2
/**
* Hier endet der Teil von eressea.h, der die defines f<EFBFBD>r die
* Spielwelt Eressea enth<EFBFBD>lt, und beginnen die allgemeinen Routinen
*/
#define ENCCHANCE 10 /* %-Chance f<>r einmalige Zufallsbegegnung */
#define SPACE_REPLACEMENT '~'
#define ESCAPE_CHAR '\\'
#define DISPLAYSIZE 8191 /* max. L<>nge einer Beschreibung, ohne trailing 0 */
2001-01-25 10:37:55 +01:00
#define NAMESIZE 127 /* max. L<>nge eines Namens, ohne trailing 0 */
#define IDSIZE 15 /* max. L<>nge einer no (als String), ohne trailing 0 */
#define KEYWORDSIZE 15 /* max. L<>nge eines Keyword, ohne trailing 0 */
#define OBJECTIDSIZE (NAMESIZE+5+IDSIZE) /* max. L<>nge der Strings, die
* von struct unitname, regionid, etc. zur<EFBFBD>ckgegeben werden. ohne die 0 */
#define CMDSIZE (DISPLAYSIZE*2+1)
#define STARTMONEY 5000
#define PRODUCEEXP 10
#define MAINTENANCE 10
#define TAVERN_MAINTENANCE 14
/* Man gibt in einer Taverne mehr Geld aus! */
#define BAGCAPACITY 20000 /* soviel pa<70>t in einen Bag of Holding */
#define STRENGTHCAPACITY 50000 /* zus<75>tzliche Tragkraft beim Kraftzauber */
typedef struct ursprung {
struct ursprung *next;
int id;
int x, y;
} ursprung;
/* ----------------- Befehle ----------------------------------- */
typedef int keyword_t;
enum {
K_KOMMENTAR,
K_BANNER,
K_WORK,
K_ATTACK,
K_BIETE,
K_STEAL,
K_BESIEGE,
K_NAME,
K_USE,
K_DISPLAY,
K_ENTER,
K_GUARD,
K_MAIL,
K_END,
K_DRIVE,
K_NUMBER,
K_WAR,
K_PEACE,
2001-01-25 10:37:55 +01:00
K_FOLLOW,
K_RESEARCH,
K_GIVE,
K_ALLY,
K_STATUS,
K_COMBAT,
K_BUY,
K_CONTACT,
K_TEACH,
K_STUDY,
K_LIEFERE,
K_MAKE,
K_MOVE,
K_PASSWORD,
K_DUMMY,
K_RECRUIT,
K_RESERVE,
K_ROUTE,
K_SABOTAGE,
K_SEND,
K_SPY,
K_QUIT,
K_SETSTEALTH,
K_TRANSPORT,
K_TAX,
K_ENTERTAIN,
K_SELL,
K_LEAVE,
K_FORGET,
K_CAST,
K_RESHOW,
K_DESTROY,
K_ZUECHTE,
K_DEFAULT,
K_REPORT,
K_URSPRUNG,
K_EMAIL,
K_VOTE,
K_MAGIEGEBIET,
K_PIRACY,
K_RESTART,
K_GROUP,
K_SACRIFICE,
K_PRAY,
K_SORT,
K_SETJIHAD,
2001-01-30 21:02:06 +01:00
K_GM, /* perform GM commands */
2001-04-26 19:41:06 +02:00
K_INFO, /* set player-info */
#ifdef USE_UGROUPS
K_JOINUGROUP,
K_LEAVEUGROUP,
#endif
K_PREFIX,
K_SYNONYM,
K_PFLANZE,
2002-04-12 14:46:16 +02:00
K_WEREWOLF,
K_XE,
K_ALLIANCE,
2001-01-25 10:37:55 +01:00
MAXKEYWORDS,
NOKEYWORD = (keyword_t) - 1
};
extern const char *keywords[MAXKEYWORDS];
/* ------------------ Status von Einheiten --------------------- */
typedef int status_t;
enum {
ST_AGGRO,
2001-01-25 10:37:55 +01:00
ST_FIGHT,
ST_BEHIND,
ST_CHICKEN,
2001-01-25 10:37:55 +01:00
ST_AVOID,
ST_FLEE
};
/* ----------------- Parameter --------------------------------- */
typedef int param_t;
enum {
P_LOCALE,
2001-01-25 10:37:55 +01:00
P_ANY,
P_PEASANT,
P_BUILDING,
P_UNIT,
P_PRIVAT,
P_BEHIND,
P_CONTROL,
P_HERBS,
P_NOT,
P_NEXT,
P_FACTION,
P_GAMENAME,
2001-01-25 10:37:55 +01:00
P_PERSON,
P_REGION,
P_SHIP,
P_SILVER,
P_ROAD,
P_TEMP,
P_FLEE,
P_GEBAEUDE,
P_GIB,
P_KAEMPFE,
P_TRAVEL,
2001-01-25 10:37:55 +01:00
P_GUARD,
P_ZAUBER,
P_PAUSE,
P_VORNE,
P_AGGRO,
P_CHICKEN,
2001-01-25 10:37:55 +01:00
P_LEVEL,
P_HELP,
P_FOREIGN,
P_AURA,
P_FOR,
P_AID,
P_MERCY,
P_AFTER,
P_BEFORE,
P_NUMBER,
P_ITEMS,
P_POTIONS,
P_GROUP,
P_FACTIONSTEALTH,
P_TREES,
P_XEPOTION,
P_XEBALLOON,
P_XELAEN,
2001-01-25 10:37:55 +01:00
MAXPARAMS,
NOPARAM = (param_t) - 1
};
typedef enum { /* Fehler und Meldungen im Report */
MSG_BATTLE,
MSG_EVENT,
MSG_MOVE,
MSG_INCOME,
MSG_COMMERCE,
MSG_PRODUCE,
MSG_ORCVERMEHRUNG,
MSG_MESSAGE,
MSG_COMMENT,
MSG_MAGIC,
MAX_MSG
} msg_t;
enum { /* Message-Level */
ML_IMPORTANT, /* Sachen, die IMO erscheinen _muessen_ */
ML_DEBUG,
ML_MISTAKE,
ML_WARN,
ML_INFO,
ML_MAX
};
extern const char *parameters[MAXPARAMS];
/* --------------- Reports Typen ------------------------------- */
enum {
O_REPORT, /* 1 */
O_COMPUTER, /* 2 */
O_ZUGVORLAGE, /* 4 */
O_SILBERPOOL, /* 8 */
O_STATISTICS, /* 16 */
O_DEBUG, /* 32 */
O_COMPRESS, /* 64 */
O_NEWS, /* 128 */
2001-01-25 10:37:55 +01:00
O_MATERIALPOOL, /* 256 */
O_ADRESSEN, /* 512 */
O_BZIP2, /* 1024 - crkurz compatible flag */
O_SCORE, /* 2048 - punkte anzeigen? */
2002-02-22 20:41:20 +01:00
O_SHOWSKCHANGE, /* 4096 - Skillver<65>nderungen anzeigen? */
2001-01-25 10:37:55 +01:00
MAXOPTIONS
};
#define want(i) (1<<i)
#define Pow(i) (1<<i)
extern const char *options[MAXOPTIONS];
/* ------------------ Talente ---------------------------------- */
enum {
SK_ALCHEMY,
SK_CROSSBOW,
SK_MINING,
SK_LONGBOW,
SK_BUILDING,
SK_TRADE,
SK_LUMBERJACK,
SK_CATAPULT,
SK_HERBALISM,
SK_MAGIC,
SK_HORSE_TRAINING, /* 10 */
SK_RIDING,
SK_ARMORER,
SK_SHIPBUILDING,
SK_SWORD,
SK_SAILING,
SK_SPEAR,
SK_SPY,
SK_QUARRYING,
SK_ROAD_BUILDING,
SK_TACTICS, /* 20 */
SK_STEALTH,
SK_ENTERTAINMENT,
SK_WEAPONSMITH,
SK_CARTMAKER,
SK_OBSERVATION,
SK_TAXING,
SK_AUSDAUER,
SK_WEAPONLESS,
MAXSKILLS,
NOSKILL = (skill_t) -1
};
/* ------------- Typ von Einheiten ----------------------------- */
enum {
RC_DWARF, /* 0 - Zwerg */
RC_ELF,
RC_ORC,
RC_GOBLIN,
RC_HUMAN,
RC_TROLL,
RC_DAEMON,
RC_INSECT,
RC_HALFLING,
RC_CAT,
RC_AQUARIAN,
RC_URUK,
2002-02-10 21:02:23 +01:00
RC_SNOTLING,
2001-01-25 10:37:55 +01:00
RC_UNDEAD, /* 12 - Untoter */
2001-01-25 10:37:55 +01:00
RC_ILLUSION,
RC_FIREDRAGON,
RC_DRAGON,
RC_WYRM,
RC_TREEMAN,
RC_BIRTHDAYDRAGON, /* 18 - Katzendrache*/
2001-01-25 10:37:55 +01:00
RC_DRACOID,
RC_SPECIAL,
RC_SPELL,
RC_IRONGOLEM, /* 22 - Eisengolem */
2001-01-25 10:37:55 +01:00
RC_STONEGOLEM,
RC_SHADOW,
RC_SHADOWLORD,
RC_IRONKEEPER, /* 26 - Bergw<67>chter */
2001-01-25 10:37:55 +01:00
RC_ALP,
RC_TOAD, /* 28 - Kr<4B>te */
2001-01-25 10:37:55 +01:00
RC_HIRNTOETER,
RC_PEASANT,
RC_WOLF, /* 31 */
2001-01-25 10:37:55 +01:00
RC_HOUSECAT,
RC_TUNNELWORM,
RC_EAGLE,
RC_RAT,
RC_PSEUDODRAGON,
RC_NYMPH,
RC_UNICORN,
RC_WARG,
RC_WRAITH,
RC_IMP, /* 41 */
2001-01-25 10:37:55 +01:00
RC_DREAMCAT,
RC_FEY,
RC_OWL,
RC_HELLCAT,
RC_TIGER,
RC_DOLPHIN,
RC_OCEANTURTLE,
RC_KRAKEN,
RC_SEASERPENT,
RC_SHADOWKNIGHT, /* 51 */
2001-01-25 10:37:55 +01:00
RC_CENTAUR,
RC_SKELETON,
RC_SKELETON_LORD,
RC_ZOMBIE,
RC_ZOMBIE_LORD,
RC_GHOUL,
RC_GHOUL_LORD,
RC_MUS_SPIRIT, /* 60 */
RC_GNOME, /* 61 */
RC_TEMPLATE, /* 62 */
RC_CLONE, /* 63 */
RC_SHADOWDRAGON, /* 64 */
RC_SHADOWBAT,
RC_NIGHTMARE,
RC_VAMPUNICORN,
2004-01-18 12:19:45 +01:00
RC_PHOENIX,
2001-01-25 10:37:55 +01:00
2004-01-18 19:51:16 +01:00
RC_SPHINX,
RC_LITTLESCARAB,
RC_GREENSCARAB,
RC_BLUESCARAB,
RC_REDSCARAB,
RC_UNDEADPHARAOH,
RC_MUMMY,
2001-01-25 10:37:55 +01:00
MAXRACES,
NORACE = (race_t) - 1
};
/* ---------- Regionen ----------------------------------------- */
/* Richtungen */
enum {
D_NORTHWEST,
D_NORTHEAST,
D_EAST,
D_SOUTHEAST,
D_SOUTHWEST,
D_WEST,
MAXDIRECTIONS,
D_PAUSE,
NODIRECTION = (direction_t) - 1
};
/* Jahreszeiten, siehe auch res/timestrings */
enum {
SEASON_WINTER,
SEASON_SPRING,
SEASON_SUMMER,
SEASON_AUTUMN
};
/* Siegbedingungen */
#define VICTORY_NONE 0
#define VICTORY_MURDER 1
2001-01-25 10:37:55 +01:00
/* ------------------------------------------------------------- */
#define MAXSPEED 21
int shipspeed(struct ship * sh, const struct unit * u);
/* MAXSPEED setzt die groesse fuer den Array, der die Kuesten Beschreibungen
* enthaelt. MAXSPEED muss 2x +3 so gross wie die groesste Geschw. sein
* (Zauberspruch) */
/* ------------------------------------------------------------- */
/* ------------------------------------------------------------- */
/* TODO
* werden diese hier eigendlich noch f<EFBFBD>r irgendwas gebraucht?*/
/* Attribute: auf Einheiten */
/* Klassen */
enum {
A_KL_GEGENSTAND,
A_KL_EIGENSCHAFT
};
/* Eigenschaften (in i[0]) */
#define ZEIGE_PARTEI 1 /* Zeigt s[0] in eigenem Report an */
#define ZEIGE_ANDEREN 2 /* Zeigt s[1] in fremden Reports an */
#define TALENTMOD 4 /* Gegenstand ver<65>ndert Talent
* i[2] um i[3] */
/* A_KL_EIGENSCHAFT */
enum {
A_TY_NOT_PARTEI_GETARNT, /* In i[0] die Pseudopartei?! */
A_TY_NOT_FLAGS, /* Verschiedene Eigenschaften in i[0] */
A_TY_EX_TYPNAME, /* Was soll als Typname erscheinen? s[0] =
* Singular, s[1] = Plural */
A_TY_EX_ZIELREGION,
A_TY_EX_BAUERNBLUT /* In i[0] die Zahl der max. gesch<63>tzten
* D<EFBFBD>monen. */
};
/* A_TY_GESEHEN: fuer cansee() in i[0] steht drin, welche Partei uns
* sah, in i[1], wie gut (0,1 oder 2) */
/* Auf Regionen */
/* Klassen */
enum {
A_KL_MERKMAL,
A_KL_ZAUBER
};
/* A_KL_MERKMAL */
enum {
A_TY_MITHRIL,
A_TY_ADAMANTIUM,
A_TY_DIRECTION /* In s[0] describe_txt, in s[1] das command,
in i[0]-i[2] die Koordinaten des Ziels. */
};
/* Auf Schiffen */
/* Klassen */
enum {
A_KL_MERKMAL_SCHIFF
};
/* A_KL_MERKMAL */
enum {
A_TY_EX_KUESTE /* In i[0] steht die Richtung */
};
/* Auf Borders */
/* Klassen */
enum {
A_KL_BLOCK
};
enum {
A_TY_LOCK
};
#define DONT_HELP 0
#define HELP_MONEY 1 /* Mitversorgen von Einheiten */
#define HELP_FIGHT 2 /* Bei Verteidigung mithelfen */
#define HELP_OBSERVE 4 /* Bei Wahrnehmung mithelfen */
#define HELP_GIVE 8 /* Dinge annehmen ohne KONTAKTIERE */
#define HELP_GUARD 16 /* Laesst Steuern eintreiben etc. */
#define HELP_FSTEALTH 32 /* Parteitarnung anzeigen. */
#define HELP_TRAVEL 64 /* Laesst Regionen betreten. */
#define HELP_ALL (127-HELP_OBSERVE) /* Alle "positiven" HELPs zusammen */
2001-01-25 10:37:55 +01:00
/* HELP_OBSERVE deaktiviert */
/* ------------------------------------------------------------- */
/* Prototypen */
#define ALLIED_TAX 1
#define ALLIED_NOBLOCK 2
#define ALLIED_HELP 4
extern vmap region_map;
#define i2b(i) ((boolean)((i)?(true):(false)))
typedef struct ally {
struct ally *next;
struct faction *faction;
int status;
} ally;
#define FF_NEWID (1<<0) /* Die Partei hat bereits einmal ihre no gewechselt */
void remove_empty_units_in_region(struct region *r);
void remove_empty_units(void);
void remove_empty_factions(boolean writedropouts);
2001-01-25 10:37:55 +01:00
typedef struct strlist {
struct strlist *next;
char * s;
} strlist;
#define FL_POTIONS (1<<15) /* speedup: hat ein oder mehr tr<74>nke, statt potionptr */
#define FL_DH (1<<18) /* ehemals f->dh, u->dh, r->dh, etc... */
/* alle vierstelligen zahlen: */
#define MAX_UNIT_NR (36*36*36*36-1)
#define MAX_CONTAINER_NR (36*36*36*36-1)
#define FL_MARK (1<<23) /* f<>r markierende algorithmen, die das hinterher auch wieder
l<EFBFBD>schen m<EFBFBD>ssen! (Ist daf<EFBFBD>r nicht eigentlich FL_DH gedacht?) */
#define FL_UNNAMED (1<<26) /* Partei/Einheit/Geb<65>ude/Schiff ist unbenannt */
#define fval(u, i) ((u)->flags & (i))
2001-01-25 10:37:55 +01:00
#define fset(u, i) ((u)->flags |= (i))
#define freset(u, i) ((u)->flags &= ~(i))
typedef struct request {
struct request * next;
struct unit *unit;
int qty;
int no;
union {
boolean goblin; /* stealing */
const struct luxury_type * ltype; /* trading */
} type;
} request;
extern int turn;
2004-01-18 21:29:47 +01:00
extern const char *xmlfile;
2001-01-25 10:37:55 +01:00
/* parteinummern */
extern int *used_faction_ids;
extern int no_used_faction_ids;
extern void register_faction_id(int id);
extern boolean faction_id_is_unused(int);
/* leuchtturm */
extern boolean check_leuchtturm(struct region * r, struct faction * f);
extern void update_lighthouse(struct building * lh);
/* skills */
magicskillboost -- implementiert. Kann nur einmal pro Partei verwendet werden, und nur von einem Magier. Müssen wir erklären. Amulett des wahren Sehens und Ring der Unsichtbarkeit geben lediglich einen Bonus auf Wahrnehmung (+2) und Tarnung (+4). -- das define war nicht aktiviert Halblinge haben Armbrustschiessen +0 (statt +1). -- spearates Rassenfile für WDW Es gibt spezielle Regeln für Allianzen, und der HELFE und KONTAKTIERE Befehl sind eingeschränkt. Konkret kann kein HELP_FIGHT HELP_GUARD HELP_FSTEALTH HELP_MONEY gegeben werden (die anderen sind erlaubt). -- mit #defeine ALLIES_ONLY definiert Jede Allianz kann bis zu 15 Magier und 15 Alchemisten haben. Jede einzelne Partei der Allianz kann dabei nicht mehr als 15/Anzahl_Parteien (aufgerundet) Magier bzw. Alchemisten haben, und die Gesamtsumme darf 15 nicht übersteigen. -- mit #define ALLIANCE_LIMITS gemacht. Die Startgeschenke (Personen, Silber, ...) werden pro Allianz, nicht pro Spieler verteilt. Größere Allianzen bekommen also weniger pro Spieler. -- Nochmal geändert: Die Allianzen kriegen jede 168 Personen zum Start, weil sich das gut aufteilen lässt. Das wird auf 28 Einheiten pro Partei gesplittet, jede Einheit hat eines der Talente, außer der Starteinheit, die hat den magicskillboost. Einige Skills kommen öfter vor als andere, das ist nicht einfach vermeidbar. Sollte aber auch wurscht sein, es geht primär darum, lehren zu können. Es gibt ein Einheitenlimit von 1000 Einheiten pro Allianz. -- die Regel sparen wir uns einfach mal.
2003-12-14 22:45:47 +01:00
extern int max_skill(struct faction * f, skill_t sk);
2001-01-25 10:37:55 +01:00
extern int count_skill(struct faction * f, skill_t sk);
extern int count_all_money(const struct region * r);
/* direction, geography */
extern const char *directions[];
extern direction_t finddirection(const char *s, const struct locale *);
extern int findoption(const char *s, const struct locale * lang);
2001-01-25 10:37:55 +01:00
/* shared character-buffer */
#define BUFSIZE 32765
2001-01-25 10:37:55 +01:00
extern char buf[BUFSIZE + 1];
/* special units */
struct unit *make_undead_unit(struct region * r, struct faction * f, int n, const struct race * rc);
2001-01-25 10:37:55 +01:00
extern struct region *regions;
extern struct faction *factions;
strlist *makestrlist(const char *s);
void addstrlist(strlist ** SP, const char *s);
int armedmen(const struct unit * u);
void scat(const char *s);
void icat(int n);
int atoip(const char *s);
int geti(void);
extern int findstr(const char **v, const char *s, unsigned char n);
extern const char *igetstrtoken(const char *s);
extern const char *getstrtoken(void);
extern skill_t findskill(const char *s, const struct locale * lang);
extern keyword_t findkeyword(const char *s, const struct locale * lang);
extern keyword_t igetkeyword(const char *s, const struct locale * lang);
extern keyword_t getkeyword(const struct locale * lang);
extern param_t findparam(const char *s, const struct locale * lang);
extern param_t igetparam(const char *s, const struct locale * lang);
extern param_t getparam(const struct locale * lang);
2001-01-25 10:37:55 +01:00
#define BASE36_VERSION 93
extern int atoi36(const char * s);
#define getid() ((global.data_version<BASE36_VERSION)?geti():atoi36(getstrtoken()))
#define getstruct unitid() getid()
#define unitid(x) itoa36((x)->no)
#define getshipid() getid()
#define getfactionid() getid()
#define buildingid(x) itoa36((x)->no)
#define shipid(x) itoa36((x)->no)
#define factionid(x) itoa36((x)->no)
#define curseid(x) itoa36((x)->no)
extern boolean cansee(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
boolean cansee_durchgezogen(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
boolean seefaction(const struct faction * f, const struct region * r, const struct unit * u, int modifier);
extern int effskill(const struct unit * u, skill_t sk);
2001-01-25 10:37:55 +01:00
extern int lovar(double xpct_x2);
/* returns a value between [0..xpct_2], generated with two dice */
2001-01-25 10:37:55 +01:00
int distribute(int old, int new_value, int n);
int newunitid(void);
int forbiddenid(int id);
int newcontainerid(void);
extern struct unit *createunit(struct region * r, struct faction * f, int number, const struct race * rc);
extern struct unit *create_unit(struct region * r1, struct faction * f, int number, const struct race * rc, int id, const char * dname, struct unit *creator);
extern void create_unitid(struct unit *u, int id);
2001-01-25 10:37:55 +01:00
extern boolean getunitpeasants;
extern struct unit *getunitg(const struct region * r, const struct faction * f);
extern struct unit *getunit(const struct region * r, const struct faction * f);
extern int read_unitid(const struct faction * f, const struct region * r);
2001-01-25 10:37:55 +01:00
2002-09-02 22:36:12 +02:00
extern int alliedunit(const struct unit * u, const struct faction * f2, int mode);
extern int alliedfaction(const struct plane * pl, const struct faction * f,
const struct faction * f2, int mode);
extern int alliedgroup(const struct plane * pl, const struct faction * f,
const struct faction * f2, const struct ally * sf,
int mode);
2001-01-25 10:37:55 +01:00
struct faction *findfaction(int n);
struct faction *getfaction(void);
struct region *findregion(int x, int y);
2001-04-26 19:41:06 +02:00
struct unit *findunitg(int n, const struct region * hint);
2001-01-25 10:37:55 +01:00
struct unit *findunit(int n);
struct unit *findunitr(const struct region * r, int n);
struct region *findunitregion(const struct unit * su);
char *estring(const char *s);
char *cstring(const char *s);
const char *regionid(const struct region * r);
const char *unitname(const struct unit * u);
2001-01-25 10:37:55 +01:00
char *xunitid(const struct unit * u);
struct building *largestbuilding(const struct region * r, boolean img);
extern boolean teure_talente(const struct unit * u);
2001-02-05 08:23:17 +01:00
int count_all(const struct faction * f);
int count_maxmigrants(const struct faction * f);
const struct race * findrace(const char *, const struct locale *);
2001-01-25 10:37:55 +01:00
int effstealth(const struct unit * u);
int eff_stealth(const struct unit * u, const struct region * r);
void scale_number(struct unit * u, int n);
int unit_max_hp(const struct unit * u);
int ispresent(const struct faction * f, const struct region * r);
char * set_string(char **s, const char *neu);
/* unterschied zu getkeyword(void) ist lediglich, da<64> in *str dynamisch der
* neue string hineingeschrieben wird (speicher wird reserviert, falls *str zu
* klein). enno. */
int check_option(struct faction * f, int option);
/* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine,
* sonst gro<EFBFBD>es Ungl<EFBFBD>ck. Durch asserts an ein paar Stellen abgesichert. */
void verify_data(void);
void stripfaction(struct faction * f);
void stripunit(struct unit * u);
void freestrlist(strlist * s);
int change_hitpoints(struct unit *u, int value);
int weight(const struct unit * u);
void changeblockchaos(void);
struct region *firstregion(struct faction * f);
struct region *lastregion(struct faction * f);
void inituhash(void);
void uhash(struct unit * u);
void uunhash(struct unit * u);
struct unit *ufindhash(int i);
void fhash(struct faction * f);
void funhash(struct faction * f);
2001-01-25 10:37:55 +01:00
#ifndef NDEBUG
const char *strcheck(const char *s, size_t maxlen);
#else
#define strcheck(s, ml) (s)
#endif
const char * findorder(const struct unit * u, const char * cmd);
#define attacked(u) (fval(u, UFL_LONGACTION))
2001-01-25 10:37:55 +01:00
boolean idle(struct faction * f);
boolean unit_has_cursed_item(struct unit *u);
/* simple garbage collection: */
void * gc_add(void * p);
void mistake(const struct unit * u, const char *cmd, const char *text, int mtype);
void addmessage(struct region * r, struct faction * f, const char *s, msg_t mtype, int level);
void cmistake(const struct unit * u, const char *cmd, int mno, int mtype);
/* grammatik-flags: */
#define GF_NONE 0
/* singular, ohne was dran */
#define GF_PLURAL 1
/* Angaben in Mehrzahl */
#define GF_ARTICLE 8
/* der, die, eine */
#define GF_SPECIFIC 16
/* der, die, das vs. ein, eine */
#define GF_DETAILED 32
/* mehr Informationen. z.b. stra<72>e zu 50% */
#define GUARD_NONE 0
#define GUARD_TAX 1
/* Verhindert Steuereintreiben */
#define GUARD_MINING 2
/* Verhindert Bergbau */
#define GUARD_TREES 4
/* Verhindert Waldarbeiten */
#define GUARD_TRAVELTHRU 8
/* Blockiert Durchreisende */
#define GUARD_LANDING 16
/* Verhindert Ausstieg + Weiterreise */
#define GUARD_CREWS 32
/* Verhindert Unterhaltung auf Schiffen */
#define GUARD_RECRUIT 64
/* Verhindert Rekrutieren */
#define GUARD_PRODUCE 128
/* Verhindert Abbau von Resourcen mit RTF_LIMITED */
2001-01-25 10:37:55 +01:00
#define GUARD_ALL 0xFFFF
extern void setguard(struct unit * u, unsigned int flags);
/* setzt die guard-flags der Einheit */
extern unsigned int getguard(const struct unit * u);
/* liest die guard-flags der Einheit */
extern void guard(struct unit * u, unsigned int mask);
/* Einheit setzt "BEWACHE", rassenspezifzisch.
* 'mask' kann einzelne flags zus<EFBFBD>tzlich und-maskieren.
*/
typedef struct local_names {
struct local_names * next;
const struct locale * lang;
struct tnode names;
2001-01-25 10:37:55 +01:00
} local_names;
extern boolean hunger(int number, struct unit * u);
2001-01-25 10:37:55 +01:00
extern int lifestyle(const struct unit*);
extern int besieged(const struct unit * u);
extern int maxworkingpeasants(const struct region * r);
2001-01-25 10:37:55 +01:00
extern int wage(const struct region *r, const struct unit *u, boolean img);
extern int fwage(const struct region *r, const struct faction *f, boolean img);
extern struct region * movewhere(struct region * r, const struct unit *u);
extern boolean move_blocked(const struct unit * u, const struct region *r, direction_t dir);
extern void add_income(struct unit * u, int type, int want, int qty);
extern int month(int offset);
extern const char * basepath(void);
extern const char * resourcepath(void);
extern void kernel_init(void);
extern void kernel_done(void);
2001-01-25 10:37:55 +01:00
extern void reorder_owners(struct region * r);
2002-09-02 22:36:12 +02:00
extern const char *localenames[];
#include <log.h>
2001-01-25 10:37:55 +01:00
#ifdef _MSC_VER
#include <stdafx.h>
#endif
#include "terrain.h" /* f<>r (bald) alte MAXTERRAINS */
/** compatibility: **/
extern race_t old_race(const struct race *);
extern const struct race * new_race[];
/* globale settings des Spieles */
typedef struct settings {
const char *gamename;
const char *welcomepath;
unsigned int maxunits;
struct attrib *attribs;
unsigned int data_version;
unsigned int data_turn;
boolean disabled[MAXKEYWORDS];
struct param * parameters;
} settings;
extern settings global;
extern FILE * updatelog;
extern int produceexp(struct unit * u, skill_t sk, int n);
2002-10-13 13:08:04 +02:00
extern boolean sqlpatch;
2002-11-02 18:24:41 +01:00
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 int NMRTimeout(void);
extern int LongHunger(void);
extern boolean TradeDisabled(void);
extern int SkillCap(skill_t sk);
#ifdef __cplusplus
}
#endif
2001-01-25 10:37:55 +01:00
#endif