forked from github/server
declutter config.h, use it sparingly.
This commit is contained in:
parent
f371a0c5f3
commit
cbb18edb8f
|
@ -19,7 +19,6 @@ without prior permission by the authors of Eressea.
|
||||||
|
|
||||||
#include <kernel/alliance.h>
|
#include <kernel/alliance.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/config.h>
|
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
|
@ -38,6 +37,23 @@ without prior permission by the authors of Eressea.
|
||||||
#include <tolua.h>
|
#include <tolua.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
typedef struct helpmode {
|
||||||
|
const char *name;
|
||||||
|
int status;
|
||||||
|
} helpmode;
|
||||||
|
|
||||||
|
static helpmode helpmodes[] = {
|
||||||
|
{ "all", HELP_ALL },
|
||||||
|
{ "money", HELP_MONEY },
|
||||||
|
{ "fight", HELP_FIGHT },
|
||||||
|
{ "observe", HELP_OBSERVE },
|
||||||
|
{ "give", HELP_GIVE },
|
||||||
|
{ "guard", HELP_GUARD },
|
||||||
|
{ "stealth", HELP_FSTEALTH },
|
||||||
|
{ "travel", HELP_TRAVEL },
|
||||||
|
{ NULL, 0 }
|
||||||
|
};
|
||||||
|
|
||||||
int tolua_factionlist_next(lua_State * L)
|
int tolua_factionlist_next(lua_State * L)
|
||||||
{
|
{
|
||||||
faction **faction_ptr = (faction **)lua_touserdata(L, lua_upvalueindex(1));
|
faction **faction_ptr = (faction **)lua_touserdata(L, lua_upvalueindex(1));
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
|
||||||
|
|
||||||
#include "spells.h"
|
#include "spells.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
|
|
|
@ -11,7 +11,6 @@ without prior permission by the authors of Eressea.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
|
||||||
#include "bind_storage.h"
|
#include "bind_storage.h"
|
||||||
|
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
|
|
29
src/chaos.c
29
src/chaos.c
|
@ -85,7 +85,7 @@ static const terrain_type *chaosterrain(void)
|
||||||
if (numtypes == 0) {
|
if (numtypes == 0) {
|
||||||
const terrain_type *terrain;
|
const terrain_type *terrain;
|
||||||
for (terrain = terrains(); terrain != NULL; terrain = terrain->next) {
|
for (terrain = terrains(); terrain != NULL; terrain = terrain->next) {
|
||||||
if (fval(terrain, LAND_REGION) && terrain->herbs) {
|
if ((terrain->flags & LAND_REGION) && terrain->herbs) {
|
||||||
++numtypes;
|
++numtypes;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ static const terrain_type *chaosterrain(void)
|
||||||
types = malloc(sizeof(terrain_type *) * numtypes);
|
types = malloc(sizeof(terrain_type *) * numtypes);
|
||||||
numtypes = 0;
|
numtypes = 0;
|
||||||
for (terrain = terrains(); terrain != NULL; terrain = terrain->next) {
|
for (terrain = terrains(); terrain != NULL; terrain = terrain->next) {
|
||||||
if (fval(terrain, LAND_REGION) && terrain->herbs) {
|
if ((terrain->flags & LAND_REGION) && terrain->herbs) {
|
||||||
types[numtypes++] = terrain;
|
types[numtypes++] = terrain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ static void chaos(region * r)
|
||||||
if (rng_int() % 100 < 8) {
|
if (rng_int() % 100 < 8) {
|
||||||
switch (rng_int() % 3) {
|
switch (rng_int() % 3) {
|
||||||
case 0: /* Untote */
|
case 0: /* Untote */
|
||||||
if (!fval(r->terrain, SEA_REGION)) {
|
if (!(r->terrain->flags & SEA_REGION)) {
|
||||||
unit *u = random_unit(r);
|
unit *u = random_unit(r);
|
||||||
if (u && playerrace(u_race(u))) {
|
if (u && playerrace(u_race(u))) {
|
||||||
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
|
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
|
||||||
|
@ -161,29 +161,28 @@ static void chaos(region * r)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
mfac = 500;
|
mfac = 500;
|
||||||
u =
|
u = create_unit(r, get_monsters(), rng_int() % 4 + 1,
|
||||||
create_unit(r, get_monsters(), rng_int() % 4 + 1,
|
|
||||||
get_race(RC_DRAGON), 0, NULL, NULL);
|
get_race(RC_DRAGON), 0, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mfac = 1000;
|
mfac = 1000;
|
||||||
u =
|
u = create_unit(r, get_monsters(), rng_int() % 2 + 1,
|
||||||
create_unit(r, get_monsters(), rng_int() % 2 + 1,
|
|
||||||
get_race(RC_WYRM), 0, NULL, NULL);
|
get_race(RC_WYRM), 0, NULL, NULL);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (mfac)
|
if (mfac) {
|
||||||
set_money(u, u->number * (rng_int() % mfac));
|
set_money(u, u->number * (rng_int() % mfac));
|
||||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
}
|
||||||
|
u->flags |= (UFL_ISNEW | UFL_MOVED);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 2: /* Terrainveränderung */
|
case 2: /* Terrainver<EFBFBD>nderung */
|
||||||
if (!fval(r->terrain, FORBIDDEN_REGION)) {
|
if (!(r->terrain->flags & FORBIDDEN_REGION)) {
|
||||||
if (!fval(r->terrain, SEA_REGION)) {
|
if (!(r->terrain->flags & SEA_REGION)) {
|
||||||
direction_t dir;
|
direction_t dir;
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
||||||
region *rn = rconnect(r, dir);
|
region *rn = rconnect(r, dir);
|
||||||
if (rn && fval(rn->terrain, SEA_REGION))
|
if (rn && (rn->terrain->flags & SEA_REGION))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dir != MAXDIRECTIONS) {
|
if (dir != MAXDIRECTIONS) {
|
||||||
|
@ -224,7 +223,7 @@ static void chaos(region * r)
|
||||||
direction_t dir;
|
direction_t dir;
|
||||||
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
for (dir = 0; dir != MAXDIRECTIONS; ++dir) {
|
||||||
region *rn = rconnect(r, dir);
|
region *rn = rconnect(r, dir);
|
||||||
if (rn && fval(rn->terrain, SEA_REGION))
|
if (rn && (rn->terrain->flags & SEA_REGION))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (dir != MAXDIRECTIONS) {
|
if (dir != MAXDIRECTIONS) {
|
||||||
|
@ -242,7 +241,7 @@ void chaos_update(void) {
|
||||||
for (r = regions; r; r = r->next) {
|
for (r = regions; r; r = r->next) {
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (fval(r, RF_CHAOTIC)) {
|
if ((r->flags & RF_CHAOTIC)) {
|
||||||
chaos(r);
|
chaos(r);
|
||||||
}
|
}
|
||||||
i = get_chaoscount(r);
|
i = get_chaoscount(r);
|
||||||
|
|
|
@ -105,26 +105,6 @@ FILE *logfile;
|
||||||
bool battledebug = false;
|
bool battledebug = false;
|
||||||
int turn = -1;
|
int turn = -1;
|
||||||
|
|
||||||
helpmode helpmodes[] = {
|
|
||||||
{ "all", HELP_ALL }
|
|
||||||
,
|
|
||||||
{ "money", HELP_MONEY }
|
|
||||||
,
|
|
||||||
{ "fight", HELP_FIGHT }
|
|
||||||
,
|
|
||||||
{ "observe", HELP_OBSERVE }
|
|
||||||
,
|
|
||||||
{ "give", HELP_GIVE }
|
|
||||||
,
|
|
||||||
{ "guard", HELP_GUARD }
|
|
||||||
,
|
|
||||||
{ "stealth", HELP_FSTEALTH }
|
|
||||||
,
|
|
||||||
{ "travel", HELP_TRAVEL }
|
|
||||||
,
|
|
||||||
{ NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *parameters[MAXPARAMS] = {
|
const char *parameters[MAXPARAMS] = {
|
||||||
"LOCALE",
|
"LOCALE",
|
||||||
"ALLES",
|
"ALLES",
|
||||||
|
@ -148,7 +128,7 @@ const char *parameters[MAXPARAMS] = {
|
||||||
"TEMP",
|
"TEMP",
|
||||||
"FLIEHE",
|
"FLIEHE",
|
||||||
"GEBAEUDE",
|
"GEBAEUDE",
|
||||||
"GIB", /* Für HELFE */
|
"GIB", /* F<EFBFBD>r HELFE */
|
||||||
"KAEMPFE",
|
"KAEMPFE",
|
||||||
"DURCHREISE",
|
"DURCHREISE",
|
||||||
"BEWACHE",
|
"BEWACHE",
|
||||||
|
@ -172,43 +152,6 @@ const char *parameters[MAXPARAMS] = {
|
||||||
"ALLIANZ"
|
"ALLIANZ"
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *report_options[MAX_MSG] = {
|
|
||||||
"Kampf",
|
|
||||||
"Ereignisse",
|
|
||||||
"Bewegung",
|
|
||||||
"Einkommen",
|
|
||||||
"Handel",
|
|
||||||
"Produktion",
|
|
||||||
"Orkvermehrung",
|
|
||||||
"Zauber",
|
|
||||||
"",
|
|
||||||
""
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *message_levels[ML_MAX] = {
|
|
||||||
"Wichtig",
|
|
||||||
"Debug",
|
|
||||||
"Fehler",
|
|
||||||
"Warnungen",
|
|
||||||
"Infos"
|
|
||||||
};
|
|
||||||
|
|
||||||
const char *options[MAXOPTIONS] = {
|
|
||||||
"AUSWERTUNG",
|
|
||||||
"COMPUTER",
|
|
||||||
"ZUGVORLAGE",
|
|
||||||
NULL,
|
|
||||||
"STATISTIK",
|
|
||||||
"DEBUG",
|
|
||||||
"ZIPPED",
|
|
||||||
"ZEITUNG", /* Option hat Sonderbehandlung! */
|
|
||||||
NULL,
|
|
||||||
"ADRESSEN",
|
|
||||||
"BZIP2",
|
|
||||||
"PUNKTE",
|
|
||||||
"SHOWSKCHANGE"
|
|
||||||
};
|
|
||||||
|
|
||||||
FILE *debug;
|
FILE *debug;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -711,8 +654,8 @@ char *_strdup(const char *s)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Lohn bei den einzelnen Burgstufen für Normale Typen, Orks, Bauern,
|
/* Lohn bei den einzelnen Burgstufen f<EFBFBD>r Normale Typen, Orks, Bauern,
|
||||||
* Modifikation für Städter. */
|
* Modifikation f<EFBFBD>r St<EFBFBD>dter. */
|
||||||
|
|
||||||
static const int wagetable[7][4] = {
|
static const int wagetable[7][4] = {
|
||||||
{ 10, 10, 11, -7 }, /* Baustelle */
|
{ 10, 10, 11, -7 }, /* Baustelle */
|
||||||
|
@ -929,7 +872,7 @@ default_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||||
wage = _max(0, wage - 10);
|
wage = _max(0, wage - 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Bei einer Dürre verdient man nur noch ein Viertel */
|
/* Bei einer D<EFBFBD>rre verdient man nur noch ein Viertel */
|
||||||
if (drought_ct) {
|
if (drought_ct) {
|
||||||
curse *c = get_curse(r->attribs, drought_ct);
|
curse *c = get_curse(r->attribs, drought_ct);
|
||||||
if (curse_active(c))
|
if (curse_active(c))
|
||||||
|
@ -953,7 +896,7 @@ minimum_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||||
return default_wage(r, f, rc, in_turn);
|
return default_wage(r, f, rc, in_turn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Gibt Arbeitslohn für entsprechende Rasse zurück, oder für
|
/* Gibt Arbeitslohn f<EFBFBD>r entsprechende Rasse zur<75>ck, oder f<>r
|
||||||
* die Bauern wenn f == NULL. */
|
* die Bauern wenn f == NULL. */
|
||||||
int wage(const region * r, const faction * f, const race * rc, int in_turn)
|
int wage(const region * r, const faction * f, const race * rc, int in_turn)
|
||||||
{
|
{
|
||||||
|
|
|
@ -27,17 +27,12 @@ extern "C" {
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
struct param;
|
struct param;
|
||||||
|
|
||||||
#define DISPLAYSIZE 8192 /* max. Länge einer Beschreibung, incl trailing 0 */
|
#define DISPLAYSIZE 8192 /* max. L<EFBFBD>nge einer Beschreibung, incl trailing 0 */
|
||||||
#define ORDERSIZE (DISPLAYSIZE*2) /* max. length of an order */
|
#define ORDERSIZE (DISPLAYSIZE*2) /* max. length of an order */
|
||||||
#define NAMESIZE 128 /* max. Länge eines Namens, incl trailing 0 */
|
#define NAMESIZE 128 /* max. L<>nge eines Namens, incl trailing 0 */
|
||||||
#define IDSIZE 16 /* max. Länge einer no (als String), incl trailing 0 */
|
#define IDSIZE 16 /* max. L<>nge einer no (als String), incl trailing 0 */
|
||||||
#define OBJECTIDSIZE (NAMESIZE+5+IDSIZE) /* max. Länge der Strings, die
|
#define OBJECTIDSIZE (NAMESIZE+5+IDSIZE) /* max. L<>nge der Strings, die
|
||||||
* von struct unitname, etc. zurückgegeben werden. ohne die 0 */
|
* von struct unitname, etc. zur<EFBFBD>ckgegeben werden. ohne die 0 */
|
||||||
|
|
||||||
/* ----------------- Befehle ----------------------------------- */
|
|
||||||
|
|
||||||
#define want(option) (1<<option)
|
|
||||||
/* ------------------------------------------------------------- */
|
|
||||||
|
|
||||||
#define i2b(i) ((bool)((i)?(true):(false)))
|
#define i2b(i) ((bool)((i)?(true):(false)))
|
||||||
|
|
||||||
|
@ -110,7 +105,7 @@ struct param;
|
||||||
#define GF_SPECIFIC 16
|
#define GF_SPECIFIC 16
|
||||||
/* der, die, das vs. ein, eine */
|
/* der, die, das vs. ein, eine */
|
||||||
#define GF_DETAILED 32
|
#define GF_DETAILED 32
|
||||||
/* mehr Informationen. z.b. straße zu 50% */
|
/* mehr Informationen. z.b. stra<EFBFBD>e zu 50% */
|
||||||
#define GF_PURE 64
|
#define GF_PURE 64
|
||||||
/* untranslated */
|
/* untranslated */
|
||||||
|
|
||||||
|
@ -144,11 +139,6 @@ struct param;
|
||||||
} functions;
|
} functions;
|
||||||
} settings;
|
} settings;
|
||||||
|
|
||||||
typedef struct helpmode {
|
|
||||||
const char *name;
|
|
||||||
int status;
|
|
||||||
} helpmode;
|
|
||||||
|
|
||||||
void set_param(struct param **p, const char *key, const char *value);
|
void set_param(struct param **p, const char *key, const char *value);
|
||||||
const char *get_param(const struct param *p, const char *key);
|
const char *get_param(const struct param *p, const char *key);
|
||||||
int get_param_int(const struct param *p, const char *key, int def);
|
int get_param_int(const struct param *p, const char *key, int def);
|
||||||
|
@ -173,7 +163,6 @@ struct param;
|
||||||
void free_gamedata(void);
|
void free_gamedata(void);
|
||||||
void free_config(void);
|
void free_config(void);
|
||||||
|
|
||||||
extern struct helpmode helpmodes[];
|
|
||||||
extern const char *parameters[];
|
extern const char *parameters[];
|
||||||
extern const char *localenames[];
|
extern const char *localenames[];
|
||||||
extern settings global;
|
extern settings global;
|
||||||
|
@ -184,8 +173,6 @@ struct param;
|
||||||
extern int turn;
|
extern int turn;
|
||||||
extern bool getunitpeasants;
|
extern bool getunitpeasants;
|
||||||
|
|
||||||
extern const char *options[MAXOPTIONS]; /* report options */
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -42,10 +42,10 @@ extern "C" {
|
||||||
#define FFL_DEFENDER (1<<10)
|
#define FFL_DEFENDER (1<<10)
|
||||||
#define FFL_SELECT (1<<18) /* ehemals f->dh, u->dh, r->dh, etc... */
|
#define FFL_SELECT (1<<18) /* ehemals f->dh, u->dh, r->dh, etc... */
|
||||||
#define FFL_NOAID (1<<21) /* Hilfsflag Kampf */
|
#define FFL_NOAID (1<<21) /* Hilfsflag Kampf */
|
||||||
#define FFL_MARK (1<<23) /* für markierende algorithmen, die das
|
#define FFL_MARK (1<<23) /* f<EFBFBD>r markierende algorithmen, die das
|
||||||
* hinterher auch wieder löschen müssen!
|
* hinterher auch wieder l<EFBFBD>schen m<EFBFBD>ssen!
|
||||||
* (FFL_SELECT muss man vorher initialisieren,
|
* (FFL_SELECT muss man vorher initialisieren,
|
||||||
* FL_MARK hinterher löschen) */
|
* FL_MARK hinterher l<EFBFBD>schen) */
|
||||||
#define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
#define FFL_NOIDLEOUT (1<<24) /* Partei stirbt nicht an NMRs */
|
||||||
#define FFL_NPC (1<<25) /* eine Partei mit Monstern */
|
#define FFL_NPC (1<<25) /* eine Partei mit Monstern */
|
||||||
#define FFL_SAVEMASK (FFL_DEFENDER|FFL_NEWID|FFL_NPC|FFL_NOIDLEOUT|FFL_CURSED)
|
#define FFL_SAVEMASK (FFL_DEFENDER|FFL_NEWID|FFL_NPC|FFL_NOIDLEOUT|FFL_CURSED)
|
||||||
|
@ -101,6 +101,8 @@ extern "C" {
|
||||||
|
|
||||||
extern struct faction *factions;
|
extern struct faction *factions;
|
||||||
|
|
||||||
|
#define want(option) (1<<option)
|
||||||
|
|
||||||
void fhash(struct faction *f);
|
void fhash(struct faction *f);
|
||||||
void funhash(struct faction *f);
|
void funhash(struct faction *f);
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@ extern "C" {
|
||||||
struct spellbook;
|
struct spellbook;
|
||||||
struct unit;
|
struct unit;
|
||||||
struct building;
|
struct building;
|
||||||
|
struct faction;
|
||||||
|
struct region;
|
||||||
struct ship;
|
struct ship;
|
||||||
struct gamedata;
|
struct gamedata;
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,22 @@ const char *coasts[MAXDIRECTIONS] = {
|
||||||
"coast::w"
|
"coast::w"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const char *options[MAXOPTIONS] = {
|
||||||
|
"AUSWERTUNG",
|
||||||
|
"COMPUTER",
|
||||||
|
"ZUGVORLAGE",
|
||||||
|
NULL,
|
||||||
|
"STATISTIK",
|
||||||
|
"DEBUG",
|
||||||
|
"ZIPPED",
|
||||||
|
"ZEITUNG", /* Option hat Sonderbehandlung! */
|
||||||
|
NULL,
|
||||||
|
"ADRESSEN",
|
||||||
|
"BZIP2",
|
||||||
|
"PUNKTE",
|
||||||
|
"SHOWSKCHANGE"
|
||||||
|
};
|
||||||
|
|
||||||
bool omniscient(const faction *f)
|
bool omniscient(const faction *f)
|
||||||
{
|
{
|
||||||
static const race *rc_template, *rc_illusion;
|
static const race *rc_template, *rc_illusion;
|
||||||
|
|
|
@ -43,6 +43,7 @@ extern "C" {
|
||||||
extern bool nocr;
|
extern bool nocr;
|
||||||
extern bool noreports;
|
extern bool noreports;
|
||||||
extern const char *visibility[];
|
extern const char *visibility[];
|
||||||
|
extern const char *options[MAXOPTIONS]; /* report options */
|
||||||
|
|
||||||
void reports_done(void);
|
void reports_done(void);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue