forked from github/server
Deveron is now just E3 with a different name.
remove a lot of duplication. add a -c option to specify a path for eressea.ini
This commit is contained in:
parent
534e5874e9
commit
ae83448e4a
|
@ -1,16 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE catalog
|
||||
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
|
||||
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
|
||||
|
||||
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
|
||||
<rewriteURI
|
||||
uriStartString="config://core/"
|
||||
rewritePrefix="../../res/core/" />
|
||||
<rewriteURI
|
||||
uriStartString="config://game/"
|
||||
rewritePrefix="../../res/e3a/" />
|
||||
<rewriteURI
|
||||
uriStartString="config://default/"
|
||||
rewritePrefix="../../res/" />
|
||||
</catalog>
|
|
@ -1,95 +0,0 @@
|
|||
{
|
||||
"include": [
|
||||
"keywords.json",
|
||||
"prefixes.json",
|
||||
"e3/terrains.json"
|
||||
],
|
||||
"disabled": [
|
||||
"herbalism",
|
||||
"alchemy",
|
||||
"entertainment",
|
||||
"espionage",
|
||||
"perception",
|
||||
"stealth",
|
||||
"taxation",
|
||||
"trade",
|
||||
"besiege",
|
||||
"steal",
|
||||
"buy",
|
||||
"teach",
|
||||
"sabotage",
|
||||
"spy",
|
||||
"tax",
|
||||
"entertain",
|
||||
"sell",
|
||||
"jsreport"
|
||||
],
|
||||
"settings": {
|
||||
"game.name" : "Eressea",
|
||||
"game.id" : 4,
|
||||
"orders.default": "work",
|
||||
"database.gameid": 7,
|
||||
"NewbieImmunity": 4,
|
||||
"modules.astralspace": false,
|
||||
"modules.wormholes": false,
|
||||
"modules.markets": true,
|
||||
"magic.regeneration": 0.75,
|
||||
"magic.power": 0.5,
|
||||
"resource.factor": 0.25,
|
||||
"skills.cost.tactics": 500,
|
||||
"entertain.base": 0,
|
||||
"entertain.perlevel": 20,
|
||||
"nmr.timeout": 5,
|
||||
"nmr.removenewbie": 0,
|
||||
"GiveRestriction": 3,
|
||||
"hunger.long": false,
|
||||
"hunger.damage": "1d9+9",
|
||||
"hunger.demons.skill": true,
|
||||
"hunger.demons.peasant_tolerance": true,
|
||||
"init_spells": 0,
|
||||
"recruit.allow_merge": true,
|
||||
"study.expensivemigrants": true,
|
||||
"study.speedup": 2,
|
||||
"study.produceexp": 12,
|
||||
"world.era": 3,
|
||||
"rules.reserve.twophase": true,
|
||||
"rules.owners.force_leave": false,
|
||||
"rules.transfermen": false,
|
||||
"stealth.faction.other": false,
|
||||
"rules.stealth.anon_battle": false,
|
||||
"rules.check_overload": false,
|
||||
"rules.combat.goblinbonus": 3,
|
||||
"rules.alliances": true,
|
||||
"rules.combat.herospeed": 3,
|
||||
"rules.combat.demon_vampire": 5,
|
||||
"rules.combat.skill_bonus": 0,
|
||||
"rules.combat.nat_armor": 1,
|
||||
"rules.items.loot_divisor": 2,
|
||||
"rules.items.give_divisor": 2,
|
||||
"rules.move.owner_leave": true,
|
||||
"rules.region_owners": true,
|
||||
"rules.cavalry.skill": 2,
|
||||
"rules.cavalry.mode": 1,
|
||||
"rules.magic.multipotion": true,
|
||||
"rules.magic.wol_effect": 5,
|
||||
"rules.magic.factionlist": true,
|
||||
"rules.magic.wol_type": 2,
|
||||
"rules.blessed_harvest.flags": 1,
|
||||
"rules.magic.elfpower": true,
|
||||
"rules.magic.playerschools": "gwyrrd illaun draig cerddor",
|
||||
"rules.build.other_buildings": true,
|
||||
"rules.economy.taxation": 1,
|
||||
"rules.food.flags": 2,
|
||||
"rules.economy.roqf": 5,
|
||||
"rules.economy.herbrot": 0,
|
||||
"rules.region_owner_pay_building": "market harbour lighthouse",
|
||||
"rules.dwarf_castles": true,
|
||||
"rules.limit.faction": 250,
|
||||
"rules.grow.formula": 1,
|
||||
"rules.tactics.formula": 1,
|
||||
"rules.help.mask": "fight guard money give",
|
||||
"movement.shipspeed.skillbonus": 6,
|
||||
"alliance.auto": "fight",
|
||||
"alliance.restricted": "fight"
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?xml version="1.0"?>
|
||||
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||
<xi:include href="config://core/messages.xml"/>
|
||||
<xi:include href="config://core/de/strings.xml"/>
|
||||
<xi:include href="config://core/en/strings.xml"/>
|
||||
<xi:include href="config://core/common/items.xml"/>
|
||||
<xi:include href="config://core/common/herbs.xml" />
|
||||
<xi:include href="config://core/spoils.xml"/>
|
||||
<xi:include href="config://core/common/buildings.xml"/>
|
||||
<xi:include href="config://game/familiars.xml"/>
|
||||
|
||||
<xi:include href="config://default/adamantium.xml" />
|
||||
|
||||
<xi:include href="config://game/ships.xml"/>
|
||||
<xi:include href="config://game/shipnames.xml"/>
|
||||
<xi:include href="config://core/calendar.xml"/>
|
||||
<xi:include href="config://game/items.xml" />
|
||||
<xi:include href="config://game/strings.xml"/>
|
||||
<xi:include href="config://game/messages.xml"/>
|
||||
<xi:include href="config://game/races.xml"/>
|
||||
<xi:include href="config://game/buildings.xml"/>
|
||||
<xi:include href="config://game/equipment.xml"/>
|
||||
<xi:include href="config://game/spells.xml"/>
|
||||
<xi:include href="config://game/luxuries.xml" />
|
||||
<xi:include href="config://game/weapons.xml" />
|
||||
<xi:include href="config://game/armor.xml" />
|
||||
<xi:include href="config://game/resources.xml" />
|
||||
|
||||
<calendar name="thirdage" newyear="month_1" start="1"/>
|
||||
<xi:include href="config://default/names-undead.xml"/>
|
||||
<xi:include href="config://default/names-skeletons.xml"/>
|
||||
<xi:include href="config://default/names-zombies.xml"/>
|
||||
<xi:include href="config://default/names-ghouls.xml"/>
|
||||
<xi:include href="config://default/names-dragons.xml"/>
|
||||
|
||||
<rules>
|
||||
<function name="wage" value="minimum_wage"/>
|
||||
</rules>
|
||||
</eressea>
|
|
@ -15,7 +15,6 @@ cd $ROOT
|
|||
$ROOT/$BUILD/eressea/eressea -v1 scripts/run-tests.lua
|
||||
$ROOT/$BUILD/eressea/eressea -v1 scripts/run-tests-e2.lua
|
||||
$ROOT/$BUILD/eressea/eressea -v1 scripts/run-tests-e3.lua
|
||||
$ROOT/$BUILD/eressea/eressea -v1 scripts/run-tests-e4.lua
|
||||
rm -rf data reports orders.txt score score.alliances datum turn
|
||||
|
||||
cd $OLDWPD
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
require 'eressea.e3.rules'
|
||||
require 'eressea.spells'
|
||||
|
||||
eressea.log.debug("rules for game E4")
|
||||
|
||||
return {
|
||||
require('eressea'),
|
||||
-- require('eressea.markets'),
|
||||
require('eressea.frost'),
|
||||
require('eressea.ents')
|
||||
}
|
|
@ -1,23 +0,0 @@
|
|||
-- Tests that work in E3. With game config of E3.
|
||||
-- Tests are under scripts/test/e3 and all files must be in scripts/test/e3/init.lua
|
||||
|
||||
path = 'scripts'
|
||||
if config.install then
|
||||
path = config.install .. '/' .. path
|
||||
package.path = package.path .. ';' .. config.install .. '/lunit/?.lua'
|
||||
--needed to find lunit if not run form eressea root. Needs right [lua] install setting in eressea.ini (point to eressea root from the start folder)
|
||||
end
|
||||
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||
|
||||
config.rules = 'e4'
|
||||
|
||||
require 'eressea'
|
||||
require 'eressea.path'
|
||||
require 'eressea.xmlconf'
|
||||
require 'tests.e3'
|
||||
require 'lunit'
|
||||
|
||||
eressea.settings.set("rules.alliances", "0")
|
||||
rules = require('eressea.' .. config.rules)
|
||||
result = lunit.main()
|
||||
return result.errors + result.failed
|
|
@ -749,14 +749,19 @@ void config_set_from(const dictionary *d)
|
|||
key[slen] = '.';
|
||||
iniparser_getseckeys(d, sec, keys);
|
||||
for (k=0;k!=nkeys;++k) {
|
||||
const char *val;
|
||||
const char *val, *orig;
|
||||
size_t klen = strlen(keys[k]);
|
||||
assert(klen+slen+1<sizeof(key));
|
||||
memcpy(key+slen+1, keys[k]+slen+1, klen-slen);
|
||||
orig = config_get(key);
|
||||
if (!orig) {
|
||||
val = iniparser_getstring(d, keys[k], NULL);
|
||||
if (val) {
|
||||
config_set(key, val);
|
||||
}
|
||||
} else {
|
||||
log_debug("not overwriting %s=%s with %s", key, orig, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1633,14 +1633,7 @@ int read_game(gamedata *data) {
|
|||
|
||||
READ_INT(store, &gameid);
|
||||
if (gameid != game_id()) {
|
||||
int c;
|
||||
log_warning("game mismatch: datafile contains game %d, but config is for %d", gameid, game_id());
|
||||
printf("WARNING: invalid game id. any key to continue, Ctrl-C to stop\n");
|
||||
c = getchar();
|
||||
if (c == EOF) {
|
||||
log_error("aborting.");
|
||||
abort();
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
|
26
src/main.c
26
src/main.c
|
@ -76,10 +76,20 @@ static void load_inifile(dictionary * d)
|
|||
|
||||
static dictionary *parse_config(const char *filename)
|
||||
{
|
||||
dictionary *d = iniparser_load(filename);
|
||||
char path[MAX_PATH];
|
||||
dictionary *d;
|
||||
const char *cfgpath = config_get("config.path");
|
||||
|
||||
if (cfgpath) {
|
||||
join_path(cfgpath, filename, path, sizeof(path));
|
||||
log_debug("reading from configuration file %s\n", path);
|
||||
d = iniparser_load(path);
|
||||
} else {
|
||||
log_debug("reading from configuration file %s\n", filename);
|
||||
d = iniparser_load(filename);
|
||||
}
|
||||
if (d) {
|
||||
load_inifile(d);
|
||||
log_debug("reading from configuration file %s\n", filename);
|
||||
config_set_from(d);
|
||||
|
||||
memdebug = iniparser_getint(d, "game:memcheck", memdebug);
|
||||
|
@ -176,6 +186,10 @@ static int parse_args(int argc, char **argv, int *exitcode)
|
|||
else {
|
||||
const char *arg;
|
||||
switch (argi[1]) {
|
||||
case 'c':
|
||||
i = get_arg(argc, argv, 2, i, &arg, 0);
|
||||
config_set("config.path", arg);
|
||||
break;
|
||||
case 'r':
|
||||
i = get_arg(argc, argv, 2, i, &arg, 0);
|
||||
config_set("config.rules", arg);
|
||||
|
@ -270,15 +284,15 @@ int main(int argc, char **argv)
|
|||
{
|
||||
int err = 0;
|
||||
lua_State *L;
|
||||
dictionary *d;
|
||||
dictionary *d = 0;
|
||||
setup_signal_handler();
|
||||
/* ini file sets defaults for arguments*/
|
||||
/* parse arguments again, to override ini file */
|
||||
parse_args(argc, argv, &err);
|
||||
|
||||
d = parse_config(inifile);
|
||||
if (!d) {
|
||||
log_error("could not open ini configuration %s\n", inifile);
|
||||
}
|
||||
/* parse arguments again, to override ini file */
|
||||
parse_args(argc, argv, &err);
|
||||
|
||||
locale_init();
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ SET SERVER=%BUILD%\eressea.exe
|
|||
%SERVER% ..\scripts\run-tests.lua
|
||||
%SERVER% -re2 ..\scripts\run-tests-e2.lua
|
||||
%SERVER% -re3 ..\scripts\run-tests-e3.lua
|
||||
%SERVER% -re4 ..\scripts\run-tests-e4.lua
|
||||
PAUSE
|
||||
RMDIR /s /q reports
|
||||
DEL score score.alliances datum turn
|
||||
|
|
Loading…
Reference in New Issue