fixed descriptions of spells with parameters (bug #2060+1867)

This commit is contained in:
Steffen Mecke 2015-01-13 22:03:09 +01:00
parent f3972a2390
commit 4ab92e3caf
4 changed files with 19 additions and 9 deletions

View File

@ -585,7 +585,7 @@
<!-- Schutzzauber -->
<resource name="aura" amount="5" cost="level"/>
</spell>
<spell name="protective_runes" rank="2" index="99" parameters="kc" ship="true">
<spell name="protective_runes" rank="2" index="99" parameters="kc" regiontarget="false" unittarget="false" buildingtarget="true" shiptarget="true" ship="true">
<resource name="aura" amount="20" cost="fixed"/>
</spell>
<spell name="analyze_magic" rank="5" index="102" parameters="kc?" los="true" ship="true" variable="true">

View File

@ -313,7 +313,7 @@
<spell name="keeploot" rank="5" index="98" variable="true" combat="3">
<resource name="aura" amount="1" cost="level"/>
</spell>
<spell name="protective_runes" rank="2" index="99" parameters="kc" ship="true">
<spell name="protective_runes" rank="2" index="99" parameters="kc" regiontarget="false" unittarget="false" buildingtarget="true" shiptarget="true" ship="true">
<resource name="aura" amount="20" cost="fixed"/>
</spell>
<spell name="song_resist_magic" rank="2" index="100" far="true" variable="true">
@ -332,7 +332,7 @@
<resource name="aura" amount="10" cost="fixed"/>
</spell>
<spell name="analyse_object" rank="5" index="105" parameters="kc+" ship="true" variable="true">
<resource name="aura" amount="3" cost="level"/>
<resource name="aura" amount="3" cost="level" regiontarget="true" unittarget="false" buildingtarget="true" shiptarget="true"/>
</spell>
<spell name="destroy_magic" rank="2" index="106" parameters="kc+" los="true" ship="true" far="true" variable="true">
<resource name="aura" amount="4" cost="level"/>

View File

@ -1484,6 +1484,16 @@ static int parse_spells(xmlDocPtr doc)
sp->sptyp |= FARCASTING;
if (xml_bvalue(node, "variable", false))
sp->sptyp |= SPELLLEVEL;
if (xml_bvalue(node, "buildingtarget", false))
sp->sptyp |= BUILDINGSPELL;
if (xml_bvalue(node, "shiptarget", false))
sp->sptyp |= SHIPSPELL;
if (xml_bvalue(node, "unittarget", false))
sp->sptyp |= UNITSPELL;
if (xml_bvalue(node, "regiontarget", false))
sp->sptyp |= REGIONSPELL;
k = xml_ivalue(node, "combat", 0);
if (k >= 0 && k <= 3)
sp->sptyp |= modes[k];

View File

@ -305,7 +305,7 @@ void nr_spell(stream *out, spellbook_entry * sbe, const struct locale *lang)
if (sp->sptyp & SPELLLEVEL) {
bytes =
_snprintf(bufp, size, " %d %s", itemanz, LOC(lang, resourcename(rtype,
itemanz != 1)));
itemanz != 1)));
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
if (costtyp == SPC_LEVEL || costtyp == SPC_LINEAR) {
@ -464,24 +464,24 @@ void nr_spell(stream *out, spellbook_entry * sbe, const struct locale *lang)
if (sp->sptyp & targetp->flag)
++maxparam;
}
if (maxparam > 1) {
if (!maxparam || maxparam > 1) {
bytes = (int)strlcpy(bufp, " (", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
}
i = 0;
for (targetp = targets; targetp->flag; ++targetp) {
if (sp->sptyp & targetp->flag) {
if (!maxparam || sp->sptyp & targetp->flag) {
if (i++ != 0) {
bytes = (int)strlcpy(bufp, " |", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
}
if (targetp->param) {
if (targetp->param && targetp->vars) {
locp = LOC(lang, targetp->vars);
bytes =
(int)_snprintf(bufp, size, " %s <%s>", parameters[targetp->param],
locp);
locp);
if (*params == '+') {
++params;
if (wrptr(&bufp, &size, bytes) != 0)
@ -497,7 +497,7 @@ void nr_spell(stream *out, spellbook_entry * sbe, const struct locale *lang)
WARN_STATIC_BUFFER();
}
}
if (maxparam > 1) {
if (!maxparam || maxparam > 1) {
bytes = (int)strlcpy(bufp, " )", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();