forked from github/server
"Astraler Ruf findet Einheiten nicht" Fehlerkontrolle muss in den spell selbst hinein, weil SEARCHGLOBAL nicht testet, aber wegen Einheit in anderer Region noetig. Meldung ueber fehlende Einheit fuer Zauber in eigene Funktion gesplittet.
This commit is contained in:
parent
2576f781d4
commit
6c8c7ae592
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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\' <Ziel-X> <Ziel-Y> <Einheit-Nr> "
|
||||
"[<Einheit-Nr> ...]",
|
||||
"ru+",
|
||||
M_ASTRAL, (UNITSPELL | SPELLLEVEL), 7, 6,
|
||||
M_ASTRAL, (UNITSPELL | SEARCHGLOBAL | SPELLLEVEL), 7, 6,
|
||||
{
|
||||
{ "aura", 2, SPC_LEVEL },
|
||||
{ 0, 0, 0 },
|
||||
|
|
Loading…
Reference in New Issue