forked from github/server
remove more cvector usage
This commit is contained in:
parent
342e7ee249
commit
de13d0d412
2 changed files with 21 additions and 23 deletions
|
@ -1087,7 +1087,6 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
||||||
static int rule_armor = -1;
|
static int rule_armor = -1;
|
||||||
|
|
||||||
/* Schild */
|
/* Schild */
|
||||||
void **si;
|
|
||||||
side *ds = df->side;
|
side *ds = df->side;
|
||||||
int hp;
|
int hp;
|
||||||
|
|
||||||
|
@ -1247,7 +1246,10 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
||||||
|
|
||||||
if ((du->race->battle_flags & BF_INV_NONMAGIC) && !magic) rda = 0;
|
if ((du->race->battle_flags & BF_INV_NONMAGIC) && !magic) rda = 0;
|
||||||
else {
|
else {
|
||||||
|
int qi;
|
||||||
|
quicklist * ql;
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
if (du->race->battle_flags & BF_RES_PIERCE) i |= WTF_PIERCE;
|
if (du->race->battle_flags & BF_RES_PIERCE) i |= WTF_PIERCE;
|
||||||
if (du->race->battle_flags & BF_RES_CUT) i |= WTF_CUT;
|
if (du->race->battle_flags & BF_RES_CUT) i |= WTF_CUT;
|
||||||
if (du->race->battle_flags & BF_RES_BASH) i |= WTF_BLUNT;
|
if (du->race->battle_flags & BF_RES_BASH) i |= WTF_BLUNT;
|
||||||
|
@ -1255,21 +1257,21 @@ terminate(troop dt, troop at, int type, const char *damage, boolean missile)
|
||||||
if (i && awtype && fval(awtype, i)) rda /= 2;
|
if (i && awtype && fval(awtype, i)) rda /= 2;
|
||||||
|
|
||||||
/* Schilde */
|
/* Schilde */
|
||||||
for (si = b->meffects.begin; si != b->meffects.end; ++si) {
|
for (qi=0,ql=b->meffects;ql;ql_advance(&ql, &qi, 1)) {
|
||||||
meffect *meffect = *si;
|
meffect *me = (meffect *)ql_get(ql, qi);
|
||||||
if (meffect_protection(b, meffect, ds) != 0) {
|
if (meffect_protection(b, me, ds) != 0) {
|
||||||
assert(0 <= rda); /* rda sollte hier immer mindestens 0 sein */
|
assert(0 <= rda); /* rda sollte hier immer mindestens 0 sein */
|
||||||
/* jeder Schaden wird um effect% reduziert bis der Schild duration
|
/* jeder Schaden wird um effect% reduziert bis der Schild duration
|
||||||
* Trefferpunkte aufgefangen hat */
|
* Trefferpunkte aufgefangen hat */
|
||||||
if (meffect->typ == SHIELD_REDUCE) {
|
if (me->typ == SHIELD_REDUCE) {
|
||||||
hp = rda * (meffect->effect/100);
|
hp = rda * (me->effect/100);
|
||||||
rda -= hp;
|
rda -= hp;
|
||||||
meffect->duration -= hp;
|
me->duration -= hp;
|
||||||
}
|
}
|
||||||
/* gibt Rüstung +effect für duration Treffer */
|
/* gibt Rüstung +effect für duration Treffer */
|
||||||
if (meffect->typ == SHIELD_ARMOR) {
|
if (me->typ == SHIELD_ARMOR) {
|
||||||
rda = MAX(rda - meffect->effect, 0);
|
rda = MAX(rda - me->effect, 0);
|
||||||
meffect->duration--;
|
me->duration--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1756,10 +1758,10 @@ do_combatspell(troop at)
|
||||||
unit *mage = fi->unit;
|
unit *mage = fi->unit;
|
||||||
battle *b = fi->side->battle;
|
battle *b = fi->side->battle;
|
||||||
region *r = b->region;
|
region *r = b->region;
|
||||||
int level;
|
quicklist * ql;
|
||||||
|
int level, qi;
|
||||||
double power;
|
double power;
|
||||||
int fumblechance = 0;
|
int fumblechance = 0;
|
||||||
void **mg;
|
|
||||||
order * ord;
|
order * ord;
|
||||||
int sl;
|
int sl;
|
||||||
const struct locale * lang = mage->faction->locale;
|
const struct locale * lang = mage->faction->locale;
|
||||||
|
@ -1784,8 +1786,8 @@ do_combatspell(troop at)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (mg = b->meffects.begin; mg != b->meffects.end; ++mg) {
|
for (qi=0,ql=b->meffects;ql;ql_advance(&ql, &qi, 1)) {
|
||||||
meffect *mblock = *mg;
|
meffect *mblock = (meffect *)ql_get(ql, qi);
|
||||||
if (mblock->typ == SHIELD_BLOCK) {
|
if (mblock->typ == SHIELD_BLOCK) {
|
||||||
if (meffect_blocked(b, mblock, fi->side) != 0) {
|
if (meffect_blocked(b, mblock, fi->side) != 0) {
|
||||||
fumblechance += mblock->duration;
|
fumblechance += mblock->duration;
|
||||||
|
@ -3607,7 +3609,6 @@ static void
|
||||||
free_battle(battle * b)
|
free_battle(battle * b)
|
||||||
{
|
{
|
||||||
side *s;
|
side *s;
|
||||||
meffect *meffect;
|
|
||||||
int max_fac_no = 0;
|
int max_fac_no = 0;
|
||||||
|
|
||||||
if (bdebug) {
|
if (bdebug) {
|
||||||
|
@ -3633,11 +3634,8 @@ free_battle(battle * b)
|
||||||
free_side(s);
|
free_side(s);
|
||||||
}
|
}
|
||||||
ql_free(b->leaders);
|
ql_free(b->leaders);
|
||||||
cv_foreach(meffect, b->meffects) {
|
ql_foreach(b->meffects, free);
|
||||||
free(meffect);
|
ql_free(b->meffects);
|
||||||
}
|
|
||||||
cv_next(meffect);
|
|
||||||
cv_kill(&b->meffects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int *
|
static int *
|
||||||
|
|
|
@ -101,7 +101,7 @@ extern "C" {
|
||||||
int nfighters;
|
int nfighters;
|
||||||
side sides[MAXSIDES];
|
side sides[MAXSIDES];
|
||||||
int nsides;
|
int nsides;
|
||||||
cvector meffects;
|
struct quicklist *meffects;
|
||||||
int max_tactics;
|
int max_tactics;
|
||||||
int turn;
|
int turn;
|
||||||
boolean has_tactics_turn;
|
boolean has_tactics_turn;
|
||||||
|
|
Loading…
Reference in a new issue