diff --git a/src/common/gamecode/creport.c b/src/common/gamecode/creport.c
index 83a46b5df..090c62d4c 100644
--- a/src/common/gamecode/creport.c
+++ b/src/common/gamecode/creport.c
@@ -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;
}
diff --git a/src/common/gamecode/laws.c b/src/common/gamecode/laws.c
index fa94ae0d0..93ce3b001 100644
--- a/src/common/gamecode/laws.c
+++ b/src/common/gamecode/laws.c
@@ -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;
}
diff --git a/src/common/gamecode/report.c b/src/common/gamecode/report.c
index 50976c7d2..6cf85aeb3 100644
--- a/src/common/gamecode/report.c
+++ b/src/common/gamecode/report.c
@@ -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;
}
}
diff --git a/src/common/kernel/magic.c b/src/common/kernel/magic.c
index 7401f0642..dba157d5a 100644
--- a/src/common/kernel/magic.c
+++ b/src/common/kernel/magic.c
@@ -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;
}
}
}
diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c
index 03cd42519..f26141b57 100644
--- a/src/common/kernel/save.c
+++ b/src/common/kernel/save.c
@@ -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;
}
}
}
diff --git a/src/common/kernel/spellid.h b/src/common/kernel/spellid.h
index f4c163147..deade4d3a 100644
--- a/src/common/kernel/spellid.h
+++ b/src/common/kernel/spellid.h
@@ -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
diff --git a/src/common/kernel/xmlreader.c b/src/common/kernel/xmlreader.c
index 2502e2cc0..3fae62400 100644
--- a/src/common/kernel/xmlreader.c
+++ b/src/common/kernel/xmlreader.c
@@ -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;
diff --git a/src/common/spells/spells.c b/src/common/spells/spells.c
index 806c5e2b0..21f9d3e01 100644
--- a/src/common/spells/spells.c
+++ b/src/common/spells/spells.c
@@ -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);
diff --git a/src/eressea/korrektur.c b/src/eressea/korrektur.c
index fadd81139..d2a82361a 100644
--- a/src/eressea/korrektur.c
+++ b/src/eressea/korrektur.c
@@ -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);
}
}
diff --git a/src/res/vinyambar-wdw.xml b/src/res/vinyambar-wdw.xml
index c5c6c60b0..4f3fa0639 100644
--- a/src/res/vinyambar-wdw.xml
+++ b/src/res/vinyambar-wdw.xml
@@ -100,4 +100,36 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/res/vinyambar/wdw-strings.xml b/src/res/vinyambar/wdw-strings.xml
index 80063e351..3ba6fdb65 100644
--- a/src/res/vinyambar/wdw-strings.xml
+++ b/src/res/vinyambar/wdw-strings.xml
@@ -1,139 +1,157 @@
-
- Schriftrolle
- scroll
+
+
+ Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.
-
- Schriftrollen
- scrolls
+
+ Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.
+
+ Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.
+
+
+ Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.
+
+
+ Mit Hilfe dieses Zaubers kann der Magier erkennen, ob eine Region für den Pyramidenbau geeignet ist.
+
+
-
- Edelstein
- gem
-
-
- Edelsteine
- gems
-
+
+ Schriftrolle
+ scroll
+
+
+ Schriftrollen
+ scrolls
+
-
- Opal
- opal
-
-
- Opale
- opals
-
+
+ Edelstein
+ gem
+
+
+ Edelsteine
+ gems
+
-
- Diamant
- diamond
-
-
- Diamanten
- diamonds
-
+
+ Opal
+ opal
+
+
+ Opale
+ opals
+
-
- Saphir
- zaphire
-
-
- Saphire
- zaphires
-
+
+ Diamant
+ diamond
+
+
+ Diamanten
+ diamonds
+
-
- Topas
- topaz
-
-
- Topase
- topazes
-
+
+ Saphir
+ zaphire
+
+
+ Saphire
+ zaphires
+
-
- Beryll
- beryl
-
-
- Berylle
- beryls
-
+
+ Topas
+ topaz
+
+
+ Topase
+ topazes
+
-
- Achat
- agate
-
-
- Achate
- agates
-
+
+ Beryll
+ beryl
+
+
+ Berylle
+ beryls
+
-
- Granat
- garnet
-
-
- Granate
- garnets
-
+
+ Achat
+ agate
+
+
+ Achate
+ agates
+
-
- Smaragd
- emerald
-
-
- Smaragde
- emeralds
-
-
- Pyramide des Hapi
- pyramid of Hapi
-
-
- Pyramide der Tayet
- pyramid of Tayet
-
-
- Pyramide der Tefnut
- pyramid of Tefnut
-
-
- Pyramide des Shu
- pyramid of Shu
-
-
- Pyramide der Nuit
- pyramid of Nuit
-
-
- Pyramide der Bastet
- pyramid of Bastet
-
-
- Pyramide des Horus
- pyramid of Horus
-
-
- Pyramide der Maat
- pyramid of Maat
-
-
- Pyramide des Osiris
- pyramid of Osiris
-
-
- Pyramide des Set
- pyramid of Set
-
-
- Pyramide des Thoth
- pyramid of Thoth
-
+
+ Granat
+ garnet
+
+
+ Granate
+ garnets
+
+
+
+ Smaragd
+ emerald
+
+
+ Smaragde
+ emeralds
+
+
+ Pyramide des Hapi
+ pyramid of Hapi
+
+
+ Pyramide der Tayet
+ pyramid of Tayet
+
+
+ Pyramide der Tefnut
+ pyramid of Tefnut
+
+
+ Pyramide des Shu
+ pyramid of Shu
+
+
+ Pyramide der Nuit
+ pyramid of Nuit
+
+
+ Pyramide der Bastet
+ pyramid of Bastet
+
+
+ Pyramide des Horus
+ pyramid of Horus
+
+
+ Pyramide der Maat
+ pyramid of Maat
+
+
+ Pyramide des Osiris
+ pyramid of Osiris
+
+
+ Pyramide des Set
+ pyramid of Set
+
+
+ Pyramide des Thoth
+ pyramid of Thoth
+
Gefangener Windgeist
trapped air elemental
diff --git a/src/todo.txt b/src/todo.txt
index 221f983af..9139a6706 100644
--- a/src/todo.txt
+++ b/src/todo.txt
@@ -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