server/src/common/spells/regioncurse.c

126 lines
2.7 KiB
C
Raw Normal View History

/* vi: set ts=2:
*
* Eressea PB(E)M host Copyright (C) 1998-2000
* Christian Schlittchen (corwin@amber.kn-bremen.de)
* Katja Zedel (katze@felidae.kn-bremen.de)
* Henning Peters (faroul@beyond.kn-bremen.de)
* Enno Rehling (enno@eressea-pbem.de)
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
*
* This program may not be used, modified or distributed without
* prior permission by the authors of Eressea.
*/
#include <config.h>
#include "eressea.h"
#include "regioncurse.h"
/* kernel includes */
2002-05-09 13:41:20 +02:00
#include <region.h>
#include <message.h>
#include <nrmessage.h>
#include <objtypes.h>
#include <curse.h>
/* util includes */
#include <message.h>
2002-05-09 14:19:15 +02:00
#include <functions.h>
/* libc includes */
#include <string.h>
#include <stdlib.h>
#include <assert.h>
2002-05-09 14:19:15 +02:00
int
cinfo_region(const struct locale * lang, const void * obj, typ_t typ, struct curse *c, int self)
{
message * msg;
unused(typ);
unused(self);
unused(obj);
assert(typ == TYP_REGION);
msg = msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
}
/* CurseInfo mit Spezialabfragen */
static int
2002-05-09 12:42:41 +02:00
cinfo_cursed_by_the_gods(const locale * lang,void * obj, typ_t typ, curse *c, int self)
{
region *r;
message * msg;
unused(typ);
unused(self);
assert(typ == TYP_REGION);
r = (region *)obj;
if (rterrain(r)!=T_OCEAN){
msg = msg_message("curseinfo::godcurse", "id", c->no);
} else {
msg = msg_message("curseinfo::godcurseocean", "id", c->no);
}
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
}
/* C_GBDREAM, */
static int
2002-05-09 12:42:41 +02:00
cinfo_dreamcurse(const locale * lang,void * obj, typ_t typ, curse *c, int self)
{
2002-05-09 13:17:31 +02:00
message * msg;
unused(self);
unused(typ);
unused(obj);
assert(typ == TYP_REGION);
if (c->effect > 0){
msg = msg_message("curseinfo::gooddream", "id", c->no);
}else{
msg = msg_message("curseinfo::baddream", "id", c->no);
}
nr_render(msg, lang, buf, sizeof(buf), NULL);
msg_release(msg);
return 1;
}
/* C_MAGICSTREET */
static int
2002-05-09 12:42:41 +02:00
cinfo_magicstreet(const locale * lang,void * obj, typ_t typ, curse *c, int self)
{
2002-05-09 13:17:31 +02:00
message * msg;
unused(typ);
unused(self);
unused(obj);
assert(typ == TYP_REGION);
2002-05-09 13:17:31 +02:00
/* Warnung vor Aufl<66>sung */
if (c->duration <= 2){
2002-05-09 13:17:31 +02:00
msg = msg_message("curseinfo::magicstreet", "id", c->no);
} else {
msg = msg_message("curseinfo::magicstreetwarn", "id", c->no);
}
return 1;
}
2002-05-09 13:41:20 +02:00
2002-05-09 14:36:43 +02:00
2002-05-09 14:19:15 +02:00
void
register_regioncurse(void)
2002-05-09 13:41:20 +02:00
{
2002-05-09 14:19:15 +02:00
register_function((pf_generic)cinfo_cursed_by_the_gods, "curseinfo::cursed_by_the_gods");
register_function((pf_generic)cinfo_dreamcurse, "curseinfo::dreamcurse");
register_function((pf_generic)cinfo_magicstreet, "curseinfo::magicstreet");
2002-05-09 13:41:20 +02:00
}