From 6a20345b535fcc7a29919700fa7ab6a4c6939e9b Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 6 Dec 2015 12:48:13 +0100 Subject: [PATCH] issue #428, fix writing spell description for break_curse --- res/e3a/spells.xml | 2 +- res/eressea/spells.xml | 2 +- src/report.c | 10 ++++++++-- src/reports.test.c | 2 -- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/res/e3a/spells.xml b/res/e3a/spells.xml index 4bb3470d8..12c52e8df 100644 --- a/res/e3a/spells.xml +++ b/res/e3a/spells.xml @@ -594,7 +594,7 @@ - + diff --git a/res/eressea/spells.xml b/res/eressea/spells.xml index 015d64a7e..f7d81abfb 100644 --- a/res/eressea/spells.xml +++ b/res/eressea/spells.xml @@ -337,7 +337,7 @@ - + diff --git a/src/report.c b/src/report.c index de44bc43d..9125cebdb 100644 --- a/src/report.c +++ b/src/report.c @@ -536,11 +536,17 @@ void nr_spell_syntax(stream *out, spellbook_entry * sbe, const struct locale *la locp = LOC(lang, mkname("spellpar", substr)); 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) WARN_STATIC_BUFFER(); } 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; diff --git a/src/reports.test.c b/src/reports.test.c index 05b75fabd..0955e8a6f 100644 --- a/src/reports.test.c +++ b/src/reports.test.c @@ -393,14 +393,12 @@ static void test_write_spell_syntax(CuTest *tc) { free(spell.sp->syntax); spell.sp->syntax = 0; - /* There are no spells with optional parameters, so we don't force this, for now set_parameter(spell, "c?"); free(spell.sp->syntax); spell.sp->syntax = _strdup("hodor"); check_spell_syntax(tc, "c?", &spell, " ZAUBERE \"Testzauber\" []"); free(spell.sp->syntax); spell.sp->syntax = 0; - */ set_parameter(spell, "kc+"); check_spell_syntax(tc, "kc+", &spell,