save game id in the data file, not name of XML file

This commit is contained in:
Enno Rehling 2014-07-23 11:54:51 +02:00
parent 51207167c8
commit 2bec7e2bbe
18 changed files with 3573 additions and 3464 deletions

View File

@ -6,11 +6,11 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../server/core/res/" />
rewritePrefix="../../core/res/" />
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../server/res/eressea/" />
rewritePrefix="../../res/eressea/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../server/res/" />
rewritePrefix="../../res/" />
</catalog>

View File

@ -97,6 +97,8 @@
<param name="rules.check_overload" value="0"/>
<param name="rules.limit.faction" value="2500"/>
<param name="rules.maxskills.magic" value="5"/>
<param name="game.id" value="2"/>
<param name="game.name" value="Eressea"/>
</game>
<strings>
<string name="mailto">

View File

@ -6,11 +6,11 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../server/core/res/" />
rewritePrefix="../../core/res/" />
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../server/res/e3a/" />
rewritePrefix="../../res/e3a/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../server/res/" />
rewritePrefix="../../res/" />
</catalog>

View File

@ -158,6 +158,8 @@
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
<param name="game.id" value="3"/>
<param name="game.name" value="E3"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>

View File

@ -6,11 +6,11 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
rewritePrefix="../server/core/res/" />
rewritePrefix="../../core/res/" />
<rewriteURI
uriStartString="config:///game/"
rewritePrefix="../server/res/e3a/" />
rewritePrefix="../../res/e3a/" />
<rewriteURI
uriStartString="config:///default/"
rewritePrefix="../server/res/" />
rewritePrefix="../../res/" />
</catalog>

View File

@ -159,6 +159,8 @@
<param name="movement.shipspeed.skillbonus" value="6"/>
<param name="alliance.auto" value="fight"/>
<param name="alliance.restricted" value="fight"/>
<param name="game.id" value="4"/>
<param name="game.name" value="Deveron"/>
</game>
<rules>
<function name="wage" value="minimum_wage"/>

15
conf/eressea.ini Normal file
View File

@ -0,0 +1,15 @@
[eressea]
base = .
report = reports
verbose = 0
lomem = 0
debug = 0
memcheck = 0
locales = de,en
[config]
source_dir = ../server
maxnmrs = 20
[editor]
color = 1

View File

