forked from github/server
Merge pull request #272 from ennorehling/feature/bug-2121-homestone-messages
Bug 2121: wrong messages for homestone spell effects
This commit is contained in:
commit
a634b115a7
|
@ -390,7 +390,7 @@
|
|||
<text locale="de">"Die Ausrüstung von $unit($unit) scheint unsichtbar. ($int36($id))"</text>
|
||||
<text locale="en">"$unit($unit)'s equipment is invisible. ($int36($id))"</text>
|
||||
</message>
|
||||
<message name="curseinfo::magicresistance" section="events">
|
||||
<message name="curseinfo::magicresistance_unit" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="id" type="int"/>
|
||||
|
@ -398,7 +398,7 @@
|
|||
<text locale="de">"Die natürliche Widerstandskraft gegen Verzauberung ist gestärkt. ($int36($id))"</text>
|
||||
<text locale="en">"The magical resistance has been strengthened. ($int36($id))"</text>
|
||||
</message>
|
||||
<message name="curseinfo::homestone" section="events">
|
||||
<message name="curseinfo::magicresistance_building" section="events">
|
||||
<type>
|
||||
<arg name="building" type="building"/>
|
||||
<arg name="id" type="int"/>
|
||||
|
@ -914,7 +914,7 @@
|
|||
<arg name="transparent" type="int"/>
|
||||
<arg name="object" type="string"/>
|
||||
</type>
|
||||
<text locale="de">"$if($transparent," befindet sich"," versperrt") ${object} $if($transparent,""," die Sicht")."</text>
|
||||
<text locale="de">"$if($transparent," befindet sich"," versperrt") ${object}$if($transparent,""," die Sicht")."</text>
|
||||
<text locale="en">"$if($transparent," there is"," sight is blocked by ") ${object}."</text>
|
||||
</message>
|
||||
<message name="nr_building_besieged" section="nr">
|
||||
|
|
|
@ -250,9 +250,7 @@ cr_output_curses(stream *out, const faction * viewer, const void *obj, objtype_t
|
|||
curse *c = (curse *)a->data.v;
|
||||
message *msg;
|
||||
|
||||
if (c->type->cansee) {
|
||||
self = c->type->cansee(viewer, obj, typ, c, self);
|
||||
}
|
||||
self = curse_cansee(c, viewer, typ, obj, self);
|
||||
msg = msg_curse(c, obj, typ, self);
|
||||
|
||||
if (msg) {
|
||||
|
|
|
@ -642,6 +642,17 @@ void transfer_curse(unit * u, unit * u2, int n)
|
|||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
||||
int curse_cansee(const curse *c, const faction *viewer, objtype_t typ, const void *obj, int self) {
|
||||
if (self < 3 && c->magician && c->magician->faction == viewer) {
|
||||
// magicians can see their own curses better than anybody, no exceptions
|
||||
self = 3;
|
||||
}
|
||||
else if (c->type->cansee) {
|
||||
self = c->type->cansee(viewer, obj, typ, c, self);
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
bool curse_active(const curse * c)
|
||||
{
|
||||
if (!c)
|
||||
|
|
|
@ -303,7 +303,7 @@ extern "C" {
|
|||
const char *oldcursename(int id);
|
||||
struct message *cinfo_simple(const void *obj, objtype_t typ,
|
||||
const struct curse *c, int self);
|
||||
|
||||
int curse_cansee(const struct curse *c, const struct faction *viewer, objtype_t typ, const void *obj, int self);
|
||||
#define is_cursed(a, id, id2) \
|
||||
curse_active(get_curse(a, ct_find(oldcursename(id))))
|
||||
#define get_curseeffect(a, id, id2) \
|
||||
|
|
22
src/report.c
22
src/report.c
|
@ -515,33 +515,27 @@ nr_curses_i(stream *out, int indent, const faction *viewer, objtype_t typ, const
|
|||
{
|
||||
for (; a; a = a->next) {
|
||||
char buf[4096];
|
||||
message *msg;
|
||||
message *msg = 0;
|
||||
|
||||
if (fval(a->type, ATF_CURSE)) {
|
||||
curse *c = (curse *)a->data.v;
|
||||
|
||||
if (c->type->cansee) {
|
||||
self = c->type->cansee(viewer, obj, typ, c, self);
|
||||
}
|
||||
self = curse_cansee(c, viewer, typ, obj, self);
|
||||
msg = msg_curse(c, obj, typ, self);
|
||||
|
||||
if (msg) {
|
||||
newline(out);
|
||||
nr_render(msg, viewer->locale, buf, sizeof(buf), viewer);
|
||||
paragraph(out, buf, indent, 2, 0);
|
||||
msg_release(msg);
|
||||
}
|
||||
}
|
||||
else if (a->type == &at_effect && self) {
|
||||
effect_data *data = (effect_data *)a->data.v;
|
||||
if (data->value > 0) {
|
||||
msg = msg_message("nr_potion_effect", "potion left",
|
||||
data->type->itype->rtype, data->value);
|
||||
nr_render(msg, viewer->locale, buf, sizeof(buf), viewer);
|
||||
paragraph(out, buf, indent, 2, 0);
|
||||
msg_release(msg);
|
||||
}
|
||||
}
|
||||
if (msg) {
|
||||
newline(out);
|
||||
nr_render(msg, viewer->locale, buf, sizeof(buf), viewer);
|
||||
paragraph(out, buf, indent, 2, 0);
|
||||
msg_release(msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -9,14 +9,14 @@ static struct message *cinfo_magicresistance(const void *obj, objtype_t typ, con
|
|||
if (typ == TYP_UNIT) {
|
||||
if (self != 0) {
|
||||
const struct unit *u = (const struct unit *)obj;
|
||||
return msg_message(mkname("curseinfo", c->type->cname), "unit id", u,
|
||||
return msg_message(mkname("curseinfo", "magicresistance_unit"), "unit id", u,
|
||||
c->no);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
if (typ == TYP_BUILDING) {
|
||||
const struct building *b = (const struct building *)obj;
|
||||
return msg_message(mkname("curseinfo", self ? "homestone" : "buildingunknown"), "id building", c->no, b);
|
||||
return msg_message(mkname("curseinfo", "magicresistance_building"), "id building", c->no, b);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue