diff --git a/src/automate.c b/src/automate.c index bf130acf3..e08d7a625 100644 --- a/src/automate.c +++ b/src/automate.c @@ -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); } } diff --git a/src/study.c b/src/study.c index 0dc4386bc..bd29fc2a8 100644 --- a/src/study.c +++ b/src/study.c @@ -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);