forked from github/server
- All the cinfo_* functions will now return a message * object, which is nicer than using buf[].
This commit is contained in:
parent
1030e44c07
commit
0423debfde
|
@ -34,47 +34,39 @@
|
||||||
|
|
||||||
|
|
||||||
static message *
|
static message *
|
||||||
cinfo_building(const struct locale * lang, const void * obj, typ_t typ, const curse *c, int self)
|
cinfo_building(const void * obj, typ_t typ, const curse *c, int self)
|
||||||
{
|
{
|
||||||
unused(typ);
|
unused(typ);
|
||||||
assert(typ == TYP_BUILDING);
|
assert(typ == TYP_BUILDING);
|
||||||
|
|
||||||
if (self != 0){ /* owner or inside */
|
if (self != 0){ /* owner or inside */
|
||||||
return msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
return msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
||||||
} else { /* outside */
|
|
||||||
return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
|
|
||||||
}
|
}
|
||||||
log_warning(("There is no curseinfo for %s.\n", c->type->cname));
|
return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* CurseInfo mit Spezialabfragen */
|
/* CurseInfo mit Spezialabfragen */
|
||||||
|
|
||||||
/* C_MAGICWALLS*/
|
/* C_MAGICWALLS*/
|
||||||
static int
|
static message *
|
||||||
cinfo_magicrunes(const struct locale* lang, const void * obj, typ_t typ, const curse *c, int self)
|
cinfo_magicrunes(const void * obj, typ_t typ, const curse *c, int self)
|
||||||
{
|
{
|
||||||
message * msg = NULL;
|
message * msg = NULL;
|
||||||
if (typ == TYP_BUILDING){
|
if (typ == TYP_BUILDING){
|
||||||
building * b;
|
building * b;
|
||||||
b = (building*)obj;
|
b = (building*)obj;
|
||||||
if (self != 0) {
|
if (self != 0) {
|
||||||
msg = msg_message(mkname("curseinfo", "magicrunes_building"), "building id", b, c->no);
|
msg = msg_message("curseinfo::magicrunes_building", "building id", b, c->no);
|
||||||
}
|
}
|
||||||
} else if (typ == TYP_SHIP) {
|
} else if (typ == TYP_SHIP) {
|
||||||
ship *sh;
|
ship *sh;
|
||||||
sh = (ship*)obj;
|
sh = (ship*)obj;
|
||||||
if (self != 0){
|
if (self != 0){
|
||||||
msg = msg_message(mkname("curseinfo", "magicrunes_ship"), "ship id", sh, c->no);
|
msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (msg!=NULL) {
|
return msg;
|
||||||
nr_render(msg, lang, buf, sizeof(buf), NULL);
|
|
||||||
msg_release(msg);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
static struct curse_type ct_magicrunes = { "magicrunes",
|
static struct curse_type ct_magicrunes = { "magicrunes",
|
||||||
CURSETYP_NORM, 0, M_SUMEFFECT,
|
CURSETYP_NORM, 0, M_SUMEFFECT,
|
||||||
|
|
Loading…
Reference in New Issue