From 143fab9653258367b8c23da24e1829974da10561 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 6 Nov 2014 07:15:53 +0100 Subject: [PATCH] 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. --- scripts/eressea/e2/init.lua | 1 + scripts/eressea/locales.lua | 20 +++++++++++ scripts/run-turn.lua | 15 -------- src/CMakeLists.txt | 1 - src/creation.c | 71 ------------------------------------- src/creation.h | 30 ---------------- src/kernel/faction.c | 1 - 7 files changed, 21 insertions(+), 118 deletions(-) create mode 100644 scripts/eressea/locales.lua delete mode 100644 src/creation.c delete mode 100644 src/creation.h diff --git a/scripts/eressea/e2/init.lua b/scripts/eressea/e2/init.lua index 4705631dd..a23aa3216 100644 --- a/scripts/eressea/e2/init.lua +++ b/scripts/eressea/e2/init.lua @@ -12,5 +12,6 @@ return { require('eressea.tunnels'), require('eressea.ponnuki'), require('eressea.astral'), + require('eressea.locales'), require('eressea.ents') } diff --git a/scripts/eressea/locales.lua b/scripts/eressea/locales.lua new file mode 100644 index 000000000..c3a9cdd83 --- /dev/null +++ b/scripts/eressea/locales.lua @@ -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 diff --git a/scripts/run-turn.lua b/scripts/run-turn.lua index f938c8514..c9033afe3 100644 --- a/scripts/run-turn.lua +++ b/scripts/run-turn.lua @@ -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' diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 402e4dc58..3ac447096 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -77,7 +77,6 @@ set (ERESSEA_SRC keyword.c skill.c json.c - creation.c creport.c economy.c give.c diff --git a/src/creation.c b/src/creation.c deleted file mode 100644 index 7cf540f30..000000000 --- a/src/creation.c +++ /dev/null @@ -1,71 +0,0 @@ -/* -Copyright (c) 1998-2014, Enno Rehling - Katja Zedel - -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 -#include -#include "creation.h" -#include "monster.h" -#include "alchemy.h" - -/* kernel includes */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* util includes */ -#include -#include - -/* libc includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -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; -} diff --git a/src/creation.h b/src/creation.h deleted file mode 100644 index 47146d303..000000000 --- a/src/creation.h +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright (c) 1998-2010, Enno Rehling - Katja Zedel - -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 diff --git a/src/kernel/faction.c b/src/kernel/faction.c index 2f58b994b..1515e9c65 100755 --- a/src/kernel/faction.c +++ b/src/kernel/faction.c @@ -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);