BESCHREIBE REGION ist jeder Einheit des Regionsbesitzers erlaubt

This commit is contained in:
Enno Rehling 2017-01-25 21:03:08 +01:00
parent 77cbd04cfa
commit 30fc6f3e91
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; 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) int display_cmd(unit * u, struct order *ord)
{ {
char token[128]; char token[128];
@ -1597,15 +1587,7 @@ int display_cmd(unit * u, struct order *ord)
break; break;
case P_REGION: case P_REGION:
if (!u->building) { if (u->faction != region_get_owner(r)) {
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)) {
cmistake(u, ord, 147, MSG_EVENT); cmistake(u, ord, 147, MSG_EVENT);
break; break;
} }

View File

@ -229,6 +229,11 @@ static void test_display_cmd(CuTest *tc) {
CuAssertPtrEquals(tc, NULL, u->display); CuAssertPtrEquals(tc, NULL, u->display);
free_order(ord); 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(); test_cleanup();
} }