Some changes after talking to Don.

moved locale change into its own module.
made monsters get a report by default.
reoved old creation.c code, it was dead.
This commit is contained in:
Enno Rehling 2014-11-06 07:15:53 +01:00
parent 61f675fad8
commit 143fab9653
7 changed files with 21 additions and 118 deletions

View File

@ -12,5 +12,6 @@ return {
require('eressea.tunnels'),
require('eressea.ponnuki'),
require('eressea.astral'),
require('eressea.locales'),
require('eressea.ents')
}

View File

@ -0,0 +1,20 @@
local function change_locales(localechange)
for loc, flist in pairs(localechange) do
for index, name in pairs(flist) do
f = get_faction(atoi36(name))
if f ~= nil and f.locale ~= loc then
print("LOCALECHANGE ", f, f.locale, loc)
f.locale = loc
end
end
end
end
local package = {}
function pacakge.update()
local localechange = { de = { 'ii' } }
change_locales(localechange)
end
return package

View File

@ -26,18 +26,6 @@ function callbacks(rules, name, ...)
end
end
local function change_locales(localechange)
for loc, flist in pairs(localechange) do
for index, name in pairs(flist) do
f = get_faction(atoi36(name))
if f ~= nil and f.locale ~= loc then
print("LOCALECHANGE ", f, f.locale, loc)
f.locale = loc
end
end
end
end
local function dbupdate()
update_scores()
dbname = config.dbname or 'eressea.db'
@ -153,9 +141,6 @@ function process(rules, orders)
process_orders()
callbacks(rules, 'update')
local localechange = { de = { 'ii' } }
change_locales(localechange)
write_files(config.locales)
file = '' .. get_turn() .. '.dat'

View File

@ -77,7 +77,6 @@ set (ERESSEA_SRC
keyword.c
skill.c
json.c
creation.c
creport.c
economy.c
give.c

View File

@ -1,71 +0,0 @@
/*
Copyright (c) 1998-2014, Enno Rehling <enno@eressea.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
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#include <platform.h>
#include <kernel/config.h>
#include "creation.h"
#include "monster.h"
#include "alchemy.h"
/* kernel includes */
#include <kernel/build.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/plane.h>
#include <kernel/race.h>
#include <kernel/region.h>
#include <kernel/save.h>
#include <kernel/ship.h>
#include <kernel/terrain.h>
#include <kernel/unit.h>
/* util includes */
#include <util/goodies.h>
#include <util/lists.h>
/* libc includes */
#include <assert.h>
#include <ctype.h>
#include <float.h>
#include <limits.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
faction *createmonsters(int no)
{
faction *f = findfaction(no);
if (f) {
puts("* Fehler! Die Monster Partei gibt es schon.");
return f;
}
f = (faction *) calloc(1, sizeof(faction));
f->no = no;
/* alles ist auf null gesetzt, ausser dem folgenden. achtung - partei
* no 0 muss keine orders einreichen! */
f->email = _strdup("monsters@eressea.de");
f->name = _strdup("Monster");
f->alive = 1;
f->options = (char)(1 << O_REPORT);
addlist(&factions, f);
fhash(f);
return f;
}

View File

@ -1,30 +0,0 @@
/*
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.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
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
**/
#ifndef H_GC_CREATION
#define H_GC_CREATION
#ifdef __cplusplus
extern "C" {
#endif
struct faction *createmonsters(int no);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -169,7 +169,6 @@ faction *get_or_create_monsters(void)
}
renumber_faction(f, 666);
faction_setname(f, "Monster");
f->options = 0;
}
if (f) {
fset(f, FFL_NPC | FFL_NOIDLEOUT);