Aus dem TODO:

- WDW spells per XML definiert, so dass sie nicht in Eressea auftauchen, aber auch kein define benötigen

- Neue Variante des seenspell-attributes.

- weniger find_spellbyid() aufrufe.
This commit is contained in:
Enno Rehling 2006-01-01 18:35:55 +00:00
parent eadda41bcb
commit b49d1cadca
12 changed files with 225 additions and 226 deletions

View File

@ -1179,7 +1179,7 @@ report_computer(const char * filename, report_context * ctx)
cr_find_address(F, f, ctx->addresses); cr_find_address(F, f, ctx->addresses);
a = a_find(f->attribs, &at_reportspell); a = a_find(f->attribs, &at_reportspell);
while (a) { while (a) {
spell *sp = find_spellbyid((spellid_t)a->data.i); spell *sp = (spell *)a->data.v;
cr_reportspell(F, sp, f->locale); cr_reportspell(F, sp, f->locale);
a = a->nexttype; a = a->nexttype;
} }

View File

@ -2481,7 +2481,7 @@ reshow(unit * u, struct order * ord, const char * s, param_t p)
sp = get_spellfromtoken(u, s, u->faction->locale); sp = get_spellfromtoken(u, s, u->faction->locale);
if (sp!=NULL && has_spell(u, sp)) { if (sp!=NULL && has_spell(u, sp)) {
attrib *a = a_find(u->faction->attribs, &at_seenspell); attrib *a = a_find(u->faction->attribs, &at_seenspell);
while (a!=NULL && a->data.i!=(int)sp->id) a = a->nexttype; while (a!=NULL && a->data.v!=sp) a = a->nexttype;
if (a!=NULL) a_remove(&u->faction->attribs, a); if (a!=NULL) a_remove(&u->faction->attribs, a);
break; break;
} }

View File

@ -376,11 +376,10 @@ rparagraph(FILE *F, const char *s, int indent, char mark)
} }
static void static void
report_spell(FILE * F, spellid_t id, const struct locale * lang) report_spell(FILE * F, spell *sp, const struct locale * lang)
{ {
int k, itemanz, costtyp; int k, itemanz, costtyp;
int dh = 0; int dh = 0;
spell *sp = find_spellbyid(id);
char * bufp; char * bufp;
rnl(F); rnl(F);
@ -1824,7 +1823,7 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
if (i != '!' && i != '?' && i != '.') if (i != '!' && i != '?' && i != '.')
scat(", "); scat(", ");
if(b->type == bt_find("pyramid")) { if (b->type == bt_find("pyramid")) {
unit * owner = buildingowner(r, b); unit * owner = buildingowner(r, b);
scat("Größenstufe "); scat("Größenstufe ");
icat(wdw_pyramid_level(b)); icat(wdw_pyramid_level(b));
@ -2095,7 +2094,8 @@ report_plaintext(const char * filename, report_context * ctx)
rnl(F); rnl(F);
centre(F, LOC(f->locale, "section_newspells"), true); centre(F, LOC(f->locale, "section_newspells"), true);
while (a) { while (a) {
report_spell(F, (spellid_t)a->data.i, f->locale); spell *sp = (spell *)a->data.v;
report_spell(F, sp, f->locale);
a = a->nexttype; a = a->nexttype;
} }
} }

View File

@ -357,17 +357,45 @@ create_mage(unit * u, magic_t mtyp)
* Spruch zu seiner List-of-known-spells hinzugefügt werden. * Spruch zu seiner List-of-known-spells hinzugefügt werden.
*/ */
static int
read_seenspell(attrib * a, FILE * f)
{
int i;
spell * sp = NULL;
fscanf(f, "%s", buf);
i = atoi(buf);
if (i!=0) {
sp = find_spellbyid((spellid_t)i);
} else {
int mtype;
fscanf(f, "%d", &mtype);
sp = find_spell((magic_t)mtype, buf);
}
a->data.v = sp;
return AT_READ_OK;
}
static void
write_seenspell(const attrib * a, FILE * f)
{
const spell * sp = (const spell*)a->data.v;
fprintf(f, "%s %d ", sp->sname, sp->magietyp);
}
attrib_type at_seenspell = { attrib_type at_seenspell = {
"seenspell", NULL, NULL, NULL, DEFAULT_WRITE, DEFAULT_READ "seenspell", NULL, NULL, NULL, write_seenspell, read_seenspell
}; };
static boolean static boolean
already_seen(const faction * f, spellid_t id) already_seen(const faction * f, const spell * sp)
{ {
attrib *a; attrib *a;
for (a = a_find(f->attribs, &at_seenspell); a; a=a->nexttype) for (a = a_find(f->attribs, &at_seenspell); a; a=a->nexttype) {
if (a->data.i==(int)id) return true; if (a->data.v==sp) return true;
}
return false; return false;
} }
@ -424,9 +452,9 @@ updatespelllist(unit * u)
faction * f = u->faction; faction * f = u->faction;
if (!know) add_spell(mage, sp); if (!know) add_spell(mage, sp);
if (!ismonster && !already_seen(u->faction, sp->id)) { if (!ismonster && !already_seen(u->faction, sp)) {
a_add(&f->attribs, a_new(&at_reportspell))->data.i = sp->id; a_add(&f->attribs, a_new(&at_reportspell))->data.v = sp;
a_add(&f->attribs, a_new(&at_seenspell))->data.i = sp->id; a_add(&f->attribs, a_new(&at_seenspell))->data.v = sp;
} }
} }
} }