@ -24,72 +24,72 @@ without prior permission by the authors of Eressea.
extern int db_update_factions(sqlite3 * db, bool force, int game);
static int tolua_db_update_factions(lua_State * L)
{
sqlite3 *db = (sqlite3 *) tolua_tousertype(L, 1, 0);
db_update_factions(db, tolua_toboolean(L, 2, 0), global.game_id);
return 0;
sqlite3 *db = (sqlite3 *)tolua_tousertype(L, 1, 0);
db_update_factions(db, tolua_toboolean(L, 2, 0), game_id());
return 0;
}
extern int db_update_scores(sqlite3 * db, bool force);
static int tolua_db_update_scores(lua_State * L)
{
sqlite3 *db = (sqlite3 *) tolua_tousertype(L, 1, 0);
db_update_scores(db, tolua_toboolean(L, 2, 0));
return 0;
sqlite3 *db = (sqlite3 *)tolua_tousertype(L, 1, 0);
db_update_scores(db, tolua_toboolean(L, 2, 0));
return 0;
}
static int tolua_db_execute(lua_State * L)
{
sqlite3 *db = (sqlite3 *) tolua_tousertype(L, 1, 0);
const char *sql = tolua_tostring(L, 2, 0);
sqlite3 *db = (sqlite3 *)tolua_tousertype(L, 1, 0);
const char *sql = tolua_tostring(L, 2, 0);
int res = sqlite3_exec(db, sql, 0, 0, 0);
int res = sqlite3_exec(db, sql, 0, 0, 0);
tolua_pushnumber(L, (LUA_NUMBER) res);
return 1;
tolua_pushnumber(L, (LUA_NUMBER)res);
return 1;
}
static int tolua_db_close(lua_State * L)
{
sqlite3 *db = (sqlite3 *) tolua_tousertype(L, 1, 0);
sqlite3_close(db);
return 0;
sqlite3 *db = (sqlite3 *)tolua_tousertype(L, 1, 0);
sqlite3_close(db);
return 0;
}
static int tolua_db_create(lua_State * L)
{
sqlite3 *db;
const char *dbname = tolua_tostring(L, 1, 0);
int result = sqlite3_open_v2(dbname, &db, SQLITE_OPEN_READWRITE, 0);
if (result == SQLITE_OK) {
tolua_pushusertype(L, (void *)db, LTYPE_DB);
return 1;
}
return 0;
sqlite3 *db;
const char *dbname = tolua_tostring(L, 1, 0);
int result = sqlite3_open_v2(dbname, &db, SQLITE_OPEN_READWRITE, 0);
if (result == SQLITE_OK) {
tolua_pushusertype(L, (void *)db, LTYPE_DB);
return 1;
}
return 0;
}
int tolua_sqlite_open(lua_State * L)
{
/* register user types */
/* register user types */
tolua_usertype(L, LTYPE_DB);
tolua_usertype(L, LTYPE_DB);
tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL);
{
tolua_cclass(L, LTYPE_DB, LTYPE_DB, TOLUA_CAST "", NULL);
tolua_beginmodule(L, LTYPE_DB);
tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL);
{
tolua_function(L, TOLUA_CAST "open", &tolua_db_create);
tolua_function(L, TOLUA_CAST "close", &tolua_db_close);
tolua_cclass(L, LTYPE_DB, LTYPE_DB, TOLUA_CAST "", NULL);
tolua_beginmodule(L, LTYPE_DB);
{
tolua_function(L, TOLUA_CAST "open", &tolua_db_create);
tolua_function(L, TOLUA_CAST "close", &tolua_db_close);
tolua_function(L, TOLUA_CAST "update_factions",
&tolua_db_update_factions);
tolua_function(L, TOLUA_CAST "update_scores", &tolua_db_update_scores);
tolua_function(L, TOLUA_CAST "execute", &tolua_db_execute);
}
tolua_endmodule(L);
tolua_function(L, TOLUA_CAST "update_factions",
&tolua_db_update_factions);
tolua_function(L, TOLUA_CAST "update_scores", &tolua_db_update_scores);
tolua_function(L, TOLUA_CAST "execute", &tolua_db_execute);
}
tolua_endmodule(L);
}
tolua_endmodule(L);
return 0;
return 0;
}

View File

