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);
a = a_find(f->attribs, &at_reportspell);
while (a) {
spell *sp = find_spellbyid((spellid_t)a->data.i);
spell *sp = (spell *)a->data.v;
cr_reportspell(F, sp, f->locale);
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);
if (sp!=NULL && has_spell(u, sp)) {
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);
break;
}

View File

@ -376,11 +376,10 @@ rparagraph(FILE *F, const char *s, int indent, char mark)
}
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 dh = 0;
spell *sp = find_spellbyid(id);
char * bufp;
rnl(F);
@ -1824,7 +1823,7 @@ report_building(FILE *F, const region * r, const building * b, const faction * f
if (i != '!' && i != '?' && i != '.')
scat(", ");
if(b->type == bt_find("pyramid")) {
if (b->type == bt_find("pyramid")) {
unit * owner = buildingowner(r, b);
scat("Größenstufe ");
icat(wdw_pyramid_level(b));
@ -2095,7 +2094,8 @@ report_plaintext(const char * filename, report_context * ctx)
rnl(F);
centre(F, LOC(f->locale, "section_newspells"), true);
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;
}
}

View File

@ -357,17 +357,45 @@ create_mage(unit * u, magic_t mtyp)
* 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 = {
"seenspell", NULL, NULL, NULL, DEFAULT_WRITE, DEFAULT_READ
"seenspell", NULL, NULL, NULL, write_seenspell, read_seenspell
};
static boolean
already_seen(const faction * f, spellid_t id)
already_seen(const faction * f, const spell * sp)
{
attrib *a;
for (a = a_find(f->attribs, &at_seenspell); a; a=a->nexttype)
if (a->data.i==(int)id) return true;
for (a = a_find(f->attribs, &at_seenspell); a; a=a->nexttype) {
if (a->data.v==sp) return true;
}
return false;
}
@ -424,9 +452,9 @@ updatespelllist(unit * u)
faction * f = u->faction;
if (!know) add_spell(mage, sp);
if (!ismonster && !already_seen(u->faction, sp->id)) {
a_add(&f->attribs, a_new(&at_reportspell))->data.i = sp->id;
a_add(&f->attribs, a_new(&at_seenspell))->data.i = sp->id;
if (!ismonster && !already_seen(u->faction, sp)) {
a_add(&f->attribs, a_new(&at_reportspell))->data.v = sp;
a_add(&f->attribs, a_new(&at_seenspell))->data.v = sp;
}
}
}

View File

@ -1623,7 +1623,7 @@ readfaction(FILE * F)
spell * sp = slist->data;
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_ICEODEM,
SPL_ACIDODEM,
#ifdef WDW_PYRAMIDSPELL
SPL_WDWPYRAMID_TRAUM,
SPL_WDWPYRAMID_ASTRAL,
SPL_WDWPYRAMID_DRUIDE,
SPL_WDWPYRAMID_BARDE,
SPL_WDWPYRAMID_CHAOS,
#endif
/* no longer used, but kept for reference: */
XMLSPL_WDWPYRAMID_TRAUM = 184,
XMLSPL_WDWPYRAMID_ASTRAL = 185,
XMLSPL_WDWPYRAMID_DRUIDE = 186,
XMLSPL_WDWPYRAMID_BARDE = 187,
XMLSPL_WDWPYRAMID_CHAOS = 188,
};
#endif

View File

@ -1201,6 +1201,7 @@ parse_spells(xmlDocPtr doc)
xmlFree(property);
/* level, rank and flags */
sp->id = xml_ivalue(node, "index", 0);
sp->level = xml_ivalue(node, "level", -1);
sp->rank = (char)xml_ivalue(node, "rank", -1);
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
};
#ifdef WDW_PYRAMIDSPELL
attrib_type at_wdwpyramid = {
"wdwpyramid", NULL, NULL, NULL, a_writedefault, a_readdefault
};
#endif
/* ----------------------------------------------------------------------- */
@ -7096,7 +7094,6 @@ sp_becomewyrm(castorder *co)
return co->level;
}
#ifdef WDW_PYRAMIDSPELL
/* ------------------------------------------------------------- */
/* Name: WDW-Pyramidenfindezauber
* Stufe: unterschiedlich
@ -7144,7 +7141,6 @@ sp_wdwpyramid(castorder *co)
return cast_level;
}
#endif
/* ------------------------------------------------------------- */
/* Name: Alltagszauber, hat je nach Gebiet anderen Namen
@ -9501,79 +9497,6 @@ static spelldata spelldaten[] =
},
(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, "no spell", NULL, NULL, NULL, 0, 0, 0, 0,
@ -9660,9 +9583,8 @@ init_spells(void)
}
at_register(&at_cursewall);
at_register(&at_unitdissolve);
#ifdef WDW_PYRAMIDSPELL
at_register(&at_wdwpyramid);
#endif
register_function((pf_generic)&sp_wdwpyramid, "wdwpyramid");
register_bordertype(&bt_firewall);
register_bordertype(&bt_wisps);
register_bordertype(&bt_chaosgate);

View File

@ -303,11 +303,11 @@ show_newspells(void)
if (m->magietyp == sp->magietyp || has_spell(u, sp)) {
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) {
/* spell is not being shown yet. if seen before, remove to show again */
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);
}
}

View File

@ -100,4 +100,36 @@
</set>
</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>

View File

@ -1,6 +1,24 @@
<?xml version="1.0" encoding="iso-8859-1" ?>
<strings>
<namespace name="spellinfo">
<string name="wdwpyramid_draig">
<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_cerrdor">
<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_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="magicskillboost">
<text locale="de">Schriftrolle</text>
<text locale="en">scroll</text>

View File

@ -18,6 +18,7 @@ Code cleanup:
- kick init_oldherbs out (good for terrain)
- allocators aus economy nach XML
- 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:
- eressea (b/g)zip reports?
@ -51,7 +52,5 @@ unterschiede in vin3 + wdw per config statt defines?
#define ATSBONUS 2
#define ROIBONUS 4
#define WDW_PYRAMIDSPELL
#define ARENA_MODULE
#define WORMHOLE_MODULE