forked from github/server
remove the obsolete dungeons module.
I don't think this has ever been used, and it has fallen victim to entropy since it was first written. good riddance!
This commit is contained in:
parent
3d24764e08
commit
a8849f2b91
|
@ -58,9 +58,6 @@ void game_init(void)
|
|||
register_resources();
|
||||
register_buildings();
|
||||
register_itemfunctions();
|
||||
#if DUNGEON_MODULE
|
||||
register_dungeon();
|
||||
#endif
|
||||
#if MUSEUM_MODULE
|
||||
register_museum();
|
||||
#endif
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
#include <modules/arena.h>
|
||||
#endif
|
||||
#include <modules/autoseed.h>
|
||||
#if DUNGEON_MODULE
|
||||
#include <modules/dungeon.h>
|
||||
#endif
|
||||
|
||||
#include <kernel/building.h>
|
||||
#include <kernel/calendar.h>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
|
||||
Copyright (c) 1998-2014, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
|
|
|
@ -1,61 +1,21 @@
|
|||
/* vi: set ts=2:
|
||||
+-------------------+
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2007 | Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| |
|
||||
+-------------------+
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
|
||||
*/
|
||||
|
||||
/* changes from->to: 72->73: struct unit::lock entfernt.
|
||||
* 73->74: struct unit::flags eingeführt.
|
||||
* 74->75: parteitarnung als flag.
|
||||
* 75->76: #ifdef NEW_HP: hp
|
||||
* 76->77: ship->damage
|
||||
* 77->78: neue Message-Option "Orkvermehrung" (MAX_MSG +1)
|
||||
* 78->79: showdata nicht mehr speichern
|
||||
* 79->HEX_VERSION: hex
|
||||
* 80->82: ATTRIB_VERSION
|
||||
* 90: Ebenen
|
||||
* 92: Magiegebiet-Auswahl f->magiegebiet
|
||||
* 94: f->attribs wird gespeichert
|
||||
* 100: NEWMAGIC, neue Message-Option "Zauber" (MAX_MSG +1)
|
||||
* 108: Speichern von Timeouts
|
||||
* 193: curse bekommen id aus struct unit-nummernraum
|
||||
*/
|
||||
|
||||
/*
|
||||
#define HEX_VERSION 81
|
||||
#define GROWTREE_VERSION 305
|
||||
#define RANDOMIZED_RESOURCES_VERSION 306
|
||||
#define NEWRACE_VERSION 307
|
||||
#define INTERIM_VERSION 309
|
||||
#define NEWSKILL_VERSION 309
|
||||
#define WATCHERS_VERSION 310
|
||||
#define OVERRIDE_VERSION 311
|
||||
*/
|
||||
#define CURSETYPE_VERSION 312 /* turn 287 */
|
||||
#define ALLIANCES_VERSION 313
|
||||
#define DBLINK_VERSION 314
|
||||
#define CURSEVIGOURISFLOAT_VERSION 315
|
||||
#define SAVEXMLNAME_VERSION 316
|
||||
#define SAVEALLIANCE_VERSION 317
|
||||
#define CLAIM_VERSION 318
|
||||
/* 319 is the HSE4 data version */
|
||||
#define BACTION_VERSION 319 /* building action gets a param string */
|
||||
#define NOLASTORDER_VERSION 320 /* do not use lastorder */
|
||||
#define SPELLNAME_VERSION 321 /* reference spells by name */
|
||||
#define TERRAIN_VERSION 322 /* terrains are a full type and saved by name */
|
||||
#define REGIONITEMS_VERSION 323 /* regions have items */
|
||||
#define ATTRIBREAD_VERSION 324 /* remove a_readint */
|
||||
#define CURSEFLAGS_VERSION 325 /* remove a_readint */
|
||||
#define UNICODE_VERSION 326 /* 2007-06-27 everything is stored as UTF8 */
|
||||
#define UID_VERSION 327 /* regions have a unique id */
|
||||
#define STORAGE_VERSION 328 /* with storage.h, some things are stored smarter (ids as base36, fractions as float) */
|
||||
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.
|
||||
**/
|
||||
|
||||
#define INTPAK_VERSION 329 /* in binary, ints can get packed */
|
||||
#define NOZEROIDS_VERSION 330 /* 2008-05-16 zero is not a valid ID for anything (including factions) */
|
||||
#define NOBORDERATTRIBS_VERSION 331 /* 2008-05-17 connection::attribs has been moved to userdata */
|
||||
|
@ -74,6 +34,7 @@
|
|||
#define SAVEGAMEID_VERSION 343 /* instead of XMLNAME, save the game.id parameter from the config */
|
||||
#define BUILDNO_VERSION 344 /* storing the build number in the save */
|
||||
#define AUTO_RACENAME_VERSION 345 /* NPC units with name==NULL will automatically get their race for a name */
|
||||
|
||||
#define MIN_VERSION INTPAK_VERSION /* minimal datafile we support */
|
||||
#define RELEASE_VERSION AUTO_RACENAME_VERSION /* current datafile */
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ PROJECT(modules C)
|
|||
SET(_FILES
|
||||
arena.c
|
||||
autoseed.c
|
||||
dungeon.c
|
||||
gmcmd.c
|
||||
museum.c
|
||||
score.c
|
||||
|
|
|
@ -1,273 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
|
||||
#if DUNGEON_MODULE
|
||||
#include "dungeon.h"
|
||||
#include "gmcmd.h"
|
||||
|
||||
#include <triggers/gate.h>
|
||||
#include <triggers/unguard.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <building.h>
|
||||
#include <item.h>
|
||||
#include <plane.h>
|
||||
#include <race.h>
|
||||
#include <region.h>
|
||||
#include <skill.h>
|
||||
#include <terrain.h>
|
||||
#include <unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <event.h>
|
||||
#include <xml.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
typedef struct treasure {
|
||||
const struct item_type *itype;
|
||||
int amount;
|
||||
struct treasure *next;
|
||||
} treasure;
|
||||
|
||||
typedef struct monster {
|
||||
const struct race *race;
|
||||
double chance;
|
||||
int maxunits;
|
||||
int avgsize;
|
||||
struct treasure *treasures;
|
||||
struct monster *next;
|
||||
struct itemtype_list *weapons;
|
||||
} monster;
|
||||
|
||||
typedef struct skilllimit {
|
||||
skill_t skill;
|
||||
int minskill;
|
||||
int maxskill;
|
||||
struct skilllimit *next;
|
||||
} skilllimit;
|
||||
|
||||
typedef struct dungeon {
|
||||
int level;
|
||||
int radius;
|
||||
int size;
|
||||
int maxpeople;
|
||||
struct skilllimit *limits;
|
||||
double connect;
|
||||
struct monster *boss;
|
||||
struct monster *monsters;
|
||||
struct dungeon *next;
|
||||
} dungeon;
|
||||
|
||||
dungeon *dungeonstyles;
|
||||
|
||||
region *make_dungeon(const dungeon * data)
|
||||
{
|
||||
int nb[2][3][2] = {
|
||||
{{-1, 0}, {0, 1}, {1, -1}},
|
||||
{{1, 0}, {-1, 1}, {0, -1}}
|
||||
};
|
||||
const struct race *bossrace = data->boss->race;
|
||||
char name[128];
|
||||
int size = data->size;
|
||||
int iterations = size * size;
|
||||
unsigned int flags = PFL_NORECRUITS;
|
||||
int n = 0;
|
||||
struct faction *fmonsters = get_monsters();
|
||||
plane *p;
|
||||
region *r, *center;
|
||||
region *rnext;
|
||||
region_list *iregion, *rlist = NULL;
|
||||
const terrain_type *terrain_hell = get_terrain("hell");
|
||||
|
||||
assert(terrain_hell != NULL);
|
||||
sprintf(name, "Die Höhlen von %s", bossrace->generate_name(NULL));
|
||||
p = gm_addplane(data->radius, flags, name);
|
||||
|
||||
center =
|
||||
findregion(p->minx + (p->maxx - p->minx) / 2,
|
||||
p->miny + (p->maxy - p->miny) / 2);
|
||||
assert(center);
|
||||
terraform_region(center, terrain_hell);
|
||||
add_regionlist(&rlist, center);
|
||||
rnext = r = center;
|
||||
while (size > 0 && iterations--) {
|
||||
int d, o = rng_int() % 3;
|
||||
for (d = 0; d != 3; ++d) {
|
||||
int index = (d + o) % 3;
|
||||
region *rn = findregion(r->x + nb[n][index][0], r->y + nb[n][index][1]);
|
||||
assert(r->terrain == terrain_hell);
|
||||
if (rn) {
|
||||
if (rn->terrain == terrain_hell) {
|
||||
rnext = rn;
|
||||
} else if (fval(rn->terrain, SEA_REGION)) {
|
||||
if (rng_int() % 100 < data->connect * 100) {
|
||||
terraform_region(rn, terrain_hell);
|
||||
--size;
|
||||
rnext = rn;
|
||||
add_regionlist(&rlist, rn);
|
||||
} else
|
||||
terraform(rn, T_FIREWALL);
|
||||
}
|
||||
if (size == 0)
|
||||
break;
|
||||
}
|
||||
rn =
|
||||
findregion(r->x + nb[(n + 1) % 2][index][0],
|
||||
r->y + nb[(n + 1) % 2][index][1]);
|
||||
if (rn && fval(rn->terrain, SEA_REGION)) {
|
||||
terraform(rn, T_FIREWALL);
|
||||
}
|
||||
}
|
||||
if (size == 0)
|
||||
break;
|
||||
if (r == rnext) {
|
||||
/* error */
|
||||
break;
|
||||
}
|
||||
r = rnext;
|
||||
n = (n + 1) % 2;
|
||||
}
|
||||
|
||||
for (iregion = rlist; iregion; iregion = iregion->next) {
|
||||
monster *m = data->monsters;
|
||||
region *r = iregion->data;
|
||||
while (m) {
|
||||
if ((rng_int() % 100) < (m->chance * 100)) {
|
||||
/* TODO: check maxunits. */
|
||||
treasure *loot = m->treasures;
|
||||
struct itemtype_list *weapon = m->weapons;
|
||||
int size = 1 + (rng_int() % m->avgsize) + (rng_int() % m->avgsize);
|
||||
unit *u = createunit(r, fmonsters, size, m->race);
|
||||
while (weapon) {
|
||||
i_change(&u->items, weapon->type, size);
|
||||
weapon = weapon->next;
|
||||
}
|
||||
while (loot) {
|
||||
i_change(&u->items, loot->itype, loot->amount * size);
|
||||
loot = loot->next;
|
||||
}
|
||||
}
|
||||
m = m->next;
|
||||
}
|
||||
}
|
||||
return center;
|
||||
}
|
||||
|
||||
void make_dungeongate(region * source, region * target, const struct dungeon *d)
|
||||
{
|
||||
building *bsource, *btarget;
|
||||
|
||||
if (source == NULL || target == NULL || d == NULL)
|
||||
return;
|
||||
bsource = new_building(bt_find("castle"), source, default_locale);
|
||||
set_string(&bsource->name, "Pforte zur Hölle");
|
||||
bsource->size = 50;
|
||||
add_trigger(&bsource->attribs, "timer", trigger_gate(bsource, target));
|
||||
add_trigger(&bsource->attribs, "create", trigger_unguard(bsource));
|
||||
fset(bsource, BLD_UNGUARDED);
|
||||
|
||||
btarget = new_building(bt_find("castle"), target, default_locale);
|
||||
set_string(&btarget->name, "Pforte zur Außenwelt");
|
||||
btarget->size = 50;
|
||||
add_trigger(&btarget->attribs, "timer", trigger_gate(btarget, source));
|
||||
add_trigger(&btarget->attribs, "create", trigger_unguard(btarget));
|
||||
fset(btarget, BLD_UNGUARDED);
|
||||
}
|
||||
|
||||
static int tagbegin(xml_stack * stack)
|
||||
{
|
||||
xml_tag *tag = stack->tag;
|
||||
if (strcmp(tag->name, "dungeon") == 0) {
|
||||
dungeon *d = (dungeon *) calloc(sizeof(dungeon), 1);
|
||||
d->maxpeople = xml_ivalue(tag, "maxpeople");
|
||||
if (d->maxpeople == 0)
|
||||
d->maxpeople = INT_MAX;
|
||||
d->level = xml_ivalue(tag, "level");
|
||||
d->radius = xml_ivalue(tag, "radius");
|
||||
d->connect = xml_fvalue(tag, "connect");
|
||||
d->size = xml_ivalue(tag, "size");
|
||||
stack->state = d;
|
||||
} else {
|
||||
dungeon *d = (dungeon *) stack->state;
|
||||
if (strcmp(tag->name, "skilllimit") == 0) {
|
||||
skill_t sk = findskill(xml_value(tag, "name"));
|
||||
if (sk != NOSKILL) {
|
||||
skilllimit *skl = calloc(sizeof(skilllimit), 1);
|
||||
skl->skill = sk;
|
||||
if (xml_value(tag, "max") != NULL) {
|
||||
skl->maxskill = xml_ivalue(tag, "max");
|
||||
} else
|
||||
skl->maxskill = INT_MAX;
|
||||
if (xml_value(tag, "min") != NULL) {
|
||||
skl->minskill = xml_ivalue(tag, "min");
|
||||
} else
|
||||
skl->maxskill = INT_MIN;
|
||||
skl->next = d->limits;
|
||||
d->limits = skl;
|
||||
}
|
||||
} else if (strcmp(tag->name, "monster") == 0) {
|
||||
monster *m = calloc(sizeof(monster), 1);
|
||||
m->race = rc_find(xml_value(tag, "race"));
|
||||
m->chance = xml_fvalue(tag, "chance");
|
||||
m->avgsize = _max(1, xml_ivalue(tag, "size"));
|
||||
m->maxunits = _min(1, xml_ivalue(tag, "maxunits"));
|
||||
|
||||
if (m->race) {
|
||||
if (xml_bvalue(tag, "boss")) {
|
||||
d->boss = m;
|
||||
} else {
|
||||
m->next = d->monsters;
|
||||
d->monsters = m;
|
||||
}
|
||||
}
|
||||
} else if (strcmp(tag->name, "weapon") == 0) {
|
||||
monster *m = d->monsters;
|
||||
itemtype_list *w = calloc(sizeof(itemtype_list), 1);
|
||||
w->type = it_find(xml_value(tag, "type"));
|
||||
if (w->type) {
|
||||
w->next = m->weapons;
|
||||
m->weapons = w;
|
||||
}
|
||||
}
|
||||
}
|
||||
return XML_OK;
|
||||
}
|
||||
|
||||
static int tagend(xml_stack * stack)
|
||||
{
|
||||
xml_tag *tag = stack->tag;
|
||||
if (strcmp(tag->name, "dungeon")) {
|
||||
dungeon *d = (dungeon *) stack->state;
|
||||
stack->state = NULL;
|
||||
d->next = dungeonstyles;
|
||||
dungeonstyles = d;
|
||||
}
|
||||
return XML_OK;
|
||||
}
|
||||
|
||||
xml_callbacks xml_dungeon = {
|
||||
tagbegin, tagend, NULL
|
||||
};
|
||||
|
||||
void register_dungeon(void)
|
||||
{
|
||||
xml_register(&xml_dungeon, "eressea dungeon", 0);
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,37 +0,0 @@
|
|||
/* vi: set ts=2:
|
||||
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
| | Enno Rehling <enno@eressea.de>
|
||||
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
|
||||
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
|
||||
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
|
||||
+-------------------+ Stefan Reich <reich@halbling.de>
|
||||
|
||||
This program may not be used, modified or distributed
|
||||
without prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef H_MOD_DUNGEON
|
||||
#define H_MOD_DUNGEON
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#if DUNGEON_MODULE == 0
|
||||
#error "must define DUNGEON_MODULE to use this module"
|
||||
#endif
|
||||
|
||||
struct region;
|
||||
struct plane;
|
||||
struct building;
|
||||
struct dungeon;
|
||||
|
||||
extern struct dungeon *dungeonstyles;
|
||||
extern struct region *make_dungeon(const struct dungeon *);
|
||||
extern void make_dungeongate(struct region *source, struct region *target,
|
||||
const struct dungeon *);
|
||||
extern void register_dungeon(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -41,7 +41,6 @@
|
|||
#define SCORE_MODULE 1
|
||||
#define MUSEUM_MODULE 1
|
||||
#define ARENA_MODULE 1
|
||||
#define DUNGEON_MODULE 0
|
||||
#define CHANGED_CROSSBOWS 0 /* use the WTF_ARMORPIERCING flag */
|
||||
#undef GLOBAL_WARMING /* number of turns before global warming sets in */
|
||||
|
||||
|
|
Loading…
Reference in New Issue