forked from github/server
Merge branch 'master' into develop
Conflicts: src/buildno.h src/kernel/unit.test.c
This commit is contained in:
commit
9e49e10d11
|
@ -5,8 +5,8 @@
|
|||
<requirement type="mallorn" quantity="1"/>
|
||||
</construction>
|
||||
<weapon armorpiercing="true" pierce="true" missile="true" skill="crossbow" offmod="0" defmod="0" reload="2" magres="0.15">
|
||||
<damage type="rider" value="3d3+5"/>
|
||||
<damage type="footman" value="3d3+5"/>
|
||||
<damage type="rider" value="3d3+6"/>
|
||||
<damage type="footman" value="3d3+6"/>
|
||||
<modifier type="missile_target" value="0"/>
|
||||
</weapon>
|
||||
</item>
|
||||
|
|
|
@ -1992,7 +1992,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
s = getstrtoken();
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
@ -2015,7 +2015,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
s = getstrtoken();
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
@ -2047,7 +2047,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
|
||||
s = getstrtoken();
|
||||
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
@ -2076,7 +2076,7 @@ int mail_cmd(unit * u, struct order *ord)
|
|||
|
||||
s = getstrtoken();
|
||||
|
||||
if (!s[0]) {
|
||||
if (!s || !s[0]) {
|
||||
cmistake(u, ord, 30, MSG_MESSAGE);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -970,7 +970,7 @@ static void test_ally_cmd(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
void test_nmr_warnings(CuTest *tc) {
|
||||
static void test_nmr_warnings(CuTest *tc) {
|
||||
faction *f1, *f2;
|
||||
test_cleanup();
|
||||
set_param(&global.parameters, "nmr.timeout", "3");
|
||||
|
@ -989,6 +989,43 @@ void test_nmr_warnings(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_cmd(CuTest *tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
faction *f;
|
||||
struct locale *lang;
|
||||
|
||||
test_cleanup();
|
||||
f = test_create_faction(0);
|
||||
f->locale = lang = get_or_create_locale("de");
|
||||
locale_setstring(lang, parameters[P_UNIT], "EINHEIT");
|
||||
init_parameters(lang);
|
||||
u = test_create_unit(f, test_create_region(0, 0, 0));
|
||||
ord = create_order(K_MAIL, u->faction->locale, "EINHEIT %s 'Hodor!'", itoa36(u->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "unitmessage"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_mail_cmd_no_msg(CuTest *tc) {
|
||||
unit *u;
|
||||
order *ord;
|
||||
faction *f;
|
||||
struct locale *lang;
|
||||
|
||||
test_cleanup();
|
||||
f = test_create_faction(0);
|
||||
f->locale = lang = get_or_create_locale("de");
|
||||
locale_setstring(lang, parameters[P_UNIT], "EINHEIT");
|
||||
init_parameters(lang);
|
||||
u = test_create_unit(f, test_create_region(0, 0, 0));
|
||||
ord = create_order(K_MAIL, u->faction->locale, "EINHEIT %s", itoa36(u->no));
|
||||
mail_cmd(u, ord);
|
||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "unitmessage"));
|
||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_laws_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -1033,6 +1070,8 @@ CuSuite *get_laws_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_force_leave_ships);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
|
||||
SUITE_ADD_TEST(suite, test_peasant_luck_effect);
|
||||
SUITE_ADD_TEST(suite, test_mail_cmd);
|
||||
SUITE_ADD_TEST(suite, test_mail_cmd_no_msg);
|
||||
(void)test_luck_message; /* disabled, breaks on travis */
|
||||
|
||||
return suite;
|
||||
|
|
Loading…
Reference in New Issue