indentation rules, slightly updated

This commit is contained in:
Enno 2011-03-07 08:24:48 +01:00
parent 347a888b67
commit d940f29a6c
17 changed files with 2 additions and 1168 deletions

View File

@ -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

View File

@ -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);

View File

@ -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;

View File

@ -20,7 +20,6 @@ extern "C" {
int countdown;
} wall_data;
#ifdef __cplusplus
}
#endif

View File

@ -15,17 +15,13 @@
#include <tests.h>
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;
}

View File

@ -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));

View File

@ -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);

View File

@ -28,23 +28,16 @@
#include <util/rng.h>
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);

View File

@ -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);

View File

@ -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);

View File

@ -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

View File

@ -33,7 +33,6 @@
#include <stdlib.h>
#include <assert.h>
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);

View File

@ -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)

View File

@ -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);

View File

@ -34,7 +34,6 @@
#include <stdlib.h>
#include <assert.h>
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;
}

File diff suppressed because it is too large Load Diff

View File

@ -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) {