teachers do not need to be in an academy.

remove source files for academy.
This commit is contained in:
Enno Rehling 2020-09-11 21:54:30 +02:00
parent c884138351
commit 85f1207af0
6 changed files with 4 additions and 102 deletions

View File

@ -92,7 +92,6 @@ set (PARSER_SRC
set (ERESSEA_SRC set (ERESSEA_SRC
vortex.c vortex.c
academy.c
alchemy.c alchemy.c
automate.c automate.c
battle.c battle.c
@ -212,7 +211,6 @@ target_link_libraries(eressea
) )
set(TESTS_SRC set(TESTS_SRC
academy.test.c
alchemy.test.c alchemy.test.c
automate.test.c automate.test.c
battle.test.c battle.test.c

View File

@ -1,22 +0,0 @@
#include "platform.h"
#include "kernel/config.h"
#include <kernel/unit.h>
#include <kernel/building.h>
#include <kernel/item.h>
#include <kernel/pool.h>
#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));
}

View File

@ -1,16 +0,0 @@
#ifndef H_ACADEMY
#define H_ACADEMY
#include <skill.h>
#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

View File

@ -1,52 +0,0 @@
#include <platform.h>
#include "academy.h"
#include "skill.h"
#include <kernel/config.h>
#include <kernel/building.h>
#include <kernel/faction.h>
#include <kernel/unit.h>
#include <kernel/item.h>
#include <kernel/region.h>
#include <CuTest.h>
#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;
}

View File

@ -8,7 +8,6 @@
#include "move.h" #include "move.h"
#include "monsters.h" #include "monsters.h"
#include "alchemy.h" #include "alchemy.h"
#include "academy.h"
#include "kernel/calendar.h" #include "kernel/calendar.h"
#include <spells/regioncurse.h> #include <spells/regioncurse.h>
@ -202,10 +201,8 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
teach->students += students; teach->students += students;
if (student->building) { if (student->building) {
/* Solange Akademien groessenbeschraenkt sind, sollte Lehrer und const struct building_type *btype = bt_find("academy");
* Student auch in unterschiedlichen Gebaeuden stehen duerfen */ if (active_building(student, btype)) {
/* FIXME comment contradicts implementation */
if (academy_can_teach(teacher, student, sk)) {
/* Jeder Schueler zusaetzlich +10 Tage wenn in Uni. */ /* Jeder Schueler zusaetzlich +10 Tage wenn in Uni. */
teach->days += students * EXPERIENCEDAYS; /* learning erhoehen */ teach->days += students * EXPERIENCEDAYS; /* learning erhoehen */
/* Lehrer zusaetzlich +1 Tag pro Schueler. */ /* 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); replace_order(&teacher->orders, ord, new_order);
free_order(new_order); /* parse_order & set_order have each increased the refcount */ free_order(new_order); /* parse_order & set_order have each increased the refcount */
} }
if (academy_students > 0 && sk_academy!=NOSKILL) { if (academy_students > 0 && sk_academy != NOSKILL) {
academy_teaching_bonus(teacher, sk_academy, academy_students); change_skill_days(teacher, sk_academy, academy_students);
} }
reset_order(); reset_order();
return 0; return 0;
@ -753,8 +750,6 @@ void produceexp(struct unit *u, skill_t sk, int n)
produceexp_ex(u, sk, n, increase_skill_days); 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 * days should be scaled by u->number; STUDYDAYS * u->number is one week worth of learning
* @return int * @return int

View File

@ -93,7 +93,6 @@ int RunAllTests(int argc, char *argv[])
/* items */ /* items */
ADD_SUITE(xerewards); ADD_SUITE(xerewards);
/* kernel */ /* kernel */
ADD_SUITE(academy);
ADD_SUITE(alliance); ADD_SUITE(alliance);
ADD_SUITE(ally); ADD_SUITE(ally);
ADD_SUITE(building); ADD_SUITE(building);