View File

@ -1623,7 +1623,7 @@ readfaction(FILE * F)
spell * sp = slist->data; spell * sp = slist->data;
if (sp->magietyp==f->magiegebiet && sp->level<=sk) { if (sp->magietyp==f->magiegebiet && sp->level<=sk) {
a_add(&f->attribs, a_new(&at_seenspell))->data.i = sp->id; a_add(&f->attribs, a_new(&at_seenspell))->data.v = sp;
} }
} }
} }

View File

@ -197,13 +197,12 @@ enum {
SPL_FIREODEM, /* 181 */ SPL_FIREODEM, /* 181 */
SPL_ICEODEM, SPL_ICEODEM,
SPL_ACIDODEM, SPL_ACIDODEM,
#ifdef WDW_PYRAMIDSPELL /* no longer used, but kept for reference: */
SPL_WDWPYRAMID_TRAUM, XMLSPL_WDWPYRAMID_TRAUM = 184,
SPL_WDWPYRAMID_ASTRAL, XMLSPL_WDWPYRAMID_ASTRAL = 185,
SPL_WDWPYRAMID_DRUIDE, XMLSPL_WDWPYRAMID_DRUIDE = 186,
SPL_WDWPYRAMID_BARDE, XMLSPL_WDWPYRAMID_BARDE = 187,
SPL_WDWPYRAMID_CHAOS, XMLSPL_WDWPYRAMID_CHAOS = 188,
#endif
}; };
#endif #endif

View File

@ -1201,6 +1201,7 @@ parse_spells(xmlDocPtr doc)
xmlFree(property); xmlFree(property);
/* level, rank and flags */ /* level, rank and flags */
sp->id = xml_ivalue(node, "index", 0);
sp->level = xml_ivalue(node, "level", -1); sp->level = xml_ivalue(node, "level", -1);
sp->rank = (char)xml_ivalue(node, "rank", -1); sp->rank = (char)xml_ivalue(node, "rank", -1);
if (xml_bvalue(node, "ship", false)) sp->sptyp |= ONSHIPCAST; if (xml_bvalue(node, "ship", false)) sp->sptyp |= ONSHIPCAST;

View File

