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