This commit is contained in:
Enno Rehling 2017-02-02 16:57:30 +01:00
commit 4c8a327a15
12 changed files with 37 additions and 203 deletions

View File

@ -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>

View File

@ -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"
}
}

View File

@ -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>

View File

@ -33,7 +33,7 @@ fi
echo "build eressea" echo "build eressea"
cd $ROOT/$BUILD cd $ROOT/$BUILD
BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//') BRANCH=$(git status -s -b | head -1 | cut -d\ -f 2 | sed 's/\..*//')
if [ "$BRANCH" == "master" ] ; then if [ "$BRANCH"=="master" ] ; then
VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//') VERSION=$(git describe --match 'v*.*.*' --tags | sed 's/^v//')
cmake -DERESSEA_VERSION="$VERSION" .. cmake -DERESSEA_VERSION="$VERSION" ..
else else

View File

@ -15,7 +15,6 @@ cd $ROOT
$ROOT/$BUILD/eressea/eressea -v1 scripts/run-tests.lua $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-e2.lua
$ROOT/$BUILD/eressea/eressea -v1 scripts/run-tests-e3.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 rm -rf data reports orders.txt score score.alliances datum turn
cd $OLDWPD cd $OLDWPD

View File

@ -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')
}

View File

@ -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

View File

@ -749,13 +749,18 @@ void config_set_from(const dictionary *d)
key[slen] = '.'; key[slen] = '.';
iniparser_getseckeys(d, sec, keys); iniparser_getseckeys(d, sec, keys);
for (k=0;k!=nkeys;++k) { for (k=0;k!=nkeys;++k) {
const char *val; const char *val, *orig;
size_t klen = strlen(keys[k]); size_t klen = strlen(keys[k]);
assert(klen+slen+1<sizeof(key)); assert(klen+slen+1<sizeof(key));
memcpy(key+slen+1, keys[k]+slen+1, klen-slen); memcpy(key+slen+1, keys[k]+slen+1, klen-slen);
orig = config_get(key);
val = iniparser_getstring(d, keys[k], NULL); val = iniparser_getstring(d, keys[k], NULL);
if (val) { if (!orig) {
config_set(key, val); if (val) {
config_set(key, val);
}
} else {
log_debug("not overwriting %s=%s with %s", key, orig, val);
} }
} }
} }

View File

@ -1633,14 +1633,7 @@ int read_game(gamedata *data) {
READ_INT(store, &gameid); READ_INT(store, &gameid);
if (gameid != game_id()) { if (gameid != game_id()) {
int c;
log_warning("game mismatch: datafile contains game %d, but config is for %d", gameid, game_id()); 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 { else {

View File

@ -76,10 +76,20 @@ static void load_inifile(dictionary * d)
static dictionary *parse_config(const char *filename) 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) { if (d) {
load_inifile(d); load_inifile(d);
log_debug("reading from configuration file %s\n", filename);
config_set_from(d); config_set_from(d);
memdebug = iniparser_getint(d, "game:memcheck", memdebug); memdebug = iniparser_getint(d, "game:memcheck", memdebug);
@ -176,6 +186,10 @@ static int parse_args(int argc, char **argv, int *exitcode)
else { else {
const char *arg; const char *arg;
switch (argi[1]) { switch (argi[1]) {
case 'c':
i = get_arg(argc, argv, 2, i, &arg, 0);
config_set("config.path", arg);
break;
case 'r': case 'r':
i = get_arg(argc, argv, 2, i, &arg, 0); i = get_arg(argc, argv, 2, i, &arg, 0);
config_set("config.rules", arg); config_set("config.rules", arg);
@ -270,15 +284,15 @@ int main(int argc, char **argv)
{ {
int err = 0; int err = 0;
lua_State *L; lua_State *L;
dictionary *d; dictionary *d = 0;
setup_signal_handler(); 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); d = parse_config(inifile);
if (!d) { if (!d) {
log_error("could not open ini configuration %s\n", inifile); log_error("could not open ini configuration %s\n", inifile);
} }
/* parse arguments again, to override ini file */
parse_args(argc, argv, &err);
locale_init(); locale_init();

View File

@ -116,6 +116,13 @@ static void test_unicode_bug2262(CuTest *tc) {
CuAssertIntEquals(tc, EILSEQ, unicode_utf8_trim(name)); CuAssertIntEquals(tc, EILSEQ, unicode_utf8_trim(name));
} }
static void test_unicode_compare(CuTest *tc)
{
CuAssertIntEquals(tc, 0, unicode_utf8_strcasecmp("ABCDEFG", "abcdefg"));
CuAssertIntEquals(tc, 0, unicode_utf8_strcasecmp("abcdefg123", "ABCDEFG123"));
CuAssertIntEquals(tc, 1, unicode_utf8_strcasecmp("bacdefg123", "ABCDEFG123"));
}
CuSuite *get_unicode_suite(void) CuSuite *get_unicode_suite(void)
{ {
CuSuite *suite = CuSuiteNew(); CuSuite *suite = CuSuiteNew();
@ -124,5 +131,6 @@ CuSuite *get_unicode_suite(void)
SUITE_ADD_TEST(suite, test_unicode_trim); SUITE_ADD_TEST(suite, test_unicode_trim);
SUITE_ADD_TEST(suite, test_unicode_utf8_to_other); SUITE_ADD_TEST(suite, test_unicode_utf8_to_other);
SUITE_ADD_TEST(suite, test_unicode_utf8_to_ucs); SUITE_ADD_TEST(suite, test_unicode_utf8_to_ucs);
SUITE_ADD_TEST(suite, test_unicode_compare);
return suite; return suite;
} }

View File

@ -8,7 +8,6 @@ SET SERVER=%BUILD%\eressea.exe
%SERVER% ..\scripts\run-tests.lua %SERVER% ..\scripts\run-tests.lua
%SERVER% -re2 ..\scripts\run-tests-e2.lua %SERVER% -re2 ..\scripts\run-tests-e2.lua
%SERVER% -re3 ..\scripts\run-tests-e3.lua %SERVER% -re3 ..\scripts\run-tests-e3.lua
%SERVER% -re4 ..\scripts\run-tests-e4.lua
PAUSE PAUSE
RMDIR /s /q reports RMDIR /s /q reports
DEL score score.alliances datum turn DEL score score.alliances datum turn