rename teaching_info.value to days

This commit is contained in:
Steffen Mecke 2017-09-02 15:50:03 +02:00
parent b98c01a7b8
commit 080d5e3f65
4 changed files with 12 additions and 12 deletions

View File

@ -74,9 +74,9 @@ struct order *ord)
if (amount > MAXGAIN) {
amount = MAXGAIN;
}
teach->value += amount * STUDYDAYS;
if (teach->value > MAXGAIN * STUDYDAYS) {
teach->value = MAXGAIN * STUDYDAYS;
teach->days += amount * STUDYDAYS;
if (teach->days > MAXGAIN * STUDYDAYS) {
teach->days = MAXGAIN * STUDYDAYS;
}
i_change(&u->items, itype, -amount);
return 0;

View File

@ -223,7 +223,7 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
teach = (teaching_info *)a->data.v;
}
selist_push(&teach->teachers, teacher);
teach->value += students * STUDYDAYS;
teach->days += students * STUDYDAYS;
teach->students += students;
if (student->building && teacher->building == student->building) {
@ -232,7 +232,7 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
/* FIXME comment contradicts implementation */
if (academy_can_teach(teacher, student, sk)) {
/* Jeder Schueler zusaetzlich +10 Tage wenn in Uni. */
teach->value += students * EXPERIENCEDAYS; /* learning erhoehen */
teach->days += students * EXPERIENCEDAYS; /* learning erhoehen */
/* Lehrer zusaetzlich +1 Tag pro Schueler. */
if (academy_students) {
*academy_students += students;
@ -713,12 +713,12 @@ int study_cmd(unit * u, order * ord)
if (get_effect(u, oldpotiontype[P_WISE])) {
l = MIN(u->number, get_effect(u, oldpotiontype[P_WISE]));
teach->value += l * EXPERIENCEDAYS;
teach->days += l * EXPERIENCEDAYS;
change_effect(u, oldpotiontype[P_WISE], -l);
}
if (get_effect(u, oldpotiontype[P_FOOL])) {
l = MIN(u->number, get_effect(u, oldpotiontype[P_FOOL]));
teach->value -= l * STUDYDAYS;
teach->days -= l * STUDYDAYS;
change_effect(u, oldpotiontype[P_FOOL], -l);
}
@ -727,16 +727,16 @@ int study_cmd(unit * u, order * ord)
/* p ist Kosten ohne Uni, studycost mit; wenn
* p!=studycost, ist die Einheit zwangsweise
* in einer Uni */
teach->value += u->number * EXPERIENCEDAYS;
teach->days += u->number * EXPERIENCEDAYS;
}
if (is_cursed(r->attribs, &ct_badlearn)) {
teach->value -= u->number * EXPERIENCEDAYS;
teach->days -= u->number * EXPERIENCEDAYS;
}
multi *= study_speedup(u, sk, speed_rule);
days = study_days(u, sk);
days = (int)((days + teach->value) * multi);
days = (int)((days + teach->days) * multi);
/* the artacademy currently improves the learning of entertainment
of all units in the region, to be able to make it cumulative with

View File

@ -51,7 +51,7 @@ extern "C" {
typedef struct teaching_info {
struct selist *teachers;
int students;
int value;
int days;
} teaching_info;
extern const struct attrib_type at_learning;

View File

@ -626,7 +626,7 @@ static void test_teach_message(CuTest *tc) {
CuAssertPtrNotNull(tc, a->data.v);
teach = (teaching_info *)a->data.v;
CuAssertPtrNotNull(tc, teach->teachers);
CuAssertIntEquals(tc, 600, teach->value);
CuAssertIntEquals(tc, 600, teach->days);
CuAssertIntEquals(tc, 2, selist_length(teach->teachers));
CuAssertPtrEquals(tc, u1, selist_get(teach->teachers, 0));
CuAssertPtrEquals(tc, u2, selist_get(teach->teachers, 1));