forked from github/server
BUG 2337: lighthouse capacity is # of units, not people.
This commit is contained in:
parent
f8de1bf29e
commit
233ea9dce4
|
@ -35,6 +35,7 @@
|
|||
"rules.guard.guard_number_stop_prob": 0.001,
|
||||
"rules.guard.castle_stop_prob": 0.05,
|
||||
"rules.guard.region_type_stop_prob": 0.05,
|
||||
"rules.economy.repopulate_maximum": 500
|
||||
"rules.economy.repopulate_maximum": 500,
|
||||
"rules.lighthouse.unit_capacity": true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,6 +92,7 @@
|
|||
"rules.grow.formula": 1,
|
||||
"rules.tactics.formula": 1,
|
||||
"rules.help.mask": "fight guard money give",
|
||||
"rules.lighthouse.unit_capacity": true,
|
||||
"movement.shipspeed.skillbonus": 6,
|
||||
"alliance.auto": "fight",
|
||||
"alliance.restricted": "fight"
|
||||
|
|
|
@ -1405,10 +1405,12 @@ void prepare_report(report_context *ctx, faction *f)
|
|||
region *r;
|
||||
static int config;
|
||||
static bool rule_region_owners;
|
||||
static bool rule_lighthouse_units;
|
||||
const struct building_type *bt_lighthouse = bt_find("lighthouse");
|
||||
|
||||
if (bt_lighthouse && config_changed(&config)) {
|
||||
rule_region_owners = config_token("rules.region_owner_pay_building", bt_lighthouse->_name);
|
||||
rule_lighthouse_units = config_get_int("rules.lighthouse.unit_capacity", 0) != 0;
|
||||
}
|
||||
|
||||
if (f->age <= 2) {
|
||||
|
@ -1471,7 +1473,12 @@ void prepare_report(report_context *ctx, faction *f)
|
|||
c = buildingcapacity(b);
|
||||
br = 0;
|
||||
}
|
||||
if (rule_lighthouse_units) {
|
||||
--c;
|
||||
}
|
||||
else {
|
||||
c -= u->number;
|
||||
}
|
||||
if (u->faction == f && c >= 0) {
|
||||
/* unit is one of ours, and inside the current lighthouse */
|
||||
if (br == 0) {
|
||||
|
|
|
@ -496,6 +496,15 @@ void test_prepare_lighthouse_capacity(CuTest *tc) {
|
|||
CuAssertIntEquals(tc, seen_neighbour, r2->seen.mode);
|
||||
finish_reports(&ctx);
|
||||
|
||||
// lighthouse capacity is # of units, not people:
|
||||
config_set_int("rules.lighthouse.unit_capacity", 1);
|
||||
prepare_report(&ctx, u2->faction);
|
||||
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
||||
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||
CuAssertIntEquals(tc, seen_lighthouse, r2->seen.mode);
|
||||
finish_reports(&ctx);
|
||||
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue