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 --> <!-- Schutzzauber -->
<resource name="aura" amount="5" cost="level"/> <resource name="aura" amount="5" cost="level"/>
</spell> </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"/> <resource name="aura" amount="20" cost="fixed"/>
</spell> </spell>
<spell name="analyze_magic" rank="5" index="102" parameters="kc?" los="true" ship="true" variable="true"> <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"> <spell name="keeploot" rank="5" index="98" variable="true" combat="3">
<resource name="aura" amount="1" cost="level"/> <resource name="aura" amount="1" cost="level"/>
</spell> </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"/> <resource name="aura" amount="20" cost="fixed"/>
</spell> </spell>
<spell name="song_resist_magic" rank="2" index="100" far="true" variable="true"> <spell name="song_resist_magic" rank="2" index="100" far="true" variable="true">
@ -332,7 +332,7 @@
<resource name="aura" amount="10" cost="fixed"/> <resource name="aura" amount="10" cost="fixed"/>
</spell> </spell>
<spell name="analyse_object" rank="5" index="105" parameters="kc+" ship="true" variable="true"> <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>
<spell name="destroy_magic" rank="2" index="106" parameters="kc+" los="true" ship="true" far="true" variable="true"> <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"/> <resource name="aura" amount="4" cost="level"/>

View File

@ -1484,6 +1484,16 @@ static int parse_spells(xmlDocPtr doc)
sp->sptyp |= FARCASTING; sp->sptyp |= FARCASTING;
if (xml_bvalue(node, "variable", false)) if (xml_bvalue(node, "variable", false))
sp->sptyp |= SPELLLEVEL; 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); k = xml_ivalue(node, "combat", 0);
if (k >= 0 && k <= 3) if (k >= 0 && k <= 3)
sp->sptyp |= modes[k]; sp->sptyp |= modes[k];

View File

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