forked from github/server
filter by curse-type before trying to call update_gbdreams.
This commit is contained in:
parent
b5ed7c562d
commit
d99ffaf1ed
|
@ -1274,8 +1274,7 @@ static int item_modification(const unit * u, skill_t sk, int val)
|
|||
return val;
|
||||
}
|
||||
|
||||
static int update_gbdream(const unit * u, int bonus, curse *c, const curse_type *gbdream_ct, int sign){
|
||||
if (curse_active(c) && c->type == gbdream_ct) {
|
||||
static int update_gbdream(const unit * u, int bonus, curse *c, int sign) {
|
||||
double effect = curse_geteffect(c);
|
||||
unit *mage = c->magician;
|
||||
/* wir suchen jeweils den groessten Bonus und den groessten Malus */
|
||||
|
@ -1287,14 +1286,13 @@ static int update_gbdream(const unit * u, int bonus, curse *c, const curse_type
|
|||
bonus = (int)effect;
|
||||
}
|
||||
}
|
||||
}
|
||||
return bonus;
|
||||
}
|
||||
|
||||
int att_modification(const unit * u, skill_t sk)
|
||||
{
|
||||
double result = 0;
|
||||
static bool init = false;
|
||||
static bool init = false; // TODO: static variables are bad global state
|
||||
static const curse_type *skillmod_ct, *gbdream_ct, *worse_ct;
|
||||
curse *c;
|
||||
|
||||
|
@ -1329,9 +1327,11 @@ int att_modification(const unit * u, skill_t sk)
|
|||
while (a && a->type == &at_curse) {
|
||||
curse *c = (curse *)a->data.v;
|
||||
|
||||
if (curse_active(c) && c->type == gbdream_ct) {
|
||||
assert(c->magician); // update_gbdream makes no sense if there is no caster (calls alliedunit)
|
||||
bonus = update_gbdream(u, bonus, c, gbdream_ct, 1);
|
||||
malus = update_gbdream(u, malus, c, gbdream_ct, -1);
|
||||
bonus = update_gbdream(u, bonus, c, 1);
|
||||
malus = update_gbdream(u, malus, c, -1);
|
||||
}
|
||||
a = a->next;
|
||||
}
|
||||
result = result + bonus + malus;
|
||||
|
|
Loading…
Reference in New Issue