issue #428, fix writing spell description for break_curse

This commit is contained in:
Enno Rehling 2015-12-06 12:48:13 +01:00
parent 65902ca97f
commit 6a20345b53
4 changed files with 10 additions and 6 deletions

View File

@ -594,7 +594,7 @@
<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"/>
</spell> </spell>
<spell name="break_curse" rank="3" index="107" syntax="spellid" parameters="kcc?" los="true" ship="true" far="true" variable="true"> <spell name="break_curse" rank="3" index="107" syntax="spellid" parameters="kcc" los="true" ship="true" far="true" variable="true">
<resource name="aura" amount="3" cost="level"/> <resource name="aura" amount="3" cost="level"/>
</spell> </spell>
<spell name="fish_shield" rank="2" index="109" variable="true" combat="1"> <spell name="fish_shield" rank="2" index="109" variable="true" combat="1">

View File

@ -337,7 +337,7 @@
<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"/>
</spell> </spell>
<spell name="break_curse" rank="3" index="107" syntax="spellid" parameters="kcc?" los="true" ship="true" far="true" variable="true"> <spell name="break_curse" rank="3" index="107" syntax="spellid" parameters="kcc" los="true" ship="true" far="true" variable="true">
<resource name="aura" amount="3" cost="level"/> <resource name="aura" amount="3" cost="level"/>
</spell> </spell>
<spell name="meteor_rain" rank="5" index="108" variable="true" combat="2"> <spell name="meteor_rain" rank="5" index="108" variable="true" combat="2">

View File

@ -536,11 +536,17 @@ void nr_spell_syntax(stream *out, spellbook_entry * sbe, const struct locale *la
locp = LOC(lang, mkname("spellpar", substr)); locp = LOC(lang, mkname("spellpar", substr));
syntaxp = substr + 1; syntaxp = substr + 1;
} }
bytes = (int)_snprintf(bufp, size, " <%s>", locp); if (*params == '?') {
++params;
bytes = (int)_snprintf(bufp, size, " [<%s>]", locp);
}
else {
bytes = (int)_snprintf(bufp, size, " <%s>", locp);
}
if (wrptr(&bufp, &size, bytes) != 0) if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER(); WARN_STATIC_BUFFER();
} else { } else {
log_error("unknown spell parameter %c for spell", cp, sp->sname); log_error("unknown spell parameter %c for spell %s", cp, sp->sname);
} }
} }
*bufp = 0; *bufp = 0;

View File

@ -393,14 +393,12 @@ static void test_write_spell_syntax(CuTest *tc) {
free(spell.sp->syntax); free(spell.sp->syntax);
spell.sp->syntax = 0; spell.sp->syntax = 0;
/* There are no spells with optional parameters, so we don't force this, for now
set_parameter(spell, "c?"); set_parameter(spell, "c?");
free(spell.sp->syntax); free(spell.sp->syntax);
spell.sp->syntax = _strdup("hodor"); spell.sp->syntax = _strdup("hodor");
check_spell_syntax(tc, "c?", &spell, " ZAUBERE \"Testzauber\" [<Hodor>]"); check_spell_syntax(tc, "c?", &spell, " ZAUBERE \"Testzauber\" [<Hodor>]");
free(spell.sp->syntax); free(spell.sp->syntax);
spell.sp->syntax = 0; spell.sp->syntax = 0;
*/
set_parameter(spell, "kc+"); set_parameter(spell, "kc+");
check_spell_syntax(tc, "kc+", &spell, check_spell_syntax(tc, "kc+", &spell,