Removing old items created in code and replacing them with XML definitions.
This commit is contained in:
Enno Rehling 2005-01-30 14:30:31 +00:00
parent 812c41c220
commit a44951cf6f
23 changed files with 50 additions and 445 deletions

View File

@ -9,15 +9,10 @@ SubDirHdrs $(SUBDIR)/../.. ;
SOURCES =
artrewards.c
birthday_firework.c
catapultammo.c
demonseye.c
itemtypes.c
questkeys.c
racespoils.c
seed.c
speedsail.c
studypotion.c
weapons.c
xerewards.c
;

View File

@ -1,122 +0,0 @@
/* 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-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 "birthday_firework.h"
/* kernel includes */
#include <item.h>
#include <build.h>
#include <region.h>
#include <teleport.h>
#include <unit.h>
#include <message.h>
/* util includes */
#include <functions.h>
#include "../util/message.h"
/* libc includes */
#include <assert.h>
#include <string.h>
const int FIREWORK_RANGE=10;
static int
use_birthday_firework(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
{
region_list *rlist = all_in_range(u->region, FIREWORK_RANGE, NULL);
region_list *rl;
message *m;
const char *name;
unused(amount);
name = getstrtoken();
/* "Zur Feier der Geburtstags von %name wird in %region ein großes
* Feuerwerk abgebrannt, welches noch hier zu bewundern ist. Kaskaden
* bunter Sterne, leuchtende Wasserfälle aus Licht und strahlende
* Feuerdrachen erhellen den Himmel." */
if(name && *name) {
m = new_message(u->faction, "birthday_firework%u:unit%r:region%s:name",
u, u->region, strdup(name));
add_message(&u->region->msgs, new_message(u->faction, "birthday_firework_local%u:unit%s:name",u, strdup(name)));
} else {
m = new_message(u->faction, "birthday_firework_noname%u:unit%r:region",
u, u->region);
add_message(&u->region->msgs, new_message(u->faction, "birthday_firework_noname_local%u:unit%s:name",u));
}
for(rl = rlist; rl; rl=rl->next) if(rl->data != u->region) {
add_message(&rl->data->msgs, m);
}
msg_release(m);
free_regionlist(rlist);
res_changeitem(u, itype->rtype, -1);
return 0;
}
resource_type rt_birthday_firework = {
{ "birthday_firework", "birthday_firework_p" },
{ "birthday_firework", "birthday_firework_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_birthday_firework = {
&rt_birthday_firework, /* resourcetype */
0, 50, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_birthday_firework, /* use */
NULL,
NULL /* give */
};
void
register_birthday_firework(void)
{
it_register(&it_birthday_firework);
it_birthday_firework.rtype->flags |= RTF_POOLED;
register_function((pf_generic)use_birthday_firework, "usefirework");
}
resource_type rt_lebkuchenherz = {
{ "lebkuchenherz", "lebkuchenherz_p" },
{ "lebkuchenherz", "lebkuchenherz_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_lebkuchenherz = {
&rt_lebkuchenherz, /* resourcetype */
0, 0, 0, /* flags, weight, capacity */
NULL, /* construction */
NULL, /* use */
NULL /* give */
};
void
register_lebkuchenherz(void)
{
it_register(&it_lebkuchenherz);
it_lebkuchenherz.rtype->flags |= RTF_POOLED;
}

View File

@ -1,33 +0,0 @@
/* 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-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.
*/
#ifndef H_ITM_BIRTHDAY
#define H_ITM_BIRTHDAY
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_birthday_firework;
extern struct resource_type rt_birthday_firework;
extern void register_birthday_firework(void);
extern struct item_type it_lebkuchenherz;
extern struct resource_type rt_lebkuchenherz;
extern void register_lebkuchenherz(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -1,57 +0,0 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea-pbem.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2003 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.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 "catapultammo.h"
#include <build.h>
#include <region.h>
/* kernel includes */
#include <item.h>
/* libc includes */
#include <assert.h>
static requirement mat_catapultammo[] = {
{I_STONE, 1},
{0, 0}
};
resource_type rt_catapultammo = {
{ "catapultammo", "catapultammo_p" },
{ "catapultammo", "catapultammo_p" },
RTF_ITEM|RTF_POOLED,
&res_changeitem
};
static construction con_catapultammo = {
SK_QUARRYING, 3, /* skill, minskill */
-1, 1, mat_catapultammo /* maxsize, reqsize [,materials] */
};
item_type it_catapultammo = {
&rt_catapultammo, /* resourcetype */
0, 1000, 0, /* flags, weight, capacity */
&con_catapultammo, /* construction */
NULL, /* use */
NULL /* give */
};
void
register_catapultammo(void)
{
it_register(&it_catapultammo);
}

View File

@ -1,18 +0,0 @@
/* 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-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.
*/
extern struct item_type it_catapultammo;
extern struct resource_type rt_catapultammo;
extern void register_catapultammo(void);

View File

@ -123,21 +123,12 @@
<File
RelativePath=".\artrewards.h">
</File>
<File
RelativePath=".\birthday_firework.h">
</File>
<File
RelativePath=".\catapultammo.h">
</File>
<File
RelativePath=".\demonseye.h">
</File>
<File
RelativePath=".\itemtypes.h">
</File>
<File
RelativePath=".\questkeys.h">
</File>
<File
RelativePath=".\racespoils.h">
</File>
@ -154,21 +145,12 @@
<File
RelativePath=".\artrewards.c">
</File>
<File
RelativePath=".\birthday_firework.c">
</File>
<File
RelativePath=".\catapultammo.c">
</File>
<File
RelativePath=".\demonseye.c">
</File>
<File
RelativePath=".\itemtypes.c">
</File>
<File
RelativePath=".\questkeys.c">
</File>
<File
RelativePath=".\racespoils.c">
</File>

View File

@ -14,7 +14,6 @@
#include <eressea.h>
#include "itemtypes.h"
#include "birthday_firework.h"
#include "demonseye.h"
#include "xerewards.h"
#include "artrewards.h"
@ -23,8 +22,6 @@
#if GROWING_TREES
# include "seed.h"
#endif
#include "questkeys.h"
#include "catapultammo.h"
void
register_itemtypes(void)
@ -36,10 +33,6 @@ register_itemtypes(void)
register_seed();
register_mallornseed();
#endif
register_birthday_firework();
register_lebkuchenherz();
register_questkeys();
register_catapultammo();
register_racespoils();
register_artrewards();
}

View File

@ -1,130 +0,0 @@
/* 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-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 "questkeys.h"
/* kernel includes */
#include <faction.h>
#include <item.h>
#include <message.h>
#include <plane.h>
#include <region.h>
#include <unit.h>
#include <border.h>
/* util includes */
#include <functions.h>
/* libc includes */
#include <assert.h>
#include <stdlib.h>
extern border *borders[];
static int
use_questkey(struct unit * u, const struct item_type * itype, int amount, struct order * ord)
{
border *bo;
region *r1, *r2;
int lock, k;
message *m;
unit *u2;
if(u->region->x != 43 || u->region->y != -39) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "use_questkey_wrongregion", ""));
return EUNUSABLE;
}
r1 = findregion(43,-39);
r2 = findregion(44,-39);
bo = get_borders(r1, r2);
while (bo!=NULL) {
if(bo->type == &bt_questportal) {
break;
}
bo = bo->next;
}
assert(bo != NULL);
lock = (int)bo->data;
if (itype == &it_questkey1) k = 1;
else k = 2;
if (lock & k) {
m = msg_message("questportal_unlock","region unit key", u->region, u, k);
lock = lock & ~k;
} else {
m = msg_message("questportal_lock","region unit key", u->region, u, k);
lock = lock | k;
}
bo->data = (void *)lock;
for(u2 = u->region->units; u2; u2=u2->next) {
freset(u2->faction, FL_DH);
}
for(u2 = u->region->units; u2; u2=u2->next) {
if(!fval(u2->faction, FL_DH)) {
add_message(&u2->faction->msgs, m);
fset(u2->faction, FL_DH);
}
}
return 0;
}
static resource_type rt_questkey1 = {
{ "questkey1", "questkey1_p" },
{ "questkey1", "questkey1_p" },
RTF_ITEM,
&res_changeitem
};
static resource_type rt_questkey2 = {
{ "questkey2", "questkey2_p" },
{ "questkey2", "questkey2_p" },
RTF_ITEM,
&res_changeitem
};
item_type it_questkey1 = {
&rt_questkey1, /* resourcetype */
ITF_NOTLOST, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_questkey,
NULL,
NULL
};
item_type it_questkey2 = {
&rt_questkey2, /* resourcetype */
ITF_NOTLOST, 1, 0, /* flags, weight, capacity */
NULL, /* construction */
&use_questkey,
NULL,
NULL
};
void
register_questkeys(void)
{
it_register(&it_questkey1);
it_register(&it_questkey2);
register_function((pf_generic)use_questkey, "usequestkey");
}

