BESCHREIBE REGION ist jeder Einheit des Regionsbesitzers erlaubt

This commit is contained in:
Enno Rehling 2017-01-25 21:03:08 +01:00 committed by Enno Rehling
parent 2a1ead6506
commit 21514f3bfe
2 changed files with 6 additions and 19 deletions

View File

@ -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;
}

View File

@ -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();
}