From 5a8a1704e7237ab16a48660ebbfb2e0e37c29dc8 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sat, 12 May 2012 12:39:49 -0700 Subject: [PATCH] disable and remove wisps, because they are so very, very broken. --- src/curses.c | 74 ++++++--------------------------------------- src/spells/spells.c | 45 ++------------------------- 2 files changed, 11 insertions(+), 108 deletions(-) diff --git a/src/curses.c b/src/curses.c index d01902f69..f6519c551 100644 --- a/src/curses.c +++ b/src/curses.c @@ -141,13 +141,14 @@ static void wall_destroy(connection * b) static void wall_read(connection * b, storage * store) { - wall_data *fd = (wall_data *) b->data.v; + static wall_data dummy; + wall_data *fd = b->data.v ? (wall_data *) b->data.v : &dummy; variant mno; - assert(fd); + if (store->version < STORAGE_VERSION) { mno.i = store->r_int(store); fd->mage = findunit(mno.i); - if (!fd->mage) { + if (!fd->mage && b->data.v) { ur_add(mno, &fd->mage, resolve_unit); } } else { @@ -241,77 +242,20 @@ void convert_firewall_timeouts(connection * b, attrib * a) } } -static const char *wisps_name(const connection * b, const region * r, - const faction * f, int gflags) -{ - const char *bname; - unused(f); - unused(r); - unused(b); - if (gflags & GF_ARTICLE) { - bname = "a_wisps"; - } else { - bname = "wisps"; - } - if (gflags & GF_PURE) - return bname; - return LOC(f->locale, mkname("border", bname)); -} - -typedef struct wisps_data { - wall_data wall; - int rnd; -} wisps_data; - -static region *wisps_move(const connection * b, struct unit *u, - struct region *from, struct region *next, boolean routing) -{ - direction_t reldir = reldirection(from, next); - wisps_data *wd = (wisps_data *) b->data.v; - assert(reldir != D_SPECIAL); - - if (routing && wd->wall.active) { - region *rl = - rconnect(from, - (direction_t) ((reldir + MAXDIRECTIONS - 1) % MAXDIRECTIONS)); - region *rr = rconnect(from, (direction_t) ((reldir + 1) % MAXDIRECTIONS)); - /* pick left and right region: */ - if (wd->rnd < 0) { - wd->rnd = rng_int() % 3; - } - - if (wd->rnd == 1 && rl - && fval(rl->terrain, LAND_REGION) == fval(next, LAND_REGION)) - return rl; - if (wd->rnd == 2 && rr - && fval(rr->terrain, LAND_REGION) == fval(next, LAND_REGION)) - return rr; - } - return next; -} - -static void wisps_init(connection * b) -{ - wisps_data *wd = (wisps_data *) calloc(sizeof(wisps_data), 1); - - b->data.v = wd; - wd->rnd = -1; -} - -border_type bt_wisps = { +border_type bt_wisps = { /* only here for reading old data */ "wisps", VAR_VOIDPTR, b_transparent, /* transparent */ - wisps_init, /* init */ + 0, /* init */ wall_destroy, /* destroy */ wall_read, /* read */ - wall_write, /* write */ + 0, /* write */ b_blocknone, /* block */ - wisps_name, /* name */ + 0, /* name */ b_rvisible, /* rvisible */ b_fvisible, /* fvisible */ b_uvisible, /* uvisible */ NULL, /* visible */ - wisps_move + 0 }; void register_curses(void) diff --git a/src/spells/spells.c b/src/spells/spells.c index fdf14fc49..a376b1fea 100644 --- a/src/spells/spells.c +++ b/src/spells/spells.c @@ -2688,47 +2688,6 @@ static int sp_firewall(castorder * co) return cast_level; } -/* ------------------------------------------------------------- */ - -static int sp_wisps(castorder * co) -{ - connection *b; - wall_data *fd; - region *r2; - direction_t dir; - region *r = co_get_region(co); - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - - dir = finddirection(pa->param[0]->data.xs, mage->faction->locale); - r2 = rconnect(r, dir); - - if (!r2) { - report_failure(mage, co->order); - return 0; - } - - b = new_border(&bt_wisps, r, r2); - fd = (wall_data *) b->data.v; - fd->force = (int)(force / 2 + 0.5); - fd->mage = mage; - fd->active = false; - fd->countdown = cast_level + 1; - - /* melden, 1x pro Partei */ - { - message *seen = msg_message("wisps_effect", "mage region", mage, r); - message *unseen = msg_message("wisps_effect", "mage region", NULL, r); - report_effect(r, mage, seen, unseen); - msg_release(seen); - msg_release(unseen); - } - - return cast_level; -} - /* ------------------------------------------------------------- */ /* Name: Unheilige Kraft * Stufe: 10 @@ -6587,7 +6546,7 @@ static spelldata spell_functions[] = { { "analysedream", sp_analysedream, 0}, { "disturbingdreams", sp_disturbingdreams, 0}, { "sleep", sp_sleep, 0}, - { "wisps", sp_wisps, 0}, + { "wisps", 0, 0}, /* this spell is gone */ { "gooddreams", sp_gooddreams, 0}, { "illaundestroymagic", sp_destroy_magic, 0}, { "illaunfamiliar", sp_summon_familiar, 0}, @@ -6718,7 +6677,7 @@ static void register_spelldata(void) int i; char zText[32]; strcpy(zText, "fumble_"); - for (i = 0; spell_functions[i].cast; ++i) { + for (i = 0; spell_functions[i].sname; ++i) { spelldata *data = spell_functions + i; if (data->cast) { register_function((pf_generic)data->cast, data->sname);