From a8849f2b91efc5d448eb5cae1e59b4d5094e9d66 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 13 Dec 2014 00:03:24 +0100 Subject: [PATCH] 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! --- src/eressea.c | 3 - src/gmtool.c | 3 - src/kernel/group.c | 2 +- src/kernel/version.h | 75 +++------- src/modules/CMakeLists.txt | 1 - src/modules/dungeon.c | 273 ------------------------------------- src/modules/dungeon.h | 37 ----- src/settings.h | 1 - 8 files changed, 19 insertions(+), 376 deletions(-) delete mode 100644 src/modules/dungeon.c delete mode 100644 src/modules/dungeon.h diff --git a/src/eressea.c b/src/eressea.c index bcc794ea1..97408cded 100755 --- a/src/eressea.c +++ b/src/eressea.c @@ -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 diff --git a/src/gmtool.c b/src/gmtool.c index 7008c1136..ff1bc556d 100644 --- a/src/gmtool.c +++ b/src/gmtool.c @@ -28,9 +28,6 @@ #include #endif #include -#if DUNGEON_MODULE -#include -#endif #include #include diff --git a/src/kernel/group.c b/src/kernel/group.c index 402ebe9a3..a99c13116 100755 --- a/src/kernel/group.c +++ b/src/kernel/group.c @@ -1,5 +1,5 @@ /* -Copyright (c) 1998-2010, Enno Rehling +Copyright (c) 1998-2014, Enno Rehling Katja Zedel diff --git a/src/kernel/version.h b/src/kernel/version.h index e92d23aa6..a54eef44d 100644 --- a/src/kernel/version.h +++ b/src/kernel/version.h @@ -1,61 +1,21 @@ -/* vi: set ts=2: - +-------------------+ - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2007 | Christian Schlittchen - | | - +-------------------+ - - 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 +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. +**/ + #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 */ diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index ad77cbf13..633c486f5 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -2,7 +2,6 @@ PROJECT(modules C) SET(_FILES arena.c autoseed.c -dungeon.c gmcmd.c museum.c score.c diff --git a/src/modules/dungeon.c b/src/modules/dungeon.c deleted file mode 100644 index 6e9508554..000000000 --- a/src/modules/dungeon.c +++ /dev/null @@ -1,273 +0,0 @@ -/* vi: set ts=2: - +-------------------+ Christian Schlittchen - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2003 | Henning Peters - | | Ingo Wilken - +-------------------+ Stefan Reich - - This program may not be used, modified or distributed - without prior permission by the authors of Eressea. -*/ - -#include -#include - -#if DUNGEON_MODULE -#include "dungeon.h" -#include "gmcmd.h" - -#include -#include - -/* kernel includes */ -#include -#include -#include -#include -#include -#include -#include -#include - -/* util includes */ -#include -#include - -/* libc includes */ -#include -#include -#include - -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 diff --git a/src/modules/dungeon.h b/src/modules/dungeon.h deleted file mode 100644 index cb7715856..000000000 --- a/src/modules/dungeon.h +++ /dev/null @@ -1,37 +0,0 @@ -/* vi: set ts=2: - +-------------------+ Christian Schlittchen - | | Enno Rehling - | Eressea PBEM host | Katja Zedel - | (c) 1998 - 2003 | Henning Peters - | | Ingo Wilken - +-------------------+ Stefan Reich - - 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 diff --git a/src/settings.h b/src/settings.h index d682d8119..9375c0dc8 100644 --- a/src/settings.h +++ b/src/settings.h @@ -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 */