From 7175c87140bbe41fbe488ae58473565834bb7a56 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Tue, 4 Aug 2009 15:29:07 +0000 Subject: [PATCH] disallow building other people's castles --- src/common/kernel/build.c | 11 +++++++++++ src/res/e3a.xml | 1 + 2 files changed, 12 insertions(+) diff --git a/src/common/kernel/build.c b/src/common/kernel/build.c index 6d296ab7e..67087897b 100644 --- a/src/common/kernel/build.c +++ b/src/common/kernel/build.c @@ -827,6 +827,7 @@ build_building(unit * u, const building_type * btype, int want, order * ord) const char * btname; order * new_order = NULL; const struct locale * lang = u->faction->locale; + static int rule_other = -1; assert(u->number); if (eff_skill(u, SK_BUILDING, r) == 0) { @@ -881,6 +882,16 @@ build_building(unit * u, const building_type * btype, int want, order * ord) } n = 1; } + if (rule_other<0) { + rule_other = get_param_int(global.parameters, "rules.build.other_buildings", 1); + } + if (!rule_other) { + unit * owner = buildingowner(r, b); + if (!owner || owner->faction!=u->faction) { + cmistake(u, ord, 1222, MSG_PRODUCE); + return; + } + } if (b) built = b->size; if (n<=0 || n == INT_MAX) { diff --git a/src/res/e3a.xml b/src/res/e3a.xml index 3d96aa4b5..34a6a5fcd 100644 --- a/src/res/e3a.xml +++ b/src/res/e3a.xml @@ -160,6 +160,7 @@ +