From e36f607fedec70bd7ea1ce8b53e8345d8405580d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 3 Sep 2017 11:32:20 +0200 Subject: [PATCH 1/3] send bz2 report with new mail text location --- process/send-bz2-report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/send-bz2-report b/process/send-bz2-report index 983564bea..f4b2ad6ea 100755 --- a/process/send-bz2-report +++ b/process/send-bz2-report @@ -26,4 +26,4 @@ addr=$1 subj=$2 shift 2 -cat $ERESSEA/etc/$TEMPLATE | mutt -F $ERESSEA/etc/muttrc -s "$subj" -a $* -- $addr +cat $ERESSEA/server/etc/$TEMPLATE | mutt -F $ERESSEA/etc/muttrc -s "$subj" -a $* -- $addr From 0386aafa7b6850d1c89935e6312ad9f60eb87ef1 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 3 Sep 2017 20:28:27 +0200 Subject: [PATCH 2/3] new template file location --- process/send-zip-report | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/send-zip-report b/process/send-zip-report index 7926de8f7..6ea2ea8e7 100755 --- a/process/send-zip-report +++ b/process/send-zip-report @@ -27,7 +27,7 @@ fi if [ -e $GAME/$TEMPLATE ]; then TEMPLATE=$GAME/$TEMPLATE else -TEMPLATE=$ERESSEA/etc/$TEMPLATE +TEMPLATE=$ERESSEA/server/etc/$TEMPLATE fi if [ ! -e $TEMPLATE ]; then From a0a39124f0baf6f097c0d80b149fe939785bf0e0 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 15 Oct 2017 20:20:43 +0200 Subject: [PATCH 3/3] additional tests for cansee, to support fixing bug 2374 --- clibs | 2 +- src/laws.test.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 89 insertions(+), 2 deletions(-) diff --git a/clibs b/clibs index d286006a2..147584ad7 160000 --- a/clibs +++ b/clibs @@ -1 +1 @@ -Subproject commit d286006a28c8aa7cd70ed7fd4cd172b50ade9727 +Subproject commit 147584ad70b220abf6a4e97ca76e785729b9ac32 diff --git a/src/laws.test.c b/src/laws.test.c index 4d6adbfe9..0d0e66eea 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -1552,6 +1552,90 @@ static void test_armedmen(CuTest *tc) { test_cleanup(); } +static void test_cansee(CuTest *tc) { + unit *u, *u2; + + test_setup(); + u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0)); + u2 = test_create_unit(test_create_faction(0), u->region); + + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + set_level(u2, SK_STEALTH, 1); + CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0)); + + set_level(u, SK_PERCEPTION, 1); + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + test_cleanup(); +} + +static void test_cansee_ring(CuTest *tc) { + unit *u, *u2; + item_type *itype[2]; + + test_setup(); + u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0)); + u2 = test_create_unit(test_create_faction(0), u->region); + scale_number(u2, 2); + + itype[0] = test_create_itemtype("roi"); + itype[1] = test_create_itemtype("aots"); + CuAssertPtrNotNull(tc, get_resourcetype(R_RING_OF_INVISIBILITY)); + CuAssertPtrEquals(tc, itype[0]->rtype, (void *)get_resourcetype(R_RING_OF_INVISIBILITY)); + CuAssertPtrNotNull(tc, get_resourcetype(R_AMULET_OF_TRUE_SEEING)); + CuAssertPtrEquals(tc, itype[1]->rtype, (void *)get_resourcetype(R_AMULET_OF_TRUE_SEEING)); + + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + /* a single ring is not enough to hide two people */ + i_change(&u2->items, itype[0], 1); + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + /* two rings can hide two people */ + i_change(&u2->items, itype[0], 1); + CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0)); + + /* one amulet negates one of the two rings */ + i_change(&u->items, itype[1], 1); + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + test_cleanup(); +} + +static void test_cansee_sphere(CuTest *tc) { + unit *u, *u2; + item_type *itype[2]; + + test_setup(); + u = test_create_unit(test_create_faction(0), test_create_region(0, 0, 0)); + u2 = test_create_unit(test_create_faction(0), u->region); + + itype[0] = test_create_itemtype("sphereofinv"); + itype[1] = test_create_itemtype("aots"); + CuAssertPtrNotNull(tc, get_resourcetype(R_SPHERE_OF_INVISIBILITY)); + CuAssertPtrEquals(tc, itype[0]->rtype, (void *)get_resourcetype(R_SPHERE_OF_INVISIBILITY)); + CuAssertPtrNotNull(tc, get_resourcetype(R_AMULET_OF_TRUE_SEEING)); + CuAssertPtrEquals(tc, itype[1]->rtype, (void *)get_resourcetype(R_AMULET_OF_TRUE_SEEING)); + + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + /* a single sphere can hide 100 people */ + scale_number(u2, 100); + i_change(&u2->items, itype[0], 1); + CuAssertTrue(tc, !cansee(u->faction, u->region, u2, 0)); + + /* one single amulet negates it? */ + i_change(&u->items, itype[1], 1); + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + /* number of people inside the sphere does not matter? */ + scale_number(u2, 99); + CuAssertTrue(tc, cansee(u->faction, u->region, u2, 0)); + + test_cleanup(); +} + CuSuite *get_laws_suite(void) { CuSuite *suite = CuSuiteNew(); @@ -1618,6 +1702,9 @@ CuSuite *get_laws_suite(void) SUITE_ADD_TEST(suite, test_immigration); SUITE_ADD_TEST(suite, test_demon_hunger); SUITE_ADD_TEST(suite, test_armedmen); - + SUITE_ADD_TEST(suite, test_cansee); + SUITE_ADD_TEST(suite, test_cansee_ring); + SUITE_ADD_TEST(suite, test_cansee_sphere); + return suite; }