From 9f971481630e78494651257e96d720bf98166911 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 2 Oct 2005 16:06:12 +0000 Subject: [PATCH] spawning of new braineaters moved into a separate LUA function which is not called for wdw. --- src/common/kernel/teleport.c | 18 +++++------------- src/common/kernel/teleport.h | 1 + src/common/settings-wdw.h | 3 --- src/eressea/lua/eressea.cpp | 2 ++ src/scripts/default.lua | 1 + src/scripts/eressea.lua | 1 + src/scripts/hse3-run.lua | 1 + src/scripts/hse4-run.lua | 1 + src/scripts/wdw-run.lua | 1 + 9 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/common/kernel/teleport.c b/src/common/kernel/teleport.c index ace7fe4ec..720835680 100644 --- a/src/common/kernel/teleport.c +++ b/src/common/kernel/teleport.c @@ -137,17 +137,15 @@ all_in_range(const region *r, short n, boolean (*valid)(const region *)) } void -random_in_teleport_plane(void) +spawn_braineaters(float chance) { region *r; faction *f0 = findfaction(MONSTER_FACTION); - int next = rand() % 100; - + int next = rand() % (int)(chance*100); + if (f0==NULL) return; - /* Für WDW abschaltbar machen */ -#if NO_RANDOM_BRAINEATERS == 0 - for (r=regions; r; r=r->next) { + for (r = regions; r; r = r->next) { if (rplane(r) != get_astralplane() || rterrain(r) != T_ASTRAL) continue; /* Neues Monster ? */ @@ -158,10 +156,9 @@ random_in_teleport_plane(void) set_string(&u->display, "Wabernde grüne Schwaden treiben durch den Nebel und verdichten sich zu einer unheimlichen Kreatur, die nur aus einem langen Ruderschwanz und einem riesigen runden Maul zu bestehen scheint."); set_level(u, SK_STEALTH, 1); set_level(u, SK_OBSERVATION, 1); - next = rand() % 100; + next = rand() % (int)(chance*100); } } -#endif } plane * @@ -189,7 +186,6 @@ void create_teleport_plane(void) { region *r; - int i; plane * aplane = get_astralplane(); /* Regionsbereich aufbauen. */ @@ -217,10 +213,6 @@ create_teleport_plane(void) } } } - - for(i=0;i<4;i++) { - random_in_teleport_plane(); - } } boolean diff --git a/src/common/kernel/teleport.h b/src/common/kernel/teleport.h index f729174f0..f1fe14592 100644 --- a/src/common/kernel/teleport.h +++ b/src/common/kernel/teleport.h @@ -28,6 +28,7 @@ extern "C" { void create_teleport_plane(void); void set_teleport_plane_regiontypes(void); + void spawn_braineaters(float chance); #ifdef __cplusplus } diff --git a/src/common/settings-wdw.h b/src/common/settings-wdw.h index 62677d4ef..3ee51fd6a 100644 --- a/src/common/settings-wdw.h +++ b/src/common/settings-wdw.h @@ -56,6 +56,3 @@ #define WDW_PHOENIX #define WDW_PYRAMIDSPELL /* #define WDW_PYRAMID 1 */ - -#define KEEP_UNZIPPED 1 -#define NO_RANDOM_BRAINEATERS 1 diff --git a/src/eressea/lua/eressea.cpp b/src/eressea/lua/eressea.cpp index db4c798b5..193838fa0 100644 --- a/src/eressea/lua/eressea.cpp +++ b/src/eressea/lua/eressea.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include // lua includes @@ -234,6 +235,7 @@ bind_eressea(lua_State * L) /* scripted monsters */ def("plan_monsters", &lua_planmonsters), + def("spawn_braineaters", &spawn_braineaters), def("set_brain", &race_setscript), /* map making */ diff --git a/src/scripts/default.lua b/src/scripts/default.lua index 16678a42a..e6c6077b4 100644 --- a/src/scripts/default.lua +++ b/src/scripts/default.lua @@ -35,6 +35,7 @@ function process(orders) -- run the turn: read_orders(orders) + spawn_braineaters(0.25) plan_monsters() process_orders() diff --git a/src/scripts/eressea.lua b/src/scripts/eressea.lua index 331b18509..22b8b8cff 100644 --- a/src/scripts/eressea.lua +++ b/src/scripts/eressea.lua @@ -76,6 +76,7 @@ function process(orders) end run_scripts() + spawn_braineaters(0.25) plan_monsters() process_orders() diff --git a/src/scripts/hse3-run.lua b/src/scripts/hse3-run.lua index 9af70c9f3..b0a398a76 100644 --- a/src/scripts/hse3-run.lua +++ b/src/scripts/hse3-run.lua @@ -49,6 +49,7 @@ function process(orders) read_orders(orders) run_scripts() + spawn_braineaters(0.25) plan_monsters() process_orders() diff --git a/src/scripts/hse4-run.lua b/src/scripts/hse4-run.lua index 54b97499f..5e38b9ccc 100644 --- a/src/scripts/hse4-run.lua +++ b/src/scripts/hse4-run.lua @@ -49,6 +49,7 @@ function process(orders) read_orders(orders) run_scripts() + spawn_braineaters(0.25) plan_monsters() process_orders() diff --git a/src/scripts/wdw-run.lua b/src/scripts/wdw-run.lua index 46607d50c..94dd6265e 100644 --- a/src/scripts/wdw-run.lua +++ b/src/scripts/wdw-run.lua @@ -15,6 +15,7 @@ function process(orders) sphinx_weekly() -- run the turn: + -- (no more braineaters) spawn_braineaters(0.25) plan_monsters() process_orders() outfile = "" .. get_turn()