diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index b9c38430e..ca4052d25 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -2051,6 +2051,7 @@ writegame(char *path, char quiet) #else for (i=0;i!=u->skill_size;++i) { skill * sv = u->skills+i; + assert(sv->level>=0 && sv->learning>=0 && sv->learning<=sv->level*2); if (sv->learning || sv->level) { wi(F, sv->id); wi(F, sv->level); diff --git a/src/common/kernel/skill.c b/src/common/kernel/skill.c index 035ab9c9d..c91536307 100644 --- a/src/common/kernel/skill.c +++ b/src/common/kernel/skill.c @@ -259,26 +259,28 @@ level(int days) void reduce_skill(skill * sv, int change) { - int weeks = (sv->level * sv->level - sv->level) / 2 + sv->learning; if (sv->learning>=change) { /* just forget a few weeks */ - weeks -= change; + sv->learning = (unsigned char)(sv->learning-change); } else { + int weeks; change -= sv->learning; while (change>=sv->level && sv->level > 0) { change -= sv->level; --sv->level; } - if (change && changelevel) { + if (change && sv->level > 0 && changelevel) { /* this is not an exact science... it would be better to set * sv->learning so that the average time to rise was = change. */ + --sv->level; weeks = (sv->level-change)*2; } else { weeks = 0; } + sv->learning = (unsigned char)weeks; } - sv->learning = (unsigned char)weeks; + assert(sv->level>=0 && sv->learning>=0 && sv->learning<=sv->level*2); } int diff --git a/src/res/de/messages.xml b/src/res/de/messages.xml index e0ab39327..04710e4ae 100644 --- a/src/res/de/messages.xml +++ b/src/res/de/messages.xml @@ -4559,8 +4559,8 @@ - "$unit($spy) gelang es Informationen über $unit(target) herauszubekommen: '$report'." - "$unit($spy) managed to gather Information about $unit(target): '$report'." + "$unit($spy) gelang es Informationen über $unit($target) herauszubekommen: '$report'." + "$unit($spy) managed to gather information about $unit($target): '$report'."