removing hardcoded itemtypes that now give warnings.

This commit is contained in:
Enno Rehling 2005-10-26 20:12:28 +00:00
parent a8480e3865
commit e31215f8f1
11 changed files with 53 additions and 204 deletions

View File

@ -56,8 +56,6 @@ a_readgive(attrib * a, FILE * F)
variant var;
char zText[32];
if (global.data_version<ITEMTYPE_VERSION) return a_readdefault(a, F);
fscanf(F, "%s ", zText);
var.i = atoi36(zText);
gdata->building = findbuilding(var.i);

View File

@ -45,15 +45,7 @@ summon_igjarjuk(struct unit * u, const struct item_type * itype, int amount, str
}
}
static resource_type rt_demonseye = {
{ "ao_daemon", "ao_daemon_p" },
{ "ao_daemon", "ao_daemon_p" },
RTF_ITEM,
&res_changeitem
};
boolean
static boolean
give_igjarjuk(const struct unit * src, const struct unit * d, const struct item_type * itype, int n, struct order * ord)
{
sprintf(buf, "Eine höhere Macht hindert %s daran, das Objekt zu übergeben. "
@ -62,19 +54,9 @@ give_igjarjuk(const struct unit * src, const struct unit * d, const struct item_
return false;
}
item_type it_demonseye = {
&rt_demonseye, /* resourcetype */
ITF_NOTLOST|ITF_CURSED, 0, 0, /* flags, weight, capacity */
NULL, /* construction */
&summon_igjarjuk,
NULL,
&give_igjarjuk
};
void
register_demonseye(void)
{
it_register(&it_demonseye);
register_function((pf_generic)summon_igjarjuk, "useigjarjuk");
register_function((pf_generic)give_igjarjuk, "giveigjarjuk");
}

View File

@ -18,10 +18,7 @@
extern "C" {
#endif
extern struct item_type it_demonseye;
extern void register_demonseye(void);
extern boolean give_igjarjuk(const struct unit *, const struct unit *, const struct item_type *, int, struct order *);
#ifdef __cplusplus
}

View File

@ -176,19 +176,9 @@ a_readeffect(attrib *a, FILE *f)
int power;
const potion_type * ptype;
effect_data * edata = (effect_data*)a->data.v;
if (global.data_version < ITEMTYPE_VERSION) {
union {
int i;
short sa[2];
} data;
fscanf(f, "%d", &data.i);
ptype = oldpotiontype[data.sa[0]];
power = data.sa[1];
} else {
char zText[32];
fscanf(f, "%s %d", zText, &power);
ptype = pt_find(zText);
}
if (ptype==NULL || power<=0) return AT_READ_FAIL;
edata->type = ptype;
edata->value = power;

View File

@ -2811,6 +2811,13 @@ make_fighter(battle * b, unit * u, side * s1, boolean attack)
const group * g = NULL;
const attrib *a = a_find(u->attribs, &at_otherfaction);
const faction *stealthfaction = a?get_otherfaction(a):NULL;
static const struct item_type * it_demonseye;
static boolean init = false;
if (!init) {
it_demonseye = it_find("demonseye");
init=true;
}
if (fval(u, UFL_GROUP)) {
const attrib * agroup = a_find(u->attribs, &at_group);
@ -2986,7 +2993,7 @@ make_fighter(battle * b, unit * u, side * s1, boolean attack)
}
}
if (i_get(u->items, &it_demonseye)) {
if (it_demonseye && i_get(u->items, it_demonseye)) {
char lbuf[80];
const char * s = LOC(default_locale, rc_name(u->race, 3));
char * c = lbuf;

View File

@ -599,8 +599,6 @@ give_horses(const unit * s, const unit * d, const item_type * itype, int n, stru
#define MAXLUXURIES (LASTLUXURY - FIRSTLUXURY)
#define item2res(itm) (resource_t)(itm+R_MINITEM)
#define herb2res(itm) (resource_t)(itm+R_MINHERB)
#define potion2res(itm) (resource_t)(itm+R_MINPOTION)
item_type * olditemtype[MAXITEMS+1];
resource_type * oldresourcetype[MAXRESOURCES+1];
@ -1225,12 +1223,6 @@ init_olditems(void)
}
}
const item_type *
oldherbtype(herb_t h)
{
return oldresourcetype[herb2res(h)]->itype;
}
static const char *potiontext[MAXPOTIONS] =
{
/* Stufe 1: */

View File

@ -214,11 +214,6 @@ extern const weapon_type * resource2weapon(const resource_type * i);
extern const potion_type * resource2potion(const resource_type * i);
extern const luxury_type * resource2luxury(const resource_type * i);
#define weapon2resource(x) ((x)->itype->rtype)
#define luxury2resource(x) ((x)->itype->rtype)
#define herb2resource(x) ((x)->itype->rtype)
#define potion2resource(x) ((x)->itype->rtype)
extern item ** i_find(item ** pi, const item_type * it);
extern item * i_add(item ** pi, item * it);
extern void i_merge(item ** pi, item ** si);
@ -239,8 +234,6 @@ extern weapon_type * new_weapontype(item_type * itype, int wflags, double magres
extern armor_type * new_armortype(item_type * itype, double penalty, double magres, int prot, unsigned int flags);
extern potion_type * new_potiontype(item_type * itype, int level);
extern const item_type * oldherbtype(herb_t h);
/* for lack of another file: */
/* sonstige resourcen */
@ -379,48 +372,7 @@ enum {
R_SACK_OF_CONSERVATION,
/* POTIONS: */
R_FAST,
R_STRONG,
R_TREES,
R_DOMORE,
R_UGLY,
#ifdef INSECT_POTION
R_WARMTH,
#else
R_STEEL,
#endif
R_WISE,
R_FOOL,
R_ROSE,
R_HORSEPOTION,
R_BERSERK,
R_PEOPLE,
R_GRASS,
R_ILL,
R_HEAL,
/* HERBS */
R_PLAIN_1, /* Flachwurz */
R_PLAIN_2, /* Würziger Wagemut */
R_PLAIN_3, /* Eulenauge */
R_FOREST_1, /* Grüner Spinnerich */
R_FOREST_2, /* Blauer Baumringel */
R_FOREST_3, /* Elfenlieb */
R_SWAMP_1, /* Gurgelkraut */
R_SWAMP_2, /* Knotiger Saugwurz */
R_SWAMP_3, /* Blasenmorchel */
R_DESERT_1, /* Wasserfinder */
R_DESERT_2, /* Kakteenschwitz */
R_DESERT_3, /* Sandfäule */
R_HIGHLAND_1, /* Windbeutel */
R_HIGHLAND_2, /* Fjordwuchs */
R_HIGHLAND_3, /* Alraune */
R_MOUNTAIN_1, /* Steinbeißer */
R_MOUNTAIN_2, /* Spaltwachs */
R_MOUNTAIN_3, /* Höhlenglimm */
R_GLACIER_1, /* Eisblume */
R_GLACIER_2, /* Weißer Wüterich */
R_GLACIER_3, /* Schneekristall */
/* SONSTIGE */
R_SILVER,
@ -429,9 +381,7 @@ enum {
R_HITPOINTS, /* Trefferpunkte */
R_PEASANTS, /* Regionsbauern */
R_UNIT, /* Einheit (gib x einheit) */
R_SWORD, /* for spells */
MAX_RESOURCES, /* do not use outside item.c ! */
NORESOURCE = (resource_t) - 1

View File

@ -1027,9 +1027,6 @@ unit *
readunit(FILE * F)
{
skill_t sk;
item_t item;
herb_t herb;
potion_t potion;
unit * u;
int number, n, p;
order ** orderp;
@ -1061,8 +1058,6 @@ readunit(FILE * F)
if (u->display && strlen(u->display)>=DISPLAYSIZE) u->display[DISPLAYSIZE] = 0;
#endif
number = ri(F);
if (global.data_version<ITEMTYPE_VERSION)
set_money(u, ri(F));
u->age = (short)ri(F);
if (global.data_version<NEWRACE_VERSION) {
u->race = new_race[(race_t)ri(F)];
@ -1189,21 +1184,7 @@ readunit(FILE * F)
}
}
}
if (global.data_version>=ITEMTYPE_VERSION) {
read_items(F, &u->items);
} else {
while ((item = (item_t) ri(F)) >= 0) {
i_change(&u->items, olditemtype[item], ri(F));
}
while ((potion = (potion_t) ri(F)) >= 0) {
i_change(&u->items, oldpotiontype[potion]->itype, ri(F));
}
while ((herb = (herb_t) ri(F)) >= 0) {
i_change(&u->items, oldherbtype(herb), ri(F));
}
}
u->hp = ri(F);
if (u->hp < u->number) {
log_error(("Einheit %s hat %u Personen, und %u Trefferpunkte\n", itoa36(u->no),
@ -1434,7 +1415,6 @@ readregion(FILE * F, short x, short y)
pres=&res->next;
}
}
if (global.data_version>=ITEMTYPE_VERSION) {
rs(F, buf);
if (strcmp(buf, "noherb") != 0) {
const resource_type * rtype = rt_find(buf);
@ -1444,16 +1424,6 @@ readregion(FILE * F, short x, short y)
rsetherbtype(r, NULL);
}
rsetherbs(r, (short)ri(F));
} else {
int i = ri(F);
if (r->terrain->herbs==NULL)
rsetherbtype(r, NULL);
else {
rsetherbtype(r, r->terrain->herbs[i % 3]);
}
rsetherbs(r, (short)ri(F));
}
rsetpeasants(r, ri(F));
rsetmoney(r, ri(F));
}
@ -1464,27 +1434,12 @@ readregion(FILE * F, short x, short y)
assert(rmoney(r) >= 0);
if (r->land) {
if (global.data_version<ITEMTYPE_VERSION) {
int i, p = 0;
for (i = 0; oldluxurytype[i]!=NULL; i++) {
int k = ri(F);
r_setdemand(r, oldluxurytype[i], k);
if (k==0) {
/* Prüfung ob nur ein Luxusgut verkauft wird. */
if (p == 1) {
/* Zuviele ... Wir setzen den Demand. */
r_setdemand(r, oldluxurytype[i], (char) (1 + rand() % 5));
} else ++p;
}
}
} else {
for (;;) {
rs(F, buf);
if (!strcmp(buf, "end")) break;
r_setdemand(r, lt_find(buf), ri(F));
}
}
}
a_read(F, &r->attribs);
return r;
@ -1832,10 +1787,6 @@ readgame(const char * filename, int backup)
if (global.data_version >= GLOBAL_ATTRIB_VERSION) {
a_read(F, &global.attribs);
}
if (global.data_version < ITEMTYPE_VERSION) {
fprintf(stderr, "kann keine alten datenfiles einlesen");
exit(-1);
}
global.data_turn = turn = ri(F);
ri(F); /* max_unique_id = */
nextborder = ri(F);

View File

@ -946,9 +946,6 @@ parse_resources(xmlDocPtr doc)
/* make sure old items (used in requirements) are available */
init_resources();
/* old resources now extern (for spells */
oldresourcetype[R_SWORD] = rt_find("sword");
return 0;
}

View File

@ -100,22 +100,6 @@ leave_arena(struct unit * u, const struct item_type * itype, int amount, order *
return 0;
}
static resource_type rt_gryphonwing = {
{ "griphonwing", "griphonwing_p" },
{ "griphonwing", "griphonwing_p" },
RTF_ITEM,
&res_changeitem
};
static item_type it_gryphonwing = {
&rt_gryphonwing, /* resourcetype */
ITF_NOTLOST|ITF_CURSED, 0, 0, /* flags, weight, capacity */
NULL, /* construction, score */
&leave_arena,
NULL,
&give_igjarjuk
};
static int
enter_fail(unit * u) {
sprintf(buf, "In %s erklingt die Stimme des Torwächters: 'Nur wer ohne materielle Güter und noch lernbegierig ist, der darf die Ebene der Herausforderung betreten. Und vergiß nicht mein Trinkgeld.'. %s erhielt keinen Einlaß.", regionname(u->region, u->faction), unitname(u));
@ -161,7 +145,7 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
}
sprintf(buf, "In %s öffnet sich ein Portal. Eine Stimme ertönt, und spricht: 'Willkommen in der Ebene der Herausforderung'. %s durchschreitet das Tor zu einer anderen Welt.", regionname(u->region, u->faction), unitname(u));
addmessage(NULL, u->faction, buf, MSG_MESSAGE, ML_IMPORTANT);
new_use_pooled(u, &rt_gryphonwing, GET_SLACK|GET_RESERVE, 1);
new_use_pooled(u, itype->rtype, GET_SLACK|GET_RESERVE, 1);
use_pooled(u, r, R_SILVER, fee);
set_money(u, 109);
fset(u, UFL_PARTEITARNUNG);
@ -169,20 +153,6 @@ enter_arena(unit * u, const item_type * itype, int amount, order * ord)
return 0;
}
static resource_type rt_arenagate = {
{ "eyeofdragon", "eyeofdragon_p" },
{ "eyeofdragon", "eyeofdragon_p" },
RTF_ITEM,
&res_changeitem
};
static item_type it_arenagate = {
&rt_arenagate, /* resourcetype */
ITF_NONE, 0, 0, /* flags, weight, capacity */
NULL, /* construction, score */
&enter_arena
};
/***
** Szepter der Tränen, Demo-Item
***/
@ -308,6 +278,9 @@ static void
tower_init(void)
{
int i, first = newarena;
item_type * it_demonseye = it_find("demonseye");
item_type * it_griphonwing = it_find("griphonwing");
assert(it_griphonwing && it_demonseye);
for (i=0;i!=6;++i) {
region * r = tower_region[i] = findregion(arena_center->x+delta_x[i]*3, arena_center->y+delta_y[i]*3);
if (r) {
@ -330,8 +303,8 @@ tower_init(void)
attrib * a;
item * items;
i_add(&items, i_new(&it_gryphonwing, 1));
i_add(&items, i_new(&it_demonseye, 1));
i_add(&items, i_new(it_griphonwing, 1));
i_add(&items, i_new(it_demonseye, 1));
a = a_add(&b->attribs, make_giveitem(b, items));
b->size = 10;
@ -548,9 +521,6 @@ void
register_arena(void)
{
at_register(&at_hurting);
register_demonseye();
it_register(&it_arenagate);
it_register(&it_gryphonwing);
register_function((pf_generic)use_wand_of_tears, "use_wand_of_tears");
register_function((pf_generic)enter_arena, "enter_arena");
register_function((pf_generic)leave_arena, "leave_arena");

View File

@ -1,50 +1,65 @@
<?xml version="1.0"?>
<resources>
<resource name="demonseye">
<!-- summons igjarjuk -->
<item weight="0" score="6000" notlost="true" cursed="true">
<function name="use" value="useigjarjuk"/>
<function name="give" value="giveigjarjuk"/>
</item>
</resource>
<resource name="griphonwing">
<!-- this lets you leave the arena -->
<item weight="0" score="6000" notlost="true" cursed="true">
<function name="use" value="leave_arena"/>
<function name="give" value="giveigjarjuk"/>
</item>
</resource>
<resource name="eyeofdragon">
<!-- the arena gate, for one-time entry -->
<item weight="0" score="0">
<function name="use" value="enter_arena"/>
</item>
</resource>
<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"/>
<item cursed="yes" notlost="yes" weight="0" />
</resource>
<resource name="wente_ring" appearance="ring">
<!-- Wedding ring for Wildente -->
<function name="change" value="changeitem"/>
<item cursed="yes" notlost="yes" weight="0" />
</resource>
<resource name="jadee_dress">
<!-- Wedding dress for Jadee -->
<function name="change" value="changeitem"/>
<item cursed="yes" notlost="yes" weight="0" />
</resource>
<resource name="wente_dress">
<!-- Wedding dress for Wildente -->
<function name="change" value="changeitem"/>
<item cursed="yes" notlost="yes" weight="0" />
</resource>
<resource name="lmsreward">
<!-- LMS reward -->
<function name="change" value="changeitem"/>
<item cursed="yes" notlost="yes" weight="0" />
</resource>
<resource name="greatbow">
<function name="change" value="changeitem"/>
<item weight="100">
<construction skill="weaponsmithing" minskill="5" reqsize="1">
<modifier function="mod_elves_only"/>