2010-08-08 09:40:42 +02:00
|
|
|
|
/* vi: set ts=2:
|
|
|
|
|
*
|
|
|
|
|
* Eressea PB(E)M host Copyright (C) 1998-2003
|
|
|
|
|
* 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.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 <platform.h>
|
|
|
|
|
#include <kernel/config.h>
|
|
|
|
|
#include "buildingcurse.h"
|
|
|
|
|
|
|
|
|
|
/* kernel includes */
|
|
|
|
|
#include <kernel/message.h>
|
|
|
|
|
#include <kernel/objtypes.h>
|
|
|
|
|
#include <kernel/building.h>
|
|
|
|
|
#include <kernel/ship.h>
|
|
|
|
|
#include <kernel/curse.h>
|
|
|
|
|
|
|
|
|
|
/* util includes */
|
|
|
|
|
#include <util/nrmessage.h>
|
|
|
|
|
#include <util/base36.h>
|
|
|
|
|
#include <util/functions.h>
|
|
|
|
|
#include <util/language.h>
|
|
|
|
|
|
|
|
|
|
/* libc includes */
|
|
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
2012-05-17 09:14:05 +02:00
|
|
|
|
static message *cinfo_building(const void *obj, objtype_t typ, const curse * c,
|
2011-03-07 08:03:10 +01:00
|
|
|
|
int self)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
{
|
|
|
|
|
unused(typ);
|
|
|
|
|
assert(typ == TYP_BUILDING);
|
|
|
|
|
|
2011-03-07 08:03:10 +01:00
|
|
|
|
if (self != 0) { /* owner or inside */
|
2010-08-08 09:40:42 +02:00
|
|
|
|
return msg_message(mkname("curseinfo", c->type->cname), "id", c->no);
|
2011-03-07 08:03:10 +01:00
|
|
|
|
}
|
2010-08-08 09:40:42 +02:00
|
|
|
|
return msg_message(mkname("curseinfo", "buildingunknown"), "id", c->no);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* CurseInfo mit Spezialabfragen */
|
|
|
|
|
|
|
|
|
|
/* C_MAGICWALLS*/
|
2012-05-17 09:14:05 +02:00
|
|
|
|
static message *cinfo_magicrunes(const void *obj, objtype_t typ, const curse * c,
|
2011-03-07 08:03:10 +01:00
|
|
|
|
int self)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
{
|
2011-03-07 08:03:10 +01:00
|
|
|
|
message *msg = NULL;
|
|
|
|
|
if (typ == TYP_BUILDING) {
|
|
|
|
|
building *b;
|
|
|
|
|
b = (building *) obj;
|
2010-08-08 09:40:42 +02:00
|
|
|
|
if (self != 0) {
|
2011-03-07 08:03:10 +01:00
|
|
|
|
msg =
|
|
|
|
|
msg_message("curseinfo::magicrunes_building", "building id", b, c->no);
|
2010-08-08 09:40:42 +02:00
|
|
|
|
}
|
|
|
|
|
} else if (typ == TYP_SHIP) {
|
|
|
|
|
ship *sh;
|
2011-03-07 08:03:10 +01:00
|
|
|
|
sh = (ship *) obj;
|
|
|
|
|
if (self != 0) {
|
2010-08-08 09:40:42 +02:00
|
|
|
|
msg = msg_message("curseinfo::magicrunes_ship", "ship id", sh, c->no);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return msg;
|
|
|
|
|
}
|
2011-03-07 08:03:10 +01:00
|
|
|
|
|
2010-08-08 09:40:42 +02:00
|
|
|
|
static struct curse_type ct_magicrunes = { "magicrunes",
|
|
|
|
|
CURSETYP_NORM, 0, M_SUMEFFECT, cinfo_magicrunes
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Heimstein-Zauber */
|
|
|
|
|
static struct curse_type ct_magicwalls = { "magicwalls",
|
|
|
|
|
CURSETYP_NORM, 0, NO_MERGE, cinfo_building
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Feste Mauer - Pr<50>kampfzauber, wirkt nur 1 Runde */
|
|
|
|
|
static struct curse_type ct_strongwall = { "strongwall",
|
|
|
|
|
CURSETYP_NORM, 0, NO_MERGE, NULL
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/* Ewige Mauern-Zauber */
|
|
|
|
|
static struct curse_type ct_nocostbuilding = { "nocostbuilding",
|
2011-03-07 08:03:10 +01:00
|
|
|
|
CURSETYP_NORM, CURSE_NOAGE | CURSE_ONLYONE, NO_MERGE, cinfo_building
|
2010-08-08 09:40:42 +02:00
|
|
|
|
};
|
|
|
|
|
|
2011-03-07 08:03:10 +01:00
|
|
|
|
void register_buildingcurse(void)
|
2010-08-08 09:40:42 +02:00
|
|
|
|
{
|
|
|
|
|
ct_register(&ct_magicwalls);
|
|
|
|
|
ct_register(&ct_strongwall);
|
|
|
|
|
ct_register(&ct_magicrunes);
|
|
|
|
|
ct_register(&ct_nocostbuilding);
|
|
|
|
|
}
|