diff --git a/Makefile b/Makefile index 619a4d947..573ba6503 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,9 @@ -PROJECT = eressea - -all: bin/$(PROJECT) +all: bin/eressea bin: mkdir bin -bin/$(PROJECT): bin/Makefile +bin/eressea: bin/Makefile cd bin ; make bin/Makefile: bin diff --git a/src/bindings.c b/src/bindings.c index a41c305b2..6cc85592f 100644 --- a/src/bindings.c +++ b/src/bindings.c @@ -13,31 +13,21 @@ static int tolua_levitate_ship(lua_State * L) { ship *sh = (ship *) tolua_tousertype(L, 1, 0); - unit *mage = (unit *) tolua_tousertype(L, 2, 0); - double power = (double)tolua_tonumber(L, 3, 0); - int duration = (int)tolua_tonumber(L, 4, 0); - int cno = levitate_ship(sh, mage, power, duration); - tolua_pushnumber(L, (lua_Number) cno); return 1; } - extern void spawn_undead(void); - extern void spawn_dragons(void); - extern void plan_monsters(struct faction *f); - static int tolua_planmonsters(lua_State * L) { faction *f = (faction *) tolua_tousertype(L, 1, get_monsters()); - if (f) { plan_monsters(f); } @@ -60,17 +50,13 @@ static int tolua_spawn_undead(lua_State * L) static int fix_familiars(struct lua_State *L) { faction *f; - for (f = factions; f; f = f->next) { unit *u; - for (u = f->units; u; u = u->nextF) { struct sc_mage *mage = get_mage(u); - if (mage && is_familiar(u)) { if (mage->spells && mage->magietyp == M_GRAY) { equipment *eq; - char buffer[64]; ql_free(mage->spells); diff --git a/src/curses.c b/src/curses.c index d996ca77f..d01902f69 100644 --- a/src/curses.c +++ b/src/curses.c @@ -36,7 +36,6 @@ typedef struct wallcurse { void cw_init(attrib * a) { curse *c; - curse_init(a); c = (curse *) a->data.v; c->data.v = calloc(sizeof(wallcurse), 1); @@ -45,7 +44,6 @@ void cw_init(attrib * a) void cw_write(const attrib * a, const void *target, storage * store) { connection *b = ((wallcurse *) ((curse *) a->data.v)->data.v)->wall; - curse_write(a, target, store); store->w_int(store, b->id); } @@ -60,11 +58,8 @@ static int resolve_buddy(variant data, void *addr); static int cw_read(attrib * a, void *target, storage * store) { bresolve *br = calloc(sizeof(bresolve), 1); - curse *c = (curse *) a->data.v; - wallcurse *wc = (wallcurse *) c->data.v; - variant var; curse_read(a, store, target); @@ -89,11 +84,9 @@ attrib_type at_cursewall = { ATF_CURSE }; - static int resolve_buddy(variant data, void *addr) { curse *result = NULL; - bresolve *br = (bresolve *) data.v; if (br->id >= 0) { @@ -101,12 +94,9 @@ static int resolve_buddy(variant data, void *addr) if (b && b->from && b->to) { attrib *a = a_find(b->from->attribs, &at_cursewall); - while (a && a->data.v != br->self) { curse *c = (curse *) a->data.v; - wallcurse *wc = (wallcurse *) c->data.v; - if (wc->wall->id == br->id) break; a = a->next; @@ -115,9 +105,7 @@ static int resolve_buddy(variant data, void *addr) a = a_find(b->to->attribs, &at_cursewall); while (a && a->type == &at_cursewall && a->data.v != br->self) { curse *c = (curse *) a->data.v; - wallcurse *wc = (wallcurse *) c->data.v; - if (wc->wall->id == br->id) break; a = a->next; @@ -125,7 +113,6 @@ static int resolve_buddy(variant data, void *addr) } if (a && a->type == &at_cursewall) { curse *c = (curse *) a->data.v; - free(br); result = c; } @@ -143,7 +130,6 @@ static int resolve_buddy(variant data, void *addr) static void wall_init(connection * b) { wall_data *fd = (wall_data *) calloc(sizeof(wall_data), 1); - fd->countdown = -1; /* infinite */ b->data.v = fd; } @@ -156,9 +142,7 @@ static void wall_destroy(connection * b) static void wall_read(connection * b, storage * store) { wall_data *fd = (wall_data *) b->data.v; - variant mno; - assert(fd); if (store->version < STORAGE_VERSION) { mno.i = store->r_int(store); @@ -179,7 +163,6 @@ static void wall_read(connection * b, storage * store) static void wall_write(const connection * b, storage * store) { wall_data *fd = (wall_data *) b->data.v; - write_unit_reference(fd->mage, store); store->w_int(store, fd->force); store->w_int(store, fd->countdown); @@ -188,7 +171,6 @@ static void wall_write(const connection * b, storage * store) static int wall_age(connection * b) { wall_data *fd = (wall_data *) b->data.v; - --fd->countdown; return (fd->countdown > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE; } @@ -197,10 +179,8 @@ static region *wall_move(const connection * b, struct unit *u, struct region *from, struct region *to, boolean routing) { wall_data *fd = (wall_data *) b->data.v; - if (!routing && fd->active) { int hp = dice(3, fd->force) * u->number; - hp = MIN(u->hp, hp); u->hp -= hp; if (u->hp) { @@ -221,7 +201,6 @@ static const char *b_namefirewall(const connection * b, const region * r, const faction * f, int gflags) { const char *bname; - unused(f); unused(r); unused(b); @@ -257,7 +236,6 @@ void convert_firewall_timeouts(connection * b, attrib * a) while (a) { if (b->type == &bt_firewall && a->type == &at_countdown) { wall_data *fd = (wall_data *) b->data.v; - fd->countdown = a->data.i; } } @@ -267,7 +245,6 @@ 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); @@ -290,9 +267,7 @@ 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) { @@ -300,7 +275,6 @@ static region *wisps_move(const connection * b, struct unit *u, 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; diff --git a/src/curses.h b/src/curses.h index d2de26e81..0904b93ad 100644 --- a/src/curses.h +++ b/src/curses.h @@ -20,7 +20,6 @@ extern "C" { int countdown; } wall_data; - #ifdef __cplusplus } #endif diff --git a/src/main.c b/src/main.c index cf6253e1f..d860d2fb9 100644 --- a/src/main.c +++ b/src/main.c @@ -15,17 +15,13 @@ #include static const char *luafile = "setup.lua"; - static const char *entry_point = NULL; - static const char *inifile = "eressea.ini"; - static int memdebug = 0; static void parse_config(const char *filename) { dictionary *d = iniparser_new(filename); - if (d) { load_inifile(d); @@ -60,7 +56,6 @@ static int usage(const char *prog, const char *arg) static int parse_args(int argc, char **argv, int *exitcode) { int i; - int run_tests = 0; for (i = 1; i != argc; ++i) { @@ -125,9 +120,7 @@ static int parse_args(int argc, char **argv, int *exitcode) static void report_segfault(int signo, siginfo_t * sinf, void *arg) { void *btrace[50]; - size_t size; - int fd = fileno(stderr); fflush(stdout); @@ -160,7 +153,6 @@ void init_crtdbg(void) { #if (defined(_MSC_VER)) int flags = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); - if (memdebug == 1) { flags |= _CRTDBG_CHECK_ALWAYS_DF; /* expensive */ } else if (memdebug == 2) { @@ -175,24 +167,17 @@ void init_crtdbg(void) } #endif - static void dump_spells(void) { struct locale *loc = find_locale("de"); - FILE *F = fopen("spells.csv", "w"); - quicklist *ql; - int qi; for (ql = spells, qi = 0; ql; ql_advance(&ql, &qi, 1)) { spell *sp = (spell *) ql_get(ql, qi); - spell_component *spc = sp->components; - char components[128]; - components[0] = 0; for (; spc->type; ++spc) { strcat(components, LOC(loc, spc->type->_name[0])); @@ -207,13 +192,9 @@ static void dump_spells(void) static void dump_skills(void) { struct locale *loc = find_locale("de"); - FILE *F = fopen("skills.csv", "w"); - race *rc; - skill_t sk; - fputs("\"Rasse\",", F); for (rc = races; rc; rc = rc->next) { if (playerrace(rc)) { @@ -224,7 +205,6 @@ static void dump_skills(void) for (sk = 0; sk != MAXSKILLS; ++sk) { const char *str = skillname(sk, loc); - if (str) { fprintf(F, "\"%s\",", str); for (rc = races; rc; rc = rc->next) { @@ -257,7 +237,6 @@ extern void bind_eressea(struct lua_State *L); int main(int argc, char **argv) { static int write_csv = 0; - int err, result = 0; setup_signal_handler(); @@ -304,6 +283,5 @@ int main(int argc, char **argv) log_close(); if (global.inifile) iniparser_free(global.inifile); - return 0; } diff --git a/src/monsters.c b/src/monsters.c index 519f80cf3..1ce48c59f 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -75,9 +75,7 @@ static void reduce_weight(unit * u) { int capacity, weight = 0; - item **itmp = &u->items; - int horses = get_resource(u, oldresourcetype[R_HORSE]); if (horses > 0) { @@ -88,9 +86,7 @@ static void reduce_weight(unit * u) /* 0. ditch any vehicles */ while (*itmp != NULL) { item *itm = *itmp; - const item_type *itype = itm->type; - weight += itm->number * itype->weight; if (itype->flags & ITF_VEHICLE) { give_item(itm->number, itm->type, u, NULL, NULL); @@ -104,16 +100,13 @@ static void reduce_weight(unit * u) /* 1. get rid of anything that isn't silver or really lightweight or helpful in combat */ for (itmp = &u->items; *itmp && capacity > 0;) { item *itm = *itmp; - const item_type *itype = itm->type; - weight += itm->number * itype->weight; if (weight > capacity) { if (itype->weight >= 10 && itype->rtype->wtype == 0 && itype->rtype->atype == 0) { if (itype->capacity < itype->weight) { int reduce = MIN(itm->number, -((capacity - weight) / itype->weight)); - give_item(reduce, itm->type, u, NULL, NULL); weight -= reduce * itype->weight; } @@ -125,13 +118,10 @@ static void reduce_weight(unit * u) for (itmp = &u->items; *itmp && weight > capacity;) { item *itm = *itmp; - const item_type *itype = itm->type; - weight += itm->number * itype->weight; if (itype->capacity < itype->weight) { int reduce = MIN(itm->number, -((capacity - weight) / itype->weight)); - give_item(reduce, itm->type, u, NULL, NULL); weight -= reduce * itype->weight; } @@ -154,18 +144,15 @@ static order *monster_attack(unit * u, const unit * target) return create_order(K_ATTACK, u->faction->locale, "%i", target->no); } - static order *get_money_for_dragon(region * r, unit * u, int wanted) { unit *u2; - int n; /* attackiere bewachende einheiten */ for (u2 = r->units; u2; u2 = u2->next) { if (u2 != u && is_guard(u2, GUARD_TAX)) { order *ord = monster_attack(u, u2); - if (ord) addlist(&u->orders, ord); } @@ -184,12 +171,10 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted) for (u2 = r->units; u2; u2 = u2->next) { if (u2->faction != u->faction && cansee(u->faction, r, u2, 0)) { int m = get_money(u2); - if (m == 0 || is_guard(u2, GUARD_TAX)) continue; else { order *ord = monster_attack(u, u2); - if (ord) { addlist(&u->orders, ord); n += m; @@ -211,7 +196,6 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted) static int all_money(region * r, faction * f) { unit *u; - int m; m = rmoney(r); @@ -229,9 +213,7 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut) /* m - maximum an Geld, d - Richtung, i - index, t = Geld hier */ double m; - double t; - direction_t d = NODIRECTION, i; if (absolut == 1 || rpeasants(r) == 0) { @@ -244,7 +226,6 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut) for (i = 0; i != MAXDIRECTIONS; i++) { region *rn = rconnect(r, i); - if (rn != NULL && fval(rn->terrain, LAND_REGION)) { if (absolut == 1 || rpeasants(rn) == 0) { t = (double)all_money(rn, f); @@ -264,7 +245,6 @@ static direction_t richest_neighbour(region * r, faction * f, int absolut) static boolean room_for_race_in_region(region * r, const race * rc) { unit *u; - int c = 0; for (u = r->units; u; u = u->next) { @@ -281,9 +261,7 @@ static boolean room_for_race_in_region(region * r, const race * rc) static direction_t random_neighbour(region * r, unit * u) { direction_t i; - region *rc; - int rr, c = 0, c2 = 0; /* Nachsehen, wieviele Regionen in Frage kommen */ @@ -334,9 +312,7 @@ static direction_t random_neighbour(region * r, unit * u) static direction_t treeman_neighbour(region * r) { direction_t i; - int rr; - int c = 0; /* Nachsehen, wieviele Regionen in Frage kommen */ @@ -421,17 +397,13 @@ static int dragon_affinity_value(region * r, unit * u) static attrib *set_new_dragon_target(unit * u, region * r, int range) { int max_affinity = 0; - region *max_region = NULL; #if 1 region_list *rptr, *rlist = regions_in_range(r, range, allowed_dragon); - for (rptr = rlist; rptr; rptr = rptr->next) { region *r2 = rptr->data; - int affinity = dragon_affinity_value(r2, u); - if (affinity > max_affinity) { max_affinity = affinity; max_region = r2; @@ -441,18 +413,14 @@ static attrib *set_new_dragon_target(unit * u, region * r, int range) free_regionlist(rlist); #else int tx, ty; - for (tx = r->x - range; tx < r->x + range; tx++) { for (ty = r->y - range; ty < r->y + range; ty++) { region *r2; - int x = tx, y = ty; - pnormalize(&x, &y, r->planep); r2 = findregion(x, y); if (r2 != NULL) { int affinity = dragon_affinity_value(r2, u); - if (affinity > max_affinity) { if (koor_distance(r->x, r->y, x, y) <= range && path_exists(r, r2, range, allowed_dragon)) { @@ -466,7 +434,6 @@ static attrib *set_new_dragon_target(unit * u, region * r, int range) #endif if (max_region && max_region != r) { attrib *a = a_find(u->attribs, &at_targetregion); - if (!a) { a = a_add(&u->attribs, make_targetregion(max_region)); } else { @@ -481,13 +448,9 @@ static order *make_movement_order(unit * u, const region * target, int moves, boolean(*allowed) (const region *, const region *)) { region *r = u->region; - region **plan; - int bytes, position = 0; - char zOrder[128], *bufp = zOrder; - size_t size = sizeof(zOrder) - 1; if (monster_is_waiting(u)) @@ -505,11 +468,8 @@ static order *make_movement_order(unit * u, const region * target, int moves, while (position != moves && plan[position + 1]) { region *prev = plan[position]; - region *next = plan[++position]; - direction_t dir = reldirection(prev, next); - assert(dir != NODIRECTION && dir != D_SPECIAL); if (size > 1) { *bufp++ = ' '; @@ -530,13 +490,9 @@ static order *make_movement_order(unit * u, const region * target, int moves, static order *monster_seeks_target(region * r, unit * u) { direction_t d; - unit *target = NULL; - int dist, dist2; - direction_t i; - region *nr; /* Das Monster sucht ein bestimmtes Opfer. Welches, steht @@ -592,14 +548,12 @@ static order *monster_seeks_target(region * r, unit * u) static void monster_attacks(unit * u) { region *r = u->region; - unit *u2; for (u2 = r->units; u2; u2 = u2->next) { if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction && chance(0.75)) { order *ord = monster_attack(u, u2); - if (ord) addlist(&u->orders, ord); } @@ -628,11 +582,8 @@ extern struct attrib_type at_direction; static order *monster_learn(unit * u) { int c = 0; - int n; - skill *sv; - const struct locale *lang = u->faction->locale; /* Monster lernt ein zufälliges Talent aus allen, in denen es schon @@ -662,7 +613,6 @@ static order *monster_learn(unit * u) static boolean check_overpopulated(unit * u) { unit *u2; - int c = 0; for (u2 = u->region->units; u2; u2 = u2->next) { @@ -679,13 +629,9 @@ static boolean check_overpopulated(unit * u) static void recruit_dracoids(unit * dragon, int size) { faction *f = dragon->faction; - region *r = dragon->region; - const struct item *weapon = NULL; - order *new_order = NULL; - unit *un = createunit(r, f, size, new_race[RC_DRACOID]); fset(un, UFL_ISNEW | UFL_MOVED); @@ -697,7 +643,6 @@ static void recruit_dracoids(unit * dragon, int size) setstatus(un, ST_FIGHT); for (weapon = un->items; weapon; weapon = weapon->next) { const weapon_type *wtype = weapon->type->rtype->wtype; - if (wtype && (wtype->flags & WTF_MISSILE)) { setstatus(un, ST_BEHIND); } @@ -713,13 +658,9 @@ static void recruit_dracoids(unit * dragon, int size) static order *plan_dragon(unit * u) { attrib *ta = a_find(u->attribs, &at_targetregion); - region *r = u->region; - region *tr = NULL; - boolean move = false; - order *long_order = NULL; reduce_weight(u); @@ -732,7 +673,6 @@ static order *plan_dragon(unit * u) if (u->race == new_race[RC_WYRM] && !move) { unit *u2; - for (u2 = r->units; u2; u2 = u2->next) { /* wyrme sind einzelgänger */ if (u2 == u) { @@ -774,7 +714,6 @@ static order *plan_dragon(unit * u) } if (rng_int() % 100 < 15) { const struct locale *lang = u->faction->locale; - /* do a growl */ if (rname(tr, lang)) { addlist(&u->orders, create_order(K_MAIL, lang, "%s '%s... %s %s %s'", @@ -793,7 +732,6 @@ static order *plan_dragon(unit * u) /* neue dracoiden! */ if (r->land && !fval(r->terrain, FORBIDDEN_REGION)) { int ra = 20 + rng_int() % 100; - if (get_money(u) > ra * 50 + 100 && rng_int() % 100 < 50) { recruit_dracoids(u, ra); } @@ -802,7 +740,6 @@ static order *plan_dragon(unit * u) } if (long_order == NULL) { skill_t sk = SK_PERCEPTION; - /* study perception (or a random useful skill) */ while (!skill_enabled[sk] || u->race->bonus[sk] < -5) { sk = (skill_t) (rng_int() % MAXSKILLS); @@ -822,14 +759,11 @@ void plan_monsters(faction * f) for (r = regions; r; r = r->next) { unit *u; - double attack_chance = MONSTERATTACK; - boolean attacking = false; for (u = r->units; u; u = u->next) { attrib *ta; - order *long_order = NULL; /* Ab hier nur noch Befehle für NPC-Einheiten. */ @@ -862,7 +796,6 @@ void plan_monsters(faction * f) ta = a_find(u->attribs, &at_hate); if (ta && !monster_is_waiting(u)) { unit *tu = (unit *) ta->data.v; - if (tu && tu->region == r) { addlist(&u->orders, create_order(K_ATTACK, u->faction->locale, "%i", tu->no)); @@ -883,7 +816,6 @@ void plan_monsters(faction * f) /* Einheiten mit Bewegungsplan kriegen ein NACH: */ if (long_order == NULL) { attrib *ta = a_find(u->attribs, &at_targetregion); - if (ta) { if (u->region == (region *) ta->data.v) { a_remove(&u->attribs, ta); @@ -946,7 +878,6 @@ void plan_monsters(faction * f) static double chaosfactor(region * r) { attrib *a = a_find(r->attribs, &at_chaoscount); - if (!a) return 0; return ((double)a->data.i / 1000.0); @@ -969,7 +900,6 @@ static int nrand(int start, int sub) void spawn_dragons(void) { region *r; - faction *monsters = get_monsters(); for (r = regions; r; r = r->next) { @@ -1012,12 +942,10 @@ void spawn_dragons(void) void spawn_undead(void) { region *r; - faction *monsters = get_monsters(); for (r = regions; r; r = r->next) { int unburied = deathcount(r); - static const curse_type *ctype = NULL; if (!ctype) @@ -1029,16 +957,12 @@ void spawn_undead(void) if (r->land && unburied > r->land->peasants / 20 && rng_int() % 10000 < (100 + 100 * chaosfactor(r))) { unit *u; - /* es ist sinnfrei, wenn irgendwo im Wald 3er-Einheiten Untote entstehen. * Lieber sammeln lassen, bis sie mindestens 5% der Bevölkerung sind, und * dann erst auferstehen. */ int undead = unburied / (rng_int() % 2 + 1); - const race *rc = NULL; - int i; - if (r->age < 100) undead = undead * r->age / 100; /* newbie-regionen kriegen weniger ab */ @@ -1082,7 +1006,6 @@ void spawn_undead(void) { message *msg = msg_message("undeadrise", "region", r); - add_message(&r->msgs, msg); for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT); @@ -1096,7 +1019,6 @@ void spawn_undead(void) } } else { int i = deathcount(r); - if (i) { /* Gräber verwittern, 3% der Untoten finden die ewige Ruhe */ deathcounts(r, (int)(-i * 0.03)); diff --git a/src/races/dragons.c b/src/races/dragons.c index a2606a966..b646f6264 100644 --- a/src/races/dragons.c +++ b/src/races/dragons.c @@ -31,7 +31,6 @@ void age_firedragon(unit * u) { if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) { double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); - u->race = new_race[RC_DRAGON]; u->irace = NULL; scale_number(u, 1); @@ -43,7 +42,6 @@ void age_dragon(unit * u) { if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) { double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); - u->race = new_race[RC_WYRM]; u->irace = NULL; u->hp = (int)(unit_max_hp(u) * u->number * q); diff --git a/src/races/races.c b/src/races/races.c index bf74653ea..5497324f8 100644 --- a/src/races/races.c +++ b/src/races/races.c @@ -28,23 +28,16 @@ #include void age_firedragon(struct unit *u); - void age_dragon(struct unit *u); - void age_illusion(struct unit *u); - void age_undead(struct unit *u); - void age_skeleton(struct unit *u); - void age_zombie(struct unit *u); - void age_ghoul(struct unit *u); static void oldfamiliars(unit * u) { char fname[64]; - /* these familiars have no special skills. */ snprintf(fname, sizeof(fname), "%s_familiar", u->race->_name[0]); @@ -55,7 +48,6 @@ static void oldfamiliars(unit * u) static void set_show_item(faction * f, item_t i) { attrib *a = a_add(&f->attribs, a_new(&at_showitem)); - a->data.v = (void *)olditemtype[i]; } @@ -74,10 +66,8 @@ static void equip_newunits(const struct equipment *eq, struct unit *u) case RC_HUMAN: if (u->building == NULL) { const building_type *btype = bt_find("castle"); - if (btype != NULL) { building *b = new_building(btype, r, u->faction->locale); - b->size = 10; u->building = b; fset(u, UFL_OWNER); @@ -90,7 +80,6 @@ static void equip_newunits(const struct equipment *eq, struct unit *u) case RC_AQUARIAN: { ship *sh = new_ship(st_find("boat"), u->faction->locale, r); - sh->size = sh->type->construction->maxsize; u->ship = sh; fset(u, UFL_OWNER); diff --git a/src/races/zombies.c b/src/races/zombies.c index c163f9e21..b58f36e0a 100644 --- a/src/races/zombies.c +++ b/src/races/zombies.c @@ -35,7 +35,6 @@ void age_undead(unit * u) { region *r = u->region; - int n = 0; /* untote, die einer partei angehoeren, koennen sich @@ -45,7 +44,6 @@ void age_undead(unit * u) if (u->number > UNDEAD_MIN && !is_monsters(u->faction) && rng_int() % 100 < UNDEAD_BREAKUP) { int m; - unit *u2; n = 0; @@ -63,9 +61,7 @@ void age_skeleton(unit * u) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { int n = MAX(1, u->number / 2); - double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); - u->race = new_race[RC_SKELETON_LORD]; u->irace = NULL; scale_number(u, n); @@ -77,9 +73,7 @@ void age_zombie(unit * u) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { int n = MAX(1, u->number / 2); - double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); - u->race = new_race[RC_ZOMBIE_LORD]; u->irace = NULL; scale_number(u, n); @@ -91,9 +85,7 @@ void age_ghoul(unit * u) { if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) { int n = MAX(1, u->number / 2); - double q = (double)u->hp / (double)(unit_max_hp(u) * u->number); - u->race = new_race[RC_GHOUL_LORD]; u->irace = NULL; scale_number(u, n); diff --git a/src/spells/alp.c b/src/spells/alp.c index d4d234575..5e0caac7d 100644 --- a/src/spells/alp.c +++ b/src/spells/alp.c @@ -61,7 +61,6 @@ static void alp_done(attrib * a) static int alp_verify(attrib * a) { alp_data *ad = (alp_data *) a->data.v; - if (ad->mage && ad->target) return 1; return 0; /* remove the attribute */ @@ -71,7 +70,6 @@ static void alp_write(const attrib * a, const void *owner, struct storage *store) { alp_data *ad = (alp_data *) a->data.v; - write_unit_reference(ad->mage, store); write_unit_reference(ad->target, store); } @@ -79,9 +77,7 @@ alp_write(const attrib * a, const void *owner, struct storage *store) static int alp_read(attrib * a, void *owner, struct storage *store) { alp_data *ad = (alp_data *) a->data.v; - int rm = read_reference(&ad->mage, store, read_unit_reference, resolve_unit); - int rt = read_reference(&ad->target, store, read_unit_reference, resolve_unit); if (rt == 0 && rm == 0 && (!ad->target || !ad->mage)) { @@ -104,19 +100,12 @@ static attrib_type at_alp = { int sp_summon_alp(struct castorder *co) { unit *alp, *opfer; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - const struct race *rc = new_race[RC_ALP]; - struct faction *f = get_monsters(); - struct message *msg; opfer = pa->param[0]->data.u; @@ -131,9 +120,7 @@ int sp_summon_alp(struct castorder *co) { attrib *a = a_add(&alp->attribs, a_new(&at_alp)); - alp_data *ad = (alp_data *) a->data.v; - ad->mage = mage; ad->target = opfer; } @@ -153,21 +140,14 @@ int sp_summon_alp(struct castorder *co) return cast_level; } - void alp_findet_opfer(unit * alp, region * r) { curse *c; - attrib *a = a_find(alp->attribs, &at_alp); - alp_data *ad = (alp_data *) a->data.v; - unit *mage = ad->mage; - unit *opfer = ad->target; - double effect; - message *msg; assert(opfer); @@ -207,7 +187,6 @@ void register_alp(void) unit *alp_target(unit * alp) { alp_data *ad; - unit *target = NULL; attrib *a = a_find(alp->attribs, &at_alp); diff --git a/src/spells/alp.h b/src/spells/alp.h index bf70da9d5..c350e7c7d 100644 --- a/src/spells/alp.h +++ b/src/spells/alp.h @@ -47,7 +47,6 @@ extern "C" { struct unit *alp_target(struct unit *alp); void alp_findet_opfer(struct unit *alp, struct region *r); - #ifdef __cplusplus } #endif diff --git a/src/spells/buildingcurse.c b/src/spells/buildingcurse.c index 535652628..ca531c6fe 100644 --- a/src/spells/buildingcurse.c +++ b/src/spells/buildingcurse.c @@ -33,7 +33,6 @@ #include #include - static message *cinfo_building(const void *obj, typ_t typ, const curse * c, int self) { @@ -53,10 +52,8 @@ static message *cinfo_magicrunes(const void *obj, typ_t typ, const curse * c, int self) { message *msg = NULL; - if (typ == TYP_BUILDING) { building *b; - b = (building *) obj; if (self != 0) { msg = @@ -64,7 +61,6 @@ static message *cinfo_magicrunes(const void *obj, typ_t typ, const curse * c, } } else if (typ == TYP_SHIP) { ship *sh; - sh = (ship *) obj; if (self != 0) { msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no); @@ -93,7 +89,6 @@ static struct curse_type ct_nocostbuilding = { "nocostbuilding", CURSETYP_NORM, CURSE_NOAGE | CURSE_ONLYONE, NO_MERGE, cinfo_building }; - void register_buildingcurse(void) { ct_register(&ct_magicwalls); diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index 301c2edf4..9b93a6512 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -109,16 +109,11 @@ static double get_force(double power, int formel) int sp_kampfzauber(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - troop at, dt; - message *m; - /* Immer aus der ersten Reihe nehmen */ int force, enemies; - int killed = 0; - const char *damage; if (power <= 0) @@ -173,14 +168,10 @@ int sp_kampfzauber(fighter * fi, int level, double power, spell * sp) int sp_petrify(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - /* Wirkt auf erste und zweite Reihe */ int force, enemies; - int stoned = 0; - message *m; force = lovar(get_force(power, 0)); @@ -196,9 +187,7 @@ int sp_petrify(fighter * fi, int level, double power, spell * sp) while (force && stoned < enemies) { troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); - unit *du = dt.fighter->unit; - if (is_magic_resistant(mage, du, 0) == false) { /* person ans ende hinter die lebenden schieben */ remove_troop(dt); @@ -219,16 +208,11 @@ int sp_petrify(fighter * fi, int level, double power, spell * sp) int sp_stun(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - message *m; - troop at; - /* Aus beiden Reihen nehmen */ int force = 0, enemies; - int stunned; if (power <= 0) @@ -256,9 +240,7 @@ int sp_stun(fighter * fi, int level, double power, spell * sp) stunned = 0; while (force && stunned < enemies) { troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); - fighter *df = dt.fighter; - unit *du = df->unit; --force; @@ -284,11 +266,8 @@ static void scramble_fighters(quicklist * ql) for (qi = 0; qi != qlen; ++qi) { int qj = qi + (rng_int() % (qlen - qi)); - void *a = ql_get(ql, qi); - void *b = ql_replace(ql, qj, a); - ql_replace(ql, qi, b); } } @@ -297,11 +276,8 @@ static void scramble_fighters(quicklist * ql) int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - quicklist *ql, *fgs; - int force = lovar(power * 15); - int qi, k = 0; /* Immer aus der ersten Reihe nehmen */ @@ -310,7 +286,6 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp) if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE | SELECT_FIND)) { message *msg = msg_message("rust_effect_0", "mage", fi->unit); - message_all(b, msg); msg_release(msg); return 0; @@ -332,17 +307,12 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp) if (df->weapons) { int w; - for (w = 0; df->weapons[w].type != NULL; ++w) { weapon *wp = df->weapons; - int n = MIN(force, wp->used); - if (n) { requirement *mat = wp->type->itype->construction->materials; - boolean iron = false; - while (mat && mat->number > 0) { if (mat->rtype == oldresourcetype[R_IRON]) { iron = true; @@ -352,7 +322,6 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp) } if (iron) { int p; - force -= n; wp->used -= n; k += n; @@ -379,14 +348,12 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp) if (k == 0) { /* keine Waffen mehr da, die zerstört werden könnten */ message *msg = msg_message("rust_effect_1", "mage", fi->unit); - message_all(b, msg); msg_release(msg); fi->magic = 0; /* kämpft nichtmagisch weiter */ level = 0; } else { message *msg = msg_message("rust_effect_2", "mage", fi->unit); - message_all(b, msg); msg_release(msg); } @@ -396,19 +363,12 @@ int sp_combatrosthauch(fighter * fi, int level, double power, spell * sp) int sp_sleep(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - unit *du; - troop dt; - int force, enemies; - int k = 0; - message *m; - /* Immer aus der ersten Reihe nehmen */ force = lovar(power * 25); @@ -438,17 +398,12 @@ int sp_sleep(fighter * fi, int level, double power, spell * sp) return level; } - int sp_speed(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - int force; - int allies; - int targets = 0; - message *m; force = lovar(power * power * 5); @@ -461,9 +416,7 @@ int sp_speed(fighter * fi, int level, double power, spell * sp) while (force && allies) { troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY); - fighter *df = dt.fighter; - --allies; if (df) { @@ -486,7 +439,6 @@ int sp_speed(fighter * fi, int level, double power, spell * sp) static skill_t random_skill(unit * u, boolean weighted) { int n = 0; - skill *sv; for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) { @@ -527,15 +479,10 @@ static skill_t random_skill(unit * u, boolean weighted) int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - int k = 0, reset = 0, maxloss = (level + 2) / 3; - message *m; - int force = lovar(power * 25); - int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); if (!enemies) { @@ -547,7 +494,6 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp) while (force > 0 && enemies > 0) { unit *du; - troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); assert(dt.fighter); @@ -560,12 +506,9 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp) if (humanoidrace(du->race) && force >= du->number) { if (!is_magic_resistant(mage, du, 0)) { skill_t sk = random_skill(du, true); - if (sk != NOSKILL) { int n = 1 + rng_int() % maxloss; - attrib *a = make_skillmod(sk, SMF_ALWAYS, NULL, 0.0, n); - /* neat: you can add a whole lot of these to a unit, they stack */ a_add(&du->attribs, a); } @@ -580,7 +523,6 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp) if (reset) { unit *u; - for (u = b->region->units; u; u = u->next) { freset(u, UFL_MARK); } @@ -599,15 +541,10 @@ int sp_mindblast_temp(fighter * fi, int level, double power, spell * sp) int sp_mindblast(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - int killed = 0, k = 0, reset = 0; - message *m; - int force = lovar(power * 25); - int enemies = count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); if (!enemies) { @@ -619,7 +556,6 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp) while (enemies > 0 && force > 0) { unit *du; - troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); assert(dt.fighter); @@ -632,10 +568,8 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp) if (humanoidrace(du->race) && force >= du->number) { if (!is_magic_resistant(mage, du, 0)) { skill_t sk = random_skill(du, false); - if (sk != NOSKILL) { skill *sv = get_skill(du, sk); - int n = 1 + rng_int() % 3; reduce_skill(du, sv, n); @@ -658,7 +592,6 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp) if (reset) { unit *u; - for (u = b->region->units; u; u = u->next) { freset(u, UFL_MARK); } @@ -675,15 +608,10 @@ int sp_mindblast(fighter * fi, int level, double power, spell * sp) int sp_dragonodem(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - troop dt; - troop at; - int force, enemies; - int killed = 0; - const char *damage; /* 11-26 HP */ @@ -726,15 +654,10 @@ int sp_dragonodem(fighter * fi, int level, double power, spell * sp) int sp_immolation(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - troop at; - int force, qi, killed = 0; - const char *damage; - quicklist *fgs, *ql; - message *m; /* 2d4 HP */ @@ -756,9 +679,7 @@ int sp_immolation(fighter * fi, int level, double power, spell * sp) fgs = fighters(b, fi->side, FIGHT_ROW, AVOID_ROW, FS_ENEMY); for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) { fighter *df = (fighter *) ql_get(ql, qi); - int n = df->alive - df->removed; - troop dt; dt.fighter = df; @@ -784,19 +705,12 @@ int sp_immolation(fighter * fi, int level, double power, spell * sp) int sp_drainodem(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - troop dt; - troop at; - int force, enemies; - int drained = 0; - int killed = 0; - const char *damage; - message *m; /* 11-26 HP */ @@ -841,19 +755,13 @@ int sp_drainodem(fighter * fi, int level, double power, spell * sp) int sp_shadowcall(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - region *r = b->region; - unit *mage = fi->unit; - attrib *a; - int force = (int)(get_force(power, 3) / 2); - unit *u; const char *races[3] = { "shadowbat", "nightmare", "vampunicorn" }; const race *rc = rc_find(races[rng_int() % 3]); - message *msg; unused(sp); @@ -882,17 +790,11 @@ int sp_shadowcall(fighter * fi, int level, double power, spell * sp) int sp_wolfhowl(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - region *r = b->region; - unit *mage = fi->unit; - attrib *a; - message *msg; - int force = (int)(get_force(power, 3) / 2); - unit *u = create_unit(r, mage->faction, force, new_race[RC_WOLF], 0, NULL, mage); unused(sp); @@ -926,22 +828,15 @@ int sp_wolfhowl(fighter * fi, int level, double power, spell * sp) int sp_shadowknights(fighter * fi, int level, double power, spell * sp) { unit *u; - battle *b = fi->side->battle; - region *r = b->region; - unit *mage = fi->unit; - attrib *a; - int force = MAX(1, (int)get_force(power, 3)); - message *msg; unused(sp); - u = create_unit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT], 0, NULL, mage); @@ -970,19 +865,12 @@ int sp_shadowknights(fighter * fi, int level, double power, spell * sp) int sp_strong_wall(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - building *burg; - double effect; - static boolean init = false; - message *msg; - static const curse_type *strongwall_ct; - if (!init) { init = true; strongwall_ct = ct_find("strongwall"); @@ -1012,15 +900,10 @@ int sp_strong_wall(fighter * fi, int level, double power, spell * sp) int sp_chaosrow(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - quicklist *fgs, *ql; - message *m; - const char *mtype; - int qi, k = 0; if (!count_enemies(b, fi, FIGHT_ROW, NUMROWS, SELECT_ADVANCE | SELECT_FIND)) { @@ -1040,7 +923,6 @@ int sp_chaosrow(fighter * fi, int level, double power, spell * sp) for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) { fighter *df = (fighter *) ql_get(ql, qi); - int n = df->unit->number; if (df->alive == 0) @@ -1054,7 +936,6 @@ int sp_chaosrow(fighter * fi, int level, double power, spell * sp) if (chance(power / n)) { int row = statusrow(df->status); - df->side->size[row] -= df->alive; if (df->unit->race->battle_flags & BF_NOBLOCK) { df->side->nonblockers[row] -= df->alive; @@ -1104,15 +985,10 @@ int sp_chaosrow(fighter * fi, int level, double power, spell * sp) int sp_flee(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - quicklist *fgs, *ql; - int force, n, qi; - int panik = 0; - message *msg; switch (sp->id) { @@ -1173,15 +1049,10 @@ int sp_flee(fighter * fi, int level, double power, spell * sp) int sp_hero(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - int df_bonus = 0; - int force = 0; - int allies; - int targets = 0; - message *m; switch (sp->id) { @@ -1203,9 +1074,7 @@ int sp_hero(fighter * fi, int level, double power, spell * sp) while (force && allies) { troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW, ALLY_ANY); - fighter *df = dt.fighter; - --allies; if (df) { @@ -1229,17 +1098,11 @@ int sp_hero(fighter * fi, int level, double power, spell * sp) int sp_berserk(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - int at_bonus = 0; - int df_malus = 0; - int force = 0; - int allies = 0; - int targets = 0; - message *m; switch (sp->id) { @@ -1264,9 +1127,7 @@ int sp_berserk(fighter * fi, int level, double power, spell * sp) while (force && allies) { troop dt = select_ally(fi, FIGHT_ROW, BEHIND_ROW - 1, ALLY_ANY); - fighter *df = dt.fighter; - --allies; if (df) { @@ -1291,19 +1152,12 @@ int sp_berserk(fighter * fi, int level, double power, spell * sp) int sp_frighten(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - int at_malus = 0; - int df_malus = 0; - int force = 0; - int enemies = 0; - int targets = 0; - message *m; at_malus = MAX(1, level - 4); @@ -1321,9 +1175,7 @@ int sp_frighten(fighter * fi, int level, double power, spell * sp) while (force && enemies) { troop dt = select_enemy(fi, FIGHT_ROW, BEHIND_ROW - 1, SELECT_ADVANCE); - fighter *df = dt.fighter; - --enemies; if (!df) @@ -1350,17 +1202,12 @@ int sp_frighten(fighter * fi, int level, double power, spell * sp) return level; } - int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - int n = 0; - int force = (int)(power * power * 4); - message *m; if (!count_enemies(b, fi, FIGHT_ROW, BEHIND_ROW, @@ -1374,7 +1221,6 @@ int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp) while (force) { troop t = select_enemy(fi, FIGHT_ROW, BEHIND_ROW, SELECT_ADVANCE); - fighter *df = t.fighter; if (!df) @@ -1400,11 +1246,8 @@ int sp_tiredsoldiers(fighter * fi, int level, double power, spell * sp) int sp_windshield(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - int force, at_malus; - int enemies; - message *m; switch (sp->id) { @@ -1427,9 +1270,7 @@ int sp_windshield(fighter * fi, int level, double power, spell * sp) while (force && enemies) { troop dt = select_enemy(fi, BEHIND_ROW, BEHIND_ROW, SELECT_ADVANCE); - fighter *df = dt.fighter; - --enemies; if (!df) @@ -1452,7 +1293,6 @@ int sp_windshield(fighter * fi, int level, double power, spell * sp) int sp_reeling_arrows(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - message *m; unused(power); @@ -1470,11 +1310,8 @@ int sp_denyattack(fighter * fi, int level, double power, spell * sp) * eine Nachbarregion, wobei ein NACH berücksichtigt wird. Ansonsten * bleibt er stehen und nimmt nicht weiter am Kampf teil. */ battle *b = fi->side->battle; - unit *mage = fi->unit; - region *r = b->region; - message *m; unused(power); @@ -1505,9 +1342,7 @@ int sp_denyattack(fighter * fi, int level, double power, spell * sp) static void do_meffect(fighter * af, int typ, int effect, int duration) { battle *b = af->side->battle; - meffect *me = (meffect *) malloc(sizeof(struct meffect)); - ql_push(&b->meffects, me); me->magician = af; me->typ = typ; @@ -1518,11 +1353,8 @@ static void do_meffect(fighter * af, int typ, int effect, int duration) int sp_armorshield(fighter * fi, int level, double power, spell * sp) { int effect; - int duration; - battle *b = fi->side->battle; - message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); @@ -1547,13 +1379,9 @@ int sp_armorshield(fighter * fi, int level, double power, spell * sp) int sp_reduceshield(fighter * fi, int level, double power, spell * sp) { int effect; - int duration; - battle *b = fi->side->battle; - message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); - message_all(b, m); msg_release(m); @@ -1577,11 +1405,8 @@ int sp_reduceshield(fighter * fi, int level, double power, spell * sp) int sp_fumbleshield(fighter * fi, int level, double power, spell * sp) { int effect; - int duration; - battle *b = fi->side->battle; - message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); @@ -1612,7 +1437,6 @@ int sp_fumbleshield(fighter * fi, int level, double power, spell * sp) static int count_healable(battle * b, fighter * df) { side *s; - int healable = 0; for (s = b->sides; s != b->sides + b->nsides; ++s) { @@ -1627,17 +1451,11 @@ static int count_healable(battle * b, fighter * df) int sp_reanimate(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - int healable, j = 0; - double c = 0.50 + 0.02 * power; - double k = EFFECT_HEALING_SPELL * power; - boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0; - message *msg; if (use_item) { @@ -1649,7 +1467,6 @@ int sp_reanimate(fighter * fi, int level, double power, spell * sp) healable = (int)MIN(k, healable); while (healable--) { fighter *tf = select_corpse(b, fi); - if (tf != NULL && tf->side->casualties > 0 && tf->unit->race != new_race[RC_DAEMON] && (chance(c))) { @@ -1690,7 +1507,6 @@ int sp_reanimate(fighter * fi, int level, double power, spell * sp) int sp_keeploot(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - message *m = msg_message("cast_spell_effect", "mage spell", fi->unit, sp); message_all(b, m); @@ -1704,7 +1520,6 @@ int sp_keeploot(fighter * fi, int level, double power, spell * sp) static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters) { int healhp = *power, healed = 0, qi; - quicklist *ql; for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) { @@ -1720,18 +1535,15 @@ static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters) /* wir heilen erstmal keine Monster */ if (heal_monsters || playerrace(df->unit->race)) { int n, hp = df->unit->hp / df->unit->number; - int rest = df->unit->hp % df->unit->number; for (n = 0; n < df->unit->number; n++) { int wound = hp - df->person[n].hp; - if (rest > n) ++wound; if (wound > 0 && wound < hp) { int heal = MIN(healhp, wound); - assert(heal >= 0); df->person[n].hp += heal; healhp = MAX(0, healhp - heal); @@ -1750,17 +1562,11 @@ static int heal_fighters(quicklist * fgs, int *power, boolean heal_monsters) int sp_healing(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - int j = 0; - int healhp = (int)power * 200; - quicklist *fgs; - message *msg; - boolean use_item = get_item(mage, I_AMULET_OF_HEALING) > 0; /* bis zu 11 Personen pro Stufe (einen HP müssen sie ja noch @@ -1798,19 +1604,12 @@ int sp_healing(fighter * fi, int level, double power, spell * sp) int sp_undeadhero(fighter * fi, int level, double power, spell * sp) { battle *b = fi->side->battle; - unit *mage = fi->unit; - region *r = b->region; - quicklist *fgs, *ql; - int qi, n, undead = 0; - message *msg; - int force = (int)get_force(power, 0); - double c = 0.50 + 0.02 * power; /* Liste aus allen Kämpfern */ @@ -1819,7 +1618,6 @@ int sp_undeadhero(fighter * fi, int level, double power, spell * sp) for (qi = 0, ql = fgs; ql; ql_advance(&ql, &qi, 1)) { fighter *df = (fighter *) ql_get(ql, qi); - unit *du = df->unit; if (force <= 0) diff --git a/src/spells/regioncurse.c b/src/spells/regioncurse.c index fa2985921..1012b163e 100644 --- a/src/spells/regioncurse.c +++ b/src/spells/regioncurse.c @@ -62,7 +62,6 @@ static struct curse_type ct_godcursezone = { cinfo_cursed_by_the_gods, }; - /* --------------------------------------------------------------------- */ /* * C_GBDREAM @@ -136,9 +135,7 @@ cansee_antimagiczone(const struct faction *viewer, const void *obj, typ_t typ, const curse * c, int self) { region *r; - unit *u = NULL; - unit *mage = c->magician; unused(typ); @@ -188,7 +185,6 @@ static struct curse_type ct_farvision = { cinfo_farvision }; - /* --------------------------------------------------------------------- */ static struct curse_type ct_fogtrap = { @@ -283,7 +279,6 @@ static struct curse_type ct_healing = { cinfo_simple }; - void register_regioncurse(void) { ct_register(&ct_fogtrap); diff --git a/src/spells/shipcurse.c b/src/spells/shipcurse.c index b04ae66c7..275be2c50 100644 --- a/src/spells/shipcurse.c +++ b/src/spells/shipcurse.c @@ -34,7 +34,6 @@ #include #include - message *cinfo_ship(const void *obj, typ_t typ, const curse * c, int self) { message *msg; @@ -79,7 +78,6 @@ static struct curse_type ct_stormwind = { "stormwind", static int flyingship_read(storage * store, curse * c, void *target) { ship *sh = (ship *) target; - c->data.v = sh; if (store->version < FOSS_VERSION) { sh->flags |= SF_FLYING; @@ -93,7 +91,6 @@ static int flyingship_write(storage * store, const curse * c, const void *target) { const ship *sh = (const ship *)target; - assert(sh->flags & SF_FLYING); return 0; } @@ -101,7 +98,6 @@ static int flyingship_write(storage * store, const curse * c, static int flyingship_age(curse * c) { ship *sh = (ship *) c->data.v; - if (sh && c->duration == 1) { freset(sh, SF_FLYING); return 1; @@ -125,7 +121,6 @@ static struct curse_type ct_shipspeedup = { "shipspeedup", curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration) { static const curse_type *ct_flyingship = NULL; - if (!ct_flyingship) { ct_flyingship = ct_find("flyingship"); assert(ct_flyingship); @@ -149,7 +144,6 @@ curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration) int levitate_ship(ship * sh, unit * mage, double power, int duration) { curse *c = shipcurse_flyingship(sh, mage, power, duration); - if (c) { return c->no; } diff --git a/src/spells/spells.c b/src/spells/spells.c index 742a8fa69..7adf28b8a 100644 --- a/src/spells/spells.c +++ b/src/spells/spells.c @@ -131,14 +131,11 @@ static double curse_chance(const struct curse *c, double force) static void magicanalyse_region(region * r, unit * mage, double force) { attrib *a; - boolean found = false; for (a = r->attribs; a; a = a->next) { curse *c = (curse *) a->data.v; - double probability; - int mon; if (!fval(a->type, ATF_CURSE)) @@ -173,16 +170,12 @@ static void magicanalyse_region(region * r, unit * mage, double force) static void magicanalyse_unit(unit * u, unit * mage, double force) { attrib *a; - boolean found = false; for (a = u->attribs; a; a = a->next) { curse *c; - double probability; - int mon; - if (!fval(a->type, ATF_CURSE)) continue; @@ -215,14 +208,11 @@ static void magicanalyse_unit(unit * u, unit * mage, double force) static void magicanalyse_building(building * b, unit * mage, double force) { attrib *a; - boolean found = false; for (a = b->attribs; a; a = a->next) { curse *c; - double probability; - int mon; if (!fval(a->type, ATF_CURSE)) @@ -258,16 +248,12 @@ static void magicanalyse_building(building * b, unit * mage, double force) static void magicanalyse_ship(ship * sh, unit * mage, double force) { attrib *a; - boolean found = false; for (a = sh->attribs; a; a = a->next) { curse *c; - double probability; - int mon; - if (!fval(a->type, ATF_CURSE)) continue; @@ -302,15 +288,12 @@ static void magicanalyse_ship(ship * sh, unit * mage, double force) int break_curse(attrib ** alist, int cast_level, double force, curse * c) { int succ = 0; - /* attrib **a = a_find(*ap, &at_curse); */ attrib **ap = alist; while (*ap && force > 0) { curse *c1; - attrib *a = *ap; - if (!fval(a->type, ATF_CURSE)) { do { ap = &(*ap)->next; @@ -332,7 +315,6 @@ int break_curse(attrib ** alist, int cast_level, double force, curse * c) * richtigen Typ ist. */ if (!c || c == c1) { double remain = destr_curse(c1, cast_level, force); - if (remain < force) { succ = cast_level; force = remain; @@ -390,7 +372,6 @@ report_effect(region * r, unit * mage, message * seen, message * unseen) } #else int err = report_action(r, mage, seen, ACTION_RESET | ACTION_CANSEE); - if (err) { report_action(r, mage, seen, ACTION_CANNOTSEE); } @@ -469,20 +450,15 @@ report_effect(region * r, unit * mage, message * seen, message * unseen) static const race *select_familiar(const race * magerace, magic_t magiegebiet) { const race *retval = NULL; - int rnd = rng_int() % 100; assert(magerace->familiars[0]); if (rnd < 3) { race_list *familiarraces = get_familiarraces(); - unsigned int maxlen = listlen(familiarraces); - if (maxlen > 0) { race_list *rclist = familiarraces; - int index = rng_int() % maxlen; - while (index-- > 0) { rclist = rclist->next; } @@ -521,27 +497,16 @@ static void make_familiar(unit * familiar, unit * mage) static int sp_summon_familiar(castorder * co) { unit *familiar; - region *r = co->rt; - region *target_region = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - const race *rc; - skill_t sk; - int dh, dh1, bytes; - direction_t d; - message *msg; - char zText[2048], *bufp = zText; - size_t size = sizeof(zText) - 1; if (get_familiar(mage) != NULL) { @@ -568,7 +533,6 @@ static int sp_summon_familiar(castorder * co) dh = -1; for (d = 0; d < MAXDIRECTIONS; d++) { region *rn = rconnect(r, d); - if (rn && fval(rn->terrain, SEA_REGION)) { dh++; if (dh == coasts) @@ -637,21 +601,13 @@ static int sp_summon_familiar(castorder * co) static int sp_destroy_magic(castorder * co) { unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - curse *c = NULL; - char ts[80]; - attrib **ap; - int obj; - int succ; /* da jeder Zauber force verbraucht und der Zauber auf alles und nicht @@ -666,7 +622,6 @@ static int sp_destroy_magic(castorder * co) { /* region *tr = pa->param[0]->data.r; -- farcasting! */ region *tr = co->rt; - ap = &tr->attribs; write_regionname(tr, mage->faction, ts, sizeof(ts)); break; @@ -675,7 +630,6 @@ static int sp_destroy_magic(castorder * co) case SPP_UNIT: { unit *u; - u = pa->param[0]->data.u; ap = &u->attribs; write_unitname(u, ts, sizeof(ts)); @@ -684,7 +638,6 @@ static int sp_destroy_magic(castorder * co) case SPP_BUILDING: { building *b; - b = pa->param[0]->data.b; ap = &b->attribs; write_buildingname(b, ts, sizeof(ts)); @@ -693,7 +646,6 @@ static int sp_destroy_magic(castorder * co) case SPP_SHIP: { ship *sh; - sh = pa->param[0]->data.sh; ap = &sh->attribs; write_shipname(sh, ts, sizeof(ts)); @@ -738,15 +690,10 @@ static int sp_destroy_magic(castorder * co) static int sp_transferaura(castorder * co) { int aura, gain, multi = 2; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - unit *u; - sc_mage *scm_dst, *scm_src = get_mage(mage); /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -814,21 +761,13 @@ static int sp_transferaura(castorder * co) static int sp_goodwinds(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - int duration = cast_level + 1; - spellparameter *pa = co->par; - message *m; - ship *sh; - unit *u; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -878,7 +817,6 @@ static int sp_goodwinds(castorder * co) static int sp_magicstreet(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; if (!fval(r->terrain, LAND_REGION)) { @@ -893,9 +831,7 @@ static int sp_magicstreet(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("path_effect", "mage region", mage, r); - message *unseen = msg_message("path_effect", "mage region", NULL, r); - report_effect(r, mage, seen, unseen); msg_release(seen); msg_release(unseen); @@ -922,17 +858,11 @@ static int sp_magicstreet(castorder * co) static int sp_summonent(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - unit *u; - attrib *a; - int ents; if (rtrees(r, 2) == 0) { @@ -956,9 +886,7 @@ static int sp_summonent(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("ent_effect", "mage amount", mage, ents); - message *unseen = msg_message("ent_effect", "mage amount", NULL, ents); - report_effect(r, mage, seen, unseen); msg_release(unseen); msg_release(seen); @@ -983,15 +911,10 @@ static int sp_summonent(castorder * co) static int sp_blessstonecircle(castorder * co) { building *b; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *p = co->par; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -1038,17 +961,11 @@ static int sp_blessstonecircle(castorder * co) static int sp_maelstrom(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - curse *c; - double power = co->force; - double effect = co->force; - int duration = (int)power + 1; if (!fval(r->terrain, SEA_REGION)) { @@ -1067,9 +984,7 @@ static int sp_maelstrom(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("maelstrom_effect", "mage", mage); - message *unseen = msg_message("maelstrom_effect", "mage", NULL); - report_effect(r, mage, seen, unseen); msg_release(seen); msg_release(unseen); @@ -1092,9 +1007,7 @@ static int sp_maelstrom(castorder * co) static int sp_mallorn(castorder * co) { region *r = co->rt; - int cast_level = co->level; - unit *mage = co->magician.u; if (!fval(r->terrain, LAND_REGION)) { @@ -1115,9 +1028,7 @@ static int sp_mallorn(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("mallorn_effect", "mage", mage); - message *unseen = msg_message("mallorn_effect", "mage", NULL); - report_effect(r, mage, seen, unseen); msg_release(seen); msg_release(unseen); @@ -1141,15 +1052,10 @@ static int sp_mallorn(castorder * co) static int sp_blessedharvest(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - int duration = (int)power + 1; - /* Attribut auf Region. * Existiert schon ein curse, so wird dieser verstaerkt * (Max(Dauer), Max(Staerke))*/ @@ -1157,9 +1063,7 @@ static int sp_blessedharvest(castorder * co) if (create_curse(mage, &r->attribs, ct_find("blessedharvest"), power, duration, 1.0, 0)) { message *seen = msg_message("harvest_effect", "mage", mage); - message *unseen = msg_message("harvest_effect", "mage", NULL); - report_effect(r, mage, seen, unseen); msg_release(seen); msg_release(unseen); @@ -1184,13 +1088,9 @@ static int sp_blessedharvest(castorder * co) static int sp_hain(castorder * co) { int trees; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; if (!r->land) { @@ -1208,7 +1108,6 @@ static int sp_hain(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("growtree_effect", "mage amount", mage, trees); - message *unseen = msg_message("growtree_effect", "mage amount", NULL, trees); report_effect(r, mage, seen, unseen); @@ -1235,13 +1134,9 @@ static int sp_hain(castorder * co) static int sp_mallornhain(castorder * co) { int trees; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; if (!r->land) { @@ -1259,7 +1154,6 @@ static int sp_mallornhain(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("growtree_effect", "mage amount", mage, trees); - message *unseen = msg_message("growtree_effect", "mage amount", NULL, trees); report_effect(r, mage, seen, unseen); @@ -1273,13 +1167,9 @@ static int sp_mallornhain(castorder * co) void patzer_ents(castorder * co) { int ents; - unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - /* int cast_level = co->level; */ double force = co->force; @@ -1298,7 +1188,6 @@ void patzer_ents(castorder * co) /* melden, 1x pro Partei */ { message *unseen = msg_message("entrise", "region", r); - report_effect(r, mage, unseen, unseen); msg_release(unseen); } @@ -1331,7 +1220,6 @@ add_ironweapon(const struct item_type *type, const struct item_type *rusty, float chance) { iron_weapon *iweapon = malloc(sizeof(iron_weapon)); - iweapon->type = type; iweapon->rusty = rusty; iweapon->chance = chance; @@ -1342,17 +1230,11 @@ add_ironweapon(const struct item_type *type, const struct item_type *rusty, static int sp_rosthauch(castorder * co) { int n; - int success = 0; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - int force = (int)co->force; - spellparameter *pa = co->par; if (ironweapons == NULL) { @@ -1372,9 +1254,7 @@ static int sp_rosthauch(castorder * co) /* fuer jede Einheit */ for (n = 0; n < pa->length; n++) { unit *u = pa->param[n]->data.u; - int ironweapon = 0; - iron_weapon *iweapon = ironweapons; if (force <= 0) @@ -1384,10 +1264,8 @@ static int sp_rosthauch(castorder * co) for (; iweapon != NULL; iweapon = iweapon->next) { item **ip = i_find(&u->items, iweapon->type); - if (*ip) { int i = MIN((*ip)->number, force); - if (iweapon->chance < 1.0) { i = (int)(i * iweapon->chance); } @@ -1427,7 +1305,6 @@ static int sp_rosthauch(castorder * co) return MIN(success, cast_level); } - /* ------------------------------------------------------------- */ /* Name: Kaelteschutz * Stufe: 3 @@ -1449,23 +1326,14 @@ static int sp_rosthauch(castorder * co) static int sp_kaelteschutz(castorder * co) { unit *u; - int n, i = 0; - int men; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = MAX(cast_level, (int)force) + 1; - spellparameter *pa = co->par; - double effect; force *= 10; /* 10 Personen pro Force-Punkt */ @@ -1521,15 +1389,10 @@ static int sp_kaelteschutz(castorder * co) static int sp_sparkle(castorder * co) { unit *u; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - int duration = cast_level + 1; - double effect; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -1586,19 +1449,12 @@ static int sp_sparkle(castorder * co) static int sp_create_irongolem(castorder * co) { unit *u2; - attrib *a; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int number = lovar(force * 8 * RESOURCE_QUANTITY); - if (number < 1) number = 1; @@ -1656,17 +1512,11 @@ static int sp_create_irongolem(castorder * co) static int sp_create_stonegolem(castorder * co) { unit *u2; - attrib *a; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - int number = lovar(co->force * 5 * RESOURCE_QUANTITY); - if (number < 1) number = 1; @@ -1724,19 +1574,12 @@ static void destroy_all_roads(region * r) static int sp_great_drought(castorder * co) { unit *u; - boolean terraform = false; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = 2; - double effect; if (fval(r->terrain, SEA_REGION)) { @@ -1806,9 +1649,7 @@ static int sp_great_drought(castorder * co) /* not destroying the region, so it should be safe to make this a local * message */ message *msg; - const char *mtype; - if (r->terrain == newterrain(T_SWAMP) && terraform) { mtype = "drought_effect_1"; } else if (!terraform) { @@ -1823,7 +1664,6 @@ static int sp_great_drought(castorder * co) /* possible that all units here get killed so better to inform with a global * message */ message *msg = msg_message("drought_effect_4", "mage region", mage, r); - for (u = r->units; u; u = u->next) freset(u->faction, FFL_SELECT); for (u = r->units; u; u = u->next) { @@ -1859,21 +1699,13 @@ static int sp_great_drought(castorder * co) static int sp_treewalkenter(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - spellparameter *pa = co->par; - double power = co->force; - int cast_level = co->level; - region *rt; - int remaining_cap; - int n; - int erfolg = 0; if (getplane(r) != 0) { @@ -1899,7 +1731,6 @@ static int sp_treewalkenter(castorder * co) /* fuer jede Einheit */ for (n = 0; n < pa->length; n++) { unit *u = pa->param[n]->data.u; - spllprm *param = pa->param[n]; if (param->flag & (TARGET_RESISTS | TARGET_NOTFOUND)) { @@ -1911,9 +1742,7 @@ static int sp_treewalkenter(castorder * co) "feedback_no_contact", "target", u)); } else { int w; - message *m; - unit *u2; if (!can_survive(u, rt)) { @@ -1988,27 +1817,16 @@ static int sp_treewalkenter(castorder * co) static int sp_treewalkexit(castorder * co) { region *rt; - region_list *rl, *rl2; - int tax, tay; - unit *u, *u2; - int remaining_cap; - int n; - int erfolg = 0; - region *r = co->rt; - unit *mage = co->magician.u; - double power = co->force; - spellparameter *pa = co->par; - int cast_level = co->level; if (!is_astral(r)) { @@ -2072,7 +1890,6 @@ static int sp_treewalkexit(castorder * co) "feedback_no_contact", "target", u)); } else { int w = weight(u); - if (!can_survive(u, rt)) { cmistake(mage, co->order, 231, MSG_MAGIC); } else if (remaining_cap - w < 0) { @@ -2141,19 +1958,12 @@ static int sp_treewalkexit(castorder * co) static int sp_holyground(castorder * co) { static const curse_type *ctype = NULL; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - curse *c; - message *msg = msg_message("sp_holyground_effect", "mage region", mage, r); - report_spell(mage, r, msg); msg_release(msg); @@ -2182,21 +1992,13 @@ static int sp_holyground(castorder * co) static int sp_homestone(castorder * co) { unit *u; - curse *c; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - double effect; - message *msg; - if (!mage->building || mage->building->type != bt_find("castle")) { cmistake(mage, co->order, 197, MSG_MAGIC); return 0; @@ -2233,8 +2035,6 @@ static int sp_homestone(castorder * co) return cast_level; } - - /* ------------------------------------------------------------- */ /* Name: Duerre * Stufe: 13 @@ -2252,17 +2052,11 @@ static int sp_homestone(castorder * co) static int sp_drought(castorder * co) { curse *c; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - int duration = (int)power + 1; - message *msg; if (fval(r->terrain, SEA_REGION)) { @@ -2286,7 +2080,6 @@ static int sp_drought(castorder * co) c->duration = MAX(c->duration, (int)power); } else { double effect; - /* Baeume und Pferde sterben */ rsettrees(r, 2, rtrees(r, 2) / 2); rsettrees(r, 1, rtrees(r, 1) / 2); @@ -2322,13 +2115,9 @@ static int sp_drought(castorder * co) static int sp_ironkeeper(castorder * co) { unit *keeper; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - message *msg; if (r->terrain != newterrain(T_MOUNTAIN) @@ -2351,7 +2140,6 @@ static int sp_ironkeeper(castorder * co) { trigger *tkill = trigger_killunit(keeper); - add_trigger(&keeper->attribs, "timer", trigger_timeout(cast_level + 2, tkill)); } @@ -2384,21 +2172,13 @@ static int sp_ironkeeper(castorder * co) static int sp_stormwinds(castorder * co) { ship *sh; - unit *u; - int erfolg = 0; - region *r = co->rt; - unit *mage = co->magician.u; - double power = co->force; - spellparameter *pa = co->par; - int n, force = (int)power; - message *m = NULL; /* melden vorbereiten */ @@ -2466,7 +2246,6 @@ static int sp_stormwinds(castorder * co) return erfolg; } - /* ------------------------------------------------------------- */ /* Name: Donnerbeben * Stufe: 6 @@ -2483,15 +2262,10 @@ static int sp_stormwinds(castorder * co) static int sp_earthquake(castorder * co) { int kaputt; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - message *msg; - building **blist = &r->buildings; while (*blist) { @@ -2520,20 +2294,15 @@ static int sp_earthquake(castorder * co) return cast_level; } - /* ------------------------------------------------------------- */ /* CHAOS / M_DRAIG / Draig */ /* ------------------------------------------------------------- */ void patzer_peasantmob(castorder * co) { int anteil = 6, n; - unit *u; - attrib *a; - region *r; - unit *mage = co->magician.u; if (mage->region->land) { @@ -2544,9 +2313,7 @@ void patzer_peasantmob(castorder * co) if (r->land) { faction *f = get_monsters(); - const struct locale *lang = f->locale; - message *msg; anteil += rng_int() % 4; @@ -2574,7 +2341,6 @@ void patzer_peasantmob(castorder * co) return; } - /* ------------------------------------------------------------- */ /* Name: Waldbrand * Stufe: 10 @@ -2604,25 +2370,16 @@ void patzer_peasantmob(castorder * co) static int sp_forest_fire(castorder * co) { unit *u; - region *nr; - direction_t i; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double probability; - double percentage = (rng_int() % 8 + 1) * 0.1; /* 10 - 80% */ - message *msg; int vernichtet_schoesslinge = (int)(rtrees(r, 1) * percentage); - int destroyed = (int)(rtrees(r, 2) * percentage); if (destroyed < 1) { @@ -2698,21 +2455,13 @@ static int sp_forest_fire(castorder * co) static int sp_fumblecurse(castorder * co) { unit *target; - int rx, sx; - int duration; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - double effect; - curse *c; - spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -2742,15 +2491,10 @@ static int sp_fumblecurse(castorder * co) void patzer_fumblecurse(castorder * co) { unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (cast_level / 2) + 1; - double effect; - curse *c; effect = force * 0.5; @@ -2784,23 +2528,14 @@ void patzer_fumblecurse(castorder * co) static int sp_summondragon(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - unit *u; - int cast_level = co->level; - double power = co->force; - region_list *rl, *rl2; - faction *f; - int time; - int number; - const race *race; f = get_monsters(); @@ -2832,7 +2567,6 @@ static int sp_summondragon(castorder * co) } { trigger *tsummon = trigger_createunit(r, f, race, number); - add_trigger(&r->attribs, "timer", trigger_timeout(time, tsummon)); } } @@ -2842,11 +2576,9 @@ static int sp_summondragon(castorder * co) for (rl2 = rl; rl2; rl2 = rl2->next) { region *r2 = rl2->data; - for (u = r2->units; u; u = u->next) { if (u->race == new_race[RC_WYRM] || u->race == new_race[RC_DRAGON]) { attrib *a = a_find(u->attribs, &at_targetregion); - if (!a) { a = a_add(&u->attribs, make_targetregion(co->rt)); } else { @@ -2882,7 +2614,6 @@ static int sp_summondragon(castorder * co) void wall_vigour(curse * c, double delta) { wallcurse *wc = (wallcurse *) c->data.v; - assert(wc->buddy->vigour == c->vigour); wc->buddy->vigour += delta; if (wc->buddy->vigour <= 0) { @@ -2902,21 +2633,13 @@ const curse_type ct_firewall = { static int sp_firewall(castorder * co) { connection *b; - wall_data *fd; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - direction_t dir; - region *r2; dir = finddirection(pa->param[0]->data.xs, mage->faction->locale); @@ -2954,9 +2677,7 @@ static int sp_firewall(castorder * co) /* melden, 1x pro Partei */ { message *seen = msg_message("firewall_effect", "mage region", mage, r); - message *unseen = msg_message("firewall_effect", "mage region", NULL, r); - report_effect(r, mage, seen, unseen); msg_release(seen); msg_release(unseen); @@ -2970,21 +2691,13 @@ static int sp_firewall(castorder * co) static int sp_wisps(castorder * co) { connection *b; - wall_data *fd; - region *r2; - direction_t dir; - region *r = co->rt; - 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); @@ -3005,9 +2718,7 @@ static int sp_wisps(castorder * co) /* 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); @@ -3033,22 +2744,16 @@ static int sp_wisps(castorder * co) static int sp_unholypower(castorder * co) { unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - int i; - int n; - int wounds; n = dice((int)co->force, 10); for (i = 0; i < pa->length && n > 0; i++) { const race *target_race; - unit *u; if (pa->param[i]->flag == TARGET_RESISTS @@ -3113,9 +2818,7 @@ static int dc_age(struct curse *c) /* age returns 0 if the attribute needs to be removed, !=0 otherwise */ { region *r = (region *) c->data.v; - unit **up; - unit *mage = c->magician; if (r == NULL || mage == NULL || mage->number == 0) { @@ -3127,7 +2830,6 @@ static int dc_age(struct curse *c) if (curse_active(c)) while (*up != NULL) { unit *u = *up; - double damage = c->effect * u->number; freset(u->faction, FFL_SELECT); @@ -3155,7 +2857,6 @@ static struct curse_type ct_deathcloud = { static curse *mk_deathcloud(unit * mage, region * r, double force, int duration) { double effect; - curse *c; effect = force * 0.5; @@ -3171,15 +2872,10 @@ static int dc_read_compat(struct attrib *a, void *target, storage * store) /* return AT_READ_OK on success, AT_READ_FAIL if attrib needs removal */ { region *r = NULL; - unit *u; - variant var; - int duration = store->r_int(store); - double strength = store->r_flt(store); - short rx, ry; var.i = store->r_id(store); @@ -3192,7 +2888,6 @@ static int dc_read_compat(struct attrib *a, void *target, storage * store) if (r != NULL) { double effect; - curse *c; effect = strength; @@ -3207,7 +2902,6 @@ static int dc_read_compat(struct attrib *a, void *target, storage * store) return AT_READ_FAIL; /* we don't care for the attribute. */ } - attrib_type at_deathcloud_compat = { "zauber_todeswolke", NULL, NULL, NULL, NULL, dc_read_compat }; @@ -3244,17 +2938,13 @@ attrib_type at_deathcloud_compat = { static int sp_deathcloud(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - attrib *a = r->attribs; - unit *u; while (a) { if ((a->type->flags & ATF_CURSE)) { curse *c = a->data.v; - if (c->type == &ct_deathcloud) { report_failure(mage, co->order); return 0; @@ -3288,7 +2978,6 @@ static int sp_deathcloud(castorder * co) void patzer_deathcloud(castorder * co) { unit *mage = co->magician.u; - int hp = (mage->hp - 2); change_hitpoints(mage, -rng_int() % hp); @@ -3312,9 +3001,7 @@ void patzer_deathcloud(castorder * co) static int sp_plague(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; plagues(r, true); @@ -3343,15 +3030,10 @@ static int sp_plague(castorder * co) static int sp_summonshadow(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - unit *u; - int val, number = (int)(force * force); u = create_unit(r, mage->faction, number, new_race[RC_SHADOW], 0, NULL, mage); @@ -3388,15 +3070,10 @@ static int sp_summonshadow(castorder * co) static int sp_summonshadowlords(castorder * co) { unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int amount = (int)(force * force); u = @@ -3427,11 +3104,8 @@ static int sp_summonshadowlords(castorder * co) static int sp_chaossuction(castorder * co) { region *rt; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; if (getplane(r) != get_normalplane()) { @@ -3486,19 +3160,12 @@ static int sp_chaossuction(castorder * co) static int sp_magicboost(castorder * co) { curse *c; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - double effect; - trigger *tsummon; - static const curse_type *ct_auraboost; - static const curse_type *ct_magicboost; if (!ct_auraboost) { @@ -3552,13 +3219,9 @@ static int sp_magicboost(castorder * co) static int sp_bloodsacrifice(castorder * co) { unit *mage = co->magician.u; - int cast_level = co->level; - int aura; - int skill = eff_skill(mage, SK_MAGIC, mage->region); - int hp = (int)(co->force * 8); if (hp <= 0) { @@ -3600,9 +3263,7 @@ static void skill_summoned(unit * u, int level) { if (level > 0) { const race *rc = u->race; - skill_t sk; - for (sk = 0; sk != MAXSKILLS; ++sk) { if (rc->bonus[sk] > 0) { set_level(u, sk, level); @@ -3626,17 +3287,11 @@ static void skill_summoned(unit * u, int level) static int sp_summonundead(castorder * co) { int undead; - unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - int force = (int)(co->force * 10); - const race *race = new_race[RC_SKELETON]; if (!r->land || deathcount(r) == 0) { @@ -3684,17 +3339,11 @@ static int sp_summonundead(castorder * co) static int sp_auraleak(castorder * co) { int lost_aura; - double lost; - unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - message *msg; lost = MIN(0.95, cast_level * 0.05); @@ -3735,15 +3384,10 @@ static int sp_auraleak(castorder * co) static int sp_analysesong_obj(castorder * co) { int obj; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; obj = pa->param[0]->typ; @@ -3756,14 +3400,12 @@ static int sp_analysesong_obj(castorder * co) case SPP_BUILDING: { building *b = pa->param[0]->data.b; - magicanalyse_building(b, mage, force); break; } case SPP_SHIP: { ship *sh = pa->param[0]->data.sh; - magicanalyse_ship(sh, mage, force); break; } @@ -3792,13 +3434,9 @@ static int sp_analysesong_obj(castorder * co) static int sp_analysesong_unit(castorder * co) { unit *u; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -3828,13 +3466,10 @@ static boolean can_charm(const unit * u, int maxlevel) for (; sv != u->skills + u->skill_size; ++sv) { int l = 0, h = 5; - skill_t sk = sv->id; - assert(expskills[h] == NOSKILL); while (l < h) { int m = (l + h) / 2; - if (sk == expskills[m]) { if (skill_limit(u->faction, sk) != INT_MAX) { return false; @@ -3880,21 +3515,13 @@ static boolean can_charm(const unit * u, int maxlevel) static int sp_charmingsong(castorder * co) { unit *target; - int duration; - skill_t i; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - int resist_bonus = 0; - int tb = 0; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -3922,7 +3549,6 @@ static int sp_charmingsong(castorder * co) /* Magieresistensbonus fuer hoehere Talentwerte */ for (i = 0; i < MAXSKILLS; i++) { int sk = effskill(target, i); - if (tb < sk) tb = sk; } @@ -3944,7 +3570,6 @@ static int sp_charmingsong(castorder * co) duration = 3 + rng_int() % (int)force; { trigger *trestore = trigger_changefaction(target, target->faction); - /* laeuft die Dauer ab, setze Partei zurueck */ add_trigger(&target->attribs, "timer", trigger_timeout(duration, trestore)); /* wird die alte Partei von Target aufgeloest, dann auch diese Einheit */ @@ -3987,13 +3612,9 @@ static int sp_charmingsong(castorder * co) static int sp_song_resistmagic(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (int)force + 1; create_curse(mage, &r->attribs, ct_find("goodmagicresistancezone"), @@ -4020,13 +3641,9 @@ static int sp_song_resistmagic(castorder * co) static int sp_song_susceptmagic(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (int)force + 1; create_curse(mage, &r->attribs, ct_find("badmagicresistancezone"), @@ -4051,17 +3668,11 @@ static int sp_song_susceptmagic(castorder * co) static int sp_rallypeasantmob(castorder * co) { unit *u, *un; - int erfolg = 0; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - message *msg; - curse *c; for (u = r->units; u; u = un) { @@ -4108,25 +3719,15 @@ static int sp_rallypeasantmob(castorder * co) static int sp_raisepeasantmob(castorder * co) { unit *u; - attrib *a; - int n; - int anteil; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (int)force + 1; - faction *monsters = get_monsters(); - message *msg; anteil = 6 + (rng_int() % 4); @@ -4177,13 +3778,9 @@ static int sp_raisepeasantmob(castorder * co) static int sp_migranten(castorder * co) { unit *target; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -4249,15 +3846,10 @@ static int sp_migranten(castorder * co) static int sp_song_of_peace(castorder * co) { unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = 2 + lovar(force / 2); message *msg[2] = { NULL, NULL }; @@ -4269,7 +3861,6 @@ static int sp_song_of_peace(castorder * co) for (u = r->units; u; u = u->next) { if (!fval(u->faction, FFL_SELECT)) { message *m = NULL; - fset(u->faction, FFL_SELECT); if (cansee(u->faction, r, mage, 0)) { if (msg[0] == NULL) @@ -4303,17 +3894,11 @@ static int sp_song_of_peace(castorder * co) static int sp_generous(castorder * co) { unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (int)force + 1; - double effect; message *msg[2] = { NULL, NULL }; @@ -4332,7 +3917,6 @@ static int sp_generous(castorder * co) for (u = r->units; u; u = u->next) { if (!fval(u->faction, FFL_SELECT)) { message *m = NULL; - fset(u->faction, FFL_SELECT); if (cansee(u->faction, r, mage, 0)) { if (msg[0] == NULL) @@ -4365,21 +3949,13 @@ static int sp_generous(castorder * co) static int sp_recruit(castorder * co) { unit *u; - region *r = co->rt; - int num, maxp = rpeasants(r); - double n; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - faction *f = mage->faction; - const struct race *rc = f->race; if (maxp == 0) { @@ -4395,7 +3971,6 @@ static int sp_recruit(castorder * co) n = (pow(force, 1.6) * 100) / f->race->recruitcost; if (rc->recruit_multi != 0) { double multp = maxp / rc->recruit_multi; - n = MIN(multp, n); n = MAX(n, 1); rsetpeasants(r, maxp - (int)(n * rc->recruit_multi)); @@ -4429,19 +4004,12 @@ static int sp_recruit(castorder * co) static int sp_bigrecruit(castorder * co) { unit *u; - region *r = co->rt; - int n, maxp = rpeasants(r); - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - faction *f = mage->faction; - message *msg; if (maxp <= 0) { @@ -4491,15 +4059,10 @@ static int sp_bigrecruit(castorder * co) static int sp_pump(castorder * co) { unit *u, *target; - region *rt; - boolean see = false; - unit *mage = co->magician.u; - spellparameter *pa = co->par; - int cast_level = co->level; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -4561,17 +4124,11 @@ static int sp_pump(castorder * co) static int sp_seduce(castorder * co) { item *items = NULL; - unit *target; - item **itmp; - unit *mage = co->magician.u; - spellparameter *pa = co->par; - int cast_level = co->level; - double force = co->force; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -4591,9 +4148,7 @@ static int sp_seduce(castorder * co) itmp = &target->items; while (*itmp) { item *itm = *itmp; - int loot; - if (itm->type == i_silver) { loot = MIN(cast_level * 1000, get_money(target) - (maintenance_cost(target))); @@ -4644,19 +4199,12 @@ static int sp_seduce(castorder * co) static int sp_calm_monster(castorder * co) { curse *c; - unit *target; - unit *mage = co->magician.u; - spellparameter *pa = co->par; - int cast_level = co->level; - double force = co->force; - double effect; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -4702,17 +4250,11 @@ static int sp_calm_monster(castorder * co) static int sp_headache(castorder * co) { skill *smax = NULL; - int i; - unit *target; - unit *mage = co->magician.u; - spellparameter *pa = co->par; - int cast_level = co->level; - message *msg; /* Macht alle nachfolgenden Zauber doppelt so teuer */ @@ -4727,7 +4269,6 @@ static int sp_headache(castorder * co) /* finde das groeßte Talent: */ for (i = 0; i != target->skill_size; ++i) { skill *sv = target->skills + i; - if (smax == NULL || skill_compare(sv, smax) > 0) { smax = sv; } @@ -4735,7 +4276,6 @@ static int sp_headache(castorder * co) if (smax != NULL) { /* wirkt auf maximal 10 Personen */ int change = MIN(10, target->number) * (rng_int() % 2 + 1) / target->number; - reduce_skill(target, smax, change); } set_order(&target->thisorder, NULL); @@ -4751,7 +4291,6 @@ static int sp_headache(castorder * co) return cast_level; } - /* ------------------------------------------------------------- */ /* Name: Mob * Stufe: 10 @@ -4767,19 +4306,12 @@ static int sp_headache(castorder * co) static int sp_raisepeasants(castorder * co) { int bauern; - unit *u2; - attrib *a; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - message *msg; if (rpeasants(r) == 0) { @@ -4830,15 +4362,10 @@ static int sp_raisepeasants(castorder * co) static int sp_depression(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (int)force + 1; - message *msg; create_curse(mage, &r->attribs, ct_find("depression"), force, duration, @@ -4871,17 +4398,11 @@ static int sp_depression(castorder * co) static int sp_dragonsong(castorder * co) { region *r = co->rt; /* Zauberregion */ - unit *mage = co->magician.u; - unit *u; - int cast_level = co->level; - double power = co->force; - region_list *rl, *rl2; - faction *f; /* TODO HP-Effekt */ @@ -4892,11 +4413,9 @@ static int sp_dragonsong(castorder * co) for (rl2 = rl; rl2; rl2 = rl2->next) { region *r2 = rl2->data; - for (u = r2->units; u; u = u->next) { if (u->race->flags & RCF_DRAGON) { attrib *a = a_find(u->attribs, &at_targetregion); - if (!a) { a = a_add(&u->attribs, make_targetregion(r)); } else { @@ -4930,11 +4449,8 @@ static int sp_dragonsong(castorder * co) static int sp_songofAttraction(castorder * co) { region *r = co->rt; /* Zauberregion */ - unit *mage = co->magician.u; - int cast_level = co->level; - /* double power = co->force; */ /* TODO Wander Effekt */ @@ -4963,15 +4479,10 @@ static int sp_songofAttraction(castorder * co) int sp_puttorest(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int dead = deathcount(r); - int laid_to_rest = dice((int)(co->force * 2), 100); - message *seen = msg_message("puttorest", "mage", mage); - message *unseen = msg_message("puttorest", "mage", NULL); laid_to_rest = MAX(laid_to_rest, dead); @@ -4998,27 +4509,16 @@ int sp_puttorest(castorder * co) int sp_icastle(castorder * co) { building *b; - const building_type *type; - attrib *a; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; - icastle_data *data; - const char *bname; - message *msg; - static const building_type *bt_illusion; if (bt_illusion == NULL) @@ -5089,17 +4589,11 @@ int sp_icastle(castorder * co) int sp_illusionary_shapeshift(castorder * co) { unit *u; - const race *rc; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; - const race *irace; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -5128,7 +4622,6 @@ int sp_illusionary_shapeshift(castorder * co) irace = u_irace(u); if (irace == u->race) { trigger *trestore = trigger_changerace(u, NULL, irace); - add_trigger(&u->attribs, "timer", trigger_timeout((int)power + 2, trestore)); u->irace = rc; @@ -5154,9 +4647,7 @@ int sp_illusionary_shapeshift(castorder * co) int sp_analyseregionsdream(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; magicanalyse_region(r, mage, cast_level); @@ -5164,7 +4655,6 @@ int sp_analyseregionsdream(castorder * co) return cast_level; } - /* ------------------------------------------------------------- */ /* Name: Traumbilder erkennen * Stufe: 5 @@ -5179,11 +4669,8 @@ int sp_analyseregionsdream(castorder * co) int sp_analysedream(castorder * co) { unit *u; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -5217,17 +4704,11 @@ int sp_analysedream(castorder * co) int sp_baddreams(castorder * co) { int duration; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - region *r = co->rt; - curse *c; - double effect; /* wirkt erst in der Folgerunde, soll mindestens eine Runde wirken, @@ -5263,17 +4744,11 @@ int sp_baddreams(castorder * co) int sp_gooddreams(castorder * co) { int duration; - curse *c; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - double effect; /* wirkt erst in der Folgerunde, soll mindestens eine Runde wirken, @@ -5306,17 +4781,11 @@ int sp_gooddreams(castorder * co) int sp_clonecopy(castorder * co) { unit *clone; - region *r = co->rt; - region *target_region = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - message *msg; - char name[NAMESIZE]; if (get_clone(mage) != NULL) { @@ -5345,17 +4814,11 @@ int sp_clonecopy(castorder * co) int sp_dreamreading(castorder * co) { unit *u, *u2; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - double power = co->force; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -5404,31 +4867,20 @@ int sp_dreamreading(castorder * co) int sp_sweetdreams(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; - int men, n; - int duration = (int)(power / 2) + 1; - int opfer = (int)(power * power); /* Schleife ueber alle angegebenen Einheiten */ for (n = 0; n < pa->length; n++) { curse *c; - unit *u; - double effect; - message *msg; - /* sollte nie negativ werden */ if (opfer < 1) break; @@ -5467,17 +4919,11 @@ int sp_sweetdreams(castorder * co) int sp_disturbingdreams(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - int duration = 1 + (int)(power / 6); - double effect; - curse *c; effect = 10; @@ -5512,11 +4958,8 @@ int sp_disturbingdreams(castorder * co) int sp_analysemagic(castorder * co) { int obj; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; if (!pa->param) { @@ -5529,7 +4972,6 @@ int sp_analysemagic(castorder * co) case SPP_REGION: { region *tr = pa->param[0]->data.r; - magicanalyse_region(tr, mage, cast_level); break; } @@ -5537,7 +4979,6 @@ int sp_analysemagic(castorder * co) case SPP_UNIT: { unit *u; - u = pa->param[0]->data.u; magicanalyse_unit(u, mage, cast_level); break; @@ -5545,7 +4986,6 @@ int sp_analysemagic(castorder * co) case SPP_BUILDING: { building *b; - b = pa->param[0]->data.b; magicanalyse_building(b, mage, cast_level); break; @@ -5553,7 +4993,6 @@ int sp_analysemagic(castorder * co) case SPP_SHIP: { ship *sh; - sh = pa->param[0]->data.sh; magicanalyse_ship(sh, mage, cast_level); break; @@ -5571,15 +5010,10 @@ int sp_analysemagic(castorder * co) int sp_itemcloak(castorder * co) { unit *target; - unit *mage = co->magician.u; - spellparameter *pa = co->par; - int cast_level = co->level; - double power = co->force; - int duration = (int)MAX(2.0, power + 1); /* works in the report, and ageing this round would kill it if it's <=1 */ /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -5615,28 +5049,19 @@ int sp_itemcloak(castorder * co) int sp_resist_magic_bonus(castorder * co) { unit *u; - int n, m; - int duration = 6; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; - /* Pro Stufe koennen bis zu 5 Personen verzaubert werden */ double maxvictims = 5; - int victims = (int)maxvictims; /* Schleife ueber alle angegebenen Einheiten */ for (n = 0; n < pa->length; n++) { message *msg; - /* sollte nie negativ werden */ if (victims < 1) break; @@ -5682,21 +5107,13 @@ int sp_resist_magic_bonus(castorder * co) int sp_enterastral(castorder * co) { region *rt, *ro; - unit *u, *u2; - int remaining_cap; - int n, w; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; switch (getplaneid(r)) { @@ -5753,7 +5170,6 @@ int sp_enterastral(castorder * co) "fail_tooheavy", "target", u)); } else { message *m; - remaining_cap = remaining_cap - w; move_unit(u, rt, NULL); @@ -5802,23 +5218,14 @@ int sp_enterastral(castorder * co) int sp_pullastral(castorder * co) { region *rt, *ro; - unit *u, *u2; - region_list *rl, *rl2; - int remaining_cap; - int n, w; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; switch (getplaneid(r)) { @@ -5829,7 +5236,6 @@ int sp_pullastral(castorder * co) rl2 = rl; while (rl2 != NULL) { region *r2 = rl2->data; - if (r2->x == ro->x && r2->y == ro->y) { ro = r2; break; @@ -5862,7 +5268,6 @@ int sp_pullastral(castorder * co) /* fuer jede Einheit in der Kommandozeile */ for (n = 1; n < pa->length; n++) { spllprm *spobj = pa->param[n]; - if (spobj->flag == TARGET_NOTFOUND) continue; @@ -5951,23 +5356,14 @@ int sp_pullastral(castorder * co) int sp_leaveastral(castorder * co) { region *rt, *ro; - region_list *rl, *rl2; - unit *u, *u2; - int remaining_cap; - int n, w; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; switch (getplaneid(r)) { @@ -6088,21 +5484,13 @@ int sp_leaveastral(castorder * co) int sp_fetchastral(castorder * co) { int n; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - double power = co->force; - int remaining_cap = (int)((power - 3) * 1500); - region_list *rtl = NULL; - region *rt = co->rt; /* region to which we are fetching */ - region *ro = NULL; /* region in which the target is */ if (rplane(rt) != get_normalplane()) { @@ -6113,9 +5501,7 @@ int sp_fetchastral(castorder * co) /* fuer jede Einheit in der Kommandozeile */ for (n = 0; n != pa->length; ++n) { unit *u2, *u = pa->param[n]->data.u; - int w; - message *m; if (pa->param[n]->flag & TARGET_NOTFOUND) @@ -6125,7 +5511,6 @@ int sp_fetchastral(castorder * co) /* this can happen several times if the units are from different astral * regions. Only possible on the intersections of schemes */ region_list *rfind; - if (!is_astral(u->region)) { ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "spellfail_astralonly", "")); @@ -6226,21 +5611,13 @@ int sp_fetchastral(castorder * co) int sp_showastral(castorder * co) { unit *u; - region *rt; - int n = 0; - int c = 0; - region_list *rl, *rl2; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; switch (getplaneid(r)) { @@ -6267,7 +5644,6 @@ int sp_showastral(castorder * co) for (rl2 = rl; rl2; rl2 = rl2->next) { region *r2 = rl2->data; - if (!is_cursed(r2->attribs, C_ASTRALBLOCK, 0)) { for (u = r2->units; u; u = u->next) { if (u->race != new_race[RC_SPECIAL] && u->race != new_race[RC_SPELL]) @@ -6328,15 +5704,10 @@ int sp_showastral(castorder * co) int sp_viewreality(castorder * co) { region_list *rl, *rl2; - unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - message *m; if (getplaneid(r) != 1) { @@ -6351,7 +5722,6 @@ int sp_viewreality(castorder * co) /* Irgendwann mal auf Curses u/o Attribut umstellen. */ for (rl2 = rl; rl2; rl2 = rl2->next) { region *rt = rl2->data; - if (!is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) { u = create_unit(rt, mage->faction, RS_FARVISION, new_race[RC_SPELL], 0, @@ -6374,19 +5744,12 @@ int sp_viewreality(castorder * co) int sp_disruptastral(castorder * co) { region_list *rl, *rl2; - region *rt; - unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - int duration = (int)(power / 3) + 1; switch (getplaneid(r)) { @@ -6411,15 +5774,10 @@ int sp_disruptastral(castorder * co) for (rl2 = rl; rl2 != NULL; rl2 = rl2->next) { attrib *a; - double effect; - region *r2 = rl2->data; - spec_direction *sd; - int inhab_regions = 0; - region_list *trl = NULL; if (is_cursed(r2->attribs, C_ASTRALBLOCK, 0)) @@ -6438,7 +5796,6 @@ int sp_disruptastral(castorder * co) while (a != NULL && a->type == &at_direction) { attrib *a2 = a->next; - sd = (spec_direction *) (a->data.v); if (sd->duration != -1) a_remove(&r->attribs, a); @@ -6451,9 +5808,7 @@ int sp_disruptastral(castorder * co) for (u = r2->units; u; u = u->next) { if (u->race != new_race[RC_SPELL]) { region_list *trl2 = trl; - region *tr; - int c = rng_int() % inhab_regions; /* Zufaellige Zielregion suchen */ @@ -6463,7 +5818,6 @@ int sp_disruptastral(castorder * co) if (!is_magic_resistant(mage, u, 0) && can_survive(u, tr)) { message *msg = msg_message("disrupt_astral", "unit region", u, tr); - add_message(&u->faction->msgs, msg); add_message(&tr->msgs, msg); msg_release(msg); @@ -6499,21 +5853,13 @@ int sp_disruptastral(castorder * co) static int sp_eternizewall(castorder * co) { unit *u; - curse *c; - building *b; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -6552,7 +5898,6 @@ static int sp_eternizewall(castorder * co) return cast_level; } - /* ------------------------------------------------------------- */ /* Name: Opfere Kraft * Stufe: 15 @@ -6574,17 +5919,11 @@ static int sp_eternizewall(castorder * co) int sp_permtransfer(castorder * co) { int aura; - unit *tu; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - const spell *sp = co->sp; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -6634,21 +5973,13 @@ int sp_permtransfer(castorder * co) int sp_movecastle(castorder * co) { building *b; - direction_t dir; - region *target_region; - unit *u, *unext; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -6697,9 +6028,7 @@ int sp_movecastle(castorder * co) if ((b->type == bt_find("caravan") || b->type == bt_find("dam") || b->type == bt_find("tunnel"))) { boolean damage = false; - direction_t d; - for (d = 0; d != MAXDIRECTIONS; ++d) { if (rroad(r, d)) { rsetroad(r, d, rroad(r, d) / 2); @@ -6731,21 +6060,13 @@ int sp_movecastle(castorder * co) int sp_flying_ship(castorder * co) { ship *sh; - unit *u; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; - message *m = NULL; - int cno; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -6790,7 +6111,6 @@ int sp_flying_ship(castorder * co) return cast_level; } - /* ------------------------------------------------------------- */ /* Name: Stehle Aura * Stufe: 6 @@ -6807,15 +6127,10 @@ int sp_flying_ship(castorder * co) int sp_stealaura(castorder * co) { int taura; - unit *u; - unit *mage = co->magician.u; - int cast_level = co->level; - double power = co->force; - spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -6880,17 +6195,11 @@ int sp_stealaura(castorder * co) int sp_antimagiczone(castorder * co) { double power; - double effect; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - int duration = (int)force + 1; /* Haelt Sprueche bis zu einem summierten Gesamtlevel von power aus. @@ -6945,15 +6254,10 @@ int sp_antimagiczone(castorder * co) static int sp_magicrunes(castorder * co) { int duration; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - double effect; duration = 3 + rng_int() % cast_level; @@ -6963,7 +6267,6 @@ static int sp_magicrunes(castorder * co) case SPP_BUILDING: { building *b; - b = pa->param[0]->data.b; /* Magieresistenz der Burg erhoeht sich um 20% */ @@ -6979,7 +6282,6 @@ static int sp_magicrunes(castorder * co) case SPP_SHIP: { ship *sh; - sh = pa->param[0]->data.sh; /* Magieresistenz des Schiffs erhoeht sich um 20% */ create_curse(mage, &sh->attribs, ct_find("magicrunes"), force, @@ -7011,15 +6313,10 @@ static int sp_magicrunes(castorder * co) int sp_speed2(castorder * co) { int n, maxmen, used = 0, dur, men; - unit *u; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; maxmen = 2 * cast_level * cast_level; @@ -7027,7 +6324,6 @@ int sp_speed2(castorder * co) for (n = 0; n < pa->length; n++) { double effect; - /* sollte nie negativ werden */ if (maxmen < 1) break; @@ -7075,23 +6371,14 @@ int sp_speed2(castorder * co) int sp_q_antimagie(castorder * co) { attrib **ap; - int obj; - curse *c = NULL; - int succ; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - const char *ts = NULL; obj = pa->param[0]->typ; @@ -7106,7 +6393,6 @@ int sp_q_antimagie(castorder * co) case SPP_UNIT: { unit *u = pa->param[0]->data.u; - ap = &u->attribs; ts = unitid(u); break; @@ -7114,7 +6400,6 @@ int sp_q_antimagie(castorder * co) case SPP_BUILDING: { building *b = pa->param[0]->data.b; - ap = &b->attribs; ts = buildingid(b); break; @@ -7122,7 +6407,6 @@ int sp_q_antimagie(castorder * co) case SPP_SHIP: { ship *sh = pa->param[0]->data.sh; - ap = &sh->attribs; ts = shipid(sh); break; @@ -7167,21 +6451,13 @@ int sp_q_antimagie(castorder * co) int sp_break_curse(castorder * co) { attrib **ap; - int obj; - curse *c; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - double force = co->force; - spellparameter *pa = co->par; - const char *ts = NULL; if (pa->length < 2) { @@ -7207,7 +6483,6 @@ int sp_break_curse(castorder * co) case SPP_UNIT: { unit *u = pa->param[0]->data.u; - ap = &u->attribs; ts = unitid(u); break; @@ -7215,7 +6490,6 @@ int sp_break_curse(castorder * co) case SPP_BUILDING: { building *b = pa->param[0]->data.b; - ap = &b->attribs; ts = buildingid(b); break; @@ -7223,7 +6497,6 @@ int sp_break_curse(castorder * co) case SPP_SHIP: { ship *sh = pa->param[0]->data.sh; - ap = &sh->attribs; ts = shipid(sh); break; @@ -7261,7 +6534,6 @@ int sp_break_curse(castorder * co) return cast_level; } - /* ------------------------------------------------------------- */ int sp_becomewyrm(castorder * co) { @@ -7281,9 +6553,7 @@ int sp_becomewyrm(castorder * co) static int sp_wdwpyramid(castorder * co) { region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; if (a_find(r->attribs, &at_wdwpyramid) != NULL) { @@ -7291,17 +6561,13 @@ static int sp_wdwpyramid(castorder * co) "unit region command", mage, r, co->order)); } else { region *r2; - int mindist = INT_MAX; - int minshowdist; - int maxshowdist; for (r2 = regions; r2; r2 = r2->next) { if (a_find(r2->attribs, &at_wdwpyramid) != NULL) { int dist = distance(mage->region, r2); - if (dist < mindist) { mindist = dist; } @@ -7783,7 +7049,6 @@ static spelldata spelldaten[] = { static boolean chaosgate_valid(const connection * b) { const attrib *a = a_findc(b->from->attribs, &at_direction); - if (!a) a = a_findc(b->to->attribs, &at_direction); if (!a) @@ -7796,7 +7061,6 @@ struct region *chaosgate_move(const connection * b, struct unit *u, { if (!routing) { int maxhp = u->hp / 4; - if (maxhp < u->number) maxhp = u->number; u->hp = maxhp; @@ -7829,10 +7093,8 @@ static void set_spelldata_i(spell * sp, spelldata * data) void set_spelldata(spell * sp) { int i; - for (i = 0; spelldaten[i].id != SPL_NOSPELL; ++i) { spelldata *data = spelldaten + i; - if (strcmp(data->sname, sp->sname) == 0) { set_spelldata_i(sp, data); return; @@ -7860,15 +7122,10 @@ void set_spelldata(spell * sp) static int sp_babbler(castorder * co) { unit *target; - region *r = co->rt; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; - message *msg; /* wenn kein Ziel gefunden, Zauber abbrechen */ @@ -7912,11 +7169,8 @@ static int sp_babbler(castorder * co) static int sp_readmind(castorder * co) { unit *target; - unit *mage = co->magician.u; - int cast_level = co->level; - spellparameter *pa = co->par; /* wenn kein Ziel gefunden, Zauber abbrechen */ diff --git a/src/spells/unitcurse.c b/src/spells/unitcurse.c index bf5d8fb33..d1f89899c 100644 --- a/src/spells/unitcurse.c +++ b/src/spells/unitcurse.c @@ -47,7 +47,6 @@ static message *cinfo_auraboost(const void *obj, typ_t typ, const curse * c, int self) { struct unit *u = (struct unit *)obj; - unused(typ); assert(typ == TYP_UNIT); @@ -81,7 +80,6 @@ static message *cinfo_slave(const void *obj, typ_t typ, const curse * c, int self) { unit *u; - unused(typ); assert(typ == TYP_UNIT); @@ -111,12 +109,10 @@ static message *cinfo_calm(const void *obj, typ_t typ, const curse * c, if (c->magician && c->magician->faction) { faction *f = c->magician->faction; - unit *u = (unit *) obj; if (f == NULL || self == 0) { const struct race *rc = u_irace(c->magician); - return msg_message("curseinfo::calm_0", "unit race id", u, rc, c->no); } return msg_message("curseinfo::calm_1", "unit faction id", u, f, c->no); @@ -142,7 +138,6 @@ static message *cinfo_speed(const void *obj, typ_t typ, const curse * c, if (self != 0) { unit *u = (unit *) obj; - return msg_message("curseinfo::speed_1", "unit number duration id", u, c->data.i, c->duration, c->no); } @@ -166,7 +161,6 @@ message *cinfo_unit(const void *obj, typ_t typ, const curse * c, int self) if (self != 0) { unit *u = (unit *) obj; - return msg_message(mkname("curseinfo", c->type->cname), "unit id", u, c->no); } @@ -191,7 +185,6 @@ static message *cinfo_kaelteschutz(const void *obj, typ_t typ, const curse * c, if (self != 0) { unit *u = (unit *) obj; - return msg_message("curseinfo::warmth_1", "unit number id", u, get_cursedmen(u, c), c->no); } @@ -238,9 +231,7 @@ static message *cinfo_sparkle(const void *obj, typ_t typ, const curse * c, NULL, /* end draig */ }; int m, begin = 0, end = 0; - unit *u; - unused(typ); assert(typ == TYP_UNIT); @@ -262,7 +253,6 @@ static message *cinfo_sparkle(const void *obj, typ_t typ, const curse * c, return NULL; else { int index = begin + curse_geteffect_int(c) % (end - begin); - return msg_message(mkname("curseinfo", effects[index]), "unit id", u, c->no); } @@ -306,7 +296,6 @@ static struct curse_type ct_fumble = { /* ------------------------------------------------------------- */ - static struct curse_type ct_oldrace = { "oldrace", CURSETYP_NORM, CURSE_SPREADALWAYS, NO_MERGE, NULL }; @@ -315,7 +304,6 @@ static struct curse_type ct_magicresistance = { "magicresistance", CURSETYP_UNIT, CURSE_SPREADMODULO, M_MEN, cinfo_simple }; - /* ------------------------------------------------------------- */ /* * C_SKILL @@ -324,10 +312,8 @@ static struct curse_type ct_magicresistance = { static int read_skill(struct storage *store, curse * c, void *target) { int skill; - if (store->version < CURSETYPE_VERSION) { int men; - skill = store->r_int(store); men = store->r_int(store); } else { @@ -351,9 +337,7 @@ static message *cinfo_skillmod(const void *obj, typ_t typ, const curse * c, if (self != 0) { unit *u = (unit *) obj; - int sk = c->data.i; - if (c->effect > 0) { return msg_message("curseinfo::skill_1", "unit skill id", u, sk, c->no); } else if (c->effect < 0) {