- bei mehereren Lehrern kriegen alle eine Meldung, nicht nur der letzte
This commit is contained in:
Enno Rehling 2004-05-24 13:19:41 +00:00
parent b2c5c55ea3
commit ccf0fe9bf7
1 changed files with 365 additions and 358 deletions

View File

@ -133,7 +133,7 @@ study_cost(unit *u, int talent)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
typedef struct teaching_info { typedef struct teaching_info {
unit * teacher; unit * teachers[4];
int value; int value;
} teaching_info; } teaching_info;
@ -187,12 +187,16 @@ teach_unit(unit * teacher, unit * student, int nteaching, skill_t sk,
if (n != 0) { if (n != 0) {
struct building * b = inside_building(teacher); struct building * b = inside_building(teacher);
const struct building_type * btype = b?b->type:NULL; const struct building_type * btype = b?b->type:NULL;
int index = 0;
if (teach==NULL) { if (teach==NULL) {
a = a_add(&student->attribs, a_new(&at_learning)); a = a_add(&student->attribs, a_new(&at_learning));
teach = (teaching_info*)a->data.v; teach = (teaching_info*)a->data.v;
} else {
while (teach->teachers[index]) ++index;
} }
teach->teacher = teacher; teach->teachers[index] = teacher;
teach->teachers[index+1] = NULL;
teach->value += n; teach->value += n;
/* Solange Akademien größenbeschränkt sind, sollte Lehrer und /* Solange Akademien größenbeschränkt sind, sollte Lehrer und
@ -632,7 +636,7 @@ learn(void)
if (teach==NULL) { if (teach==NULL) {
a = a_add(&u->attribs, a_new(&at_learning)); a = a_add(&u->attribs, a_new(&at_learning));
teach = (teaching_info*)a->data.v; teach = (teaching_info*)a->data.v;
teach->teacher = NULL; teach->teachers[0] = 0;
} }
if (money>0) { if (money>0) {
use_pooled(u, r, R_SILVER, money); use_pooled(u, r, R_SILVER, money);
@ -698,9 +702,11 @@ learn(void)
days = 0; days = 0;
} }
} }
if (a) { if (a!=NULL) {
if (teach && teach->teacher) { if (teach!=NULL) {
unit * teacher = teach->teacher; int index = 0;
while (teach->teachers[index]) {
unit * teacher = teach->teachers[index++];
if (teacher->faction != u->faction) { if (teacher->faction != u->faction) {
add_message(&u->faction->msgs, msg_message("teach_student", add_message(&u->faction->msgs, msg_message("teach_student",
"teacher student skill", teacher, u, sk)); "teacher student skill", teacher, u, sk));
@ -709,6 +715,7 @@ learn(void)
effskill(u, sk))); effskill(u, sk)));
} }
} }
}
a_remove(&u->attribs, a); a_remove(&u->attribs, a);
a = NULL; a = NULL;
} }