Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/laws.c
Original file line number Diff line number Diff line change
Expand Up @@ -2490,6 +2490,7 @@ int status_cmd(unit * u, struct order *ord)
break;
case P_FLEE:
unit_setstatus(u, ST_FLEE);
setguard(u, false);
break;
case P_CHICKEN:
unit_setstatus(u, ST_CHICKEN);
Expand Down
20 changes: 19 additions & 1 deletion src/laws.test.c
Original file line number Diff line number Diff line change
Expand Up @@ -1577,7 +1577,24 @@ static void test_status_cmd(CuTest* tc) {
test_teardown();
}

static void test_ally_cmd(CuTest* tc) {
static void test_status_flee_stops_guard(CuTest *tc) {
unit *u;
faction *f;

guard_fixture fix;

setup_guard(&fix, true);
u = fix.u;
f = fix.u->faction;
u->thisorder = create_order(K_STATUS, f->locale, param_name(P_FLEE, f->locale));
status_cmd(u, u->thisorder);
CuAssertIntEquals(tc, ST_FLEE, u->status);
CuAssertTrue(tc, !is_guard(u));

test_teardown();
}

static void test_ally_cmd(CuTest *tc) {
unit *u;
faction * f;
order *ord;
Expand Down Expand Up @@ -3027,6 +3044,7 @@ CuSuite *get_laws_suite(void)
SUITE_ADD_TEST(suite, test_findparam_ex);
SUITE_ADD_TEST(suite, test_nmr_warnings);
SUITE_ADD_TEST(suite, test_status_cmd);
SUITE_ADD_TEST(suite, test_status_flee_stops_guard);
SUITE_ADD_TEST(suite, test_ally_cmd);
SUITE_ADD_TEST(suite, test_name_cmd);
SUITE_ADD_TEST(suite, test_name_foreign_cmd);
Expand Down