Merge pull request #79 from badgerman/bug-2054

Bug 2054: monsters trying to STUDY when they cannot.
This commit is contained in:
Enno Rehling 2014-12-14 16:29:56 +01:00
commit 2a113bcd04
4 changed files with 12 additions and 3 deletions

View File

@ -1881,3 +1881,7 @@ bool unit_name_equals_race(const unit *u) {
}
return false;
}
bool unit_can_study(const unit *u) {
return !((u_race(u)->flags & RCF_NOLEARN) || fval(u, UFL_WERE));
}

View File

@ -250,6 +250,7 @@ extern "C" {
const char *unitname(const struct unit *u);
char *write_unitname(const struct unit *u, char *buffer, size_t size);
bool unit_name_equals_race(const struct unit *u);
bool unit_can_study(const struct unit *u);
#ifdef __cplusplus
}

View File

@ -579,9 +579,13 @@ static order *monster_learn(unit * u)
skill *sv;
const struct locale *lang = u->faction->locale;
/* can these monsters even study? */
if (!unit_can_study(u)) {
return NULL;
}
/* Monster lernt ein zufälliges Talent aus allen, in denen es schon
* Lerntage hat. */
for (sv = u->skills; sv != u->skills + u->skill_size; ++sv) {
if (sv->level > 0)
++c;
@ -826,7 +830,7 @@ void plan_monsters(faction * f)
}
}
if (long_order == NULL) {
if (long_order == NULL && unit_can_study(u)) {
/* Einheiten, die Waffenlosen Kampf lernen könnten, lernen es um
* zu bewachen: */
if (u_race(u)->bonus[SK_WEAPONLESS] != -99) {

View File

@ -543,7 +543,7 @@ int learn_cmd(unit * u, order * ord)
else
learn_newskills = 1;
}
if ((u_race(u)->flags & RCF_NOLEARN) || fval(u, UFL_WERE)) {
if (!unit_can_study(u)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_race_nolearn", "race",
u_race(u)));
return 0;