@ -1490,7 +1490,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
fprintf(F, "\"%s\";locale\n", locale_name(f->locale));
fprintf(F, "%d;noskillpoints\n", 1);
fprintf(F, "%ld;date\n", ctx->report_time);
fprintf(F, "\"%s\";Spiel\n", global.gamename);
fprintf(F, "\"%s\";Spiel\n", game_name());
fprintf(F, "\"%s\";Konfiguration\n", "Standard");
fprintf(F, "\"%s\";Koordinaten\n", "Hex");
fprintf(F, "%d;Basis\n", 36);

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@ -23,13 +23,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
extern "C" {
#endif
/* this should always be the first thing included after platform.h */
/* this should always be the first thing included after platform.h */
#include "types.h"
struct _dictionary_;
struct critbit_tree;
/* experimental gameplay features (that don't affect the savefile) */
/* TODO: move these settings to settings.h or into configuration files */
struct _dictionary_;
struct critbit_tree;
/* experimental gameplay features (that don't affect the savefile) */
/* TODO: move these settings to settings.h or into configuration files */
#define GOBLINKILL /* Goblin-Spezialklau kann tödlich enden */
#define HERBS_ROT /* herbs owned by units have a chance to rot. */
#define SHIPDAMAGE /* Schiffsbeschädigungen */
@ -38,7 +38,7 @@ extern "C" {
#define ALLIED(f1, f2) (f1==f2 || (f1->alliance && f1->alliance==f2->alliance))
/* for some good prime numbers, check http://www.math.niu.edu/~rusin/known-math/98/pi_x */
/* for some good prime numbers, check http://www.math.niu.edu/~rusin/known-math/98/pi_x */
#ifndef MAXREGIONS
# define MAXREGIONS 524287 /* must be prime for hashing. 262139 was a little small */
#endif
@ -52,23 +52,23 @@ extern "C" {
#define PEASANTFORCE 0.75 /* Chance einer Vermehrung trotz 90% Auslastung */
#define HERBROTCHANCE 5 /* Verrottchance für Kräuter (ifdef HERBS_ROT) */
/* Gebäudegröße = Minimalbelagerer */
/* Gebäudegröße = Minimalbelagerer */
#define SIEGEFACTOR 2
/** Magic */
/** Magic */
#define MAXMAGICIANS 3
#define MAXALCHEMISTS 3
/** Plagues **/
/** Plagues **/
#define PLAGUE_CHANCE 0.1F /* Seuchenwahrscheinlichkeit (siehe plagues()) */
#define PLAGUE_VICTIMS 0.2F /* % Betroffene */
#define PLAGUE_HEALCHANCE 0.25F /* Wahrscheinlichkeit Heilung */
#define PLAGUE_HEALCOST 30 /* Heilkosten */
/* Chance of a monster attack */
/* Chance of a monster attack */
#define MONSTERATTACK 0.4F
/* Bewegungsweiten: */
/* Bewegungsweiten: */
#define BP_WALKING 4
#define BP_RIDING 6
#define BP_UNICORN 9
@ -80,10 +80,10 @@ extern "C" {
#define PERSON_WEIGHT 1000 /* weight of a "normal" human unit */
#define STAMINA_AFFECTS_HP 1<<0
/**
* Hier endet der Teil von config.h, der die defines für die
* Spielwelt Eressea enthält, und beginnen die allgemeinen Routinen
*/
/**
* Hier endet der Teil von config.h, der die defines für die
* Spielwelt Eressea enthält, und beginnen die allgemeinen Routinen
*/
#define ENCCHANCE 10 /* %-Chance für einmalige Zufallsbegegnung */
@ -92,75 +92,67 @@ extern "C" {
#define IDSIZE 16 /* max. Länge einer no (als String), incl trailing 0 */
#define KEYWORDSIZE 16 /* max. Länge eines Keyword, incl trailing 0 */
#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ückgegeben werden. ohne die 0 */
#define BAGCAPACITY 20000 /* soviel paßt in einen Bag of Holding */
#define STRENGTHCAPACITY 50000 /* zusätzliche Tragkraft beim Kraftzauber (deprecated) */
#define STRENGTHMULTIPLIER 50 /* multiplier for trollbelt */
/* ----------------- Befehle ----------------------------------- */
/* ----------------- Befehle ----------------------------------- */
extern const char *parameters[MAXPARAMS];
/** report options **/
#define want(option) (1<<option)
extern const char *options[MAXOPTIONS];
/* ------------------------------------------------------------- */
void add_translation(struct critbit_tree **cb, const char *str, int i);
void init_translations(const struct locale *lang, int ut, const char * (*string_cb)(int i), int maxstrings);
void init_locales(void);
int shipspeed(const struct ship *sh, const struct unit *u);
/* ------------------------------------------------------------- */
void add_translation(struct critbit_tree **cb, const char *str, int i);
void init_translations(const struct locale *lang, int ut, const char * (*string_cb)(int i), int maxstrings);
void init_locales(void);
int shipspeed(const struct ship *sh, const struct unit *u);
#define i2b(i) ((bool)((i)?(true):(false)))
void remove_empty_units_in_region(struct region *r);
void remove_empty_units(void);
void remove_empty_factions(void);
void remove_empty_units_in_region(struct region *r);
void remove_empty_units(void);
void remove_empty_factions(void);
typedef struct strlist {
struct strlist *next;
char *s;
} strlist;
typedef struct strlist {
struct strlist *next;
char *s;
} strlist;
#define fval(u, i) ((u)->flags & (i))
#define fset(u, i) ((u)->flags |= (i))
#define freset(u, i) ((u)->flags &= ~(i))
extern int turn;
extern int verbosity;
/* parteinummern */
bool faction_id_is_unused(int);
/* parteinummern */
bool faction_id_is_unused(int);
int max_magicians(const struct faction * f);
/* leuchtturm */
bool check_leuchtturm(struct region *r, struct faction *f);
void update_lighthouse(struct building *lh);
int lighthouse_range(const struct building *b,
const struct faction *f);
int max_magicians(const struct faction * f);
/* leuchtturm */
bool check_leuchtturm(struct region *r, struct faction *f);
void update_lighthouse(struct building *lh);
int lighthouse_range(const struct building *b,
const struct faction *f);
int findoption(const char *s, const struct locale *lang);
int findoption(const char *s, const struct locale *lang);
/* special units */
void make_undead_unit(struct unit *);
/* special units */
void make_undead_unit(struct unit *);
void addstrlist(strlist ** SP, const char *s);
void addstrlist(strlist ** SP, const char *s);
int armedmen(const struct unit *u, bool siege_weapons);
int armedmen(const struct unit *u, bool siege_weapons);
unsigned int atoip(const char *s);
unsigned int getuint(void);
int getint(void);
unsigned int atoip(const char *s);
unsigned int getuint(void);
int getint(void);
const char *igetstrtoken(const char *s);
const char *igetstrtoken(const char *s);
param_t findparam(const char *s, const struct locale *lang);
param_t findparam_ex(const char *s, const struct locale * lang);
bool isparam(const char *s, const struct locale * lang, param_t param);
param_t getparam(const struct locale *lang);
param_t findparam(const char *s, const struct locale *lang);
param_t findparam_ex(const char *s, const struct locale * lang);
bool isparam(const char *s, const struct locale * lang, param_t param);
param_t getparam(const struct locale *lang);
int getid(void);
int getid(void);
#define unitid(x) itoa36((x)->no)
#define getshipid() getid()
@ -171,85 +163,86 @@ int max_magicians(const struct faction * f);
#define factionid(x) itoa36((x)->no)
#define curseid(x) itoa36((x)->no)
bool cansee(const struct faction *f, const struct region *r,
const struct unit *u, int modifier);
bool cansee_durchgezogen(const struct faction *f, const struct region *r,
const struct unit *u, int modifier);
bool cansee_unit(const struct unit *u, const struct unit *target,
int modifier);
bool seefaction(const struct faction *f, const struct region *r,
const struct unit *u, int modifier);
bool cansee(const struct faction *f, const struct region *r,
const struct unit *u, int modifier);
bool cansee_durchgezogen(const struct faction *f, const struct region *r,
const struct unit *u, int modifier);
bool cansee_unit(const struct unit *u, const struct unit *target,
int modifier);
bool seefaction(const struct faction *f, const struct region *r,
const struct unit *u, int modifier);
int lovar(double xpct_x2);
/* returns a value between [0..xpct_2], generated with two dice */
const char * game_name(void);
int game_id(void);
int lovar(double xpct_x2);
/* returns a value between [0..xpct_2], generated with two dice */
int distribute(int old, int new_value, int n);
void init_locales(void);
int distribute(int old, int new_value, int n);
void init_locales(void);
int newunitid(void);
int forbiddenid(int id);
int newcontainerid(void);
int newunitid(void);
int forbiddenid(int id);
int newcontainerid(void);
struct unit *createunit(struct region *r, struct faction *f,
int number, const struct race *rc);
void create_unitid(struct unit *u, int id);
extern bool getunitpeasants;
struct unit *getunitg(const struct region *r, const struct faction *f);
struct unit *getunit(const struct region *r, const struct faction *f);
struct unit *createunit(struct region *r, struct faction *f,
int number, const struct race *rc);
void create_unitid(struct unit *u, int id);
struct unit *getunitg(const struct region *r, const struct faction *f);
struct unit *getunit(const struct region *r, const struct faction *f);
int read_unitid(const struct faction *f, const struct region *r);
int read_unitid(const struct faction *f, const struct region *r);
int alliedunit(const struct unit *u, const struct faction *f2,
int mode);
int alliedfaction(const struct plane *pl, const struct faction *f,
const struct faction *f2, int mode);
int alliedgroup(const struct plane *pl, const struct faction *f,
const struct faction *f2, const struct ally *sf, int mode);
int alliedunit(const struct unit *u, const struct faction *f2,
int mode);
int alliedfaction(const struct plane *pl, const struct faction *f,
const struct faction *f2, int mode);
int alliedgroup(const struct plane *pl, const struct faction *f,
const struct faction *f2, const struct ally *sf, int mode);
struct faction *findfaction(int n);
struct faction *getfaction(void);
struct faction *findfaction(int n);
struct faction *getfaction(void);
struct unit *findunitg(int n, const struct region *hint);
struct unit *findunit(int n);
struct unit *findunitg(int n, const struct region *hint);
struct unit *findunit(int n);
struct unit *findunitr(const struct region *r, int n);
struct region *findunitregion(const struct unit *su);
struct unit *findunitr(const struct region *r, int n);
struct region *findunitregion(const struct unit *su);
char *estring(const char *s);
char *estring_i(char *s);
char *cstring(const char *s);
char *cstring_i(char *s);
const char *unitname(const struct unit *u);
char *write_unitname(const struct unit *u, char *buffer, size_t size);
char *estring(const char *s);
char *estring_i(char *s);
char *cstring(const char *s);
char *cstring_i(char *s);
const char *unitname(const struct unit *u);
char *write_unitname(const struct unit *u, char *buffer, size_t size);
typedef int (*cmp_building_cb) (const struct building * b,
const struct building * a);
struct building *largestbuilding(const struct region *r, cmp_building_cb,
bool imaginary);
int cmp_wage(const struct building *b, const struct building *bother);
int cmp_taxes(const struct building *b, const struct building *bother);
int cmp_current_owner(const struct building *b,
const struct building *bother);
typedef int(*cmp_building_cb) (const struct building * b,
const struct building * a);
struct building *largestbuilding(const struct region *r, cmp_building_cb,
bool imaginary);
int cmp_wage(const struct building *b, const struct building *bother);
int cmp_taxes(const struct building *b, const struct building *bother);
int cmp_current_owner(const struct building *b,
const struct building *bother);
#define TAX_ORDER 0x00
#define TAX_OWNER 0x01
int rule_auto_taxation(void);
int rule_transfermen(void);
int rule_region_owners(void);
int rule_stealth_faction(void);
int rule_auto_taxation(void);
int rule_transfermen(void);
int rule_region_owners(void);
int rule_stealth_faction(void);
#define HARVEST_WORK 0x00
#define HARVEST_TAXES 0x01
int rule_blessed_harvest(void);
int rule_give(void);
int rule_alliance_limit(void);
int rule_faction_limit(void);
int rule_blessed_harvest(void);
int rule_give(void);
int rule_alliance_limit(void);
int rule_faction_limit(void);
#define COUNT_MONSTERS 0x01
#define COUNT_MIGRANTS 0x02
#define COUNT_DEFAULT 0x04
#define COUNT_ALL 0x07
#define COUNT_UNITS 0x10
int count_faction(const struct faction * f, int flags);
int count_migrants(const struct faction * f);
int count_maxmigrants(const struct faction * f);
@ -262,166 +255,159 @@ int max_magicians(const struct faction * f);
int eff_stealth(const struct unit *u, const struct region *r);
int ispresent(const struct faction *f, const struct region *r);
int check_option(struct faction *f, int option);
int check_option(struct faction *f, int option);
/* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine,
* sonst großes Unglück. Durch asserts an ein paar Stellen abgesichert. */
void verify_data(void);
/* Anzahl Personen in einer Einheit festlegen. NUR (!) mit dieser Routine,
* sonst großes Unglück. Durch asserts an ein paar Stellen abgesichert. */
void verify_data(void);
void freestrlist(strlist * s);
void freestrlist(strlist * s);
int change_hitpoints(struct unit *u, int value);
int change_hitpoints(struct unit *u, int value);
int weight(const struct unit *u);
void changeblockchaos(void);
int weight(const struct unit *u);
void changeblockchaos(void);
/* intervall, in dem die regionen der partei zu finden sind */
struct region *firstregion(struct faction *f);
struct region *lastregion(struct faction *f);
/* intervall, in dem die regionen der partei zu finden sind */
struct region *firstregion(struct faction *f);
struct region *lastregion(struct faction *f);
void fhash(struct faction *f);
void funhash(struct faction *f);
void fhash(struct faction *f);
void funhash(struct faction *f);
bool idle(struct faction *f);
bool unit_has_cursed_item(struct unit *u);
bool idle(struct faction *f);
bool unit_has_cursed_item(struct unit *u);
/* simple garbage collection: */
void *gc_add(void *p);
/* simple garbage collection: */
void *gc_add(void *p);
/* grammatik-flags: */
/* grammatik-flags: */
#define GF_NONE 0
/* singular, ohne was dran */
/* singular, ohne was dran */
#define GF_PLURAL 1
/* Angaben in Mehrzahl */
/* Angaben in Mehrzahl */
#define GF_ARTICLE 8
/* der, die, eine */
/* der, die, eine */
#define GF_SPECIFIC 16
/* der, die, das vs. ein, eine */
/* der, die, das vs. ein, eine */
#define GF_DETAILED 32
/* mehr Informationen. z.b. straße zu 50% */
/* mehr Informationen. z.b. straße zu 50% */
#define GF_PURE 64
/* untranslated */
/* untranslated */
#define GUARD_NONE 0
#define GUARD_TAX 1
/* Verhindert Steuereintreiben */
/* Verhindert Steuereintreiben */
#define GUARD_MINING 2
/* Verhindert Bergbau */
/* Verhindert Bergbau */
#define GUARD_TREES 4
/* Verhindert Waldarbeiten */
/* Verhindert Waldarbeiten */
#define GUARD_TRAVELTHRU 8
/* Blockiert Durchreisende */
/* Blockiert Durchreisende */
#define GUARD_LANDING 16
/* Verhindert Ausstieg + Weiterreise */
/* Verhindert Ausstieg + Weiterreise */
#define GUARD_CREWS 32
/* Verhindert Unterhaltung auf Schiffen */
/* Verhindert Unterhaltung auf Schiffen */
#define GUARD_RECRUIT 64
/* Verhindert Rekrutieren */
/* Verhindert Rekrutieren */
#define GUARD_PRODUCE 128
/* Verhindert Abbau von Resourcen mit RTF_LIMITED */
/* Verhindert Abbau von Resourcen mit RTF_LIMITED */
#define GUARD_ALL 0xFFFF
void setstatus(struct unit *u, int status);
/* !< sets combatstatus of a unit */
void setguard(struct unit *u, unsigned int flags);
/* !< setzt die guard-flags der Einheit */
unsigned int getguard(const struct unit *u);
/* liest die guard-flags der Einheit */
void guard(struct unit *u, unsigned int mask);
/* Einheit setzt "BEWACHE", rassenspezifzisch.
* 'mask' kann einzelne flags zusätzlich und-maskieren.
*/
unsigned int guard_flags(const struct unit *u);
void setstatus(struct unit *u, int status);
/* !< sets combatstatus of a unit */
void setguard(struct unit *u, unsigned int flags);
/* !< setzt die guard-flags der Einheit */
unsigned int getguard(const struct unit *u);
/* liest die guard-flags der Einheit */
void guard(struct unit *u, unsigned int mask);
/* Einheit setzt "BEWACHE", rassenspezifzisch.
* 'mask' kann einzelne flags zusätzlich und-maskieren.
*/
unsigned int guard_flags(const struct unit *u);
bool hunger(int number, struct unit *u);
int lifestyle(const struct unit *);
int besieged(const struct unit *u);
int maxworkingpeasants(const struct region *r);
bool has_horses(const struct unit *u);
int markets_module(void);
int wage(const struct region *r, const struct faction *f,
const struct race *rc, int in_turn);
int maintenance_cost(const struct unit *u);
struct message *movement_error(struct unit *u, const char *token,
bool hunger(int number, struct unit *u);
int lifestyle(const struct unit *);
int besieged(const struct unit *u);
int maxworkingpeasants(const struct region *r);
bool has_horses(const struct unit *u);
int markets_module(void);
int wage(const struct region *r, const struct faction *f,
const struct race *rc, int in_turn);
int maintenance_cost(const struct unit *u);
struct message *movement_error(struct unit *u, const char *token,
struct order *ord, int error_code);
bool move_blocked(const struct unit *u, const struct region *src,
const struct region *dest);
void add_income(struct unit *u, int type, int want, int qty);
bool move_blocked(const struct unit *u, const struct region *src,
const struct region *dest);
void add_income(struct unit *u, int type, int want, int qty);
/* movewhere error codes */
enum {
E_MOVE_OK = 0, /* possible to move */
E_MOVE_NOREGION, /* no region exists in this direction */
E_MOVE_BLOCKED /* cannot see this region, there is a blocking connection. */
};
int movewhere(const struct unit *u, const char *token,
/* movewhere error codes */
enum {
E_MOVE_OK = 0, /* possible to move */
E_MOVE_NOREGION, /* no region exists in this direction */
E_MOVE_BLOCKED /* cannot see this region, there is a blocking connection. */
};
int movewhere(const struct unit *u, const char *token,
struct region *r, struct region **resultp);
const char *datapath(void);
void set_datapath(const char *path);
const char *datapath(void);
void set_datapath(const char *path);
const char *basepath(void);
void set_basepath(const char *);
void load_inifile(struct _dictionary_ *d);
const char *basepath(void);
void set_basepath(const char *);
void load_inifile(struct _dictionary_ *d);
const char *reportpath(void);
void set_reportpath(const char *);
const char *reportpath(void);
void set_reportpath(const char *);
void kernel_init(void);
void kernel_done(void);
void kernel_init(void);
void kernel_done(void);
extern const char *localenames[];
/* globale settings des Spieles */
typedef struct settings {
const char *gamename;
struct attrib *attribs;
unsigned int data_turn;
struct param *parameters;
void *vm_state;
float producexpchance;
int cookie;
int game_id;
int data_version; /* TODO: eliminate in favor of gamedata.version */
struct _dictionary_ *inifile;
/* globale settings des Spieles */
typedef struct settings {
const char *gamename;
struct attrib *attribs;
unsigned int data_turn;
struct param *parameters;
void *vm_state;
float producexpchance;
int cookie;
int game_id;
int data_version; /* TODO: eliminate in favor of gamedata.version */
struct _dictionary_ *inifile;
struct global_functions {
int(*wage) (const struct region * r, const struct faction * f,
const struct race * rc, int in_turn);
int(*maintenance) (const struct unit * u);
} functions;
} settings;
struct global_functions {
int (*wage) (const struct region * r, const struct faction * f,
const struct race * rc, int in_turn);
int (*maintenance) (const struct unit * u);
} functions;
} settings;
extern settings global;
typedef struct helpmode {
const char *name;
int status;
} helpmode;
extern bool battledebug;
extern bool sqlpatch;
extern bool lomem; /* save memory */
const char *dbrace(const struct race *rc);
const char *dbrace(const struct race *rc);
void set_param(struct param **p, const char *name, const char *data);
const char *get_param(const struct param *p, const char *name);
int get_param_int(const struct param *p, const char *name, int def);
float get_param_flt(const struct param *p, const char *name, float def);
void set_param(struct param **p, const char *name, const char *data);
const char *get_param(const struct param *p, const char *name);
int get_param_int(const struct param *p, const char *name, int def);
float get_param_flt(const struct param *p, const char *name, float def);
bool ExpensiveMigrants(void);
int NMRTimeout(void);
int LongHunger(const struct unit *u);
int NewbieImmunity(void);
bool IsImmune(const struct faction *f);
int AllianceAuto(void); /* flags that allied factions get automatically */
int AllianceRestricted(void); /* flags restricted to allied factions */
int HelpMask(void); /* flags restricted to allied factions */
struct order *default_order(const struct locale *lang);
int entertainmoney(const struct region *r);
bool ExpensiveMigrants(void);
int NMRTimeout(void);
int LongHunger(const struct unit *u);
int NewbieImmunity(void);
bool IsImmune(const struct faction *f);
int AllianceAuto(void); /* flags that allied factions get automatically */
int AllianceRestricted(void); /* flags restricted to allied factions */
int HelpMask(void); /* flags restricted to allied factions */
struct order *default_order(const struct locale *lang);
int entertainmoney(const struct region *r);
void plagues(struct region *r, bool ismagic);
typedef struct helpmode {
const char *name;
int status;
} helpmode;
extern struct helpmode helpmodes[];
void plagues(struct region *r, bool ismagic);
void free_gamedata(void);
#define GIVE_SELF 1
#define GIVE_PEASANTS 2
@ -432,8 +418,38 @@ int max_magicians(const struct faction * f);
#define GIVE_ALLITEMS (GIVE_GOODS|GIVE_HERBS|GIVE_LUXURIES)
#define GIVE_DEFAULT (GIVE_SELF|GIVE_PEASANTS|GIVE_LUXURIES|GIVE_HERBS|GIVE_GOODS)
extern struct attrib_type at_guard;
void free_gamedata(void);
extern struct attrib_type at_guard;
extern struct helpmode helpmodes[];
extern const char *parameters[];
extern const char *localenames[];
extern settings global;
extern bool battledebug;
extern bool sqlpatch;
extern bool lomem; /* save memory */
extern int turn;
extern int verbosity;
extern bool getunitpeasants;
/** report options **/
extern const char *options[MAXOPTIONS];
extern struct helpmode helpmodes[];
extern const char *parameters[];
extern const char *localenames[];
extern settings global;
extern bool battledebug;
extern bool sqlpatch;
extern bool lomem; /* save memory */
extern int turn;
extern int verbosity;
extern bool getunitpeasants;
/** report options **/
extern const char *options[MAXOPTIONS];
#ifdef __cplusplus
}

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,6 @@ extern "C" {
/* Versionsänderungen: */
extern int data_version;
extern const char *game_name;
extern int enc_gamedata;
extern int current_turn(void);

View File

@ -71,8 +71,9 @@
#define SPELLBOOK_VERSION 340 /* turn 775, full spellbooks are stored for factions */
#define NOOVERRIDE_VERSION 341 /* turn 775, full spellbooks are stored for factions */
#define INTFLAGS_VERSION 342 /* turn 876, FFL_NPC is now bit 25, flags is an int */
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
#define MIN_VERSION CURSETYPE_VERSION /* minimal datafile we support */
#define RELEASE_VERSION INTFLAGS_VERSION /* current datafile */
#define RELEASE_VERSION SAVEGAMEID_VERSION /* current datafile */
#define STREAM_VERSION 2 /* internal encoding of binary files */

View File

@ -59,13 +59,7 @@ static void parse_config(const char *filename)
/* only one value in the [editor] section */
force_color = iniparser_getint(d, "editor:color", force_color);
#endif
/* excerpt from [config] (the rest is used in bindings.c) */
game_name = iniparser_getstring(d, "config:game", game_name);
}
else {
log_error("could not open configuration file %s\n", filename);
}
global.inifile = d;
}
static int usage(const char *prog, const char *arg)
@ -109,7 +103,7 @@ static int parse_args(int argc, char **argv, int *exitcode)
printf("\n%s PBEM host\n"
"Copyright (C) 1996-2005 C. Schlittchen, K. Zedel, E. Rehling, H. Peters.\n\n"
"Compilation: " __DATE__ " at " __TIME__ "\nVersion: %d.%d.%d\n\n",
global.gamename, VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
game_name(), VERSION_MAJOR, VERSION_MINOR, VERSION_BUILD);
#ifdef USE_CURSES
}
else if (strcmp(argv[i] + 2, "color") == 0) {
@ -261,12 +255,13 @@ int main(int argc, char **argv)
return err;
}
/* ini file sets defaults for arguments*/
if (confpath) {
parse_config(inifile);
if (!global.inifile && confpath) {
_snprintf(inipath, sizeof(inipath), "%s/%s", confpath, inifile);
parse_config(inipath);
}
else {
parse_config(inifile);
if (!global.inifile) {
log_error("could not open ini configuration %s\n", inifile);
}
/* parse arguments again, to override ini file */
parse_args(argc, argv, &err);

View File

@ -2119,7 +2119,7 @@ report_plaintext(const char *filename, report_context * ctx,
}
strftime(pzTime, 64, "%A, %d. %B %Y, %H:%M", localtime(&ctx->report_time));
m = msg_message("nr_header_date", "game date", global.gamename, pzTime);
m = msg_message("nr_header_date", "game date", game_name(), pzTime);
nr_render(m, f->locale, buf, sizeof(buf), f);
msg_release(m);
centre(F, buf, true);

View File

@ -15,8 +15,8 @@
extern "C" {
#endif
extern void register_nr(void);
extern void report_cleanup(void);
void register_nr(void);
void report_cleanup(void);
#ifdef __cplusplus
}

View File

@ -161,7 +161,7 @@ void report_summary(summary * s, summary * o, bool full)
}
#endif
printf("Schreibe Zusammenfassung (parteien)...\n");
fprintf(F, "%s\n%s\n\n", global.gamename, gamedate2(default_locale));
fprintf(F, "%s\n%s\n\n", game_name(), gamedate2(default_locale));
fprintf(F, "Auswertung Nr: %d\n\n", turn);
fprintf(F, "Parteien: %s\n", pcomp(s->factions, o->factions));
fprintf(F, "Einheiten: %s\n", pcomp(s->nunits, o->nunits));