@ -93,11 +93,9 @@ attrib_type at_unitdissolve = {
"unitdissolve", NULL, NULL, NULL, a_writedefault, a_readdefault "unitdissolve", NULL, NULL, NULL, a_writedefault, a_readdefault
}; };
#ifdef WDW_PYRAMIDSPELL
attrib_type at_wdwpyramid = { attrib_type at_wdwpyramid = {
"wdwpyramid", NULL, NULL, NULL, a_writedefault, a_readdefault "wdwpyramid", NULL, NULL, NULL, a_writedefault, a_readdefault
}; };
#endif
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
@ -7096,7 +7094,6 @@ sp_becomewyrm(castorder *co)
return co->level; return co->level;
} }
#ifdef WDW_PYRAMIDSPELL
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: WDW-Pyramidenfindezauber /* Name: WDW-Pyramidenfindezauber
* Stufe: unterschiedlich * Stufe: unterschiedlich
@ -7144,7 +7141,6 @@ sp_wdwpyramid(castorder *co)
return cast_level; return cast_level;
} }
#endif
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
/* Name: Alltagszauber, hat je nach Gebiet anderen Namen /* Name: Alltagszauber, hat je nach Gebiet anderen Namen
@ -9501,79 +9497,6 @@ static spelldata spelldaten[] =
}, },
(spell_f)sp_immolation, NULL (spell_f)sp_immolation, NULL
}, },
#ifdef WDW_PYRAMIDSPELL
{
SPL_WDWPYRAMID_TRAUM, "wdwpyramid_illaun",
"Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine "
"Region für den Pyramidenbau geeignet ist.", NULL, NULL,
M_TRAUM, (0), 5, 4,
{
{ "aura", 2, SPC_FIX },
{ "h2", 1, SPC_FIX },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
},
(spell_f)sp_wdwpyramid, NULL
},
{
SPL_WDWPYRAMID_ASTRAL, "wdwpyramid_tybied",
"Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine "
"Region für den Pyramidenbau geeignet ist.", NULL, NULL,
M_ASTRAL, (0), 5, 3,
{
{ "aura", 4, SPC_FIX },
{ "p6", 1, SPC_FIX },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
},
(spell_f)sp_wdwpyramid, NULL
},
{
SPL_WDWPYRAMID_DRUIDE, "wdwpyramid_gwyrrd",
"Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine "
"Region für den Pyramidenbau geeignet ist.", NULL, NULL,
M_DRUIDE, (0), 5, 5,
{
{ "aura", 3, SPC_FIX },
{ "mallorn", 5, SPC_FIX },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
},
(spell_f)sp_wdwpyramid, NULL
},
{
SPL_WDWPYRAMID_BARDE, "wdwpyramid_cerrdor",
"Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine "
"Region für den Pyramidenbau geeignet ist.", NULL, NULL,
M_BARDE, (0), 5, 4,
{
{ "aura", 2, SPC_FIX },
{ "h14", 1, SPC_FIX },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
},
(spell_f)sp_wdwpyramid, NULL
},
{
SPL_WDWPYRAMID_CHAOS, "wdwpyramid_draig",
"Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine "
"Region für den Pyramidenbau geeignet ist.", NULL, NULL,
M_CHAOS, (0), 5, 5,
{
{ "aura", 1, SPC_FIX },
{ "permaura", 1, SPC_FIX },
{ 0, 0, 0 },
{ 0, 0, 0 },
{ 0, 0, 0 }
},
(spell_f)sp_wdwpyramid, NULL
},
#endif
/* SPL_NOSPELL MUSS der letzte Spruch der Liste sein*/ /* SPL_NOSPELL MUSS der letzte Spruch der Liste sein*/
{ {
SPL_NOSPELL, "no spell", NULL, NULL, NULL, 0, 0, 0, 0, SPL_NOSPELL, "no spell", NULL, NULL, NULL, 0, 0, 0, 0,
@ -9660,9 +9583,8 @@ init_spells(void)
} }
at_register(&at_cursewall); at_register(&at_cursewall);
at_register(&at_unitdissolve); at_register(&at_unitdissolve);
#ifdef WDW_PYRAMIDSPELL
at_register(&at_wdwpyramid); at_register(&at_wdwpyramid);
#endif register_function((pf_generic)&sp_wdwpyramid, "wdwpyramid");
register_bordertype(&bt_firewall); register_bordertype(&bt_firewall);
register_bordertype(&bt_wisps); register_bordertype(&bt_wisps);
register_bordertype(&bt_chaosgate); register_bordertype(&bt_chaosgate);

