Bug 2623: Untote dürfen nicht in heilige Regionen ziehen.

Code style fixes.
This commit is contained in:
Enno Rehling 2019-12-29 14:28:55 +01:00
parent cef5ff44eb
commit d949d9a6d0
3 changed files with 46 additions and 10 deletions

View file

@ -14,6 +14,29 @@ function setup()
eressea.settings.set("magic.regeneration.enable", "0") eressea.settings.set("magic.regeneration.enable", "0")
end end
function test_undead_cannot_enter_holyground()
local r1 = region.create(0, 0, 'plain')
local r2 = region.create(1, 0, 'plain')
local f = faction.create('human')
local u1 = unit.create(f, r1, 1)
local u2 = unit.create(f, r2, 1)
u2.name = "Xolgrim's Magier"
u1.name = "Xolgrim's Opfer"
u2.magic = 'gwyrrd'
u2:set_skill('magic', 100)
u2.aura = 200
u2:add_spell('holyground')
u2:add_order('ZAUBERE STUFE 10 "Heiliger Boden"')
u1.race = "skeleton"
u1:add_order("NACH Osten")
process_orders()
assert_not_nil(r2:get_curse('holyground'))
assert_equal(r1, u1.region)
end
function test_shapeshift() function test_shapeshift()
local r = region.create(42, 0, "plain") local r = region.create(42, 0, "plain")
local f = faction.create("demon", "noreply@eressea.de", "de") local f = faction.create("demon", "noreply@eressea.de", "de")

View file

@ -3712,8 +3712,9 @@ void process(void)
log_debug("- Step %u", prio); log_debug("- Step %u", prio);
while (proc && proc->priority == prio) { while (proc && proc->priority == prio) {
if (proc->name) if (proc->name) {
log_debug(" - %s", proc->name); log_debug(" - %s", proc->name);
}
proc = proc->next; proc = proc->next;
} }
@ -3721,8 +3722,9 @@ void process(void)
pglobal->data.global.process(); pglobal->data.global.process();
pglobal = pglobal->next; pglobal = pglobal->next;
} }
if (pglobal == NULL || pglobal->priority != prio) if (pglobal == NULL || pglobal->priority != prio) {
continue; continue;
}
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
unit *u; unit *u;
@ -3733,8 +3735,9 @@ void process(void)
pregion->data.per_region.process(r); pregion->data.per_region.process(r);
pregion = pregion->next; pregion = pregion->next;
} }
if (pregion == NULL || pregion->priority != prio) if (pregion == NULL || pregion->priority != prio) {
continue; continue;
}
if (r->units) { if (r->units) {
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
@ -3744,14 +3747,16 @@ void process(void)
punit->data.per_unit.process(u); punit->data.per_unit.process(u);
punit = punit->next; punit = punit->next;
} }
if (punit == NULL || punit->priority != prio) if (punit == NULL || punit->priority != prio) {
continue; continue;
}
porder = punit; porder = punit;
while (porder && porder->priority == prio && porder->type == PR_ORDER) { while (porder && porder->priority == prio && porder->type == PR_ORDER) {
order **ordp = &u->orders; order **ordp = &u->orders;
if (porder->flags & PROC_THISORDER) if (porder->flags & PROC_THISORDER) {
ordp = &u->thisorder; ordp = &u->thisorder;
}
while (*ordp) { while (*ordp) {
order *ord = *ordp; order *ord = *ordp;
if (getkeyword(ord) == porder->data.per_order.kword) { if (getkeyword(ord) == porder->data.per_order.kword) {
@ -3780,8 +3785,9 @@ void process(void)
} }
} }
} }
if (!ord || *ordp == ord) if (!ord || *ordp == ord) {
ordp = &(*ordp)->next; ordp = &(*ordp)->next;
}
} }
porder = porder->next; porder = porder->next;
} }
@ -3798,9 +3804,9 @@ void process(void)
pregion->data.per_region.process(r); pregion->data.per_region.process(r);
pregion = pregion->next; pregion = pregion->next;
} }
if (pregion == NULL || pregion->priority != prio) if (pregion == NULL || pregion->priority != prio) {
continue; continue;
}
} }
} }

View file

@ -974,10 +974,17 @@ bool move_blocked(const unit * u, const region * r, const region * r2)
} }
if (r->attribs) { if (r->attribs) {
const curse_type *fogtrap_ct = &ct_fogtrap; curse *c = get_curse(r->attribs, &ct_fogtrap);
curse *c = get_curse(r->attribs, fogtrap_ct); if (curse_active(c)) {
return true;
}
}
if (r2->attribs && fval(u_race(u), RCF_UNDEAD)) {
curse *c = get_curse(r2->attribs, &ct_holyground);
return curse_active(c); return curse_active(c);
} }
return false; return false;
} }