View File

@ -1,28 +0,0 @@
/* 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-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.
*/
#ifndef H_ITM_QUESTKEYS
#define H_ITM_QUESTKEYS
#ifdef __cplusplus
extern "C" {
#endif
extern struct item_type it_questkey1;
extern struct item_type it_questkey2;
extern void register_questkeys(void);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -16,8 +16,6 @@
#include <eressea.h>
#include "weapons.h"
#include "catapultammo.h"
#include <unit.h>
#include <build.h>
#include <race.h>
@ -205,6 +203,10 @@ attack_catapult(const troop * at, int * casualties, int row)
int d = 0, n;
int minrow, maxrow;
weapon * wp = af->person[at->index].missile;
static item_type * it_catapultammo = NULL;
if (it_catapultammo==NULL) {
it_catapultammo = it_find("catapultammo");
}
assert(row>=FIGHT_ROW);
if (row>BEHIND_ROW) {
@ -214,12 +216,12 @@ attack_catapult(const troop * at, int * casualties, int row)
assert(wp->type->itype==olditemtype[I_CATAPULT]);
assert(af->person[at->index].reload==0);
#if CATAPULT_AMMUNITION
if(new_get_pooled(au, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK) <= 0) {
if (it_catapultammo!=NULL) {
if (new_get_pooled(au, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK) <= 0) {
/* No ammo. Use other weapon if available. */
return true;
}
#endif
}
if (af->catmsg == -1) {
int i, k=0;
@ -235,9 +237,9 @@ attack_catapult(const troop * at, int * casualties, int row)
n = min(CATAPULT_ATTACKS, count_enemies(b, af->side, minrow, maxrow, true));
#if CATAPULT_AMMUNITION
new_use_pooled(au, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);
#endif
if (it_catapultammo!=NULL) {
new_use_pooled(au, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, 1);
}
while (--n >= 0) {
/* Select defender */

View File

@ -60,8 +60,6 @@
/* attributes inclues */
#include <attributes/matmod.h>
#include <items/catapultammo.h>
#define STONERECYCLE 50
/* Name, MaxGroesse, MinBauTalent, Kapazitaet, {Eisen, Holz, Stein, BauSilber,
* Laen, Mallorn}, UnterSilber, UnterSpezialTyp, UnterSpezial */
@ -198,7 +196,12 @@ siege_cmd(unit * u, order * ord)
int bewaffnete, katapultiere = 0;
static boolean init = false;
static const curse_type * magicwalls_ct;
if (!init) { init = true; magicwalls_ct = ct_find("magicwalls"); }
static item_type * it_catapultammo = NULL;
if (!init) {
init = true;
magicwalls_ct = ct_find("magicwalls");
it_catapultammo = it_find("catapultammo");
}
/* gibt es ueberhaupt Burgen? */
init_tokens(ord);
@ -218,7 +221,7 @@ siege_cmd(unit * u, order * ord)
/* schaden durch katapulte */
d = min(u->number,
min(new_get_pooled(u, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK), get_item(u, I_CATAPULT)));
min(new_get_pooled(u, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK), get_item(u, I_CATAPULT)));
if (eff_skill(u, SK_CATAPULT, r) >= 1) {
katapultiere = d;
d *= eff_skill(u, SK_CATAPULT, r);
@ -252,7 +255,7 @@ siege_cmd(unit * u, order * ord)
/* meldung, schaden anrichten */
if (d && !curse_active(get_curse(b->attribs, magicwalls_ct))) {
b->size -= d;
new_use_pooled(u, &rt_catapultammo, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, d);
new_use_pooled(u, it_catapultammo->rtype, GET_SLACK|GET_RESERVE|GET_POOLED_SLACK, d);
d = 100 * d / b->size;
} else d = 0;

View File

@ -28,7 +28,6 @@
#define GUARD_DISABLES_PRODUCTION 1
#define RESOURCE_QUANTITY 0.5
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
#define CHANGED_CROSSBOWS 1
#define COMBAT_TURNS 5
#define PEASANTS_DO_NOT_STARVE 0

View File

@ -28,7 +28,6 @@
#define GUARD_DISABLES_PRODUCTION 1
#define RESOURCE_QUANTITY 0.5
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
#define CHANGED_CROSSBOWS 1
#define NEWATSROI 0
#define COMBAT_TURNS 5

View File

@ -28,7 +28,6 @@
#define GUARD_DISABLES_PRODUCTION 1
#define RESOURCE_QUANTITY 0.5
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
#define CHANGED_CROSSBOWS 1
#define NEWATSROI 0
#define COMBAT_TURNS 5

View File

@ -28,7 +28,6 @@
#define GUARD_DISABLES_PRODUCTION 1
#define RESOURCE_QUANTITY 0.5
#define RECRUITFRACTION 40 /* 100/RECRUITFRACTION% */
#define CATAPULT_AMMUNITION 1 /* Gebaut werden kann sie auch mit 0! */
#define CHANGED_CROSSBOWS 1
#define COMBAT_TURNS 5
#define PEASANTS_DO_NOT_STARVE 0

View File

@ -23,8 +23,6 @@
/* misc includes */
#include <attributes/key.h>
#include <items/questkeys.h>
#include <items/catapultammo.h>
#include <modules/xecmd.h>
/* gamecode includes */

View File

@ -11,7 +11,6 @@
* prior permission by the authors of Eressea.
*/
#define BOOL_DEFINED
/* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */
/* wenn curses.h nicht vor mapper included wird, kennt es die structs nicht. TODO: curses-teil separieren (map_tools.h) */
#include <config.h>

View File

@ -11,7 +11,6 @@
* prior permission by the authors of Eressea.
*/
#define BOOL_DEFINED
#include <config.h>
#include <curses.h>
#include <eressea.h>

View File

@ -12,7 +12,6 @@
* prior permission by the authors of Eressea.
*/
#define BOOL_DEFINED
/* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */
#include <config.h>

View File

@ -14,8 +14,6 @@
#define VERSION "3.3.0"
#define ISLANDSIZE 20
#define MAIN_C
#define BOOL_DEFINED
/* wenn config.h nicht vor curses included wird, kompiliert es unter windows nicht */
#include <config.h>
#include <curses.h>

View File

@ -1299,6 +1299,14 @@
<text locale="de">Lebkuchenherzen mit der Aufschrift 'Erz und
Stein, das ist fein'</text>
</string>
<string name="key">
<text locale="de">Schlüssel</text>
<text locale="en">key</text>
</string>
<string name="key_p">
<text locale="de">Schlüssel</text>
<text locale="en">keys</text>
</string>
<string name="questkey1">
<text locale="de">Achatener Schlüssel</text>
<text locale="en">agate key</text>

View File

@ -1,5 +1,18 @@
<?xml version="1.0"?>
<resources>
<resource name="questkey1" appearance="key">
<!-- Key for an old quest. placeholder item -->
<function name="change" value="changeitem"/>
<item notlost="yes" weight="1" />
</resource>
<resource name="questkey2" appearance="key">
<!-- Key for an old quest. placeholder item -->
<function name="change" value="changeitem"/>
<item notlost="yes" weight="1" />
</resource>
<resource name="jadee_ring" appearance="ring">
<!-- Wedding ring for Jadee -->
<function name="change" value="changeitem"/>

View File

@ -91,4 +91,12 @@
</item>
</resource>
<resource name="catapultammo">
<item weight="1000">
<construction skill="sk_quarrying" minskill="3" reqsize="1">
<requirement type="stone" quantity="1"/>
</construction>
</item>
</resource>
</resources>