forked from github/server
actually do the learning.
This commit is contained in:
parent
b4cb1dfe8d
commit
b0fb1e5032
|
@ -142,22 +142,10 @@ void autostudy_run(scholar scholars[], int nscholars)
|
|||
void do_autostudy(region *r)
|
||||
{
|
||||
scholar scholars[MAXSCHOLARS];
|
||||
int nscholars = autostudy_init(scholars, MAXSCHOLARS, r);
|
||||
|
||||
if (nscholars > 0) {
|
||||
int i;
|
||||
skill_t sk = NOSKILL;
|
||||
|
||||
for (i = 0; i != nscholars; ++i) {
|
||||
if (scholars[i].u) {
|
||||
if (sk == NOSKILL) {
|
||||
sk = scholars[i].sk;
|
||||
}
|
||||
else if (sk != scholars[i].sk) {
|
||||
continue;
|
||||
}
|
||||
scholars[i].u = NULL;
|
||||
}
|
||||
}
|
||||
int i, nscholars = autostudy_init(scholars, MAXSCHOLARS, r);
|
||||
autostudy_run(scholars, nscholars);
|
||||
for (i = 0; i != nscholars; ++i) {
|
||||
int days = STUDYDAYS * scholars[i].learn;
|
||||
learn_skill(scholars[i].u, scholars[i].sk, days);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -766,9 +766,6 @@ int study_cmd(unit * u, order * ord)
|
|||
days *= 2;
|
||||
}
|
||||
|
||||
if (fval(u, UFL_HUNGER))
|
||||
days /= 2;
|
||||
|
||||
learn_skill(u, sk, days);
|
||||
if (a != NULL) {
|
||||
if (teach->teachers) {
|
||||
|
@ -832,6 +829,9 @@ void learn_skill(unit *u, skill_t sk, int days) {
|
|||
int leveldays = STUDYDAYS * u->number;
|
||||
int weeks = 0;
|
||||
|
||||
if (fval(u, UFL_HUNGER)) {
|
||||
days /= 2;
|
||||
}
|
||||
assert(sk >= 0 && sk < MAXSKILLS);
|
||||
if (inject_learn_fun) {
|
||||
inject_learn_fun(u, sk, days);
|
||||
|
|
Loading…
Reference in New Issue