diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bc8337e7d..ce2b6a8cc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -92,7 +92,6 @@ set (PARSER_SRC set (ERESSEA_SRC vortex.c - academy.c alchemy.c automate.c battle.c @@ -212,7 +211,6 @@ target_link_libraries(eressea ) set(TESTS_SRC - academy.test.c alchemy.test.c automate.test.c battle.test.c diff --git a/src/academy.c b/src/academy.c deleted file mode 100644 index c639805db..000000000 --- a/src/academy.c +++ /dev/null @@ -1,22 +0,0 @@ -#include "platform.h" -#include "kernel/config.h" -#include -#include -#include -#include - -#include "academy.h" -#include "study.h" - -void academy_teaching_bonus(struct unit *u, skill_t sk, int students) { - if (students > 0 && sk != NOSKILL) { - /* actually students * EXPERIENCEDAYS / MAX_STUDENTS */ - change_skill_days(u, sk, students); - } -} - -bool academy_can_teach(unit *teacher, unit *scholar, skill_t sk) { - const struct building_type *btype = bt_find("academy"); - return (active_building(scholar, btype)); -} - diff --git a/src/academy.h b/src/academy.h deleted file mode 100644 index 3c496d8fa..000000000 --- a/src/academy.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef H_ACADEMY -#define H_ACADEMY - -#include - -#ifdef __cplusplus -extern "C" { -#endif - - struct unit; - void academy_teaching_bonus(struct unit *u, skill_t sk, int academy); - bool academy_can_teach(struct unit *teacher, struct unit *scholar, skill_t sk); -#ifdef __cplusplus -} -#endif -#endif diff --git a/src/academy.test.c b/src/academy.test.c deleted file mode 100644 index 6f26cee93..000000000 --- a/src/academy.test.c +++ /dev/null @@ -1,52 +0,0 @@ -#include - -#include "academy.h" -#include "skill.h" - -#include -#include -#include -#include -#include -#include - -#include -#include "tests.h" - -static void test_academy(CuTest * tc) -{ - faction *f; - unit *u, *u2; - region *r; - building *b; - const item_type *it_silver; - - test_setup(); - config_set_int("skills.cost.alchemy", 100); - r = test_create_region(0, 0, NULL); - f = test_create_faction(NULL); - u = test_create_unit(f, r); - b = test_create_building(r, test_create_buildingtype("academy")); - u2 = test_create_unit(f, r); - it_silver = test_create_silver(); - - CuAssert(tc, "teacher must be in academy", !academy_can_teach(u, u2, SK_CROSSBOW)); - u_set_building(u, b); - CuAssert(tc, "student must be in academy", !academy_can_teach(u, u2, SK_CROSSBOW)); - u_set_building(u2, b); - CuAssert(tc, "student must have 50 silver", !academy_can_teach(u, u2, SK_CROSSBOW)); - i_change(&u2->items, it_silver, 50); - CuAssert(tc, "building must be maintained", !academy_can_teach(u, u2, SK_CROSSBOW)); - b->flags |= BLD_MAINTAINED; - CuAssert(tc, "building must have capacity", !academy_can_teach(u, u2, SK_CROSSBOW)); - b->size = 2; - CuAssertTrue(tc, academy_can_teach(u, u2, SK_CROSSBOW)); - test_teardown(); -} - -CuSuite *get_academy_suite(void) -{ - CuSuite *suite = CuSuiteNew(); - SUITE_ADD_TEST(suite, test_academy); - return suite; -} diff --git a/src/study.c b/src/study.c index 4521420cb..1229d6e60 100644 --- a/src/study.c +++ b/src/study.c @@ -8,7 +8,6 @@ #include "move.h" #include "monsters.h" #include "alchemy.h" -#include "academy.h" #include "kernel/calendar.h" #include @@ -202,10 +201,8 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk, teach->students += students; if (student->building) { - /* Solange Akademien groessenbeschraenkt sind, sollte Lehrer und - * Student auch in unterschiedlichen Gebaeuden stehen duerfen */ - /* FIXME comment contradicts implementation */ - if (academy_can_teach(teacher, student, sk)) { + const struct building_type *btype = bt_find("academy"); + if (active_building(student, btype)) { /* Jeder Schueler zusaetzlich +10 Tage wenn in Uni. */ teach->days += students * EXPERIENCEDAYS; /* learning erhoehen */ /* Lehrer zusaetzlich +1 Tag pro Schueler. */ @@ -421,8 +418,8 @@ int teach_cmd(unit * teacher, struct order *ord) replace_order(&teacher->orders, ord, new_order); free_order(new_order); /* parse_order & set_order have each increased the refcount */ } - if (academy_students > 0 && sk_academy!=NOSKILL) { - academy_teaching_bonus(teacher, sk_academy, academy_students); + if (academy_students > 0 && sk_academy != NOSKILL) { + change_skill_days(teacher, sk_academy, academy_students); } reset_order(); return 0; @@ -753,8 +750,6 @@ void produceexp(struct unit *u, skill_t sk, int n) produceexp_ex(u, sk, n, increase_skill_days); } -static int speed_rule; - /** * days should be scaled by u->number; STUDYDAYS * u->number is one week worth of learning * @return int diff --git a/src/test_eressea.c b/src/test_eressea.c index fc5c49d1c..452b847c5 100644 --- a/src/test_eressea.c +++ b/src/test_eressea.c @@ -93,7 +93,6 @@ int RunAllTests(int argc, char *argv[]) /* items */ ADD_SUITE(xerewards); /* kernel */ - ADD_SUITE(academy); ADD_SUITE(alliance); ADD_SUITE(ally); ADD_SUITE(building);