forked from github/server
Merge pull request #429 from ennorehling/develop
break_curse spell description error message
This commit is contained in:
commit
b854213be6
|
@ -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">
|
||||||
|
|
|
@ -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">
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
if (*params == '?') {
|
||||||
|
++params;
|
||||||
|
bytes = (int)_snprintf(bufp, size, " [<%s>]", locp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
bytes = (int)_snprintf(bufp, size, " <%s>", locp);
|
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;
|
||||||
|
|
|
@ -313,22 +313,17 @@ static void setup_spell_fixture(spell_fixture * spf) {
|
||||||
spf->sp = test_create_spell();
|
spf->sp = test_create_spell();
|
||||||
spellbook_add(spf->spb, spf->sp, 1);
|
spellbook_add(spf->spb, spf->sp, 1);
|
||||||
spf->sbe = spellbook_get(spf->spb, spf->sp);
|
spf->sbe = spellbook_get(spf->spb, spf->sp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_spell_syntax(CuTest *tc, char *msg, spell_fixture *spell, char *syntax) {
|
static void check_spell_syntax(CuTest *tc, char *msg, spell_fixture *spell, char *syntax) {
|
||||||
stream strm;
|
stream strm;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
char *linestart, *newline;
|
char *linestart, *newline;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
mstream_init(&strm);
|
mstream_init(&strm);
|
||||||
|
|
||||||
|
|
||||||
nr_spell_syntax(&strm, spell->sbe, spell->lang);
|
nr_spell_syntax(&strm, spell->sbe, spell->lang);
|
||||||
|
|
||||||
strm.api->rewind(strm.handle);
|
strm.api->rewind(strm.handle);
|
||||||
|
|
||||||
len = strm.api->read(strm.handle, buf, sizeof(buf));
|
len = strm.api->read(strm.handle, buf, sizeof(buf));
|
||||||
buf[len] = '\0';
|
buf[len] = '\0';
|
||||||
|
|
||||||
|
@ -360,55 +355,53 @@ static void test_write_spell_syntax(CuTest *tc) {
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
setup_spell_fixture(&spell);
|
setup_spell_fixture(&spell);
|
||||||
|
|
||||||
test_spell_syntax(tc, "vanilla", &spell, " ZAUBERE \"Testzauber\"");
|
check_spell_syntax(tc, "vanilla", &spell, " ZAUBERE \"Testzauber\"");
|
||||||
|
|
||||||
spell.sp->sptyp |= FARCASTING;
|
spell.sp->sptyp |= FARCASTING;
|
||||||
test_spell_syntax(tc, "far", &spell, " ZAUBERE [REGION x y] \"Testzauber\"");
|
check_spell_syntax(tc, "far", &spell, " ZAUBERE [REGION x y] \"Testzauber\"");
|
||||||
|
|
||||||
spell.sp->sptyp |= SPELLLEVEL;
|
spell.sp->sptyp |= SPELLLEVEL;
|
||||||
test_spell_syntax(tc, "farlevel", &spell, " ZAUBERE [REGION x y] [STUFE n] \"Testzauber\"");
|
check_spell_syntax(tc, "farlevel", &spell, " ZAUBERE [REGION x y] [STUFE n] \"Testzauber\"");
|
||||||
spell.sp->sptyp = 0;
|
spell.sp->sptyp = 0;
|
||||||
|
|
||||||
set_parameter(spell, "kc");
|
set_parameter(spell, "kc");
|
||||||
test_spell_syntax(tc, "kc", &spell, " ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> | SCHIFF <snr> | BURG <bnr> )");
|
check_spell_syntax(tc, "kc", &spell, " ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> | SCHIFF <snr> | BURG <bnr> )");
|
||||||
|
|
||||||
spell.sp->sptyp |= BUILDINGSPELL;
|
spell.sp->sptyp |= BUILDINGSPELL;
|
||||||
test_spell_syntax(tc, "kc typed", &spell, " ZAUBERE \"Testzauber\" BURG <bnr>");
|
check_spell_syntax(tc, "kc typed", &spell, " ZAUBERE \"Testzauber\" BURG <bnr>");
|
||||||
spell.sp->sptyp = 0;
|
spell.sp->sptyp = 0;
|
||||||
|
|
||||||
set_parameter(spell, "b");
|
set_parameter(spell, "b");
|
||||||
test_spell_syntax(tc, "b", &spell, " ZAUBERE \"Testzauber\" <bnr>");
|
check_spell_syntax(tc, "b", &spell, " ZAUBERE \"Testzauber\" <bnr>");
|
||||||
|
|
||||||
set_parameter(spell, "s");
|
set_parameter(spell, "s");
|
||||||
test_spell_syntax(tc, "s", &spell, " ZAUBERE \"Testzauber\" <snr>");
|
check_spell_syntax(tc, "s", &spell, " ZAUBERE \"Testzauber\" <snr>");
|
||||||
|
|
||||||
set_parameter(spell, "s+");
|
set_parameter(spell, "s+");
|
||||||
test_spell_syntax(tc, "s+", &spell, " ZAUBERE \"Testzauber\" <snr> [<snr> ...]");
|
check_spell_syntax(tc, "s+", &spell, " ZAUBERE \"Testzauber\" <snr> [<snr> ...]");
|
||||||
|
|
||||||
set_parameter(spell, "u");
|
set_parameter(spell, "u");
|
||||||
test_spell_syntax(tc, "u", &spell, " ZAUBERE \"Testzauber\" <enr>");
|
check_spell_syntax(tc, "u", &spell, " ZAUBERE \"Testzauber\" <enr>");
|
||||||
|
|
||||||
set_parameter(spell, "r");
|
set_parameter(spell, "r");
|
||||||
test_spell_syntax(tc, "r", &spell, " ZAUBERE \"Testzauber\" <x> <y>");
|
check_spell_syntax(tc, "r", &spell, " ZAUBERE \"Testzauber\" <x> <y>");
|
||||||
|
|
||||||
set_parameter(spell, "bc");
|
set_parameter(spell, "bc");
|
||||||
free(spell.sp->syntax);
|
free(spell.sp->syntax);
|
||||||
spell.sp->syntax = _strdup("hodor");
|
spell.sp->syntax = _strdup("hodor");
|
||||||
test_spell_syntax(tc, "bc hodor", &spell, " ZAUBERE \"Testzauber\" <bnr> <Hodor>");
|
check_spell_syntax(tc, "bc hodor", &spell, " ZAUBERE \"Testzauber\" <bnr> <Hodor>");
|
||||||
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");
|
||||||
test_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+");
|
||||||
test_spell_syntax(tc, "kc+", &spell,
|
check_spell_syntax(tc, "kc+", &spell,
|
||||||
" ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> [<enr> ...] | SCHIFF <snr>\n [<snr> ...] | BURG <bnr> [<bnr> ...] )");
|
" ZAUBERE \"Testzauber\" ( REGION | EINHEIT <enr> [<enr> ...] | SCHIFF <snr>\n [<snr> ...] | BURG <bnr> [<bnr> ...] )");
|
||||||
|
|
||||||
test_cleanup();
|
test_cleanup();
|
||||||
|
|
Loading…
Reference in New Issue