forked from github/server
Merge branch 'bug/#2144' of https://github.com/TurnerSE/server into TurnerSE-bug/#2144
This commit is contained in:
commit
9f94979b0d
3 changed files with 61 additions and 7 deletions
|
@ -2461,8 +2461,10 @@ static void reshow(unit * u, struct order *ord, const char *s, param_t p)
|
|||
break;
|
||||
}
|
||||
else {
|
||||
if (display_item(u->faction, u, itype))
|
||||
break;
|
||||
if (!display_item(u->faction, u, itype))
|
||||
cmistake(u, ord, 36, MSG_EVENT);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
/* try for a spell */
|
||||
|
|
|
@ -1199,6 +1199,50 @@ static void test_mail_region_no_msg(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_show_without_item(CuTest *tc)
|
||||
{
|
||||
region *r;
|
||||
faction *f;
|
||||
unit *u;
|
||||
order *ord;
|
||||
item_type *itype;
|
||||
item *i;
|
||||
struct locale *loc;
|
||||
|
||||
test_cleanup();
|
||||
|
||||
loc = get_or_create_locale("de");
|
||||
|
||||
r = test_create_region(0, 0, test_create_terrain("testregion", LAND_REGION));
|
||||
f = test_create_faction(test_create_race("human"));
|
||||
u = test_create_unit(f, r);
|
||||
|
||||
ord = create_order(K_RESHOW, u->faction->locale, "testname");
|
||||
|
||||
itype = it_get_or_create(rt_get_or_create("testitem"));
|
||||
i = i_new(itype, 1);
|
||||
|
||||
reshow_cmd(u, ord);
|
||||
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") != NULL);
|
||||
test_clear_messages(u->faction);
|
||||
|
||||
locale_setstring(loc, "testitem", "testname");
|
||||
locale_setstring(loc, "iteminfo::testitem", "testdescription");
|
||||
reshow_cmd(u, ord);
|
||||
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") == NULL);
|
||||
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error36") != NULL);
|
||||
test_clear_messages(u->faction);
|
||||
|
||||
i_add(&(u->items), i);
|
||||
reshow_cmd(u, ord);
|
||||
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error21") == NULL);
|
||||
CuAssertTrue(tc, test_find_messagetype(u->faction->msgs, "error36") == NULL);
|
||||
test_clear_messages(u->faction);
|
||||
|
||||
free_order(ord);
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_laws_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -1255,6 +1299,7 @@ CuSuite *get_laws_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_name_region);
|
||||
SUITE_ADD_TEST(suite, test_name_building);
|
||||
SUITE_ADD_TEST(suite, test_name_ship);
|
||||
SUITE_ADD_TEST(suite, test_show_without_item);
|
||||
|
||||
return suite;
|
||||
}
|
||||
|
|
|
@ -37,14 +37,21 @@ int sp_flying_ship(castorder * co)
|
|||
{
|
||||
ship *sh;
|
||||
unit *u;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
region *r;
|
||||
unit *mage;
|
||||
int cast_level;
|
||||
double power;
|
||||
spellparameter *pa;
|
||||
message *m = NULL;
|
||||
int cno;
|
||||
|
||||
assert(co);
|
||||
r = co_get_region(co);
|
||||
mage = co->magician.u;
|
||||
cast_level = co->level;
|
||||
power = co->force;
|
||||
pa = co->par;
|
||||
|
||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||
if (pa->param[0]->flag == TARGET_NOTFOUND)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue