From 30fc6f3e919b2ebfc31af6480d63b24b24e6cdeb Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Wed, 25 Jan 2017 21:03:08 +0100 Subject: [PATCH] BESCHREIBE REGION ist jeder Einheit des Regionsbesitzers erlaubt --- src/laws.c | 20 +------------------- src/laws.test.c | 5 +++++ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/laws.c b/src/laws.c index 59bf9efc8..b99b2d3f2 100644 --- a/src/laws.c +++ b/src/laws.c @@ -1538,16 +1538,6 @@ int prefix_cmd(unit * u, struct order *ord) return 0; } -static cmp_building_cb get_cmp_region_owner(void) -{ - if (rule_region_owners()) { - return &cmp_current_owner; - } - else { - return &cmp_wage; - } -} - int display_cmd(unit * u, struct order *ord) { char token[128]; @@ -1597,15 +1587,7 @@ int display_cmd(unit * u, struct order *ord) break; case P_REGION: - if (!u->building) { - cmistake(u, ord, 145, MSG_EVENT); - break; - } - if (building_owner(u->building) != u) { - cmistake(u, ord, 148, MSG_EVENT); - break; - } - if (u->building != largestbuilding(r, get_cmp_region_owner(), false)) { + if (u->faction != region_get_owner(r)) { cmistake(u, ord, 147, MSG_EVENT); break; } diff --git a/src/laws.test.c b/src/laws.test.c index 67a9bb810..5eb742809 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -229,6 +229,11 @@ static void test_display_cmd(CuTest *tc) { CuAssertPtrEquals(tc, NULL, u->display); free_order(ord); + ord = create_order(K_DISPLAY, f->locale, "%s Hodor", LOC(f->locale, parameters[P_REGION])); + CuAssertIntEquals(tc, 0, display_cmd(u, ord)); + CuAssertPtrEquals(tc, NULL, r->display); + free_order(ord); + test_cleanup(); }