View File

@ -303,11 +303,11 @@ show_newspells(void)
if (m->magietyp == sp->magietyp || has_spell(u, sp)) { if (m->magietyp == sp->magietyp || has_spell(u, sp)) {
attrib * a = a_find(u->faction->attribs, &at_reportspell); attrib * a = a_find(u->faction->attribs, &at_reportspell);
while (a && a->data.i != (int)sp->id) a = a->nexttype; while (a && a->data.v != sp) a = a->nexttype;
if (!a) { if (!a) {
/* spell is not being shown yet. if seen before, remove to show again */ /* spell is not being shown yet. if seen before, remove to show again */
a = a_find(u->faction->attribs, &at_seenspell); a = a_find(u->faction->attribs, &at_seenspell);
while (a && a->data.i != (int)sp->id) a = a->nexttype; while (a && a->data.v != sp) a = a->nexttype;
if (a) a_remove(&u->faction->attribs, a); if (a) a_remove(&u->faction->attribs, a);
} }
} }

View File

@ -100,4 +100,36 @@
</set> </set>
</equipment> </equipment>
<spells>
<spell name="wdwpyramid_illaun" type="draig" rank="5" level="4" index="184">
<function name="cast" value="wdwpyramid"/>
<resource name="aura" amount="2" cost="fixed"/>
<resource name="h2" amount="1" cost="fixed"/>
</spell>
<spell name="wdwpyramid_tybied" type="draig" rank="5" level="3" index="185">
<function name="cast" value="wdwpyramid"/>
<resource name="aura" amount="4" cost="fixed"/>
<resource name="p6" amount="1" cost="fixed"/>
</spell>
<spell name="wdwpyramid_gwyrrd" type="draig" rank="5" level="5" index="186">
<function name="cast" value="wdwpyramid"/>
<resource name="aura" amount="3" cost="fixed"/>
<resource name="mallorn" amount="5" cost="fixed"/>
</spell>
<spell name="wdwpyramid_cerrdor" type="draig" rank="5" level="4" index="187">
<function name="cast" value="wdwpyramid"/>
<resource name="aura" amount="2" cost="fixed"/>
<resource name="h14" amount="1" cost="fixed"/>
</spell>
<spell name="wdwpyramid_draig" type="draig" rank="5" level="5" index="188">
<function name="cast" value="wdwpyramid"/>
<resource name="aura" amount="1" cost="fixed"/>
<resource name="permaura" amount="1" cost="fixed"/>
</spell>
</spells>
</eressea> </eressea>

View File

