forked from github/server
monsters need a default locale, or their report will crash (thanks, Don!)
- empty factions have not seen any region, prevent the code from crashing in that case. - must load the rules even when only writing the reports (taxation affects guards?)
This commit is contained in:
parent
7d5109329f
commit
f92df416ff
4 changed files with 11 additions and 10 deletions
|
@ -5,3 +5,4 @@ end
|
||||||
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||||
require 'eressea'
|
require 'eressea'
|
||||||
require 'eressea.xmlconf'
|
require 'eressea.xmlconf'
|
||||||
|
return require('eressea.rules')
|
||||||
|
|
|
@ -174,12 +174,6 @@ end
|
||||||
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
package.path = package.path .. ';' .. path .. '/?.lua;' .. path .. '/?/init.lua'
|
||||||
require 'eressea'
|
require 'eressea'
|
||||||
require 'eressea.xmlconf' -- read xml data
|
require 'eressea.xmlconf' -- read xml data
|
||||||
|
local rules = require('eressea.rules')
|
||||||
|
|
||||||
local rules = {}
|
|
||||||
if config.rules then
|
|
||||||
rules = require('eressea.' .. config.rules)
|
|
||||||
eressea.log.info('loaded ' .. #rules .. ' modules for ' .. config.rules)
|
|
||||||
else
|
|
||||||
eressea.log.warning('no rule modules loaded, specify a game in eressea.ini or with -r')
|
|
||||||
end
|
|
||||||
run_turn(rules)
|
run_turn(rules)
|
||||||
|
|
|
@ -223,7 +223,7 @@ faction *get_or_create_monsters(void)
|
||||||
if (!f) {
|
if (!f) {
|
||||||
const race *rc = rc_get_or_create("dragon");
|
const race *rc = rc_get_or_create("dragon");
|
||||||
const char *email = get_param(global.parameters, "monster.email");
|
const char *email = get_param(global.parameters, "monster.email");
|
||||||
f = addfaction(email ? email : "noreply@eressea.de", NULL, rc, NULL, 0);
|
f = addfaction(email ? email : "noreply@eressea.de", NULL, rc, default_locale, 0);
|
||||||
renumber_faction(f, MONSTER_ID);
|
renumber_faction(f, MONSTER_ID);
|
||||||
faction_setname(f, "Monster");
|
faction_setname(f, "Monster");
|
||||||
fset(f, FFL_NPC | FFL_NOIDLEOUT);
|
fset(f, FFL_NPC | FFL_NOIDLEOUT);
|
||||||
|
|
|
@ -1204,6 +1204,8 @@ static void get_seen_interval(report_context * ctx)
|
||||||
/* this is required to find the neighbour regions of the ones we are in,
|
/* this is required to find the neighbour regions of the ones we are in,
|
||||||
* which may well be outside of [firstregion, lastregion) */
|
* which may well be outside of [firstregion, lastregion) */
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
assert(ctx->seen);
|
||||||
for (i = 0; i != MAXSEEHASH; ++i) {
|
for (i = 0; i != MAXSEEHASH; ++i) {
|
||||||
seen_region *sr = ctx->seen[i];
|
seen_region *sr = ctx->seen[i];
|
||||||
while (sr != NULL) {
|
while (sr != NULL) {
|
||||||
|
@ -1643,7 +1645,9 @@ int write_reports(faction * f, time_t ltime)
|
||||||
ctx.last = lastregion(f);
|
ctx.last = lastregion(f);
|
||||||
ctx.addresses = NULL;
|
ctx.addresses = NULL;
|
||||||
ctx.userdata = NULL;
|
ctx.userdata = NULL;
|
||||||
get_seen_interval(&ctx);
|
if (ctx.seen) {
|
||||||
|
get_seen_interval(&ctx);
|
||||||
|
}
|
||||||
get_addresses(&ctx);
|
get_addresses(&ctx);
|
||||||
_mkdir(reportpath());
|
_mkdir(reportpath());
|
||||||
do {
|
do {
|
||||||
|
@ -1679,7 +1683,9 @@ int write_reports(faction * f, time_t ltime)
|
||||||
log_warning("No report for faction %s!", factionid(f));
|
log_warning("No report for faction %s!", factionid(f));
|
||||||
}
|
}
|
||||||
ql_free(ctx.addresses);
|
ql_free(ctx.addresses);
|
||||||
seen_done(ctx.seen);
|
if (ctx.seen) {
|
||||||
|
seen_done(ctx.seen);
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue