diff --git a/src/common/kernel/magic.c b/src/common/kernel/magic.c index 6557f6bd5..0796c2fc6 100644 --- a/src/common/kernel/magic.c +++ b/src/common/kernel/magic.c @@ -1518,6 +1518,24 @@ verify_building(region * r, unit * mage, const spell * sp, spllprm * spobj, orde return true; } +message * +msg_unitnotfound(const struct unit * mage, struct order * ord, const struct spllprm * spobj) +{ + /* Einheit nicht gefunden */ + char tbuf[20]; + const char * uid; + + if (spobj->typ==SPP_UNIT) { + uid = itoa36(spobj->data.i); + } else { + sprintf(tbuf, "%s %s", LOC(mage->faction->locale, + parameters[P_TEMP]), itoa36(spobj->data.i)); + uid = tbuf; + } + return msg_message("spellunitnotfound", + "unit region command id", mage, mage->region, ord, uid); +} + static boolean verify_unit(region * r, unit * mage, const spell * sp, spllprm * spobj, order * ord) { @@ -1544,19 +1562,8 @@ verify_unit(region * r, unit * mage, const spell * sp, spllprm * spobj, order * if (u==NULL) { /* Einheit nicht gefunden */ - char * uid; spobj->flag = TARGET_NOTFOUND; - - if (spobj->typ==SPP_UNIT) { - uid = strdup(itoa36(spobj->data.i)); - } else { - char tbuf[20]; - sprintf(tbuf, "%s %s", LOC(mage->faction->locale, - parameters[P_TEMP]), itoa36(spobj->data.i)); - uid = strdup(tbuf); - } - ADDMSG(&mage->faction->msgs, msg_message("spellunitnotfound", - "unit region command id", mage, mage->region, ord, uid)); + ADDMSG(&mage->faction->msgs, msg_unitnotfound(mage, ord, spobj)); return false; } /* Einheit wurde gefunden, pointer setzen */ @@ -1598,13 +1605,13 @@ verify_targets(castorder *co) switch(spobj->typ) { case SPP_TEMP: - case SPP_UNIT: + case SPP_UNIT: if (!verify_unit(target_r, mage, sp, spobj, co->order)) ++failed; break; - case SPP_BUILDING: + case SPP_BUILDING: if (!verify_building(target_r, mage, sp, spobj, co->order)) ++failed; break; - case SPP_SHIP: + case SPP_SHIP: if (!verify_ship(target_r, mage, sp, spobj, co->order)) ++failed; break; default: diff --git a/src/common/kernel/magic.h b/src/common/kernel/magic.h index dd47949c4..412704ada 100644 --- a/src/common/kernel/magic.h +++ b/src/common/kernel/magic.h @@ -371,6 +371,8 @@ extern struct unit * has_clone(struct unit * mage); extern const char * spell_info(const struct spell * sp, const struct locale * lang); extern const char * spell_name(const struct spell * sp, const struct locale * lang); +extern struct message * msg_unitnotfound(const struct unit * mage, struct order * ord, const struct spllprm * spobj); + #ifdef __cplusplus } #endif diff --git a/src/common/spells/spells.c b/src/common/spells/spells.c index 8f6583559..ee18bafeb 100644 --- a/src/common/spells/spells.c +++ b/src/common/spells/spells.c @@ -5365,9 +5365,7 @@ sp_dreamreading(castorder *co) /* Illusionen und Untote abfangen. */ if (fval(u->race, RCF_UNDEAD|RCF_ILLUSIONARY)) { - ADDMSG(&mage->faction->msgs, msg_message( - "spellunitnotfound", "unit region command id", - mage, mage->region, co->order, strdup(itoa36(u->no)))); + ADDMSG(&mage->faction->msgs, msg_unitnotfound(mage, co->order, pa->param[0])); return 0; } @@ -5844,12 +5842,29 @@ sp_pullastral(castorder *co) /* für jede Einheit in der Kommandozeile */ for (n = 1; n < pa->length; n++) { - if (pa->param[n]->flag == TARGET_NOTFOUND) continue; + spllprm * spobj = pa->param[n]; + if (spobj->flag == TARGET_NOTFOUND) continue; - u = pa->param[n]->data.u; + u = spobj->data.u; + + if (u->region!=r) { + /* Report this as unit not found */ + char * uid; + + if (spobj->typ==SPP_UNIT) { + uid = strdup(itoa36(spobj->data.i)); + } else { + char tbuf[20]; + sprintf(tbuf, "%s %s", LOC(mage->faction->locale, + parameters[P_TEMP]), itoa36(spobj->data.i)); + uid = strdup(tbuf); + } + ADDMSG(&mage->faction->msgs, msg_unitnotfound(mage, co->order, spobj)); + return false; + } if (!ucontact(u, mage)) { - if (power > 12 && pa->param[n]->flag != TARGET_RESISTS && can_survive(u, rt)) { + if (power > 12 && spobj->flag != TARGET_RESISTS && can_survive(u, rt)) { ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "feedback_no_contact_no_resist", "target", u)); ADDMSG(&u->faction->msgs, msg_message("send_astral", "unit target", mage, u)); } else { @@ -9000,7 +9015,7 @@ static spelldata spelldaten[] = "ZAUBER [STUFE n] \'Astraler Ruf\' " "[ ...]", "ru+", - M_ASTRAL, (UNITSPELL | SPELLLEVEL), 7, 6, + M_ASTRAL, (UNITSPELL | SEARCHGLOBAL | SPELLLEVEL), 7, 6, { { "aura", 2, SPC_LEVEL }, { 0, 0, 0 },