diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c index 62290e073..344b97b2f 100644 --- a/src/common/gamecode/report.c +++ b/src/common/gamecode/report.c @@ -2990,7 +2990,6 @@ int * age = NULL; typedef struct summary { int waffen; int factions; - int artefakte; int ruestungen; int schiffe; int gebaeude; @@ -3105,12 +3104,6 @@ make_summary(void) s->ruestungen += itm->number; } } - s->artefakte += get_item(u, I_AMULET_OF_TRUE_SEEING); - s->artefakte += get_item(u, I_RING_OF_INVISIBILITY); - s->artefakte += get_item(u, I_SPHERE_OF_INVISIBILITY); - s->artefakte += get_item(u, I_SACK_OF_CONSERVATION); - s->artefakte += get_item(u, I_RING_OF_POWER); - s->artefakte += get_item(u, I_RUNESWORD); s->spielerpferde += get_item(u, I_HORSE); @@ -3426,7 +3419,6 @@ report_summary(summary * s, summary * o, boolean full) fprintf(F, "ungezähmte Pferde: %s\n", pcomp(s->pferde, o->pferde)); fprintf(F, "gezähmte Pferde: %s\n", pcomp(s->spielerpferde,o->spielerpferde)); - fprintf(F, "Artefakte: %s\n", pcomp(s->artefakte,o->artefakte)); fprintf(F, "Schiffe: %s\n", pcomp(s->schiffe, o->schiffe)); fprintf(F, "Gebäude: %s\n", pcomp(s->gebaeude, o->gebaeude)); diff --git a/src/common/items/weapons.c b/src/common/items/weapons.c index 5ea6a007c..4a767f74d 100644 --- a/src/common/items/weapons.c +++ b/src/common/items/weapons.c @@ -30,11 +30,6 @@ #include #include -static weapon_mod wm_bow[] = { - { 2, WMF_MISSILE_TARGET }, - { 0, 0 } -}; - static weapon_mod wm_catapult[] = { { 4, WMF_MISSILE_TARGET }, { 0, 0 } @@ -52,11 +47,8 @@ static weapon_mod wm_lance[] = { }; enum { - WP_RUNESWORD, - WP_FIRESWORD, WP_EOGSWORD, WP_CATAPULT, - WP_LONGBOW, WP_SPEAR, WP_LANCE, WP_NONE, @@ -97,16 +89,9 @@ static weapondata weapontable[WP_MAX + 1] = /* MagRes, Schaden/Fuß, Schaden/Pferd, Item, Skill, OffMod, DefMod, * missile, is_magic */ { - /* Runenschwert */ - {0.00, "3d10+10", "3d10+10", I_RUNESWORD, SK_MELEE, 2, 2, false, true, { RL_NONE, 0}, CUT }, - /* Flammenschwert */ - {0.30, "3d6+10", "3d6+10", I_FIRESWORD, SK_MELEE, 1, 1, false, false, { RL_NONE, 0}, CUT }, - /* Laenschwert */ {0.30, "3d6+10", "3d6+10", I_LAENSWORD, SK_MELEE, 1, 1, false, false, { RL_NONE, 0}, CUT }, /* Katapult */ {0.00, "3d10+5", "3d10+5", I_CATAPULT, SK_CATAPULT, 0, 0, true, false, { RL_CATAPULT, 5 }, BASH }, - /* Langbogen */ - {0.00, "1d11+1", "1d11+1", I_LONGBOW, SK_LONGBOW, 0, 0, true, false, { RL_NONE, 0 }, PIERCE }, /* Speer */ {0.00, "1d10+0", "1d12+2", I_SPEAR, SK_SPEAR, 0, 0, false, false, { RL_NONE, 0}, PIERCE }, /* Lanze */ @@ -120,7 +105,7 @@ static weapondata weapontable[WP_MAX + 1] = weapon_type * oldweapontype[WP_MAX]; static boolean -attack_firesword(const troop * at, int *casualties, int row) +attack_firesword(const troop * at, const struct weapon_type * wtype, int *casualties, int row) { fighter *fi = at->fighter; troop dt; @@ -144,7 +129,7 @@ attack_firesword(const troop * at, int *casualties, int row) int i, k=0; for (i=0;i<=at->index;++i) { struct weapon * wp = fi->person[i].melee; - if (wp!=NULL && wp->type == oldweapontype[WP_FIRESWORD]) ++k; + if (wp!=NULL && wp->type == wtype) ++k; } sprintf(buf, "%d Kämpfer aus %s benutz%s Flammenschwert%s:", k, unitname(fi->unit), (k==1)?"t sein ":"en ihre",(k==1)?"":"er"); @@ -165,7 +150,7 @@ attack_firesword(const troop * at, int *casualties, int row) #define CATAPULT_ATTACKS 6 static boolean -attack_catapult(const troop * at, int * casualties, int row) +attack_catapult(const troop * at, const struct weapon_type * wtype, int * casualties, int row) { fighter *af = at->fighter; unit *au = af->unit; @@ -184,7 +169,7 @@ attack_catapult(const troop * at, int * casualties, int row) /* probiere noch weitere attacken, kann nicht schiessen */ return true; } - assert(wp->type->itype==olditemtype[I_CATAPULT]); + assert(wp->type==wtype); assert(af->person[at->index].reload==0); if (it_catapultammo!=NULL) { @@ -245,14 +230,9 @@ init_oldweapons(void) int minskill = 1, wflags = WTF_NONE; int m; weapon_mod * modifiers = NULL; - boolean (*attack)(const troop *, int * deaths, int row) = NULL; + boolean (*attack)(const troop *, const struct weapon_type *, int *, int) = NULL; switch (w) { - case WP_RUNESWORD: - case WP_FIRESWORD: - attack = attack_firesword; - minskill = 7; - break; case WP_LANCE: modifiers = wm_lance; break; @@ -263,9 +243,6 @@ init_oldweapons(void) case WP_SPEAR: modifiers = wm_spear; break; - case WP_LONGBOW: - modifiers = wm_bow; - break; } assert(itype!=NULL || !"item not initialized"); diff --git a/src/common/kernel/battle.c b/src/common/kernel/battle.c index 5c963bda0..d3fa012fd 100644 --- a/src/common/kernel/battle.c +++ b/src/common/kernel/battle.c @@ -1964,7 +1964,7 @@ attack(battle *b, troop ta, const att *a, int numattack) * sonst helden mit feuerschwertern zu mächtig */ if (numattack==0 && wp && wp->type->attack) { int dead = 0; - standard_attack = wp->type->attack(&ta, &dead, row); + standard_attack = wp->type->attack(&ta, wp->type, &dead, row); if (!standard_attack) reload = true; af->catmsg += dead; if (!standard_attack && af->person[ta.index].last_action < b->turn) { diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 7b4b25794..973d00ac4 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -51,7 +51,6 @@ extern "C" { #define luxury_t short #define weapon_t short #define item_t short -#define resource_t short #define spellid_t unsigned int #else typedef short order_t; @@ -66,7 +65,6 @@ typedef short potion_t; typedef short luxury_t; typedef short weapon_t; typedef short item_t; -typedef short resource_t; typedef unsigned int spellid_t; #endif diff --git a/src/common/kernel/item.c b/src/common/kernel/item.c index f3c8237f2..c3fbf0a26 100644 --- a/src/common/kernel/item.c +++ b/src/common/kernel/item.c @@ -597,11 +597,8 @@ give_horses(const unit * s, const unit * d, const item_type * itype, int n, stru #define LASTLUXURY (I_INCENSE +1) #define MAXLUXURIES (LASTLUXURY - FIRSTLUXURY) -#define item2res(itm) (resource_t)(itm+R_MINITEM) - item_type * olditemtype[MAXITEMS+1]; resource_type * oldresourcetype[MAXRESOURCES+1]; -luxury_type * oldluxurytype[MAXLUXURIES+1]; potion_type * oldpotiontype[MAXPOTIONS+1]; /*** alte items ***/ @@ -783,10 +780,6 @@ static t_item itemdata[MAXITEMS] = { {"Speer", "Speere", "Speer", "Speere"}, IS_PRODUCT, SK_WEAPONSMITH, 2, {0, 1, 0, 0, 0, 0}, 100, 0, 0, NULL }, - { /* I_LONGBOW */ - {"Bogen", "Bögen", "Bogen", "Bögen"}, - IS_PRODUCT, SK_WEAPONSMITH, 2, {0, 1, 0, 0, 0, 0}, 100, 0, 0, NULL - }, { /* I_BALM */ {"Balsam", "Balsam", "Balsam", "Balsam"}, IS_LUXURY, 0, 0, {0, 0, 0, 0, 0, 0}, 200, 4, 0, NULL @@ -832,11 +825,6 @@ static t_item itemdata[MAXITEMS] = { {"Ring der Macht", "Ringe der Macht", "", ""}, IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 0, 0, 0, NULL }, - { /* I_FIRESWORD */ - {"Flammenschwert", "Flammenschwerter", - "Flammenschwert", "Flammenschwerter"}, - IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 100, 0, 0, NULL - }, { /* I_DRAGONHEAD 33 */ {"Drachenkopf", "Drachenköpfe", "Drachenkopf", "Drachenköpfe"}, IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 500, 0, 0, NULL @@ -899,10 +887,6 @@ static t_item itemdata[MAXITEMS] = { "Akkredition des Xontormia-Expreß", "Akkreditionen des Xontormia-Expreß"}, IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 0, 0, FL_ITEM_CURSED, NULL }, - { /* I_RUNESWORD 68 */ - {"Runenschwert", "Runenschwerter", "Runenschwert", "Runenschwerter"}, - IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 100, 0, 0, NULL - }, { /* I_AURAKULUM 69 */ {"Aurafocus", "Aurafocuse", "Amulett", "Amulette"}, IS_MAGIC, 0, 0, {0, 0, 0, 0, 0, 0}, 100, 0, 0, NULL @@ -1144,7 +1128,6 @@ init_olditems(void) switch (itemdata[i].typ) { case IS_LUXURY: price = itemdata[i].preis; - oldluxurytype[i-FIRSTLUXURY] = new_luxurytype(itype, price); break; case IS_RESOURCE: rtype->flags |= RTF_LIMITED; @@ -1161,7 +1144,7 @@ init_olditems(void) itype->use = use_olditem; } olditemtype[i] = itype; - oldresourcetype[item2res(i)] = rtype; + oldresourcetype[i] = rtype; } for (i=0; i!=MAXITEMS; ++i) { diff --git a/src/common/kernel/item.h b/src/common/kernel/item.h index 327e1cc59..4e265273c 100644 --- a/src/common/kernel/item.h +++ b/src/common/kernel/item.h @@ -195,7 +195,7 @@ typedef struct weapon_type { int reload; /* time to reload this weapon */ weapon_mod * modifiers; /* --- functions --- */ - boolean (*attack)(const struct troop *, int *deaths, int row); + boolean (*attack)(const struct troop *, const struct weapon_type *, int *deaths, int row); } weapon_type; extern void rt_register(resource_type * it); @@ -265,7 +265,6 @@ enum { I_WAGON, I_CATAPULT, I_SPEAR, - I_LONGBOW, I_BALM, I_SPICES, I_JEWELERY, @@ -278,7 +277,6 @@ enum { I_AMULET_OF_TRUE_SEEING, I_RING_OF_INVISIBILITY, I_RING_OF_POWER, - I_FIRESWORD, /* Runenschwert ersetzen durch Flammenschwert */ I_DRAGONHEAD, I_CHASTITY_BELT, /* bleibt */ I_LAENSWORD, @@ -294,7 +292,6 @@ enum { I_RING_OF_NIMBLEFINGER, I_TROLLBELT, I_PRESSCARD, - I_RUNESWORD, I_AURAKULUM, I_SEASERPENTHEAD, I_SPHERE_OF_INVISIBILITY, @@ -314,19 +311,19 @@ enum { R_WAGON, R_CATAPULT, R_SPEAR, - R_LONGBOW, - R_BALM, + /* luxury */ + R_BALM, R_SPICES, R_JEWELERY, R_MYRRH, R_OIL, R_SILK, R_INCENSE, + /**/ R_AMULET_OF_HEALING, R_AMULET_OF_TRUE_SEEING, R_RING_OF_INVISIBILITY, R_RING_OF_POWER, - R_FIRESWORD, R_DRAGONHEAD, R_CHASTITY_BELT, R_EOGSWORD, @@ -342,7 +339,6 @@ enum { R_RING_OF_NIMBLEFINGER, R_TROLLBELT, R_PRESSCARD, - R_RUNESWORD, R_AURAKULUM, R_SEASERPENTHEAD, R_SPHERE_OF_INVISIBILITY, @@ -360,10 +356,9 @@ enum { R_PERMAURA, /* Permanente Aura */ MAX_RESOURCES, /* do not use outside item.c ! */ - NORESOURCE = (resource_t) - 1 + NORESOURCE = -1 }; -extern struct luxury_type * oldluxurytype[]; extern struct potion_type * oldpotiontype[]; extern struct item_type * olditemtype[]; extern struct resource_type * oldresourcetype[]; diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c index 0224bee3b..4168fc575 100644 --- a/src/common/kernel/xmlreader.c +++ b/src/common/kernel/xmlreader.c @@ -692,6 +692,34 @@ xml_readweapon(xmlXPathContextPtr xpath, item_type * itype) } xmlXPathFreeObject(result); + if (gamecode_enabled) { + /* reading weapon/function */ + xpath->node = node; + result = xmlXPathEvalExpression(BAD_CAST "function", xpath); + for (k=0;k!=result->nodesetval->nodeNr;++k) { + xmlNodePtr node = result->nodesetval->nodeTab[k]; + xmlChar * property; + pf_generic fun; + + parse_function(node, &fun, &property); + if (fun==NULL) { + log_error(("unknown function name '%s' for item '%s'\n", + (const char*)property, itype->rtype->_name[0])); + xmlFree(property); + continue; + } + assert(property!=NULL); + if (strcmp((const char*)property, "attack")==0) { + wtype->attack = (boolean (*)(const struct troop*, const struct weapon_type *, int*, int))fun; + } else { + log_error(("unknown function type '%s' for item '%s'\n", + (const char*)property, itype->rtype->_name[0])); + } + xmlFree(property); + } + xmlXPathFreeObject(result); + } + xpath->node = node; return wtype; } diff --git a/src/res/resources.xml b/src/res/resources.xml index 33a079fbb..951dda6b5 100644 --- a/src/res/resources.xml +++ b/src/res/resources.xml @@ -1,18 +1,10 @@ - - - - - - - - - - + + - + @@ -110,6 +102,26 @@ + + + + + + + + + + + + + + + + + + + + @@ -195,6 +207,19 @@ + + + + + + + + + + + + +