BUG 2340: endloser Sturmelementar

CURSE_NOAGE is a weird thing.
This commit is contained in:
Enno Rehling 2017-06-18 21:48:47 +02:00
parent 8178f3f1e6
commit 75ae22e5b6
4 changed files with 15 additions and 20 deletions

View File

@ -107,24 +107,21 @@ void curse_init(attrib * a)
int curse_age(attrib * a, void *owner)
{
curse *c = (curse *)a->data.v;
int result = 0;
int result = AT_AGE_KEEP;
UNUSED_ARG(owner);
c_clearflag(c, CURSE_ISNEW);
if (c_flags(c) & CURSE_NOAGE) {
c->duration = INT_MAX;
if ((c_flags(c) & CURSE_NOAGE) == 0) {
if (c->type->age) {
if (c->type->age(c) == 0) {
result = AT_AGE_REMOVE;
}
}
if (--c->duration <= 0) {
result = AT_AGE_REMOVE;
}
}
if (c->type->age) {
result = c->type->age(c);
}
if (result != 0) {
c->duration = 0;
}
else if (c->duration != INT_MAX) {
c->duration = MAX(0, c->duration - 1);
}
return (c->duration > 0) ? AT_AGE_KEEP : AT_AGE_REMOVE;
return result;
}
void destroy_curse(curse * c)
@ -308,6 +305,7 @@ void ct_register(const curse_type * ct)
unsigned int hash = tolower(ct->cname[0]) & 0xFF;
selist **ctlp = cursetypes + hash;
assert(ct->age==NULL || (ct->flags&CURSE_NOAGE) == 0);
selist_set_insert(ctlp, (void *)ct, NULL);
++ct_changes;
}

View File

@ -2079,7 +2079,6 @@ static int sp_homestone(castorder * co)
cmistake(mage, co->order, 206, MSG_MAGIC);
return 0;
}
c_setflag(c, CURSE_NOAGE | CURSE_ONLYONE);
/* Magieresistenz der Burg erhoeht sich um 50% */
effect = 50.0F;

View File

@ -76,7 +76,7 @@ CURSETYP_NORM, 0, M_SUMEFFECT, cinfo_magicrunes
/* Heimstein-Zauber */
static struct curse_type ct_magicwalls = { "magicwalls",
CURSETYP_NORM, 0, NO_MERGE, cinfo_building
CURSETYP_NORM, CURSE_ONLYONE|CURSE_NOAGE, NO_MERGE, cinfo_building
};
/* Feste Mauer - Präkampfzauber, wirkt nur 1 Runde */

View File

@ -149,10 +149,8 @@ bool flying_ship(const ship * sh)
static curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int duration)
{
curse *c;
const curse_type *ct_flyingship = ct_find("flyingship");
assert(ct_flyingship);
if (sh->attribs) {
if (curse_active(get_curse(sh->attribs, ct_flyingship))) {
if (curse_active(get_curse(sh->attribs, &ct_flyingship))) {
return NULL;
}
if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0)) {
@ -160,7 +158,7 @@ static curse *shipcurse_flyingship(ship * sh, unit * mage, double power, int dur
}
}
/* mit C_SHIP_NODRIFT haben wir kein Problem */
c = create_curse(mage, &sh->attribs, ct_flyingship, power, duration, 0.0, 0);
c = create_curse(mage, &sh->attribs, &ct_flyingship, power, duration, 0.0, 0);
if (c) {
c->data.v = sh;
if (c->duration > 0) {