From 36d884143ee406b3045350ac6f44395d45f2d05c Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 29 Jan 2017 11:06:08 +0100 Subject: [PATCH 1/3] =?UTF-8?q?Bug=202278:=20Neue=20Magier=20k=C3=B6nnen?= =?UTF-8?q?=20nicht=20gelehrt=20werden.=20http://bugs.eressea.de/view.php?= =?UTF-8?q?=3Fid=3D2278?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/study.c | 4 ++-- src/study.test.c | 29 +++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/src/study.c b/src/study.c index 1dd4da8b8..89be92bbd 100644 --- a/src/study.c +++ b/src/study.c @@ -473,8 +473,8 @@ int teach_cmd(unit * u, struct order *ord) * Lehrer seines Gebietes */ sc_mage *mage1 = get_mage(u); sc_mage *mage2 = get_mage(u2); - if (!mage2 || !mage1 || (mage2->magietyp != M_GRAY - && mage1->magietyp != mage2->magietyp)) { + if (mage2 && mage1 && mage2->magietyp != M_GRAY + && mage1->magietyp != mage2->magietyp) { if (feedback) { ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_different_magic", "target", u2)); diff --git a/src/study.test.c b/src/study.test.c index 47976930d..83628a123 100644 --- a/src/study.test.c +++ b/src/study.test.c @@ -381,6 +381,34 @@ static void test_study_cost(CuTest *tc) { test_cleanup(); } +static void test_teach_magic(CuTest *tc) { + unit *u, *ut; + faction *f; + const struct item_type *itype; + + test_setup(); + init_resources(); + itype = get_resourcetype(R_SILVER)->itype; + f = test_create_faction(0); + f->magiegebiet = M_GWYRRD; + u = test_create_unit(f, test_create_region(0, 0, 0)); + u->thisorder = create_order(K_STUDY, f->locale, "%s", skillnames[SK_MAGIC]); + i_change(&u->items, itype, study_cost(u, SK_MAGIC)); + ut = test_create_unit(f, u->region); + set_level(ut, SK_MAGIC, TEACHDIFFERENCE); + create_mage(ut, M_GWYRRD); + ut->thisorder = create_order(K_TEACH, f->locale, "%s", itoa36(u->no)); + learn_inject(); + teach_cmd(ut, ut->thisorder); + study_cmd(u, u->thisorder); + learn_reset(); + CuAssertPtrEquals(tc, u, log_learners[0].u); + CuAssertIntEquals(tc, SK_MAGIC, log_learners[0].sk); + CuAssertIntEquals(tc, STUDYDAYS*2, log_learners[0].days); + CuAssertIntEquals(tc, 0, i_get(u->items, itype)); + test_cleanup(); +} + static void test_teach_cmd(CuTest *tc) { unit *u, *ut; test_setup(); @@ -550,6 +578,7 @@ CuSuite *get_study_suite(void) SUITE_ADD_TEST(suite, test_study_cost); SUITE_ADD_TEST(suite, test_study_magic); SUITE_ADD_TEST(suite, test_teach_cmd); + SUITE_ADD_TEST(suite, test_teach_magic); SUITE_ADD_TEST(suite, test_teach_two); SUITE_ADD_TEST(suite, test_teach_one_to_many); SUITE_ADD_TEST(suite, test_teach_many_to_one); From bf22cbc2ef49369781b713a5aa8838ad888c2408 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 29 Jan 2017 11:30:22 +0100 Subject: [PATCH 2/3] increase MAXTEACHERS again (permament fix in 3.11) --- src/study.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/study.h b/src/study.h index 20903583a..9d053dd5e 100644 --- a/src/study.h +++ b/src/study.h @@ -45,7 +45,7 @@ extern "C" { void demon_skillchange(struct unit *u); -#define MAXTEACHERS 32 +#define MAXTEACHERS 64 #define TEACHNUMBER 10 typedef struct teaching_info { struct unit *teachers[MAXTEACHERS]; From f58db3f729a49abf8a72a963e93c2fce2acc1df4 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 29 Jan 2017 12:59:09 +0100 Subject: [PATCH 3/3] Bug 2276: hacking a band-aid fix for compress.sh aka the game.name related mailpocalypse http://bugs.eressea.de/view.php?id=2276 --- process/compress.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/process/compress.sh b/process/compress.sh index ff152b9f1..23b0929dd 100755 --- a/process/compress.sh +++ b/process/compress.sh @@ -6,7 +6,7 @@ if [ -z $ERESSEA ]; then fi GAME=$ERESSEA/game-$1 -GAME_NAME=$(grep name $GAME/eressea.ini | sed 's/.*=\s*//') +GAME_NAME=$(grep -w name $GAME/eressea.ini | sed 's/.*=\s*//') TURN=$2 if [ -z $TURN ]