forked from github/server
re-enable report tests.
RF_LIGHTHOUSE also flags for lighthouses with size 0.
This commit is contained in:
parent
a5d44f9638
commit
ac8332c896
|
@ -25,4 +25,4 @@ cd $ROOT
|
|||
inifile
|
||||
s/runtests
|
||||
|
||||
# integraton_tests
|
||||
integraton_tests
|
||||
|
|
|
@ -8,7 +8,7 @@ require 'tests.e2.spells'
|
|||
require 'tests.e2.stealth'
|
||||
require 'tests.orders'
|
||||
require 'tests.common'
|
||||
-- require 'tests.report'
|
||||
require 'tests.report'
|
||||
require 'tests.storage'
|
||||
require 'tests.magicbag'
|
||||
require 'tests.process'
|
||||
|
|
|
@ -23,7 +23,7 @@ local function assert_file(filename)
|
|||
os.remove(filename)
|
||||
end
|
||||
|
||||
function disable_test_process_turn()
|
||||
function test_process_turn()
|
||||
u:add_order("NUMMER PARTEI 777")
|
||||
process_orders()
|
||||
assert_equal(0, init_reports())
|
||||
|
|
|
@ -26,36 +26,37 @@ const attrib_type at_lighthouse = {
|
|||
*/
|
||||
void update_lighthouse(building * lh)
|
||||
{
|
||||
if (lh->size>0 && is_building_type(lh->type, "lighthouse")) {
|
||||
if (is_building_type(lh->type, "lighthouse")) {
|
||||
region *r = lh->region;
|
||||
int d = (int)log10(lh->size) + 1;
|
||||
int x;
|
||||
|
||||
r->flags |= RF_LIGHTHOUSE;
|
||||
if (lh->size > 0) {
|
||||
int d = (int)log10(lh->size) + 1;
|
||||
int x;
|
||||
for (x = -d; x <= d; ++x) {
|
||||
int y;
|
||||
for (y = -d; y <= d; ++y) {
|
||||
attrib *a;
|
||||
region *r2;
|
||||
int px = r->x + x, py = r->y + y;
|
||||
|
||||
for (x = -d; x <= d; ++x) {
|
||||
int y;
|
||||
for (y = -d; y <= d; ++y) {
|
||||
attrib *a;
|
||||
region *r2;
|
||||
int px = r->x + x, py = r->y + y;
|
||||
|
||||
pnormalize(&px, &py, rplane(r));
|
||||
r2 = findregion(px, py);
|
||||
if (!r2 || !fval(r2->terrain, SEA_REGION))
|
||||
continue;
|
||||
if (distance(r, r2) > d)
|
||||
continue;
|
||||
a = a_find(r2->attribs, &at_lighthouse);
|
||||
while (a && a->type == &at_lighthouse) {
|
||||
building *b = (building *)a->data.v;
|
||||
if (b == lh)
|
||||
break;
|
||||
a = a->next;
|
||||
}
|
||||
if (!a) {
|
||||
a = a_add(&r2->attribs, a_new(&at_lighthouse));
|
||||
a->data.v = (void *)lh;
|
||||
pnormalize(&px, &py, rplane(r));
|
||||
r2 = findregion(px, py);
|
||||
if (!r2 || !fval(r2->terrain, SEA_REGION))
|
||||
continue;
|
||||
if (distance(r, r2) > d)
|
||||
continue;
|
||||
a = a_find(r2->attribs, &at_lighthouse);
|
||||
while (a && a->type == &at_lighthouse) {
|
||||
building *b = (building *)a->data.v;
|
||||
if (b == lh)
|
||||
break;
|
||||
a = a->next;
|
||||
}
|
||||
if (!a) {
|
||||
a = a_add(&r2->attribs, a_new(&at_lighthouse));
|
||||
a->data.v = (void *)lh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -65,7 +65,7 @@ static void test_lighthouse_update(CuTest * tc)
|
|||
r2 = test_create_region(1, 0, t_ocean);
|
||||
r3 = test_create_region(2, 0, t_ocean);
|
||||
b = test_create_building(r1, test_create_buildingtype("lighthouse"));
|
||||
CuAssertIntEquals(tc, 0, r1->flags&RF_LIGHTHOUSE);
|
||||
CuAssertIntEquals(tc, RF_LIGHTHOUSE, r1->flags&RF_LIGHTHOUSE);
|
||||
CuAssertPtrEquals(tc, NULL, r1->attribs);
|
||||
CuAssertPtrEquals(tc, NULL, r2->attribs);
|
||||
CuAssertPtrEquals(tc, NULL, r3->attribs);
|
||||
|
|
Loading…
Reference in New Issue