make att_modification not crash when a good/bad dream curse has no magician.

This commit is contained in:
Enno Rehling 2017-02-12 13:22:44 +01:00
parent a4bd4320e5
commit b05c2564e5
5 changed files with 18 additions and 6 deletions

2
clibs

@ -1 +1 @@
Subproject commit f91ef37f08c5244bf616f1836c0aa9caaf36805c Subproject commit 27c8b3202b52766465743c3324fc0b52c5ba4b11

12
conf/e2/locales.xml Normal file
View file

@ -0,0 +1,12 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config://core/messages.xml"/>
<xi:include href="config://core/de/strings.xml"/>
<xi:include href="config://core/en/strings.xml"/>
<xi:include href="config://game/spellinfo.xml" />
<xi:include href="config://default/names-undead.xml"/>
<xi:include href="config://default/names-skeletons.xml"/>
<xi:include href="config://default/names-zombies.xml"/>
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
</eressea>

View file

@ -210,7 +210,7 @@ extern "C" {
typedef struct curse { typedef struct curse {
variant data; /* pointer auf spezielle curse-unterstructs */ variant data; /* pointer auf spezielle curse-unterstructs */
struct curse *nexthash; struct curse *nexthash;
const curse_type *type; /* Zeiger auf ein curse_type-struct */ const curse_type *type; /* Zeiger auf ein curse_type-struct */
struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */ struct unit *magician; /* Pointer auf den Magier, der den Spruch gewirkt hat */
double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */ double vigour; /* Stärke der Verzauberung, Widerstand gegen Antimagie */
double effect; double effect;

View file

@ -1301,7 +1301,7 @@ static int att_modification(const unit * u, skill_t sk)
while (a && a->type == &at_curse) { while (a && a->type == &at_curse) {
curse *c = (curse *)a->data.v; curse *c = (curse *)a->data.v;
if (curse_active(c) && c->type == gbdream_ct) { if (c->magician && curse_active(c) && c->type == gbdream_ct) {
int effect = curse_geteffect_int(c); int effect = curse_geteffect_int(c);
bool allied = alliedunit(c->magician, u->faction, HELP_GUARD); bool allied = alliedunit(c->magician, u->faction, HELP_GUARD);
if (allied) { if (allied) {

View file

@ -4726,7 +4726,7 @@ static int sp_gbdreams(castorder * co, const char *curse_name, int effect)
/* Erfolg melden */ /* Erfolg melden */
ADDMSG(&mage->faction->msgs, msg_message("regionmagic_effect", ADDMSG(&mage->faction->msgs, msg_message("regionmagic_effect",
"unit region command", c->magician, mage->region, co->order)); "unit region command", mage, mage->region, co->order));
return cast_level; return cast_level;
} }
@ -4867,7 +4867,7 @@ int sp_sweetdreams(castorder * co)
effect = 0.05f; effect = 0.05f;
c = create_curse(mage, &u->attribs, ct_find("orcish"), power, duration, effect, men); c = create_curse(mage, &u->attribs, ct_find("orcish"), power, duration, effect, men);
msg = msg_message("sp_sweetdreams_effect", "mage unit region", c->magician, u, r); msg = msg_message("sp_sweetdreams_effect", "mage unit region", mage, u, r);
r_addmessage(r, mage->faction, msg); r_addmessage(r, mage->faction, msg);
if (u->faction != mage->faction) { if (u->faction != mage->faction) {
r_addmessage(r, u->faction, msg); r_addmessage(r, u->faction, msg);
@ -4892,7 +4892,7 @@ int sp_disturbingdreams(castorder * co)
c = create_curse(mage, &r->attribs, ct_find("badlearn"), power, duration, effect, 0); c = create_curse(mage, &r->attribs, ct_find("badlearn"), power, duration, effect, 0);
ADDMSG(&mage->faction->msgs, msg_message("sp_disturbingdreams_effect", ADDMSG(&mage->faction->msgs, msg_message("sp_disturbingdreams_effect",
"mage region", c->magician, r)); "mage region", mage, r));
return cast_level; return cast_level;
} }