forked from github/server
bug in reduce_skill führte zu verrückten skillwerten und asserts.
This commit is contained in:
parent
d82f1335bf
commit
d2d2b75cdc
|
@ -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);
|
||||
|
|
|
@ -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 && change<sv->level) {
|
||||
if (change && sv->level > 0 && change<sv->level) {
|
||||
/* 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;
|
||||
}
|
||||
assert(sv->level>=0 && sv->learning>=0 && sv->learning<=sv->level*2);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -4559,8 +4559,8 @@
|
|||
<arg name="target" type="unit"></arg>
|
||||
<arg name="report" type="string"></arg>
|
||||
</type>
|
||||
<text locale="de">"$unit($spy) gelang es Informationen über $unit(target) herauszubekommen: '$report'."</text>
|
||||
<text locale="en">"$unit($spy) managed to gather Information about $unit(target): '$report'."</text>
|
||||
<text locale="de">"$unit($spy) gelang es Informationen über $unit($target) herauszubekommen: '$report'."</text>
|
||||
<text locale="en">"$unit($spy) managed to gather information about $unit($target): '$report'."</text>
|
||||
</message>
|
||||
|
||||
<message name="spyfail" section="events">
|
||||
|
|
Loading…
Reference in New Issue