@ -1,139 +1,157 @@
<?xml version="1.0" encoding="iso-8859-1" ?> <?xml version="1.0" encoding="iso-8859-1" ?>
<strings> <strings>
<string name="magicskillboost"> <namespace name="spellinfo">
<text locale="de">Schriftrolle</text> <string name="wdwpyramid_draig">
<text locale="en">scroll</text> <text locale="de">Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.</text>
</string> </string>
<string name="magicskillboost_p"> <string name="wdwpyramid_cerrdor">
<text locale="de">Schriftrollen</text> <text locale="de">Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.</text>
<text locale="en">scrolls</text>
</string> </string>
<string name="wdwpyramid_gwyrrd">
<text locale="de">Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.</text>
</string>
<string name="wdwpyramid_tybied">
<text locale="de">Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.</text>
</string>
<string name="wdwpyramid_illaun">
<text locale="de">Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.</text>
</string>
</namespace>
<string name="gem"> <string name="magicskillboost">
<text locale="de">Edelstein</text> <text locale="de">Schriftrolle</text>
<text locale="en">gem</text> <text locale="en">scroll</text>
</string> </string>
<string name="gem_p"> <string name="magicskillboost_p">
<text locale="de">Edelsteine</text> <text locale="de">Schriftrollen</text>
<text locale="en">gems</text> <text locale="en">scrolls</text>
</string> </string>
<string name="opal"> <string name="gem">
<text locale="de">Opal</text> <text locale="de">Edelstein</text>
<text locale="en">opal</text> <text locale="en">gem</text>
</string> </string>
<string name="opal_p"> <string name="gem_p">
<text locale="de">Opale</text> <text locale="de">Edelsteine</text>
<text locale="en">opals</text> <text locale="en">gems</text>
</string> </string>
<string name="diamond"> <string name="opal">
<text locale="de">Diamant</text> <text locale="de">Opal</text>
<text locale="en">diamond</text> <text locale="en">opal</text>
</string> </string>
<string name="diamond_p"> <string name="opal_p">
<text locale="de">Diamanten</text> <text locale="de">Opale</text>
<text locale="en">diamonds</text> <text locale="en">opals</text>
</string> </string>
<string name="zaphire"> <string name="diamond">
<text locale="de">Saphir</text> <text locale="de">Diamant</text>
<text locale="en">zaphire</text> <text locale="en">diamond</text>
</string> </string>
<string name="zaphire_p"> <string name="diamond_p">
<text locale="de">Saphire</text> <text locale="de">Diamanten</text>
<text locale="en">zaphires</text> <text locale="en">diamonds</text>
</string> </string>
<string name="topaz"> <string name="zaphire">
<text locale="de">Topas</text> <text locale="de">Saphir</text>
<text locale="en">topaz</text> <text locale="en">zaphire</text>
</string> </string>
<string name="topaz_p"> <string name="zaphire_p">
<text locale="de">Topase</text> <text locale="de">Saphire</text>
<text locale="en">topazes</text> <text locale="en">zaphires</text>
</string> </string>
<string name="beryl"> <string name="topaz">
<text locale="de">Beryll</text> <text locale="de">Topas</text>
<text locale="en">beryl</text> <text locale="en">topaz</text>
</string> </string>
<string name="beryl_p"> <string name="topaz_p">
<text locale="de">Berylle</text> <text locale="de">Topase</text>
<text locale="en">beryls</text> <text locale="en">topazes</text>
</string> </string>
<string name="agate"> <string name="beryl">
<text locale="de">Achat</text> <text locale="de">Beryll</text>
<text locale="en">agate</text> <text locale="en">beryl</text>
</string> </string>
<string name="agate_p"> <string name="beryl_p">
<text locale="de">Achate</text> <text locale="de">Berylle</text>
<text locale="en">agates</text> <text locale="en">beryls</text>
</string> </string>
<string name="garnet"> <string name="agate">
<text locale="de">Granat</text> <text locale="de">Achat</text>
<text locale="en">garnet</text> <text locale="en">agate</text>
</string> </string>
<string name="garnet_p"> <string name="agate_p">
<text locale="de">Granate</text> <text locale="de">Achate</text>
<text locale="en">garnets</text> <text locale="en">agates</text>
</string> </string>
<string name="emerald"> <string name="garnet">
<text locale="de">Smaragd</text> <text locale="de">Granat</text>
<text locale="en">emerald</text> <text locale="en">garnet</text>
</string> </string>
<string name="emerald_p"> <string name="garnet_p">
<text locale="de">Smaragde</text> <text locale="de">Granate</text>
<text locale="en">emeralds</text> <text locale="en">garnets</text>
</string> </string>
<string name="pyramid0">
<text locale="de">Pyramide des Hapi</text> <string name="emerald">
<text locale="en">pyramid of Hapi</text> <text locale="de">Smaragd</text>
</string> <text locale="en">emerald</text>
<string name="pyramid1"> </string>
<text locale="de">Pyramide der Tayet</text> <string name="emerald_p">
<text locale="en">pyramid of Tayet</text> <text locale="de">Smaragde</text>
</string> <text locale="en">emeralds</text>
<string name="pyramid2"> </string>
<text locale="de">Pyramide der Tefnut</text> <string name="pyramid0">
<text locale="en">pyramid of Tefnut</text> <text locale="de">Pyramide des Hapi</text>
</string> <text locale="en">pyramid of Hapi</text>
<string name="pyramid3"> </string>
<text locale="de">Pyramide des Shu</text> <string name="pyramid1">
<text locale="en">pyramid of Shu</text> <text locale="de">Pyramide der Tayet</text>
</string> <text locale="en">pyramid of Tayet</text>
<string name="pyramid4"> </string>
<text locale="de">Pyramide der Nuit</text> <string name="pyramid2">
<text locale="en">pyramid of Nuit</text> <text locale="de">Pyramide der Tefnut</text>
</string> <text locale="en">pyramid of Tefnut</text>
<string name="pyramid5"> </string>
<text locale="de">Pyramide der Bastet</text> <string name="pyramid3">
<text locale="en">pyramid of Bastet</text> <text locale="de">Pyramide des Shu</text>
</string> <text locale="en">pyramid of Shu</text>
<string name="pyramid6"> </string>
<text locale="de">Pyramide des Horus</text> <string name="pyramid4">
<text locale="en">pyramid of Horus </text> <text locale="de">Pyramide der Nuit</text>
</string> <text locale="en">pyramid of Nuit</text>
<string name="pyramid7"> </string>
<text locale="de">Pyramide der Maat</text> <string name="pyramid5">
<text locale="en">pyramid of Maat</text> <text locale="de">Pyramide der Bastet</text>
</string> <text locale="en">pyramid of Bastet</text>
<string name="pyramid8"> </string>
<text locale="de">Pyramide des Osiris</text> <string name="pyramid6">
<text locale="en">pyramid of Osiris</text> <text locale="de">Pyramide des Horus</text>
</string> <text locale="en">pyramid of Horus </text>
<string name="pyramid9"> </string>
<text locale="de">Pyramide des Set</text> <string name="pyramid7">
<text locale="en">pyramid of Set</text> <text locale="de">Pyramide der Maat</text>
</string> <text locale="en">pyramid of Maat</text>
<string name="pyramid10"> </string>
<text locale="de">Pyramide des Thoth</text> <string name="pyramid8">
<text locale="en">pyramid of Thoth</text> <text locale="de">Pyramide des Osiris</text>
</string> <text locale="en">pyramid of Osiris</text>
</string>
<string name="pyramid9">
<text locale="de">Pyramide des Set</text>
<text locale="en">pyramid of Set</text>
</string>
<string name="pyramid10">
<text locale="de">Pyramide des Thoth</text>
<text locale="en">pyramid of Thoth</text>
</string>
<string name="trappedairelemental"> <string name="trappedairelemental">
<text locale="de">Gefangener Windgeist</text> <text locale="de">Gefangener Windgeist</text>
<text locale="en">trapped air elemental</text> <text locale="en">trapped air elemental</text>

View File

@ -18,6 +18,7 @@ Code cleanup:
- kick init_oldherbs out (good for terrain) - kick init_oldherbs out (good for terrain)
- allocators aus economy nach XML - allocators aus economy nach XML
- reporting units: http://eressea.upb.de/mantis/view.php?id=781 - reporting units: http://eressea.upb.de/mantis/view.php?id=781
- wdw pyramid spell could be written in lua (replace attrib with a flag)
Larger Features: Larger Features:
- eressea (b/g)zip reports? - eressea (b/g)zip reports?
@ -51,7 +52,5 @@ unterschiede in vin3 + wdw per config statt defines?
#define ATSBONUS 2 #define ATSBONUS 2
#define ROIBONUS 4 #define ROIBONUS 4
#define WDW_PYRAMIDSPELL
#define ARENA_MODULE #define ARENA_MODULE
#define WORMHOLE_MODULE #define WORMHOLE_MODULE